mirror of
https://github.com/reactos/reactos.git
synced 2025-07-29 09:51:56 +00:00
[AMSTREAM]
* Sync with Wine 1.7.1. CORE-7469 svn path=/trunk/; revision=60493
This commit is contained in:
parent
29ea7d3cc7
commit
0d941932f3
11 changed files with 1640 additions and 297 deletions
|
@ -1,23 +1,21 @@
|
||||||
|
|
||||||
add_definitions(-D__WINESRC__)
|
add_definitions(
|
||||||
|
-D__WINESRC__
|
||||||
remove_definitions(-D_WIN32_WINNT=0x502)
|
-DWIDL_C_INLINE_WRAPPERS)
|
||||||
add_definitions(-D_WIN32_WINNT=0x600)
|
|
||||||
|
|
||||||
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
|
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
|
||||||
|
|
||||||
spec2def(amstream.dll amstream.spec)
|
spec2def(amstream.dll amstream.spec)
|
||||||
|
|
||||||
add_library(amstream SHARED
|
list(APPEND SOURCE
|
||||||
amstream.c
|
amstream.c
|
||||||
|
audiodata.c
|
||||||
main.c
|
main.c
|
||||||
mediastream.c
|
mediastream.c
|
||||||
mediastreamfilter.c
|
mediastreamfilter.c
|
||||||
version.rc
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/amstream.def)
|
${CMAKE_CURRENT_BINARY_DIR}/amstream.def)
|
||||||
|
|
||||||
|
add_library(amstream SHARED ${SOURCE} version.rc)
|
||||||
set_module_type(amstream win32dll)
|
set_module_type(amstream win32dll)
|
||||||
target_link_libraries(amstream strmiids uuid wine)
|
target_link_libraries(amstream strmbase strmiids uuid wine)
|
||||||
add_importlibs(amstream ole32 advapi32 msvcrt kernel32 ntdll)
|
add_importlibs(amstream ole32 msvcrt kernel32 ntdll)
|
||||||
add_dependencies(amstream dxsdk)
|
|
||||||
add_cd_file(TARGET amstream DESTINATION reactos/system32 FOR all)
|
add_cd_file(TARGET amstream DESTINATION reactos/system32 FOR all)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Implementation of IAMMultiMediaStream Interface
|
* Implementation of IAMMultiMediaStream Interface
|
||||||
*
|
*
|
||||||
* Copyright 2004 Christian Costa
|
* Copyright 2004, 2012 Christian Costa
|
||||||
* Copyright 2006 Ivan Leo Puoti
|
* Copyright 2006 Ivan Leo Puoti
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
|
@ -35,11 +35,14 @@ typedef struct {
|
||||||
IAMMultiMediaStream IAMMultiMediaStream_iface;
|
IAMMultiMediaStream IAMMultiMediaStream_iface;
|
||||||
LONG ref;
|
LONG ref;
|
||||||
IGraphBuilder* pFilterGraph;
|
IGraphBuilder* pFilterGraph;
|
||||||
|
IMediaSeeking* media_seeking;
|
||||||
|
IMediaControl* media_control;
|
||||||
|
IBaseFilter* media_stream_filter;
|
||||||
IPin* ipin;
|
IPin* ipin;
|
||||||
IGraphBuilder* GraphBuilder;
|
|
||||||
ULONG nbStreams;
|
ULONG nbStreams;
|
||||||
IMediaStream** pStreams;
|
IMediaStream** pStreams;
|
||||||
STREAM_TYPE StreamType;
|
STREAM_TYPE StreamType;
|
||||||
|
OAEVENT event;
|
||||||
} IAMMultiMediaStreamImpl;
|
} IAMMultiMediaStreamImpl;
|
||||||
|
|
||||||
static inline IAMMultiMediaStreamImpl *impl_from_IAMMultiMediaStream(IAMMultiMediaStream *iface)
|
static inline IAMMultiMediaStreamImpl *impl_from_IAMMultiMediaStream(IAMMultiMediaStream *iface)
|
||||||
|
@ -60,10 +63,7 @@ HRESULT AM_create(IUnknown *pUnkOuter, LPVOID *ppObj)
|
||||||
|
|
||||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IAMMultiMediaStreamImpl));
|
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IAMMultiMediaStreamImpl));
|
||||||
if (!object)
|
if (!object)
|
||||||
{
|
|
||||||
ERR("Out of memory\n");
|
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
|
||||||
|
|
||||||
object->IAMMultiMediaStream_iface.lpVtbl = &AM_Vtbl;
|
object->IAMMultiMediaStream_iface.lpVtbl = &AM_Vtbl;
|
||||||
object->ref = 1;
|
object->ref = 1;
|
||||||
|
@ -84,8 +84,8 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_QueryInterface(IAMMultiMediaStream
|
||||||
IsEqualGUID(riid, &IID_IMultiMediaStream) ||
|
IsEqualGUID(riid, &IID_IMultiMediaStream) ||
|
||||||
IsEqualGUID(riid, &IID_IAMMultiMediaStream))
|
IsEqualGUID(riid, &IID_IAMMultiMediaStream))
|
||||||
{
|
{
|
||||||
IUnknown_AddRef(iface);
|
IAMMultiMediaStream_AddRef(iface);
|
||||||
*ppvObject = This;
|
*ppvObject = iface;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,11 +107,26 @@ static ULONG WINAPI IAMMultiMediaStreamImpl_Release(IAMMultiMediaStream* iface)
|
||||||
{
|
{
|
||||||
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
|
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
|
||||||
ULONG ref = InterlockedDecrement(&This->ref);
|
ULONG ref = InterlockedDecrement(&This->ref);
|
||||||
|
ULONG i;
|
||||||
|
|
||||||
TRACE("(%p/%p)\n", iface, This);
|
TRACE("(%p/%p)\n", iface, This);
|
||||||
|
|
||||||
if (!ref)
|
if (!ref)
|
||||||
|
{
|
||||||
|
for(i = 0; i < This->nbStreams; i++)
|
||||||
|
IMediaStream_Release(This->pStreams[i]);
|
||||||
|
if (This->ipin)
|
||||||
|
IPin_Release(This->ipin);
|
||||||
|
if (This->media_stream_filter)
|
||||||
|
IBaseFilter_Release(This->media_stream_filter);
|
||||||
|
if (This->media_seeking)
|
||||||
|
IMediaSeeking_Release(This->media_seeking);
|
||||||
|
if (This->media_control)
|
||||||
|
IMediaControl_Release(This->media_control);
|
||||||
|
if (This->pFilterGraph)
|
||||||
|
IGraphBuilder_Release(This->pFilterGraph);
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
HeapFree(GetProcessHeap(), 0, This);
|
||||||
|
}
|
||||||
|
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
@ -166,13 +181,19 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetState(IAMMultiMediaStream* ifac
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IAMMultiMediaStreamImpl_SetState(IAMMultiMediaStream* iface, STREAM_STATE NewState)
|
static HRESULT WINAPI IAMMultiMediaStreamImpl_SetState(IAMMultiMediaStream* iface, STREAM_STATE new_state)
|
||||||
{
|
{
|
||||||
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
|
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
|
||||||
|
HRESULT hr = E_INVALIDARG;
|
||||||
|
|
||||||
FIXME("(%p/%p)->() stub!\n", This, iface);
|
TRACE("(%p/%p)->(%u)\n", This, iface, new_state);
|
||||||
|
|
||||||
return E_NOTIMPL;
|
if (new_state == STREAMSTATE_RUN)
|
||||||
|
hr = IMediaControl_Run(This->media_control);
|
||||||
|
else if (new_state == STREAMSTATE_STOP)
|
||||||
|
hr = IMediaControl_Stop(This->media_control);
|
||||||
|
|
||||||
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IAMMultiMediaStreamImpl_GetTime(IAMMultiMediaStream* iface, STREAM_TIME* pCurrentTime)
|
static HRESULT WINAPI IAMMultiMediaStreamImpl_GetTime(IAMMultiMediaStream* iface, STREAM_TIME* pCurrentTime)
|
||||||
|
@ -193,13 +214,13 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetDuration(IAMMultiMediaStream* i
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IAMMultiMediaStreamImpl_Seek(IAMMultiMediaStream* iface, STREAM_TIME SeekTime)
|
static HRESULT WINAPI IAMMultiMediaStreamImpl_Seek(IAMMultiMediaStream* iface, STREAM_TIME seek_time)
|
||||||
{
|
{
|
||||||
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
|
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
|
||||||
|
|
||||||
FIXME("(%p/%p)->() stub!\n", This, iface);
|
TRACE("(%p/%p)->(%s)\n", This, iface, wine_dbgstr_longlong(seek_time));
|
||||||
|
|
||||||
return E_NOTIMPL;
|
return IMediaSeeking_SetPositions(This->media_seeking, &seek_time, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IAMMultiMediaStreamImpl_GetEndOfStream(IAMMultiMediaStream* iface, HANDLE* phEOS)
|
static HRESULT WINAPI IAMMultiMediaStreamImpl_GetEndOfStream(IAMMultiMediaStream* iface, HANDLE* phEOS)
|
||||||
|
@ -216,6 +237,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_Initialize(IAMMultiMediaStream* if
|
||||||
{
|
{
|
||||||
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
|
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
|
const WCHAR filternameW[] = {'M','e','d','i','a','S','t','r','e','a','m','F','i','l','t','e','r',0};
|
||||||
|
|
||||||
TRACE("(%p/%p)->(%x,%x,%p)\n", This, iface, (DWORD)StreamType, dwFlags, pFilterGraph);
|
TRACE("(%p/%p)->(%x,%x,%p)\n", This, iface, (DWORD)StreamType, dwFlags, pFilterGraph);
|
||||||
|
|
||||||
|
@ -232,6 +254,40 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_Initialize(IAMMultiMediaStream* if
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
This->StreamType = StreamType;
|
This->StreamType = StreamType;
|
||||||
|
hr = IGraphBuilder_QueryInterface(This->pFilterGraph, &IID_IMediaSeeking, (void**)&This->media_seeking);
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
IGraphBuilder_QueryInterface(This->pFilterGraph, &IID_IMediaControl, (void**)&This->media_control);
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
hr = CoCreateInstance(&CLSID_MediaStreamFilter, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)&This->media_stream_filter);
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
IGraphBuilder_AddFilter(This->pFilterGraph, This->media_stream_filter, filternameW);
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
{
|
||||||
|
IMediaEventEx* media_event = NULL;
|
||||||
|
hr = IGraphBuilder_QueryInterface(This->pFilterGraph, &IID_IMediaEventEx, (void**)&media_event);
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
hr = IMediaEventEx_GetEventHandle(media_event, &This->event);
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
hr = IMediaEventEx_SetNotifyFlags(media_event, AM_MEDIAEVENT_NONOTIFY);
|
||||||
|
if (media_event)
|
||||||
|
IMediaEventEx_Release(media_event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
if (This->media_stream_filter)
|
||||||
|
IBaseFilter_Release(This->media_stream_filter);
|
||||||
|
This->media_stream_filter = NULL;
|
||||||
|
if (This->media_seeking)
|
||||||
|
IMediaSeeking_Release(This->media_seeking);
|
||||||
|
This->media_seeking = NULL;
|
||||||
|
if (This->media_control)
|
||||||
|
IMediaControl_Release(This->media_control);
|
||||||
|
This->media_control = NULL;
|
||||||
|
if (This->pFilterGraph)
|
||||||
|
IGraphBuilder_Release(This->pFilterGraph);
|
||||||
|
This->pFilterGraph = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
|
@ -247,7 +303,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetFilterGraph(IAMMultiMediaStream
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
|
||||||
if (This->pFilterGraph)
|
if (This->pFilterGraph)
|
||||||
return IFilterGraph_QueryInterface(This->pFilterGraph, &IID_IGraphBuilder, (void**)ppGraphBuilder);
|
return IGraphBuilder_QueryInterface(This->pFilterGraph, &IID_IGraphBuilder, (void**)ppGraphBuilder);
|
||||||
else
|
else
|
||||||
*ppGraphBuilder = NULL;
|
*ppGraphBuilder = NULL;
|
||||||
|
|
||||||
|
@ -257,13 +313,22 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetFilterGraph(IAMMultiMediaStream
|
||||||
static HRESULT WINAPI IAMMultiMediaStreamImpl_GetFilter(IAMMultiMediaStream* iface, IMediaStreamFilter** ppFilter)
|
static HRESULT WINAPI IAMMultiMediaStreamImpl_GetFilter(IAMMultiMediaStream* iface, IMediaStreamFilter** ppFilter)
|
||||||
{
|
{
|
||||||
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
|
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
|
||||||
|
HRESULT hr = S_OK;
|
||||||
|
|
||||||
FIXME("(%p/%p)->(%p) stub!\n", This, iface, ppFilter);
|
TRACE("(%p/%p)->(%p)\n", This, iface, ppFilter);
|
||||||
|
|
||||||
return E_NOTIMPL;
|
if (!ppFilter)
|
||||||
|
return E_POINTER;
|
||||||
|
|
||||||
|
*ppFilter = NULL;
|
||||||
|
|
||||||
|
if (This->media_stream_filter)
|
||||||
|
hr = IBaseFilter_QueryInterface(This->media_stream_filter, &IID_IMediaStreamFilter, (LPVOID*)ppFilter);
|
||||||
|
|
||||||
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IAMMultiMediaStreamImpl_AddMediaStream(IAMMultiMediaStream* iface, IUnknown* pStreamObject, const MSPID* PurposeId,
|
static HRESULT WINAPI IAMMultiMediaStreamImpl_AddMediaStream(IAMMultiMediaStream* iface, IUnknown* stream_object, const MSPID* PurposeId,
|
||||||
DWORD dwFlags, IMediaStream** ppNewStream)
|
DWORD dwFlags, IMediaStream** ppNewStream)
|
||||||
{
|
{
|
||||||
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
|
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
|
||||||
|
@ -271,9 +336,42 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_AddMediaStream(IAMMultiMediaStream
|
||||||
IMediaStream* pStream;
|
IMediaStream* pStream;
|
||||||
IMediaStream** pNewStreams;
|
IMediaStream** pNewStreams;
|
||||||
|
|
||||||
FIXME("(%p/%p)->(%p,%s,%x,%p) partial stub!\n", This, iface, pStreamObject, debugstr_guid(PurposeId), dwFlags, ppNewStream);
|
TRACE("(%p/%p)->(%p,%s,%x,%p)\n", This, iface, stream_object, debugstr_guid(PurposeId), dwFlags, ppNewStream);
|
||||||
|
|
||||||
hr = mediastream_create((IMultiMediaStream*)iface, PurposeId, This->StreamType, &pStream);
|
if (!IsEqualGUID(PurposeId, &MSPID_PrimaryVideo) && !IsEqualGUID(PurposeId, &MSPID_PrimaryAudio))
|
||||||
|
return MS_E_PURPOSEID;
|
||||||
|
|
||||||
|
if (stream_object)
|
||||||
|
FIXME("Specifying a stream object in params is not yet supported\n");
|
||||||
|
|
||||||
|
if (dwFlags & AMMSF_ADDDEFAULTRENDERER)
|
||||||
|
{
|
||||||
|
if (IsEqualGUID(PurposeId, &MSPID_PrimaryVideo))
|
||||||
|
{
|
||||||
|
/* Default renderer not supported by video stream */
|
||||||
|
return MS_E_PURPOSEID;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IBaseFilter* dsoundrender_filter;
|
||||||
|
|
||||||
|
/* Create the default renderer for audio */
|
||||||
|
hr = CoCreateInstance(&CLSID_DSoundRender, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (LPVOID*)&dsoundrender_filter);
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
{
|
||||||
|
hr = IGraphBuilder_AddFilter(This->pFilterGraph, dsoundrender_filter, NULL);
|
||||||
|
IBaseFilter_Release(dsoundrender_filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* No media stream created when the default renderer is used */
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsEqualGUID(PurposeId, &MSPID_PrimaryVideo))
|
||||||
|
hr = ddrawmediastream_create((IMultiMediaStream*)iface, PurposeId, This->StreamType, &pStream);
|
||||||
|
else
|
||||||
|
hr = audiomediastream_create((IMultiMediaStream*)iface, PurposeId, This->StreamType, &pStream);
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
pNewStreams = CoTaskMemRealloc(This->pStreams, (This->nbStreams+1) * sizeof(IMediaStream*));
|
pNewStreams = CoTaskMemRealloc(This->pStreams, (This->nbStreams+1) * sizeof(IMediaStream*));
|
||||||
|
@ -290,80 +388,57 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_AddMediaStream(IAMMultiMediaStream
|
||||||
*ppNewStream = pStream;
|
*ppNewStream = pStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
{
|
||||||
|
/* Add stream to the media stream filter */
|
||||||
|
IMediaStreamFilter_AddMediaStream((IMediaStreamFilter*)This->media_stream_filter, (IAMMediaStream*)pStream);
|
||||||
|
}
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IAMMultiMediaStreamImpl_OpenFile(IAMMultiMediaStream* iface, LPCWSTR pszFileName, DWORD dwFlags)
|
static HRESULT WINAPI IAMMultiMediaStreamImpl_OpenFile(IAMMultiMediaStream* iface, LPCWSTR filename, DWORD flags)
|
||||||
{
|
{
|
||||||
HRESULT ret;
|
|
||||||
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
|
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
|
||||||
IFileSourceFilter *SourceFilter;
|
HRESULT ret = S_OK;
|
||||||
IBaseFilter *BaseFilter;
|
IBaseFilter *BaseFilter = NULL;
|
||||||
IEnumPins *EnumPins;
|
IEnumPins *EnumPins = NULL;
|
||||||
IPin *ipin;
|
IPin *ipin;
|
||||||
PIN_DIRECTION pin_direction;
|
PIN_DIRECTION pin_direction;
|
||||||
|
const WCHAR sourceW[] = {'S','o','u','r','c','e',0};
|
||||||
|
|
||||||
TRACE("(%p/%p)->(%s,%x)\n", This, iface, debugstr_w(pszFileName), dwFlags);
|
TRACE("(%p/%p)->(%s,%x)\n", This, iface, debugstr_w(filename), flags);
|
||||||
|
|
||||||
ret = CoCreateInstance(&CLSID_AsyncReader, NULL, CLSCTX_INPROC_SERVER, &IID_IFileSourceFilter, (void**)&SourceFilter);
|
if (!filename)
|
||||||
if(ret != S_OK)
|
return E_POINTER;
|
||||||
return ret;
|
|
||||||
|
|
||||||
ret = IFileSourceFilter_Load(SourceFilter, pszFileName, NULL);
|
|
||||||
if(ret != S_OK)
|
|
||||||
{
|
|
||||||
IFileSourceFilter_Release(SourceFilter);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = IFileSourceFilter_QueryInterface(SourceFilter, &IID_IBaseFilter, (void**)&BaseFilter);
|
|
||||||
if(ret != S_OK)
|
|
||||||
{
|
|
||||||
IFileSourceFilter_Release(SourceFilter);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = IBaseFilter_EnumPins(BaseFilter, &EnumPins);
|
|
||||||
if(ret != S_OK)
|
|
||||||
{
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = IEnumPins_Next(EnumPins, 1, &ipin, NULL);
|
|
||||||
if(ret == S_OK)
|
|
||||||
{
|
|
||||||
ret = IPin_QueryDirection(ipin, &pin_direction);
|
|
||||||
IEnumPins_Release(EnumPins);
|
|
||||||
if(ret == S_OK && pin_direction == PINDIR_OUTPUT)
|
|
||||||
This->ipin = ipin;
|
|
||||||
else
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
IEnumPins_Release(EnumPins);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If Initialize was not called before, we do it here */
|
/* If Initialize was not called before, we do it here */
|
||||||
if (!This->pFilterGraph)
|
if (!This->pFilterGraph)
|
||||||
{
|
|
||||||
ret = IAMMultiMediaStream_Initialize(iface, STREAMTYPE_READ, 0, NULL);
|
ret = IAMMultiMediaStream_Initialize(iface, STREAMTYPE_READ, 0, NULL);
|
||||||
if (FAILED(ret))
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = IFilterGraph_QueryInterface(This->pFilterGraph, &IID_IGraphBuilder, (void**)&This->GraphBuilder);
|
if (SUCCEEDED(ret))
|
||||||
if(ret != S_OK)
|
ret = IGraphBuilder_AddSourceFilter(This->pFilterGraph, filename, sourceW, &BaseFilter);
|
||||||
|
|
||||||
|
if (SUCCEEDED(ret))
|
||||||
|
ret = IBaseFilter_EnumPins(BaseFilter, &EnumPins);
|
||||||
|
|
||||||
|
if (SUCCEEDED(ret))
|
||||||
|
ret = IEnumPins_Next(EnumPins, 1, &ipin, NULL);
|
||||||
|
|
||||||
|
if (SUCCEEDED(ret))
|
||||||
{
|
{
|
||||||
goto end;
|
ret = IPin_QueryDirection(ipin, &pin_direction);
|
||||||
|
if (ret == S_OK && pin_direction == PINDIR_OUTPUT)
|
||||||
|
This->ipin = ipin;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = IGraphBuilder_AddSourceFilter(This->GraphBuilder, pszFileName, pszFileName, &BaseFilter);
|
if (SUCCEEDED(ret) && !(flags & AMMSF_NORENDER))
|
||||||
|
ret = IGraphBuilder_Render(This->pFilterGraph, This->ipin);
|
||||||
|
|
||||||
end:
|
if (EnumPins)
|
||||||
IBaseFilter_Release(BaseFilter);
|
IEnumPins_Release(EnumPins);
|
||||||
IFileSourceFilter_Release(SourceFilter);
|
if (BaseFilter)
|
||||||
|
IBaseFilter_Release(BaseFilter);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -385,7 +460,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_Render(IAMMultiMediaStream* iface,
|
||||||
if(dwFlags != AMMSF_NOCLOCK)
|
if(dwFlags != AMMSF_NOCLOCK)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
|
||||||
return IGraphBuilder_Render(This->GraphBuilder, This->ipin);
|
return IGraphBuilder_Render(This->pFilterGraph, This->ipin);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const IAMMultiMediaStreamVtbl AM_Vtbl =
|
static const IAMMultiMediaStreamVtbl AM_Vtbl =
|
||||||
|
|
|
@ -38,3 +38,10 @@ coclass AMDirectDrawStream { interface IAMMultiMediaStream; }
|
||||||
uuid(49c47ce5-9ba4-11d0-8212-00c04fc32c45)
|
uuid(49c47ce5-9ba4-11d0-8212-00c04fc32c45)
|
||||||
]
|
]
|
||||||
coclass AMMultiMediaStream { interface IAMMultiMediaStream; }
|
coclass AMMultiMediaStream { interface IAMMultiMediaStream; }
|
||||||
|
|
||||||
|
[
|
||||||
|
helpstring("AuStream Class"),
|
||||||
|
threading(both),
|
||||||
|
uuid(f2468580-af8a-11d0-8212-00c04fc32c45)
|
||||||
|
]
|
||||||
|
coclass AMAudioData { interface IAudioData; }
|
||||||
|
|
|
@ -17,5 +17,9 @@ HKCR
|
||||||
{
|
{
|
||||||
InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Both' }
|
InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Both' }
|
||||||
}
|
}
|
||||||
|
'{F2468580-AF8A-11D0-8212-00C04FC32C45}' = s 'AuStream Class'
|
||||||
|
{
|
||||||
|
InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Both' }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -33,10 +33,14 @@
|
||||||
//#include "winuser.h"
|
//#include "winuser.h"
|
||||||
#include <dshow.h>
|
#include <dshow.h>
|
||||||
#include <mmstream.h>
|
#include <mmstream.h>
|
||||||
|
#include <austream.h>
|
||||||
|
|
||||||
HRESULT AM_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN;
|
HRESULT AM_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN;
|
||||||
|
HRESULT AMAudioData_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN;
|
||||||
HRESULT MediaStreamFilter_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN;
|
HRESULT MediaStreamFilter_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN;
|
||||||
HRESULT mediastream_create(IMultiMediaStream *Parent, const MSPID *pPurposeId,
|
HRESULT ddrawmediastream_create(IMultiMediaStream *Parent, const MSPID *pPurposeId,
|
||||||
STREAM_TYPE StreamType, IMediaStream **ppMediaStream) DECLSPEC_HIDDEN;
|
STREAM_TYPE StreamType, IMediaStream **ppMediaStream) DECLSPEC_HIDDEN;
|
||||||
|
HRESULT audiomediastream_create(IMultiMediaStream *parent, const MSPID *purpose_id,
|
||||||
|
STREAM_TYPE stream_type, IMediaStream **media_stream) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
#endif /* __AMSTREAM_PRIVATE_INCLUDED__ */
|
#endif /* __AMSTREAM_PRIVATE_INCLUDED__ */
|
||||||
|
|
154
reactos/dll/directx/wine/amstream/audiodata.c
Normal file
154
reactos/dll/directx/wine/amstream/audiodata.c
Normal file
|
@ -0,0 +1,154 @@
|
||||||
|
/*
|
||||||
|
* Implementation of IAudioData Interface
|
||||||
|
*
|
||||||
|
* Copyright 2012 Christian Costa
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "wine/debug.h"
|
||||||
|
|
||||||
|
#define COBJMACROS
|
||||||
|
|
||||||
|
#include "winbase.h"
|
||||||
|
#include "amstream_private.h"
|
||||||
|
|
||||||
|
#include "amstream.h"
|
||||||
|
|
||||||
|
WINE_DEFAULT_DEBUG_CHANNEL(amstream);
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
IAudioData IAudioData_iface;
|
||||||
|
LONG ref;
|
||||||
|
} AMAudioDataImpl;
|
||||||
|
|
||||||
|
static inline AMAudioDataImpl *impl_from_IAudioData(IAudioData *iface)
|
||||||
|
{
|
||||||
|
return CONTAINING_RECORD(iface, AMAudioDataImpl, IAudioData_iface);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*** IUnknown methods ***/
|
||||||
|
static HRESULT WINAPI IAudioDataImpl_QueryInterface(IAudioData *iface, REFIID riid, void **ret_iface)
|
||||||
|
{
|
||||||
|
TRACE("(%p)->(%s,%p)\n", iface, debugstr_guid(riid), ret_iface);
|
||||||
|
|
||||||
|
if (IsEqualGUID(riid, &IID_IUnknown) ||
|
||||||
|
IsEqualGUID(riid, &IID_IMemoryData) ||
|
||||||
|
IsEqualGUID(riid, &IID_IAudioData))
|
||||||
|
{
|
||||||
|
IAudioData_AddRef(iface);
|
||||||
|
*ret_iface = iface;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ERR("(%p)->(%s,%p),not found\n", iface, debugstr_guid(riid), ret_iface);
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ULONG WINAPI IAudioDataImpl_AddRef(IAudioData* iface)
|
||||||
|
{
|
||||||
|
AMAudioDataImpl *This = impl_from_IAudioData(iface);
|
||||||
|
ULONG ref = InterlockedIncrement(&This->ref);
|
||||||
|
|
||||||
|
TRACE("(%p)->(): new ref = %u\n", iface, This->ref);
|
||||||
|
|
||||||
|
return ref;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ULONG WINAPI IAudioDataImpl_Release(IAudioData* iface)
|
||||||
|
{
|
||||||
|
AMAudioDataImpl *This = impl_from_IAudioData(iface);
|
||||||
|
ULONG ref = InterlockedDecrement(&This->ref);
|
||||||
|
|
||||||
|
TRACE("(%p)->(): new ref = %u\n", iface, This->ref);
|
||||||
|
|
||||||
|
if (!ref)
|
||||||
|
HeapFree(GetProcessHeap(), 0, This);
|
||||||
|
|
||||||
|
return ref;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*** IMemoryData methods ***/
|
||||||
|
static HRESULT WINAPI IAudioDataImpl_SetBuffer(IAudioData* iface, DWORD size, BYTE *data, DWORD flags)
|
||||||
|
{
|
||||||
|
FIXME("(%p)->(%u,%p,%x): stub\n", iface, size, data, flags);
|
||||||
|
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI IAudioDataImpl_GetInfo(IAudioData* iface, DWORD *length, BYTE **data, DWORD *actual_data)
|
||||||
|
{
|
||||||
|
FIXME("(%p)->(%p,%p,%p): stub\n", iface, length, data, actual_data);
|
||||||
|
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI IAudioDataImpl_SetActual(IAudioData* iface, DWORD data_valid)
|
||||||
|
{
|
||||||
|
FIXME("(%p)->(%u): stub\n", iface, data_valid);
|
||||||
|
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*** IAudioData methods ***/
|
||||||
|
static HRESULT WINAPI IAudioDataImpl_GetFormat(IAudioData* iface, WAVEFORMATEX *wave_format_current)
|
||||||
|
{
|
||||||
|
FIXME("(%p)->(%p): stub\n", iface, wave_format_current);
|
||||||
|
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI IAudioDataImpl_SetFormat(IAudioData* iface, const WAVEFORMATEX *wave_format)
|
||||||
|
{
|
||||||
|
FIXME("(%p)->(%p): stub\n", iface, wave_format);
|
||||||
|
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct IAudioDataVtbl AudioData_Vtbl =
|
||||||
|
{
|
||||||
|
/*** IUnknown methods ***/
|
||||||
|
IAudioDataImpl_QueryInterface,
|
||||||
|
IAudioDataImpl_AddRef,
|
||||||
|
IAudioDataImpl_Release,
|
||||||
|
/*** IMemoryData methods ***/
|
||||||
|
IAudioDataImpl_SetBuffer,
|
||||||
|
IAudioDataImpl_GetInfo,
|
||||||
|
IAudioDataImpl_SetActual,
|
||||||
|
/*** IAudioData methods ***/
|
||||||
|
IAudioDataImpl_GetFormat,
|
||||||
|
IAudioDataImpl_SetFormat
|
||||||
|
};
|
||||||
|
|
||||||
|
HRESULT AMAudioData_create(IUnknown *pUnkOuter, LPVOID *ppObj)
|
||||||
|
{
|
||||||
|
AMAudioDataImpl *object;
|
||||||
|
|
||||||
|
TRACE("(%p,%p)\n", pUnkOuter, ppObj);
|
||||||
|
|
||||||
|
if (pUnkOuter)
|
||||||
|
return CLASS_E_NOAGGREGATION;
|
||||||
|
|
||||||
|
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(AMAudioDataImpl));
|
||||||
|
if (!object)
|
||||||
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
object->IAudioData_iface.lpVtbl = &AudioData_Vtbl;
|
||||||
|
object->ref = 1;
|
||||||
|
|
||||||
|
*ppObj = &object->IAudioData_iface;
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
|
@ -53,8 +53,6 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
|
||||||
instance = hInstDLL;
|
instance = hInstDLL;
|
||||||
DisableThreadLibraryCalls(hInstDLL);
|
DisableThreadLibraryCalls(hInstDLL);
|
||||||
break;
|
break;
|
||||||
case DLL_PROCESS_DETACH:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -63,12 +61,16 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
|
||||||
* Multimedia Streams ClassFactory
|
* Multimedia Streams ClassFactory
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
IClassFactory ITF_IClassFactory;
|
IClassFactory IClassFactory_iface;
|
||||||
|
|
||||||
LONG ref;
|
LONG ref;
|
||||||
HRESULT (*pfnCreateInstance)(IUnknown *pUnkOuter, LPVOID *ppObj);
|
HRESULT (*pfnCreateInstance)(IUnknown *pUnkOuter, LPVOID *ppObj);
|
||||||
} IClassFactoryImpl;
|
} IClassFactoryImpl;
|
||||||
|
|
||||||
|
static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
|
||||||
|
{
|
||||||
|
return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
|
||||||
|
}
|
||||||
|
|
||||||
struct object_creation_info
|
struct object_creation_info
|
||||||
{
|
{
|
||||||
const CLSID *clsid;
|
const CLSID *clsid;
|
||||||
|
@ -79,36 +81,34 @@ static const struct object_creation_info object_creation[] =
|
||||||
{
|
{
|
||||||
{ &CLSID_AMMultiMediaStream, AM_create },
|
{ &CLSID_AMMultiMediaStream, AM_create },
|
||||||
{ &CLSID_AMDirectDrawStream, AM_create },
|
{ &CLSID_AMDirectDrawStream, AM_create },
|
||||||
|
{ &CLSID_AMAudioData, AMAudioData_create },
|
||||||
{ &CLSID_MediaStreamFilter, MediaStreamFilter_create }
|
{ &CLSID_MediaStreamFilter, MediaStreamFilter_create }
|
||||||
};
|
};
|
||||||
|
|
||||||
static HRESULT WINAPI
|
static HRESULT WINAPI AMCF_QueryInterface(IClassFactory *iface, REFIID riid, void **ppobj)
|
||||||
AMCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj)
|
|
||||||
{
|
{
|
||||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
|
||||||
|
|
||||||
if (IsEqualGUID(riid, &IID_IUnknown)
|
if (IsEqualGUID(riid, &IID_IUnknown)
|
||||||
|| IsEqualGUID(riid, &IID_IClassFactory))
|
|| IsEqualGUID(riid, &IID_IClassFactory))
|
||||||
{
|
{
|
||||||
IClassFactory_AddRef(iface);
|
IClassFactory_AddRef(iface);
|
||||||
*ppobj = This;
|
*ppobj = iface;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
|
*ppobj = NULL;
|
||||||
|
WARN("(%p)->(%s,%p), not found\n", iface, debugstr_guid(riid), ppobj);
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI AMCF_AddRef(LPCLASSFACTORY iface)
|
static ULONG WINAPI AMCF_AddRef(IClassFactory *iface)
|
||||||
{
|
{
|
||||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
|
||||||
return InterlockedIncrement(&This->ref);
|
return InterlockedIncrement(&This->ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI AMCF_Release(LPCLASSFACTORY iface)
|
static ULONG WINAPI AMCF_Release(IClassFactory *iface)
|
||||||
{
|
{
|
||||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
|
||||||
|
|
||||||
ULONG ref = InterlockedDecrement(&This->ref);
|
ULONG ref = InterlockedDecrement(&This->ref);
|
||||||
|
|
||||||
if (ref == 0)
|
if (ref == 0)
|
||||||
|
@ -118,10 +118,10 @@ static ULONG WINAPI AMCF_Release(LPCLASSFACTORY iface)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static HRESULT WINAPI AMCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter,
|
static HRESULT WINAPI AMCF_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
|
||||||
REFIID riid, LPVOID *ppobj)
|
REFIID riid, void **ppobj)
|
||||||
{
|
{
|
||||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
LPUNKNOWN punk;
|
LPUNKNOWN punk;
|
||||||
|
|
||||||
|
@ -136,9 +136,9 @@ static HRESULT WINAPI AMCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter
|
||||||
return hres;
|
return hres;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI AMCF_LockServer(LPCLASSFACTORY iface,BOOL dolock)
|
static HRESULT WINAPI AMCF_LockServer(IClassFactory *iface, BOOL dolock)
|
||||||
{
|
{
|
||||||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
|
||||||
FIXME("(%p)->(%d),stub!\n",This,dolock);
|
FIXME("(%p)->(%d),stub!\n",This,dolock);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -195,12 +195,12 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
|
||||||
factory = HeapAlloc(GetProcessHeap(), 0, sizeof(*factory));
|
factory = HeapAlloc(GetProcessHeap(), 0, sizeof(*factory));
|
||||||
if (factory == NULL) return E_OUTOFMEMORY;
|
if (factory == NULL) return E_OUTOFMEMORY;
|
||||||
|
|
||||||
factory->ITF_IClassFactory.lpVtbl = &DSCF_Vtbl;
|
factory->IClassFactory_iface.lpVtbl = &DSCF_Vtbl;
|
||||||
factory->ref = 1;
|
factory->ref = 1;
|
||||||
|
|
||||||
factory->pfnCreateInstance = object_creation[i].pfnCreateInstance;
|
factory->pfnCreateInstance = object_creation[i].pfnCreateInstance;
|
||||||
|
|
||||||
*ppv = &(factory->ITF_IClassFactory);
|
*ppv = &factory->IClassFactory_iface;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Implementation of MediaStream Filter
|
* Implementation of MediaStream Filter
|
||||||
*
|
*
|
||||||
* Copyright 2008 Christian Costa
|
* Copyright 2008, 2012 Christian Costa
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -24,6 +24,9 @@
|
||||||
|
|
||||||
//#include "winbase.h"
|
//#include "winbase.h"
|
||||||
//#include "wingdi.h"
|
//#include "wingdi.h"
|
||||||
|
#include <dshow.h>
|
||||||
|
|
||||||
|
#include <wine/strmbase.h>
|
||||||
|
|
||||||
//#include "amstream_private.h"
|
//#include "amstream_private.h"
|
||||||
#include <amstream.h>
|
#include <amstream.h>
|
||||||
|
@ -32,46 +35,191 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(amstream);
|
WINE_DEFAULT_DEBUG_CHANNEL(amstream);
|
||||||
|
|
||||||
|
typedef struct MediaStreamFilter_InputPin
|
||||||
|
{
|
||||||
|
BaseInputPin pin;
|
||||||
|
} MediaStreamFilter_InputPin;
|
||||||
|
|
||||||
|
static const IPinVtbl MediaStreamFilter_InputPin_Vtbl =
|
||||||
|
{
|
||||||
|
BaseInputPinImpl_QueryInterface,
|
||||||
|
BasePinImpl_AddRef,
|
||||||
|
BaseInputPinImpl_Release,
|
||||||
|
BaseInputPinImpl_Connect,
|
||||||
|
BaseInputPinImpl_ReceiveConnection,
|
||||||
|
BasePinImpl_Disconnect,
|
||||||
|
BasePinImpl_ConnectedTo,
|
||||||
|
BasePinImpl_ConnectionMediaType,
|
||||||
|
BasePinImpl_QueryPinInfo,
|
||||||
|
BasePinImpl_QueryDirection,
|
||||||
|
BasePinImpl_QueryId,
|
||||||
|
BasePinImpl_QueryAccept,
|
||||||
|
BasePinImpl_EnumMediaTypes,
|
||||||
|
BasePinImpl_QueryInternalConnections,
|
||||||
|
BaseInputPinImpl_EndOfStream,
|
||||||
|
BaseInputPinImpl_BeginFlush,
|
||||||
|
BaseInputPinImpl_EndFlush,
|
||||||
|
BasePinImpl_NewSegment
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
IMediaStreamFilter IMediaStreamFilter_iface;
|
BaseFilter filter;
|
||||||
LONG ref;
|
ULONG nb_streams;
|
||||||
CRITICAL_SECTION csFilter;
|
IMediaStream** streams;
|
||||||
FILTER_STATE state;
|
IPin** pins;
|
||||||
REFERENCE_TIME rtStreamStart;
|
|
||||||
IReferenceClock * pClock;
|
|
||||||
FILTER_INFO filterInfo;
|
|
||||||
} IMediaStreamFilterImpl;
|
} IMediaStreamFilterImpl;
|
||||||
|
|
||||||
static inline IMediaStreamFilterImpl *impl_from_IMediaStreamFilter(IMediaStreamFilter *iface)
|
static inline IMediaStreamFilterImpl *impl_from_IMediaStreamFilter(IMediaStreamFilter *iface)
|
||||||
{
|
{
|
||||||
return CONTAINING_RECORD(iface, IMediaStreamFilterImpl, IMediaStreamFilter_iface);
|
return CONTAINING_RECORD(iface, IMediaStreamFilterImpl, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI BasePinImpl_CheckMediaType(BasePin *This, const AM_MEDIA_TYPE *pmt)
|
||||||
|
{
|
||||||
|
IMediaStreamFilterImpl *filter = impl_from_IMediaStreamFilter((IMediaStreamFilter*)This->pinInfo.pFilter);
|
||||||
|
MSPID purpose_id;
|
||||||
|
ULONG i;
|
||||||
|
|
||||||
|
TRACE("Checking media type %s - %s\n", debugstr_guid(&pmt->majortype), debugstr_guid(&pmt->subtype));
|
||||||
|
|
||||||
|
/* Find which stream is associated with the pin */
|
||||||
|
for (i = 0; i < filter->nb_streams; i++)
|
||||||
|
if (&This->IPin_iface == filter->pins[i])
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (i == filter->nb_streams)
|
||||||
|
return S_FALSE;
|
||||||
|
|
||||||
|
if (FAILED(IMediaStream_GetInformation(filter->streams[i], &purpose_id, NULL)))
|
||||||
|
return S_FALSE;
|
||||||
|
|
||||||
|
TRACE("Checking stream with purpose id %s\n", debugstr_guid(&purpose_id));
|
||||||
|
|
||||||
|
if (IsEqualGUID(&purpose_id, &MSPID_PrimaryVideo) && IsEqualGUID(&pmt->majortype, &MEDIATYPE_Video))
|
||||||
|
{
|
||||||
|
if (IsEqualGUID(&pmt->subtype, &MEDIASUBTYPE_RGB1) ||
|
||||||
|
IsEqualGUID(&pmt->subtype, &MEDIASUBTYPE_RGB4) ||
|
||||||
|
IsEqualGUID(&pmt->subtype, &MEDIASUBTYPE_RGB8) ||
|
||||||
|
IsEqualGUID(&pmt->subtype, &MEDIASUBTYPE_RGB565) ||
|
||||||
|
IsEqualGUID(&pmt->subtype, &MEDIASUBTYPE_RGB555) ||
|
||||||
|
IsEqualGUID(&pmt->subtype, &MEDIASUBTYPE_RGB24) ||
|
||||||
|
IsEqualGUID(&pmt->subtype, &MEDIASUBTYPE_RGB32))
|
||||||
|
{
|
||||||
|
TRACE("Video sub-type %s matches\n", debugstr_guid(&pmt->subtype));
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (IsEqualGUID(&purpose_id, &MSPID_PrimaryAudio) && IsEqualGUID(&pmt->majortype, &MEDIATYPE_Audio))
|
||||||
|
{
|
||||||
|
if (IsEqualGUID(&pmt->subtype, &MEDIASUBTYPE_PCM))
|
||||||
|
{
|
||||||
|
TRACE("Audio sub-type %s matches\n", debugstr_guid(&pmt->subtype));
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return S_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static LONG WINAPI BasePinImp_GetMediaTypeVersion(BasePin *This)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI BasePinImp_GetMediaType(BasePin *This, int index, AM_MEDIA_TYPE *amt)
|
||||||
|
{
|
||||||
|
IMediaStreamFilterImpl *filter = (IMediaStreamFilterImpl*)This->pinInfo.pFilter;
|
||||||
|
MSPID purpose_id;
|
||||||
|
ULONG i;
|
||||||
|
|
||||||
|
/* FIXME: Reset structure as we only fill majortype and minortype for now */
|
||||||
|
ZeroMemory(amt, sizeof(*amt));
|
||||||
|
|
||||||
|
/* Find which stream is associated with the pin */
|
||||||
|
for (i = 0; i < filter->nb_streams; i++)
|
||||||
|
if (&This->IPin_iface == filter->pins[i])
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (i == filter->nb_streams)
|
||||||
|
return S_FALSE;
|
||||||
|
|
||||||
|
if (FAILED(IMediaStream_GetInformation(filter->streams[i], &purpose_id, NULL)))
|
||||||
|
return S_FALSE;
|
||||||
|
|
||||||
|
TRACE("Processing stream with purpose id %s\n", debugstr_guid(&purpose_id));
|
||||||
|
|
||||||
|
if (IsEqualGUID(&purpose_id, &MSPID_PrimaryVideo))
|
||||||
|
{
|
||||||
|
amt->majortype = MEDIATYPE_Video;
|
||||||
|
|
||||||
|
switch (index)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
amt->subtype = MEDIASUBTYPE_RGB1;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
amt->subtype = MEDIASUBTYPE_RGB4;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
amt->subtype = MEDIASUBTYPE_RGB8;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
amt->subtype = MEDIASUBTYPE_RGB565;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
amt->subtype = MEDIASUBTYPE_RGB555;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
amt->subtype = MEDIASUBTYPE_RGB24;
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
amt->subtype = MEDIASUBTYPE_RGB32;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return S_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (IsEqualGUID(&purpose_id, &MSPID_PrimaryAudio))
|
||||||
|
{
|
||||||
|
if (index)
|
||||||
|
return S_FALSE;
|
||||||
|
|
||||||
|
amt->majortype = MEDIATYPE_Audio;
|
||||||
|
amt->subtype = MEDIASUBTYPE_PCM;
|
||||||
|
}
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const BasePinFuncTable input_BaseFuncTable = {
|
||||||
|
BasePinImpl_CheckMediaType,
|
||||||
|
NULL,
|
||||||
|
BasePinImp_GetMediaTypeVersion,
|
||||||
|
BasePinImp_GetMediaType
|
||||||
|
};
|
||||||
|
|
||||||
|
static const BaseInputPinFuncTable input_BaseInputFuncTable = {
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
/*** IUnknown methods ***/
|
/*** IUnknown methods ***/
|
||||||
|
|
||||||
static HRESULT WINAPI MediaStreamFilterImpl_QueryInterface(IMediaStreamFilter *iface, REFIID riid,
|
static HRESULT WINAPI MediaStreamFilterImpl_QueryInterface(IMediaStreamFilter *iface, REFIID riid, void **ret_iface)
|
||||||
void **ppv)
|
|
||||||
{
|
{
|
||||||
IMediaStreamFilterImpl *This = impl_from_IMediaStreamFilter(iface);
|
TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ret_iface);
|
||||||
|
|
||||||
TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv);
|
*ret_iface = NULL;
|
||||||
|
|
||||||
*ppv = NULL;
|
if (IsEqualIID(riid, &IID_IUnknown) ||
|
||||||
|
IsEqualIID(riid, &IID_IPersist) ||
|
||||||
|
IsEqualIID(riid, &IID_IMediaFilter) ||
|
||||||
|
IsEqualIID(riid, &IID_IBaseFilter) ||
|
||||||
|
IsEqualIID(riid, &IID_IMediaStreamFilter))
|
||||||
|
*ret_iface = iface;
|
||||||
|
|
||||||
if (IsEqualIID(riid, &IID_IUnknown))
|
if (*ret_iface)
|
||||||
*ppv = This;
|
|
||||||
else if (IsEqualIID(riid, &IID_IPersist))
|
|
||||||
*ppv = This;
|
|
||||||
else if (IsEqualIID(riid, &IID_IMediaFilter))
|
|
||||||
*ppv = This;
|
|
||||||
else if (IsEqualIID(riid, &IID_IBaseFilter))
|
|
||||||
*ppv = This;
|
|
||||||
else if (IsEqualIID(riid, &IID_IMediaStreamFilter))
|
|
||||||
*ppv = This;
|
|
||||||
|
|
||||||
if (*ppv)
|
|
||||||
{
|
{
|
||||||
IUnknown_AddRef((IUnknown *)(*ppv));
|
IMediaStreamFilter_AddRef(*ret_iface);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,132 +229,178 @@ static HRESULT WINAPI MediaStreamFilterImpl_QueryInterface(IMediaStreamFilter *i
|
||||||
static ULONG WINAPI MediaStreamFilterImpl_AddRef(IMediaStreamFilter *iface)
|
static ULONG WINAPI MediaStreamFilterImpl_AddRef(IMediaStreamFilter *iface)
|
||||||
{
|
{
|
||||||
IMediaStreamFilterImpl *This = impl_from_IMediaStreamFilter(iface);
|
IMediaStreamFilterImpl *This = impl_from_IMediaStreamFilter(iface);
|
||||||
ULONG refCount = InterlockedIncrement(&This->ref);
|
ULONG ref = BaseFilterImpl_AddRef(&This->filter.IBaseFilter_iface);
|
||||||
|
|
||||||
TRACE("(%p)->() AddRef from %d\n", iface, refCount - 1);
|
TRACE("(%p)->(): new ref = %u\n", iface, ref);
|
||||||
|
|
||||||
return refCount;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI MediaStreamFilterImpl_Release(IMediaStreamFilter *iface)
|
static ULONG WINAPI MediaStreamFilterImpl_Release(IMediaStreamFilter *iface)
|
||||||
{
|
{
|
||||||
IMediaStreamFilterImpl *This = impl_from_IMediaStreamFilter(iface);
|
IMediaStreamFilterImpl *This = impl_from_IMediaStreamFilter(iface);
|
||||||
ULONG refCount = InterlockedDecrement(&This->ref);
|
ULONG ref = BaseFilterImpl_Release(&This->filter.IBaseFilter_iface);
|
||||||
|
|
||||||
TRACE("(%p)->() Release from %d\n", iface, refCount + 1);
|
TRACE("(%p)->(): new ref = %u\n", iface, ref);
|
||||||
|
|
||||||
if (!refCount)
|
if (!ref)
|
||||||
|
{
|
||||||
|
ULONG i;
|
||||||
|
for (i = 0; i < This->nb_streams; i++)
|
||||||
|
{
|
||||||
|
IMediaStream_Release(This->streams[i]);
|
||||||
|
IPin_Release(This->pins[i]);
|
||||||
|
}
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
HeapFree(GetProcessHeap(), 0, This);
|
||||||
|
}
|
||||||
|
|
||||||
return refCount;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** IPersist methods ***/
|
/*** IPersist methods ***/
|
||||||
|
|
||||||
static HRESULT WINAPI MediaStreamFilterImpl_GetClassID(IMediaStreamFilter * iface, CLSID * pClsid)
|
static HRESULT WINAPI MediaStreamFilterImpl_GetClassID(IMediaStreamFilter *iface, CLSID *clsid)
|
||||||
{
|
{
|
||||||
TRACE("(%p)->(%p)\n", iface, pClsid);
|
IMediaStreamFilterImpl *This = impl_from_IMediaStreamFilter(iface);
|
||||||
|
return BaseFilterImpl_GetClassID(&This->filter.IBaseFilter_iface, clsid);
|
||||||
*pClsid = CLSID_MediaStreamFilter;
|
|
||||||
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*** IMediaFilter methods ***/
|
|
||||||
|
|
||||||
static HRESULT WINAPI MediaStreamFilterImpl_Stop(IMediaStreamFilter * iface)
|
|
||||||
{
|
|
||||||
FIXME("(%p)->(): Stub!\n", iface);
|
|
||||||
|
|
||||||
return E_NOTIMPL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI MediaStreamFilterImpl_Pause(IMediaStreamFilter * iface)
|
|
||||||
{
|
|
||||||
FIXME("(%p)->(): Stub!\n", iface);
|
|
||||||
|
|
||||||
return E_NOTIMPL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI MediaStreamFilterImpl_Run(IMediaStreamFilter * iface, REFERENCE_TIME tStart)
|
|
||||||
{
|
|
||||||
FIXME("(%p)->(%s): Stub!\n", iface, wine_dbgstr_longlong(tStart));
|
|
||||||
|
|
||||||
return E_NOTIMPL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI MediaStreamFilterImpl_GetState(IMediaStreamFilter * iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState)
|
|
||||||
{
|
|
||||||
FIXME("(%p)->(%d,%p): Stub!\n", iface, dwMilliSecsTimeout, pState);
|
|
||||||
|
|
||||||
return E_NOTIMPL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI MediaStreamFilterImpl_SetSyncSource(IMediaStreamFilter * iface, IReferenceClock *pClock)
|
|
||||||
{
|
|
||||||
TRACE("(%p)->(%p): Stub!\n", iface, pClock);
|
|
||||||
|
|
||||||
return E_NOTIMPL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI MediaStreamFilterImpl_GetSyncSource(IMediaStreamFilter * iface, IReferenceClock **ppClock)
|
|
||||||
{
|
|
||||||
FIXME("(%p)->(%p): Stub!\n", iface, ppClock);
|
|
||||||
|
|
||||||
return E_NOTIMPL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** IBaseFilter methods ***/
|
/*** IBaseFilter methods ***/
|
||||||
|
|
||||||
static HRESULT WINAPI MediaStreamFilterImpl_EnumPins(IMediaStreamFilter * iface, IEnumPins **ppEnum)
|
static HRESULT WINAPI MediaStreamFilterImpl_Stop(IMediaStreamFilter *iface)
|
||||||
{
|
{
|
||||||
FIXME("(%p)->(%p): Stub!\n", iface, ppEnum);
|
FIXME("(%p)->(): Stub!\n", iface);
|
||||||
|
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI MediaStreamFilterImpl_FindPin(IMediaStreamFilter * iface, LPCWSTR Id, IPin **ppPin)
|
static HRESULT WINAPI MediaStreamFilterImpl_Pause(IMediaStreamFilter *iface)
|
||||||
{
|
{
|
||||||
FIXME("(%p)->(%s,%p): Stub!\n", iface, debugstr_w(Id), ppPin);
|
FIXME("(%p)->(): Stub!\n", iface);
|
||||||
|
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI MediaStreamFilterImpl_QueryFilterInfo(IMediaStreamFilter * iface, FILTER_INFO *pInfo)
|
static HRESULT WINAPI MediaStreamFilterImpl_Run(IMediaStreamFilter *iface, REFERENCE_TIME start)
|
||||||
{
|
{
|
||||||
FIXME("(%p)->(%p): Stub!\n", iface, pInfo);
|
FIXME("(%p)->(%s): Stub!\n", iface, wine_dbgstr_longlong(start));
|
||||||
|
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI MediaStreamFilterImpl_JoinFilterGraph(IMediaStreamFilter * iface, IFilterGraph *pGraph, LPCWSTR pName)
|
static HRESULT WINAPI MediaStreamFilterImpl_GetState(IMediaStreamFilter *iface, DWORD ms_timeout, FILTER_STATE *state)
|
||||||
{
|
{
|
||||||
FIXME("(%p)->(%p, %s): Stub!\n", iface, pGraph, debugstr_w(pName));
|
IMediaStreamFilterImpl *This = impl_from_IMediaStreamFilter(iface);
|
||||||
|
return BaseFilterImpl_GetState(&This->filter.IBaseFilter_iface, ms_timeout, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI MediaStreamFilterImpl_SetSyncSource(IMediaStreamFilter *iface, IReferenceClock *clock)
|
||||||
|
{
|
||||||
|
IMediaStreamFilterImpl *This = impl_from_IMediaStreamFilter(iface);
|
||||||
|
return BaseFilterImpl_SetSyncSource(&This->filter.IBaseFilter_iface, clock);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI MediaStreamFilterImpl_GetSyncSource(IMediaStreamFilter *iface, IReferenceClock **clock)
|
||||||
|
{
|
||||||
|
IMediaStreamFilterImpl *This = impl_from_IMediaStreamFilter(iface);
|
||||||
|
return BaseFilterImpl_GetSyncSource(&This->filter.IBaseFilter_iface, clock);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI MediaStreamFilterImpl_EnumPins(IMediaStreamFilter *iface, IEnumPins **enum_pins)
|
||||||
|
{
|
||||||
|
IMediaStreamFilterImpl *This = impl_from_IMediaStreamFilter(iface);
|
||||||
|
return BaseFilterImpl_EnumPins(&This->filter.IBaseFilter_iface, enum_pins);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI MediaStreamFilterImpl_FindPin(IMediaStreamFilter *iface, LPCWSTR id, IPin **pin)
|
||||||
|
{
|
||||||
|
FIXME("(%p)->(%s,%p): Stub!\n", iface, debugstr_w(id), pin);
|
||||||
|
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI MediaStreamFilterImpl_QueryVendorInfo(IMediaStreamFilter * iface, LPWSTR *pVendorInfo)
|
static HRESULT WINAPI MediaStreamFilterImpl_QueryFilterInfo(IMediaStreamFilter *iface, FILTER_INFO *info)
|
||||||
{
|
{
|
||||||
FIXME("(%p)->(%p): Stub!\n", iface, pVendorInfo);
|
IMediaStreamFilterImpl *This = impl_from_IMediaStreamFilter(iface);
|
||||||
|
return BaseFilterImpl_QueryFilterInfo(&This->filter.IBaseFilter_iface, info);
|
||||||
|
}
|
||||||
|
|
||||||
return E_NOTIMPL;
|
static HRESULT WINAPI MediaStreamFilterImpl_JoinFilterGraph(IMediaStreamFilter *iface, IFilterGraph *graph, LPCWSTR name)
|
||||||
|
{
|
||||||
|
IMediaStreamFilterImpl *This = impl_from_IMediaStreamFilter(iface);
|
||||||
|
return BaseFilterImpl_JoinFilterGraph(&This->filter.IBaseFilter_iface, graph, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI MediaStreamFilterImpl_QueryVendorInfo(IMediaStreamFilter *iface, LPWSTR *vendor_info)
|
||||||
|
{
|
||||||
|
IMediaStreamFilterImpl *This = impl_from_IMediaStreamFilter(iface);
|
||||||
|
return BaseFilterImpl_QueryVendorInfo(&This->filter.IBaseFilter_iface, vendor_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** IMediaStreamFilter methods ***/
|
/*** IMediaStreamFilter methods ***/
|
||||||
|
|
||||||
static HRESULT WINAPI MediaStreamFilterImpl_AddMediaStream(IMediaStreamFilter* iface, IAMMediaStream *pAMMediaStream)
|
static HRESULT WINAPI MediaStreamFilterImpl_AddMediaStream(IMediaStreamFilter* iface, IAMMediaStream *pAMMediaStream)
|
||||||
{
|
{
|
||||||
FIXME("(%p)->(%p): Stub!\n", iface, pAMMediaStream);
|
IMediaStreamFilterImpl *This = impl_from_IMediaStreamFilter(iface);
|
||||||
|
IMediaStream** streams;
|
||||||
|
IPin** pins;
|
||||||
|
MediaStreamFilter_InputPin* pin;
|
||||||
|
HRESULT hr;
|
||||||
|
PIN_INFO info;
|
||||||
|
MSPID purpose_id;
|
||||||
|
|
||||||
return E_NOTIMPL;
|
TRACE("(%p)->(%p)\n", iface, pAMMediaStream);
|
||||||
|
|
||||||
|
streams = CoTaskMemRealloc(This->streams, (This->nb_streams + 1) * sizeof(IMediaStream*));
|
||||||
|
if (!streams)
|
||||||
|
return E_OUTOFMEMORY;
|
||||||
|
This->streams = streams;
|
||||||
|
pins = CoTaskMemRealloc(This->pins, (This->nb_streams + 1) * sizeof(IPin*));
|
||||||
|
if (!pins)
|
||||||
|
return E_OUTOFMEMORY;
|
||||||
|
This->pins = pins;
|
||||||
|
info.pFilter = (IBaseFilter*)&This->filter;
|
||||||
|
info.dir = PINDIR_INPUT;
|
||||||
|
hr = IAMMediaStream_GetInformation(pAMMediaStream, &purpose_id, NULL);
|
||||||
|
if (FAILED(hr))
|
||||||
|
return hr;
|
||||||
|
/* Pin name is "I{guid MSPID_PrimaryVideo or MSPID_PrimaryAudio}" */
|
||||||
|
info.achName[0] = 'I';
|
||||||
|
StringFromGUID2(&purpose_id, info.achName + 1, 40);
|
||||||
|
hr = BaseInputPin_Construct(&MediaStreamFilter_InputPin_Vtbl, &info, &input_BaseFuncTable, &input_BaseInputFuncTable, &This->filter.csFilter, NULL, &This->pins[This->nb_streams]);
|
||||||
|
if (FAILED(hr))
|
||||||
|
return hr;
|
||||||
|
|
||||||
|
pin = (MediaStreamFilter_InputPin*)This->pins[This->nb_streams];
|
||||||
|
pin->pin.pin.pinInfo.pFilter = (LPVOID)This;
|
||||||
|
This->streams[This->nb_streams] = (IMediaStream*)pAMMediaStream;
|
||||||
|
This->nb_streams++;
|
||||||
|
|
||||||
|
IMediaStream_AddRef((IMediaStream*)pAMMediaStream);
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI MediaStreamFilterImpl_GetMediaStream(IMediaStreamFilter* iface, REFMSPID idPurpose, IMediaStream **ppMediaStream)
|
static HRESULT WINAPI MediaStreamFilterImpl_GetMediaStream(IMediaStreamFilter* iface, REFMSPID idPurpose, IMediaStream **ppMediaStream)
|
||||||
{
|
{
|
||||||
FIXME("(%p)->(%s,%p): Stub!\n", iface, debugstr_guid(idPurpose), ppMediaStream);
|
IMediaStreamFilterImpl *This = impl_from_IMediaStreamFilter(iface);
|
||||||
|
MSPID purpose_id;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
return E_NOTIMPL;
|
TRACE("(%p)->(%s,%p)\n", iface, debugstr_guid(idPurpose), ppMediaStream);
|
||||||
|
|
||||||
|
for (i = 0; i < This->nb_streams; i++)
|
||||||
|
{
|
||||||
|
IMediaStream_GetInformation(This->streams[i], &purpose_id, NULL);
|
||||||
|
if (IsEqualIID(&purpose_id, idPurpose))
|
||||||
|
{
|
||||||
|
*ppMediaStream = This->streams[i];
|
||||||
|
IMediaStream_AddRef(*ppMediaStream);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return MS_E_NOSTREAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI MediaStreamFilterImpl_EnumMediaStreams(IMediaStreamFilter* iface, LONG Index, IMediaStream **ppMediaStream)
|
static HRESULT WINAPI MediaStreamFilterImpl_EnumMediaStreams(IMediaStreamFilter* iface, LONG Index, IMediaStream **ppMediaStream)
|
||||||
|
@ -286,6 +480,31 @@ static const IMediaStreamFilterVtbl MediaStreamFilter_Vtbl =
|
||||||
MediaStreamFilterImpl_EndOfStream
|
MediaStreamFilterImpl_EndOfStream
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static IPin* WINAPI MediaStreamFilterImpl_GetPin(BaseFilter *iface, int pos)
|
||||||
|
{
|
||||||
|
IMediaStreamFilterImpl* This = (IMediaStreamFilterImpl*)iface;
|
||||||
|
|
||||||
|
if (pos < This->nb_streams)
|
||||||
|
{
|
||||||
|
IPin_AddRef(This->pins[pos]);
|
||||||
|
return This->pins[pos];
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static LONG WINAPI MediaStreamFilterImpl_GetPinCount(BaseFilter *iface)
|
||||||
|
{
|
||||||
|
IMediaStreamFilterImpl* This = (IMediaStreamFilterImpl*)iface;
|
||||||
|
|
||||||
|
return This->nb_streams;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const BaseFilterFuncTable BaseFuncTable = {
|
||||||
|
MediaStreamFilterImpl_GetPin,
|
||||||
|
MediaStreamFilterImpl_GetPinCount
|
||||||
|
};
|
||||||
|
|
||||||
HRESULT MediaStreamFilter_create(IUnknown *pUnkOuter, void **ppObj)
|
HRESULT MediaStreamFilter_create(IUnknown *pUnkOuter, void **ppObj)
|
||||||
{
|
{
|
||||||
IMediaStreamFilterImpl* object;
|
IMediaStreamFilterImpl* object;
|
||||||
|
@ -297,13 +516,9 @@ HRESULT MediaStreamFilter_create(IUnknown *pUnkOuter, void **ppObj)
|
||||||
|
|
||||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IMediaStreamFilterImpl));
|
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IMediaStreamFilterImpl));
|
||||||
if (!object)
|
if (!object)
|
||||||
{
|
|
||||||
ERR("Out of memory\n");
|
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
|
||||||
|
|
||||||
object->IMediaStreamFilter_iface.lpVtbl = &MediaStreamFilter_Vtbl;
|
BaseFilter_Init(&object->filter, (IBaseFilterVtbl*)&MediaStreamFilter_Vtbl, &CLSID_MediaStreamFilter, (DWORD_PTR)(__FILE__ ": MediaStreamFilterImpl.csFilter"), &BaseFuncTable);
|
||||||
object->ref = 1;
|
|
||||||
|
|
||||||
*ppObj = object;
|
*ppObj = object;
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
1 WINE_REGISTRY amstream.rgs
|
1 WINE_REGISTRY amstream_classes.rgs
|
||||||
|
|
||||||
#define WINE_FILEDESCRIPTION_STR "Wine AMStream dll"
|
#define WINE_FILEDESCRIPTION_STR "Wine AMStream dll"
|
||||||
#define WINE_FILENAME_STR "amstream.dll"
|
#define WINE_FILENAME_STR "amstream.dll"
|
||||||
|
@ -25,4 +25,4 @@
|
||||||
#define WINE_PRODUCTVERSION 6,5,1,900
|
#define WINE_PRODUCTVERSION 6,5,1,900
|
||||||
#define WINE_PRODUCTVERSION_STR "6.5"
|
#define WINE_PRODUCTVERSION_STR "6.5"
|
||||||
|
|
||||||
#include "wine/wine_common_ver.rc"
|
#include <wine/wine_common_ver.rc>
|
||||||
|
|
|
@ -27,7 +27,7 @@ reactos/tools/wpp # Synced to Wine-1.7.1
|
||||||
|
|
||||||
The following libraries are shared with Wine.
|
The following libraries are shared with Wine.
|
||||||
|
|
||||||
reactos/dll/directx/wine/amstream # Synced to Wine-1.3.37
|
reactos/dll/directx/wine/amstream # Synced to Wine-1.7.1
|
||||||
reactos/dll/directx/wine/d3d8 # Synced to Wine-1.7.1
|
reactos/dll/directx/wine/d3d8 # Synced to Wine-1.7.1
|
||||||
reactos/dll/directx/wine/d3d9 # Synced to Wine-1.7.1
|
reactos/dll/directx/wine/d3d9 # Synced to Wine-1.7.1
|
||||||
reactos/dll/directx/wine/d3dcompiler_43 # Synced to Wine-1.7.1
|
reactos/dll/directx/wine/d3dcompiler_43 # Synced to Wine-1.7.1
|
||||||
|
@ -37,8 +37,8 @@ reactos/dll/directx/wine/ddraw # Synced to Wine-1.7.1
|
||||||
reactos/dll/directx/wine/dinput # Synced to Wine-1.7.1
|
reactos/dll/directx/wine/dinput # Synced to Wine-1.7.1
|
||||||
reactos/dll/directx/wine/dinput8 # Synced to Wine-1.5.26
|
reactos/dll/directx/wine/dinput8 # Synced to Wine-1.5.26
|
||||||
reactos/dll/directx/wine/dmusic # Synced to Wine-1.5.26
|
reactos/dll/directx/wine/dmusic # Synced to Wine-1.5.26
|
||||||
reactos/dll/directx/wine/dplay # Synced to Wine-1.7.1
|
reactos/dll/directx/wine/dplay # Synced to Wine-1.5.26
|
||||||
reactos/dll/directx/wine/dplayx # Synced to Wine-1.7.1
|
reactos/dll/directx/wine/dplayx # Synced to Wine-1.5.26
|
||||||
reactos/dll/directx/wine/dsound # Synced to Wine-1.7.1
|
reactos/dll/directx/wine/dsound # Synced to Wine-1.7.1
|
||||||
reactos/dll/directx/wine/dxdiagn # Synced to Wine-0_9_5
|
reactos/dll/directx/wine/dxdiagn # Synced to Wine-0_9_5
|
||||||
reactos/dll/directx/wine/dxgi # Synced to Wine-1.7.1
|
reactos/dll/directx/wine/dxgi # Synced to Wine-1.7.1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue