Author: akhaldi
Date: Tue Oct 1 15:06:37 2013
New Revision: 60493
URL:
http://svn.reactos.org/svn/reactos?rev=60493&view=rev
Log:
[AMSTREAM]
* Sync with Wine 1.7.1.
CORE-7469
Added:
trunk/reactos/dll/directx/wine/amstream/amstream_classes.rgs (with props)
trunk/reactos/dll/directx/wine/amstream/audiodata.c (with props)
Removed:
trunk/reactos/dll/directx/wine/amstream/amstream.rgs
Modified:
trunk/reactos/dll/directx/wine/amstream/CMakeLists.txt
trunk/reactos/dll/directx/wine/amstream/amstream.c
trunk/reactos/dll/directx/wine/amstream/amstream_classes.idl
trunk/reactos/dll/directx/wine/amstream/amstream_private.h
trunk/reactos/dll/directx/wine/amstream/main.c
trunk/reactos/dll/directx/wine/amstream/mediastream.c
trunk/reactos/dll/directx/wine/amstream/mediastreamfilter.c
trunk/reactos/dll/directx/wine/amstream/version.rc
trunk/reactos/media/doc/README.WINE
Modified: trunk/reactos/dll/directx/wine/amstream/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/amstream/…
==============================================================================
--- trunk/reactos/dll/directx/wine/amstream/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/amstream/CMakeLists.txt [iso-8859-1] Tue Oct 1
15:06:37 2013
@@ -1,23 +1,21 @@
-add_definitions(-D__WINESRC__)
-
-remove_definitions(-D_WIN32_WINNT=0x502)
-add_definitions(-D_WIN32_WINNT=0x600)
+add_definitions(
+ -D__WINESRC__
+ -DWIDL_C_INLINE_WRAPPERS)
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
-
spec2def(amstream.dll amstream.spec)
-add_library(amstream SHARED
+list(APPEND SOURCE
amstream.c
+ audiodata.c
main.c
mediastream.c
mediastreamfilter.c
- version.rc
${CMAKE_CURRENT_BINARY_DIR}/amstream.def)
+add_library(amstream SHARED ${SOURCE} version.rc)
set_module_type(amstream win32dll)
-target_link_libraries(amstream strmiids uuid wine)
-add_importlibs(amstream ole32 advapi32 msvcrt kernel32 ntdll)
-add_dependencies(amstream dxsdk)
+target_link_libraries(amstream strmbase strmiids uuid wine)
+add_importlibs(amstream ole32 msvcrt kernel32 ntdll)
add_cd_file(TARGET amstream DESTINATION reactos/system32 FOR all)
Modified: trunk/reactos/dll/directx/wine/amstream/amstream.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/amstream/…
==============================================================================
--- trunk/reactos/dll/directx/wine/amstream/amstream.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/amstream/amstream.c [iso-8859-1] Tue Oct 1 15:06:37
2013
@@ -1,7 +1,7 @@
/*
* Implementation of IAMMultiMediaStream Interface
*
- * Copyright 2004 Christian Costa
+ * Copyright 2004, 2012 Christian Costa
* Copyright 2006 Ivan Leo Puoti
*
* This library is free software; you can redistribute it and/or
@@ -35,11 +35,14 @@
IAMMultiMediaStream IAMMultiMediaStream_iface;
LONG ref;
IGraphBuilder* pFilterGraph;
+ IMediaSeeking* media_seeking;
+ IMediaControl* media_control;
+ IBaseFilter* media_stream_filter;
IPin* ipin;
- IGraphBuilder* GraphBuilder;
ULONG nbStreams;
IMediaStream** pStreams;
STREAM_TYPE StreamType;
+ OAEVENT event;
} IAMMultiMediaStreamImpl;
static inline IAMMultiMediaStreamImpl *impl_from_IAMMultiMediaStream(IAMMultiMediaStream
*iface)
@@ -60,10 +63,7 @@
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(IAMMultiMediaStreamImpl));
if (!object)
- {
- ERR("Out of memory\n");
return E_OUTOFMEMORY;
- }
object->IAMMultiMediaStream_iface.lpVtbl = &AM_Vtbl;
object->ref = 1;
@@ -84,8 +84,8 @@
IsEqualGUID(riid, &IID_IMultiMediaStream) ||
IsEqualGUID(riid, &IID_IAMMultiMediaStream))
{
- IUnknown_AddRef(iface);
- *ppvObject = This;
+ IAMMultiMediaStream_AddRef(iface);
+ *ppvObject = iface;
return S_OK;
}
@@ -107,11 +107,26 @@
{
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
ULONG ref = InterlockedDecrement(&This->ref);
+ ULONG i;
TRACE("(%p/%p)\n", iface, This);
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);
+ }
return ref;
}
@@ -166,13 +181,19 @@
return E_NOTIMPL;
}
-static HRESULT WINAPI IAMMultiMediaStreamImpl_SetState(IAMMultiMediaStream* iface,
STREAM_STATE NewState)
-{
- IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
-
- FIXME("(%p/%p)->() stub!\n", This, iface);
-
- return E_NOTIMPL;
+static HRESULT WINAPI IAMMultiMediaStreamImpl_SetState(IAMMultiMediaStream* iface,
STREAM_STATE new_state)
+{
+ IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
+ HRESULT hr = E_INVALIDARG;
+
+ TRACE("(%p/%p)->(%u)\n", This, iface, new_state);
+
+ 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)
@@ -193,13 +214,13 @@
return E_NOTIMPL;
}
-static HRESULT WINAPI IAMMultiMediaStreamImpl_Seek(IAMMultiMediaStream* iface,
STREAM_TIME SeekTime)
-{
- IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
-
- FIXME("(%p/%p)->() stub!\n", This, iface);
-
- return E_NOTIMPL;
+static HRESULT WINAPI IAMMultiMediaStreamImpl_Seek(IAMMultiMediaStream* iface,
STREAM_TIME seek_time)
+{
+ IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
+
+ TRACE("(%p/%p)->(%s)\n", This, iface, wine_dbgstr_longlong(seek_time));
+
+ return IMediaSeeking_SetPositions(This->media_seeking, &seek_time,
AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning);
}
static HRESULT WINAPI IAMMultiMediaStreamImpl_GetEndOfStream(IAMMultiMediaStream* iface,
HANDLE* phEOS)
@@ -216,6 +237,7 @@
{
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
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);
@@ -232,6 +254,40 @@
if (SUCCEEDED(hr))
{
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;
@@ -247,7 +303,7 @@
return E_POINTER;
if (This->pFilterGraph)
- return IFilterGraph_QueryInterface(This->pFilterGraph, &IID_IGraphBuilder,
(void**)ppGraphBuilder);
+ return IGraphBuilder_QueryInterface(This->pFilterGraph,
&IID_IGraphBuilder, (void**)ppGraphBuilder);
else
*ppGraphBuilder = NULL;
@@ -257,13 +313,22 @@
static HRESULT WINAPI IAMMultiMediaStreamImpl_GetFilter(IAMMultiMediaStream* iface,
IMediaStreamFilter** ppFilter)
{
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
-
- FIXME("(%p/%p)->(%p) stub!\n", This, iface, ppFilter);
-
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI IAMMultiMediaStreamImpl_AddMediaStream(IAMMultiMediaStream* iface,
IUnknown* pStreamObject, const MSPID* PurposeId,
+ HRESULT hr = S_OK;
+
+ TRACE("(%p/%p)->(%p)\n", This, iface, ppFilter);
+
+ 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* stream_object, const MSPID* PurposeId,
DWORD dwFlags, IMediaStream** ppNewStream)
{
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
@@ -271,9 +336,42 @@
IMediaStream* pStream;
IMediaStream** pNewStreams;
- FIXME("(%p/%p)->(%p,%s,%x,%p) partial stub!\n", This, iface,
pStreamObject, debugstr_guid(PurposeId), dwFlags, ppNewStream);
-
- hr = mediastream_create((IMultiMediaStream*)iface, PurposeId, This->StreamType,
&pStream);
+ TRACE("(%p/%p)->(%p,%s,%x,%p)\n", This, iface, stream_object,
debugstr_guid(PurposeId), dwFlags, ppNewStream);
+
+ 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))
{
pNewStreams = CoTaskMemRealloc(This->pStreams, (This->nbStreams+1) *
sizeof(IMediaStream*));
@@ -290,80 +388,57 @@
*ppNewStream = pStream;
}
+ if (SUCCEEDED(hr))
+ {
+ /* Add stream to the media stream filter */
+
IMediaStreamFilter_AddMediaStream((IMediaStreamFilter*)This->media_stream_filter,
(IAMMediaStream*)pStream);
+ }
+
return hr;
}
-static HRESULT WINAPI IAMMultiMediaStreamImpl_OpenFile(IAMMultiMediaStream* iface,
LPCWSTR pszFileName, DWORD dwFlags)
-{
- HRESULT ret;
- IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
- IFileSourceFilter *SourceFilter;
- IBaseFilter *BaseFilter;
- IEnumPins *EnumPins;
+static HRESULT WINAPI IAMMultiMediaStreamImpl_OpenFile(IAMMultiMediaStream* iface,
LPCWSTR filename, DWORD flags)
+{
+ IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
+ HRESULT ret = S_OK;
+ IBaseFilter *BaseFilter = NULL;
+ IEnumPins *EnumPins = NULL;
IPin *ipin;
PIN_DIRECTION pin_direction;
-
- TRACE("(%p/%p)->(%s,%x)\n", This, iface, debugstr_w(pszFileName),
dwFlags);
-
- ret = CoCreateInstance(&CLSID_AsyncReader, NULL, CLSCTX_INPROC_SERVER,
&IID_IFileSourceFilter, (void**)&SourceFilter);
- if(ret != S_OK)
- 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;
- }
+ const WCHAR sourceW[] =
{'S','o','u','r','c','e',0};
+
+ TRACE("(%p/%p)->(%s,%x)\n", This, iface, debugstr_w(filename), flags);
+
+ if (!filename)
+ return E_POINTER;
/* If Initialize was not called before, we do it here */
if (!This->pFilterGraph)
- {
ret = IAMMultiMediaStream_Initialize(iface, STREAMTYPE_READ, 0, NULL);
- if (FAILED(ret))
- goto end;
- }
-
- ret = IFilterGraph_QueryInterface(This->pFilterGraph, &IID_IGraphBuilder,
(void**)&This->GraphBuilder);
- if(ret != S_OK)
- {
- goto end;
- }
-
- ret = IGraphBuilder_AddSourceFilter(This->GraphBuilder, pszFileName, pszFileName,
&BaseFilter);
-
-end:
- IBaseFilter_Release(BaseFilter);
- IFileSourceFilter_Release(SourceFilter);
+
+ if (SUCCEEDED(ret))
+ 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))
+ {
+ ret = IPin_QueryDirection(ipin, &pin_direction);
+ if (ret == S_OK && pin_direction == PINDIR_OUTPUT)
+ This->ipin = ipin;
+ }
+
+ if (SUCCEEDED(ret) && !(flags & AMMSF_NORENDER))
+ ret = IGraphBuilder_Render(This->pFilterGraph, This->ipin);
+
+ if (EnumPins)
+ IEnumPins_Release(EnumPins);
+ if (BaseFilter)
+ IBaseFilter_Release(BaseFilter);
return ret;
}
@@ -385,7 +460,7 @@
if(dwFlags != AMMSF_NOCLOCK)
return E_INVALIDARG;
- return IGraphBuilder_Render(This->GraphBuilder, This->ipin);
+ return IGraphBuilder_Render(This->pFilterGraph, This->ipin);
}
static const IAMMultiMediaStreamVtbl AM_Vtbl =
Removed: trunk/reactos/dll/directx/wine/amstream/amstream.rgs
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/amstream/…
==============================================================================
--- trunk/reactos/dll/directx/wine/amstream/amstream.rgs [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/amstream/amstream.rgs (removed)
@@ -1,21 +0,0 @@
-HKCR
-{
- NoRemove Interface
- {
- }
- NoRemove CLSID
- {
- '{49C47CE0-9BA4-11D0-8212-00C04FC32C45}' = s 'SFilter Class'
- {
- InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Both'
}
- }
- '{49C47CE4-9BA4-11D0-8212-00C04FC32C45}' = s 'Stream Class'
- {
- InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Both'
}
- }
- '{49C47CE5-9BA4-11D0-8212-00C04FC32C45}' = s 'MMStream Class'
- {
- InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Both'
}
- }
- }
-}
Modified: trunk/reactos/dll/directx/wine/amstream/amstream_classes.idl
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/amstream/…
==============================================================================
--- trunk/reactos/dll/directx/wine/amstream/amstream_classes.idl [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/amstream/amstream_classes.idl [iso-8859-1] Tue Oct 1
15:06:37 2013
@@ -38,3 +38,10 @@
uuid(49c47ce5-9ba4-11d0-8212-00c04fc32c45)
]
coclass AMMultiMediaStream { interface IAMMultiMediaStream; }
+
+[
+ helpstring("AuStream Class"),
+ threading(both),
+ uuid(f2468580-af8a-11d0-8212-00c04fc32c45)
+]
+coclass AMAudioData { interface IAudioData; }
Added: trunk/reactos/dll/directx/wine/amstream/amstream_classes.rgs
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/amstream/…
==============================================================================
--- trunk/reactos/dll/directx/wine/amstream/amstream_classes.rgs (added)
+++ trunk/reactos/dll/directx/wine/amstream/amstream_classes.rgs [iso-8859-1] Tue Oct 1
15:06:37 2013
@@ -0,0 +1,25 @@
+HKCR
+{
+ NoRemove Interface
+ {
+ }
+ NoRemove CLSID
+ {
+ '{49C47CE0-9BA4-11D0-8212-00C04FC32C45}' = s 'SFilter Class'
+ {
+ InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Both'
}
+ }
+ '{49C47CE4-9BA4-11D0-8212-00C04FC32C45}' = s 'Stream Class'
+ {
+ InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Both'
}
+ }
+ '{49C47CE5-9BA4-11D0-8212-00C04FC32C45}' = s 'MMStream Class'
+ {
+ InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Both'
}
+ }
+ '{F2468580-AF8A-11D0-8212-00C04FC32C45}' = s 'AuStream Class'
+ {
+ InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Both'
}
+ }
+ }
+}
Propchange: trunk/reactos/dll/directx/wine/amstream/amstream_classes.rgs
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/dll/directx/wine/amstream/amstream_private.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/amstream/…
==============================================================================
--- trunk/reactos/dll/directx/wine/amstream/amstream_private.h [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/amstream/amstream_private.h [iso-8859-1] Tue Oct 1
15:06:37 2013
@@ -33,10 +33,14 @@
//#include "winuser.h"
#include <dshow.h>
#include <mmstream.h>
+#include <austream.h>
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 mediastream_create(IMultiMediaStream *Parent, const MSPID *pPurposeId,
+HRESULT ddrawmediastream_create(IMultiMediaStream *Parent, const MSPID *pPurposeId,
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__ */
Added: trunk/reactos/dll/directx/wine/amstream/audiodata.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/amstream/…
==============================================================================
--- trunk/reactos/dll/directx/wine/amstream/audiodata.c (added)
+++ trunk/reactos/dll/directx/wine/amstream/audiodata.c [iso-8859-1] Tue Oct 1 15:06:37
2013
@@ -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;
+}
Propchange: trunk/reactos/dll/directx/wine/amstream/audiodata.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/dll/directx/wine/amstream/main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/amstream/…
==============================================================================
--- trunk/reactos/dll/directx/wine/amstream/main.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/amstream/main.c [iso-8859-1] Tue Oct 1 15:06:37 2013
@@ -53,8 +53,6 @@
instance = hInstDLL;
DisableThreadLibraryCalls(hInstDLL);
break;
- case DLL_PROCESS_DETACH:
- break;
}
return TRUE;
}
@@ -63,12 +61,16 @@
* Multimedia Streams ClassFactory
*/
typedef struct {
- IClassFactory ITF_IClassFactory;
-
+ IClassFactory IClassFactory_iface;
LONG ref;
HRESULT (*pfnCreateInstance)(IUnknown *pUnkOuter, LPVOID *ppObj);
} IClassFactoryImpl;
+static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
+{
+ return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
+}
+
struct object_creation_info
{
const CLSID *clsid;
@@ -79,36 +81,34 @@
{
{ &CLSID_AMMultiMediaStream, AM_create },
{ &CLSID_AMDirectDrawStream, AM_create },
+ { &CLSID_AMAudioData, AMAudioData_create },
{ &CLSID_MediaStreamFilter, MediaStreamFilter_create }
};
-static HRESULT WINAPI
-AMCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj)
-{
- IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
-
+static HRESULT WINAPI AMCF_QueryInterface(IClassFactory *iface, REFIID riid, void
**ppobj)
+{
if (IsEqualGUID(riid, &IID_IUnknown)
|| IsEqualGUID(riid, &IID_IClassFactory))
{
IClassFactory_AddRef(iface);
- *ppobj = This;
+ *ppobj = iface;
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;
}
-static ULONG WINAPI AMCF_AddRef(LPCLASSFACTORY iface)
-{
- IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
+static ULONG WINAPI AMCF_AddRef(IClassFactory *iface)
+{
+ IClassFactoryImpl *This = impl_from_IClassFactory(iface);
return InterlockedIncrement(&This->ref);
}
-static ULONG WINAPI AMCF_Release(LPCLASSFACTORY iface)
-{
- IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
-
+static ULONG WINAPI AMCF_Release(IClassFactory *iface)
+{
+ IClassFactoryImpl *This = impl_from_IClassFactory(iface);
ULONG ref = InterlockedDecrement(&This->ref);
if (ref == 0)
@@ -118,10 +118,10 @@
}
-static HRESULT WINAPI AMCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter,
- REFIID riid, LPVOID *ppobj)
-{
- IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
+static HRESULT WINAPI AMCF_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
+ REFIID riid, void **ppobj)
+{
+ IClassFactoryImpl *This = impl_from_IClassFactory(iface);
HRESULT hres;
LPUNKNOWN punk;
@@ -136,9 +136,9 @@
return hres;
}
-static HRESULT WINAPI AMCF_LockServer(LPCLASSFACTORY iface,BOOL dolock)
-{
- IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
+static HRESULT WINAPI AMCF_LockServer(IClassFactory *iface, BOOL dolock)
+{
+ IClassFactoryImpl *This = impl_from_IClassFactory(iface);
FIXME("(%p)->(%d),stub!\n",This,dolock);
return S_OK;
}
@@ -195,12 +195,12 @@
factory = HeapAlloc(GetProcessHeap(), 0, sizeof(*factory));
if (factory == NULL) return E_OUTOFMEMORY;
- factory->ITF_IClassFactory.lpVtbl = &DSCF_Vtbl;
+ factory->IClassFactory_iface.lpVtbl = &DSCF_Vtbl;
factory->ref = 1;
factory->pfnCreateInstance = object_creation[i].pfnCreateInstance;
- *ppv = &(factory->ITF_IClassFactory);
+ *ppv = &factory->IClassFactory_iface;
return S_OK;
}
Modified: trunk/reactos/dll/directx/wine/amstream/mediastream.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/amstream/…
==============================================================================
--- trunk/reactos/dll/directx/wine/amstream/mediastream.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/amstream/mediastream.c [iso-8859-1] Tue Oct 1 15:06:37
2013
@@ -1,7 +1,7 @@
/*
- * Implementation of IMediaStream Interface
+ * Implementation of IMediaStream Interfaces
*
- * Copyright 2005, 2008 Christian Costa
+ * Copyright 2005, 2008, 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
@@ -32,51 +32,250 @@
WINE_DEFAULT_DEBUG_CHANNEL(amstream);
+static HRESULT ddrawstreamsample_create(IDirectDrawMediaStream *parent,
IDirectDrawStreamSample **ddraw_stream_sample);
+static HRESULT audiostreamsample_create(IAudioMediaStream *parent, IAudioData
*audio_data, IAudioStreamSample **audio_stream_sample);
+
typedef struct {
+ IAMMediaStream IAMMediaStream_iface;
IDirectDrawMediaStream IDirectDrawMediaStream_iface;
LONG ref;
- IMultiMediaStream* Parent;
- MSPID PurposeId;
- STREAM_TYPE StreamType;
-} IDirectDrawMediaStreamImpl;
-
-static inline IDirectDrawMediaStreamImpl
*impl_from_IDirectDrawMediaStream(IDirectDrawMediaStream *iface)
-{
- return CONTAINING_RECORD(iface, IDirectDrawMediaStreamImpl,
IDirectDrawMediaStream_iface);
-}
-
-static HRESULT WINAPI IDirectDrawMediaStreamImpl_QueryInterface(IDirectDrawMediaStream
*iface,
- REFIID riid, void **ppv)
-{
- IDirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
-
- TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppv);
+ IMultiMediaStream* parent;
+ MSPID purpose_id;
+ STREAM_TYPE stream_type;
+} DirectDrawMediaStreamImpl;
+
+static inline DirectDrawMediaStreamImpl
*impl_from_DirectDrawMediaStream_IAMMediaStream(IAMMediaStream *iface)
+{
+ return CONTAINING_RECORD(iface, DirectDrawMediaStreamImpl, IAMMediaStream_iface);
+}
+
+/*** IUnknown methods ***/
+static HRESULT WINAPI
DirectDrawMediaStreamImpl_IAMMediaStream_QueryInterface(IAMMediaStream *iface,
+ REFIID riid, void **ret_iface)
+{
+ DirectDrawMediaStreamImpl *This =
impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
+
+ TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid),
ret_iface);
+
+ if (IsEqualGUID(riid, &IID_IUnknown) ||
+ IsEqualGUID(riid, &IID_IMediaStream) ||
+ IsEqualGUID(riid, &IID_IAMMediaStream))
+ {
+ IAMMediaStream_AddRef(iface);
+ *ret_iface = iface;
+ return S_OK;
+ }
+ else if (IsEqualGUID(riid, &IID_IDirectDrawMediaStream))
+ {
+ IAMMediaStream_AddRef(iface);
+ *ret_iface = &This->IDirectDrawMediaStream_iface;
+ return S_OK;
+ }
+
+ ERR("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ret_iface);
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_AddRef(IAMMediaStream
*iface)
+{
+ DirectDrawMediaStreamImpl *This =
impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
+ ULONG ref = InterlockedIncrement(&This->ref);
+
+ TRACE("(%p/%p)->(): new ref = %u\n", iface, This, ref);
+
+ return ref;
+}
+
+static ULONG WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_Release(IAMMediaStream
*iface)
+{
+ DirectDrawMediaStreamImpl *This =
impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
+ ULONG ref = InterlockedDecrement(&This->ref);
+
+ TRACE("(%p/%p)->(): new ref = %u\n", iface, This, ref);
+
+ if (!ref)
+ HeapFree(GetProcessHeap(), 0, This);
+
+ return ref;
+}
+
+/*** IMediaStream methods ***/
+static HRESULT WINAPI
DirectDrawMediaStreamImpl_IAMMediaStream_GetMultiMediaStream(IAMMediaStream *iface,
+ IMultiMediaStream** multi_media_stream)
+{
+ DirectDrawMediaStreamImpl *This =
impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
+
+ FIXME("(%p/%p)->(%p) stub!\n", This, iface, multi_media_stream);
+
+ return S_FALSE;
+}
+
+static HRESULT WINAPI
DirectDrawMediaStreamImpl_IAMMediaStream_GetInformation(IAMMediaStream *iface,
+ MSPID *purpose_id, STREAM_TYPE *type)
+{
+ DirectDrawMediaStreamImpl *This =
impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
+
+ TRACE("(%p/%p)->(%p,%p)\n", This, iface, purpose_id, type);
+
+ if (purpose_id)
+ *purpose_id = This->purpose_id;
+ if (type)
+ *type = This->stream_type;
+
+ return S_OK;
+}
+
+static HRESULT WINAPI
DirectDrawMediaStreamImpl_IAMMediaStream_SetSameFormat(IAMMediaStream *iface,
+ IMediaStream *pStreamThatHasDesiredFormat, DWORD flags)
+{
+ DirectDrawMediaStreamImpl *This =
impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
+
+ FIXME("(%p/%p)->(%p,%x) stub!\n", This, iface,
pStreamThatHasDesiredFormat, flags);
+
+ return S_FALSE;
+}
+
+static HRESULT WINAPI
DirectDrawMediaStreamImpl_IAMMediaStream_AllocateSample(IAMMediaStream *iface,
+ DWORD flags, IStreamSample **sample)
+{
+ DirectDrawMediaStreamImpl *This =
impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
+
+ FIXME("(%p/%p)->(%x,%p) stub!\n", This, iface, flags, sample);
+
+ return S_FALSE;
+}
+
+static HRESULT WINAPI
DirectDrawMediaStreamImpl_IAMMediaStream_CreateSharedSample(IAMMediaStream *iface,
+ IStreamSample *existing_sample, DWORD flags, IStreamSample **sample)
+{
+ DirectDrawMediaStreamImpl *This =
impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
+
+ FIXME("(%p/%p)->(%p,%x,%p) stub!\n", This, iface, existing_sample,
flags, sample);
+
+ return S_FALSE;
+}
+
+static HRESULT WINAPI
DirectDrawMediaStreamImpl_IAMMediaStream_SendEndOfStream(IAMMediaStream *iface, DWORD
flags)
+{
+ DirectDrawMediaStreamImpl *This =
impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
+
+ FIXME("(%p/%p)->(%x) stub!\n", This, iface, flags);
+
+ return S_FALSE;
+}
+
+/*** IAMMediaStream methods ***/
+static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_Initialize(IAMMediaStream
*iface, IUnknown *source_object, DWORD flags,
+ REFMSPID purpose_id, const
STREAM_TYPE stream_type)
+{
+ DirectDrawMediaStreamImpl *This =
impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
+
+ FIXME("(%p/%p)->(%p,%x,%p,%u) stub!\n", This, iface, source_object,
flags, purpose_id, stream_type);
+
+ return S_FALSE;
+}
+
+static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_SetState(IAMMediaStream
*iface, FILTER_STATE state)
+{
+ DirectDrawMediaStreamImpl *This =
impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
+
+ FIXME("(%p/%p)->(%u) stub!\n", This, iface, state);
+
+ return S_FALSE;
+}
+
+static HRESULT WINAPI
DirectDrawMediaStreamImpl_IAMMediaStream_JoinAMMultiMediaStream(IAMMediaStream *iface,
IAMMultiMediaStream *am_multi_media_stream)
+{
+ DirectDrawMediaStreamImpl *This =
impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
+
+ FIXME("(%p/%p)->(%p) stub!\n", This, iface, am_multi_media_stream);
+
+ return S_FALSE;
+}
+
+static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_JoinFilter(IAMMediaStream
*iface, IMediaStreamFilter *media_stream_filter)
+{
+ DirectDrawMediaStreamImpl *This =
impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
+
+ FIXME("(%p/%p)->(%p) stub!\n", This, iface, media_stream_filter);
+
+ return S_FALSE;
+}
+
+static HRESULT WINAPI
DirectDrawMediaStreamImpl_IAMMediaStream_JoinFilterGraph(IAMMediaStream *iface,
IFilterGraph *filtergraph)
+{
+ DirectDrawMediaStreamImpl *This =
impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
+
+ FIXME("(%p/%p)->(%p) stub!\n", This, iface, filtergraph);
+
+ return S_FALSE;
+}
+
+static const struct IAMMediaStreamVtbl DirectDrawMediaStreamImpl_IAMMediaStream_Vtbl =
+{
+ /*** IUnknown methods ***/
+ DirectDrawMediaStreamImpl_IAMMediaStream_QueryInterface,
+ DirectDrawMediaStreamImpl_IAMMediaStream_AddRef,
+ DirectDrawMediaStreamImpl_IAMMediaStream_Release,
+ /*** IMediaStream methods ***/
+ DirectDrawMediaStreamImpl_IAMMediaStream_GetMultiMediaStream,
+ DirectDrawMediaStreamImpl_IAMMediaStream_GetInformation,
+ DirectDrawMediaStreamImpl_IAMMediaStream_SetSameFormat,
+ DirectDrawMediaStreamImpl_IAMMediaStream_AllocateSample,
+ DirectDrawMediaStreamImpl_IAMMediaStream_CreateSharedSample,
+ DirectDrawMediaStreamImpl_IAMMediaStream_SendEndOfStream,
+ /*** IAMMediaStream methods ***/
+ DirectDrawMediaStreamImpl_IAMMediaStream_Initialize,
+ DirectDrawMediaStreamImpl_IAMMediaStream_SetState,
+ DirectDrawMediaStreamImpl_IAMMediaStream_JoinAMMultiMediaStream,
+ DirectDrawMediaStreamImpl_IAMMediaStream_JoinFilter,
+ DirectDrawMediaStreamImpl_IAMMediaStream_JoinFilterGraph
+};
+
+static inline DirectDrawMediaStreamImpl
*impl_from_IDirectDrawMediaStream(IDirectDrawMediaStream *iface)
+{
+ return CONTAINING_RECORD(iface, DirectDrawMediaStreamImpl,
IDirectDrawMediaStream_iface);
+}
+
+/*** IUnknown methods ***/
+static HRESULT WINAPI
DirectDrawMediaStreamImpl_IDirectDrawMediaStream_QueryInterface(IDirectDrawMediaStream
*iface,
+ REFIID riid, void **ret_iface)
+{
+ DirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
+
+ TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid),
ret_iface);
if (IsEqualGUID(riid, &IID_IUnknown) ||
IsEqualGUID(riid, &IID_IMediaStream) ||
IsEqualGUID(riid, &IID_IDirectDrawMediaStream))
{
- IUnknown_AddRef(iface);
- *ppv = This;
+ IDirectDrawMediaStream_AddRef(iface);
+ *ret_iface = iface;
return S_OK;
}
-
- ERR("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppv);
+ else if (IsEqualGUID(riid, &IID_IAMMediaStream))
+ {
+ IDirectDrawMediaStream_AddRef(iface);
+ *ret_iface = &This->IAMMediaStream_iface;
+ return S_OK;
+ }
+
+ ERR("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ret_iface);
return E_NOINTERFACE;
}
-static ULONG WINAPI IDirectDrawMediaStreamImpl_AddRef(IDirectDrawMediaStream *iface)
-{
- IDirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
+static ULONG WINAPI
DirectDrawMediaStreamImpl_IDirectDrawMediaStream_AddRef(IDirectDrawMediaStream *iface)
+{
+ DirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
TRACE("(%p/%p)\n", iface, This);
return InterlockedIncrement(&This->ref);
}
-static ULONG WINAPI IDirectDrawMediaStreamImpl_Release(IDirectDrawMediaStream *iface)
-{
- IDirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
+static ULONG WINAPI
DirectDrawMediaStreamImpl_IDirectDrawMediaStream_Release(IDirectDrawMediaStream *iface)
+{
+ DirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p/%p)\n", iface, This);
@@ -88,83 +287,84 @@
}
/*** IMediaStream methods ***/
-static HRESULT WINAPI
IDirectDrawMediaStreamImpl_GetMultiMediaStream(IDirectDrawMediaStream *iface,
+static HRESULT WINAPI
DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetMultiMediaStream(IDirectDrawMediaStream
*iface,
IMultiMediaStream** ppMultiMediaStream)
{
- IDirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
+ DirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
FIXME("(%p/%p)->(%p) stub!\n", This, iface, ppMultiMediaStream);
return S_FALSE;
}
-static HRESULT WINAPI IDirectDrawMediaStreamImpl_GetInformation(IDirectDrawMediaStream
*iface,
- MSPID *pPurposeId, STREAM_TYPE *pType)
-{
- IDirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
-
- TRACE("(%p/%p)->(%p,%p)\n", This, iface, pPurposeId, pType);
-
- if (pPurposeId)
- *pPurposeId = This->PurposeId;
- if (pType)
- *pType = This->StreamType;
+static HRESULT WINAPI
DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetInformation(IDirectDrawMediaStream
*iface,
+ MSPID *purpose_id, STREAM_TYPE *type)
+{
+ DirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
+
+ TRACE("(%p/%p)->(%p,%p)\n", This, iface, purpose_id, type);
+
+ if (purpose_id)
+ *purpose_id = This->purpose_id;
+ if (type)
+ *type = This->stream_type;
return S_OK;
}
-static HRESULT WINAPI IDirectDrawMediaStreamImpl_SetSameFormat(IDirectDrawMediaStream
*iface,
+static HRESULT WINAPI
DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetSameFormat(IDirectDrawMediaStream
*iface,
IMediaStream *pStreamThatHasDesiredFormat, DWORD dwFlags)
{
- IDirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
+ DirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
FIXME("(%p/%p)->(%p,%x) stub!\n", This, iface,
pStreamThatHasDesiredFormat, dwFlags);
return S_FALSE;
}
-static HRESULT WINAPI IDirectDrawMediaStreamImpl_AllocateSample(IDirectDrawMediaStream
*iface,
+static HRESULT WINAPI
DirectDrawMediaStreamImpl_IDirectDrawMediaStream_AllocateSample(IDirectDrawMediaStream
*iface,
DWORD dwFlags, IStreamSample **ppSample)
{
- IDirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
+ DirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
FIXME("(%p/%p)->(%x,%p) stub!\n", This, iface, dwFlags, ppSample);
return S_FALSE;
}
-static HRESULT WINAPI
IDirectDrawMediaStreamImpl_CreateSharedSample(IDirectDrawMediaStream *iface,
+static HRESULT WINAPI
DirectDrawMediaStreamImpl_IDirectDrawMediaStream_CreateSharedSample(IDirectDrawMediaStream
*iface,
IStreamSample *pExistingSample, DWORD dwFlags, IStreamSample **ppSample)
{
- IDirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
+ DirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
FIXME("(%p/%p)->(%p,%x,%p) stub!\n", This, iface, pExistingSample,
dwFlags, ppSample);
return S_FALSE;
}
-static HRESULT WINAPI IDirectDrawMediaStreamImpl_SendEndOfStream(IDirectDrawMediaStream
*iface,
+static HRESULT WINAPI
DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SendEndOfStream(IDirectDrawMediaStream
*iface,
DWORD dwFlags)
{
- IDirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
+ DirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
FIXME("(%p/%p)->(%x) stub!\n", This, iface, dwFlags);
return S_FALSE;
}
-static HRESULT WINAPI IDirectDrawMediaStreamImpl_GetFormat(IDirectDrawMediaStream
*iface,
- DDSURFACEDESC *pDDSDCurrent, IDirectDrawPalette **ppDirectDrawPalette,
- DDSURFACEDESC *pDDSDDesired, DWORD *pdwFlags)
-{
- FIXME("(%p)->(%p,%p,%p,%p) stub!\n", iface, pDDSDCurrent,
ppDirectDrawPalette, pDDSDDesired,
- pdwFlags);
-
- return E_NOTIMPL;
-
-}
-
-static HRESULT WINAPI IDirectDrawMediaStreamImpl_SetFormat(IDirectDrawMediaStream
*iface,
+/*** IDirectDrawMediaStream methods ***/
+static HRESULT WINAPI
DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetFormat(IDirectDrawMediaStream *iface,
+ DDSURFACEDESC *current_format, IDirectDrawPalette **palette,
+ DDSURFACEDESC *desired_format, DWORD *flags)
+{
+ FIXME("(%p)->(%p,%p,%p,%p) stub!\n", iface, current_format, palette,
desired_format,
+ flags);
+
+ return MS_E_NOSTREAM;
+
+}
+
+static HRESULT WINAPI
DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetFormat(IDirectDrawMediaStream *iface,
const DDSURFACEDESC *pDDSurfaceDesc, IDirectDrawPalette *pDirectDrawPalette)
{
FIXME("(%p)->(%p,%p) stub!\n", iface, pDDSurfaceDesc,
pDirectDrawPalette);
@@ -172,7 +372,7 @@
return E_NOTIMPL;
}
-static HRESULT WINAPI IDirectDrawMediaStreamImpl_GetDirectDraw(IDirectDrawMediaStream
*iface,
+static HRESULT WINAPI
DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetDirectDraw(IDirectDrawMediaStream
*iface,
IDirectDraw **ppDirectDraw)
{
FIXME("(%p)->(%p) stub!\n", iface, ppDirectDraw);
@@ -180,7 +380,7 @@
return E_NOTIMPL;
}
-static HRESULT WINAPI IDirectDrawMediaStreamImpl_SetDirectDraw(IDirectDrawMediaStream
*iface,
+static HRESULT WINAPI
DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetDirectDraw(IDirectDrawMediaStream
*iface,
IDirectDraw *pDirectDraw)
{
FIXME("(%p)->(%p) stub!\n", iface, pDirectDraw);
@@ -188,16 +388,16 @@
return E_NOTIMPL;
}
-static HRESULT WINAPI IDirectDrawMediaStreamImpl_CreateSample(IDirectDrawMediaStream
*iface,
+static HRESULT WINAPI
DirectDrawMediaStreamImpl_IDirectDrawMediaStream_CreateSample(IDirectDrawMediaStream
*iface,
IDirectDrawSurface *pSurface, const RECT *pRect, DWORD dwFlags,
IDirectDrawStreamSample **ppSample)
{
- FIXME("(%p)->(%p,%p,%x,%p) stub!\n", iface, pSurface, pRect, dwFlags,
ppSample);
-
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI IDirectDrawMediaStreamImpl_GetTimePerFrame(IDirectDrawMediaStream
*iface,
+ TRACE("(%p)->(%p,%p,%x,%p)\n", iface, pSurface, pRect, dwFlags,
ppSample);
+
+ return ddrawstreamsample_create(iface, ppSample);
+}
+
+static HRESULT WINAPI
DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetTimePerFrame(IDirectDrawMediaStream
*iface,
STREAM_TIME *pFrameTime)
{
FIXME("(%p)->(%p) stub!\n", iface, pFrameTime);
@@ -205,47 +405,733 @@
return E_NOTIMPL;
}
-static const struct IDirectDrawMediaStreamVtbl DirectDrawMediaStream_Vtbl =
-{
- IDirectDrawMediaStreamImpl_QueryInterface,
- IDirectDrawMediaStreamImpl_AddRef,
- IDirectDrawMediaStreamImpl_Release,
- IDirectDrawMediaStreamImpl_GetMultiMediaStream,
- IDirectDrawMediaStreamImpl_GetInformation,
- IDirectDrawMediaStreamImpl_SetSameFormat,
- IDirectDrawMediaStreamImpl_AllocateSample,
- IDirectDrawMediaStreamImpl_CreateSharedSample,
- IDirectDrawMediaStreamImpl_SendEndOfStream,
- IDirectDrawMediaStreamImpl_GetFormat,
- IDirectDrawMediaStreamImpl_SetFormat,
- IDirectDrawMediaStreamImpl_GetDirectDraw,
- IDirectDrawMediaStreamImpl_SetDirectDraw,
- IDirectDrawMediaStreamImpl_CreateSample,
- IDirectDrawMediaStreamImpl_GetTimePerFrame
+static const struct IDirectDrawMediaStreamVtbl
DirectDrawMediaStreamImpl_IDirectDrawMediaStream_Vtbl =
+{
+ /*** IUnknown methods ***/
+ DirectDrawMediaStreamImpl_IDirectDrawMediaStream_QueryInterface,
+ DirectDrawMediaStreamImpl_IDirectDrawMediaStream_AddRef,
+ DirectDrawMediaStreamImpl_IDirectDrawMediaStream_Release,
+ /*** IMediaStream methods ***/
+ DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetMultiMediaStream,
+ DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetInformation,
+ DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetSameFormat,
+ DirectDrawMediaStreamImpl_IDirectDrawMediaStream_AllocateSample,
+ DirectDrawMediaStreamImpl_IDirectDrawMediaStream_CreateSharedSample,
+ DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SendEndOfStream,
+ /*** IDirectDrawMediaStream methods ***/
+ DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetFormat,
+ DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetFormat,
+ DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetDirectDraw,
+ DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetDirectDraw,
+ DirectDrawMediaStreamImpl_IDirectDrawMediaStream_CreateSample,
+ DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetTimePerFrame
};
-HRESULT mediastream_create(IMultiMediaStream *Parent, const MSPID *pPurposeId,
- STREAM_TYPE StreamType, IMediaStream **ppMediaStream)
-{
- IDirectDrawMediaStreamImpl *object;
-
- TRACE("(%p,%s,%p)\n", Parent, debugstr_guid(pPurposeId), ppMediaStream);
-
- object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(IDirectDrawMediaStreamImpl));
+HRESULT ddrawmediastream_create(IMultiMediaStream *parent, const MSPID *purpose_id,
+ STREAM_TYPE stream_type, IMediaStream **media_stream)
+{
+ DirectDrawMediaStreamImpl *object;
+
+ TRACE("(%p,%s,%p)\n", parent, debugstr_guid(purpose_id), media_stream);
+
+ object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(DirectDrawMediaStreamImpl));
if (!object)
+ return E_OUTOFMEMORY;
+
+ object->IAMMediaStream_iface.lpVtbl =
&DirectDrawMediaStreamImpl_IAMMediaStream_Vtbl;
+ object->IDirectDrawMediaStream_iface.lpVtbl =
&DirectDrawMediaStreamImpl_IDirectDrawMediaStream_Vtbl;
+ object->ref = 1;
+
+ object->parent = parent;
+ object->purpose_id = *purpose_id;
+ object->stream_type = stream_type;
+
+ *media_stream = (IMediaStream*)&object->IAMMediaStream_iface;
+
+ return S_OK;
+}
+
+typedef struct {
+ IAMMediaStream IAMMediaStream_iface;
+ IAudioMediaStream IAudioMediaStream_iface;
+ LONG ref;
+ IMultiMediaStream* parent;
+ MSPID purpose_id;
+ STREAM_TYPE stream_type;
+} AudioMediaStreamImpl;
+
+static inline AudioMediaStreamImpl
*impl_from_AudioMediaStream_IAMMediaStream(IAMMediaStream *iface)
+{
+ return CONTAINING_RECORD(iface, AudioMediaStreamImpl, IAMMediaStream_iface);
+}
+
+/*** IUnknown methods ***/
+static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_QueryInterface(IAMMediaStream
*iface,
+ REFIID riid, void **ret_iface)
+{
+ AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
+
+ TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid),
ret_iface);
+
+ if (IsEqualGUID(riid, &IID_IUnknown) ||
+ IsEqualGUID(riid, &IID_IMediaStream) ||
+ IsEqualGUID(riid, &IID_IAMMediaStream))
{
- ERR("Out of memory\n");
+ IAMMediaStream_AddRef(iface);
+ *ret_iface = iface;
+ return S_OK;
+ }
+ else if (IsEqualGUID(riid, &IID_IAudioMediaStream))
+ {
+ IAMMediaStream_AddRef(iface);
+ *ret_iface = &This->IAudioMediaStream_iface;
+ return S_OK;
+ }
+
+ ERR("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ret_iface);
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI AudioMediaStreamImpl_IAMMediaStream_AddRef(IAMMediaStream *iface)
+{
+ AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
+ ULONG ref = InterlockedIncrement(&This->ref);
+
+ TRACE("(%p/%p)->(): new ref = %u\n", iface, This, ref);
+
+ return ref;
+}
+
+static ULONG WINAPI AudioMediaStreamImpl_IAMMediaStream_Release(IAMMediaStream *iface)
+{
+ AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
+ ULONG ref = InterlockedDecrement(&This->ref);
+
+ TRACE("(%p/%p)->(): new ref = %u\n", iface, This, ref);
+
+ if (!ref)
+ HeapFree(GetProcessHeap(), 0, This);
+
+ return ref;
+}
+
+/*** IMediaStream methods ***/
+static HRESULT WINAPI
AudioMediaStreamImpl_IAMMediaStream_GetMultiMediaStream(IAMMediaStream *iface,
+ IMultiMediaStream** multi_media_stream)
+{
+ AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
+
+ FIXME("(%p/%p)->(%p) stub!\n", This, iface, multi_media_stream);
+
+ return S_FALSE;
+}
+
+static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_GetInformation(IAMMediaStream
*iface,
+ MSPID *purpose_id, STREAM_TYPE *type)
+{
+ AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
+
+ TRACE("(%p/%p)->(%p,%p)\n", This, iface, purpose_id, type);
+
+ if (purpose_id)
+ *purpose_id = This->purpose_id;
+ if (type)
+ *type = This->stream_type;
+
+ return S_OK;
+}
+
+static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_SetSameFormat(IAMMediaStream
*iface,
+ IMediaStream *pStreamThatHasDesiredFormat, DWORD flags)
+{
+ AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
+
+ FIXME("(%p/%p)->(%p,%x) stub!\n", This, iface,
pStreamThatHasDesiredFormat, flags);
+
+ return S_FALSE;
+}
+
+static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_AllocateSample(IAMMediaStream
*iface,
+ DWORD flags, IStreamSample **sample)
+{
+ AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
+
+ FIXME("(%p/%p)->(%x,%p) stub!\n", This, iface, flags, sample);
+
+ return S_FALSE;
+}
+
+static HRESULT WINAPI
AudioMediaStreamImpl_IAMMediaStream_CreateSharedSample(IAMMediaStream *iface,
+ IStreamSample *existing_sample, DWORD flags, IStreamSample **sample)
+{
+ AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
+
+ FIXME("(%p/%p)->(%p,%x,%p) stub!\n", This, iface, existing_sample,
flags, sample);
+
+ return S_FALSE;
+}
+
+static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_SendEndOfStream(IAMMediaStream
*iface, DWORD flags)
+{
+ AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
+
+ FIXME("(%p/%p)->(%x) stub!\n", This, iface, flags);
+
+ return S_FALSE;
+}
+
+/*** IAMMediaStream methods ***/
+static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_Initialize(IAMMediaStream
*iface, IUnknown *source_object, DWORD flags,
+ REFMSPID purpose_id, const
STREAM_TYPE stream_type)
+{
+ AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
+
+ FIXME("(%p/%p)->(%p,%x,%p,%u) stub!\n", This, iface, source_object,
flags, purpose_id, stream_type);
+
+ return S_FALSE;
+}
+
+static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_SetState(IAMMediaStream *iface,
FILTER_STATE state)
+{
+ AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
+
+ FIXME("(%p/%p)->(%u) stub!\n", This, iface, state);
+
+ return S_FALSE;
+}
+
+static HRESULT WINAPI
AudioMediaStreamImpl_IAMMediaStream_JoinAMMultiMediaStream(IAMMediaStream *iface,
IAMMultiMediaStream *am_multi_media_stream)
+{
+ AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
+
+ FIXME("(%p/%p)->(%p) stub!\n", This, iface, am_multi_media_stream);
+
+ return S_FALSE;
+}
+
+static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_JoinFilter(IAMMediaStream
*iface, IMediaStreamFilter *media_stream_filter)
+{
+ AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
+
+ FIXME("(%p/%p)->(%p) stub!\n", This, iface, media_stream_filter);
+
+ return S_FALSE;
+}
+
+static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_JoinFilterGraph(IAMMediaStream
*iface, IFilterGraph *filtergraph)
+{
+ AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
+
+ FIXME("(%p/%p)->(%p) stub!\n", This, iface, filtergraph);
+
+ return S_FALSE;
+}
+
+static const struct IAMMediaStreamVtbl AudioMediaStreamImpl_IAMMediaStream_Vtbl =
+{
+ /*** IUnknown methods ***/
+ AudioMediaStreamImpl_IAMMediaStream_QueryInterface,
+ AudioMediaStreamImpl_IAMMediaStream_AddRef,
+ AudioMediaStreamImpl_IAMMediaStream_Release,
+ /*** IMediaStream methods ***/
+ AudioMediaStreamImpl_IAMMediaStream_GetMultiMediaStream,
+ AudioMediaStreamImpl_IAMMediaStream_GetInformation,
+ AudioMediaStreamImpl_IAMMediaStream_SetSameFormat,
+ AudioMediaStreamImpl_IAMMediaStream_AllocateSample,
+ AudioMediaStreamImpl_IAMMediaStream_CreateSharedSample,
+ AudioMediaStreamImpl_IAMMediaStream_SendEndOfStream,
+ /*** IAMMediaStream methods ***/
+ AudioMediaStreamImpl_IAMMediaStream_Initialize,
+ AudioMediaStreamImpl_IAMMediaStream_SetState,
+ AudioMediaStreamImpl_IAMMediaStream_JoinAMMultiMediaStream,
+ AudioMediaStreamImpl_IAMMediaStream_JoinFilter,
+ AudioMediaStreamImpl_IAMMediaStream_JoinFilterGraph
+};
+
+static inline AudioMediaStreamImpl *impl_from_IAudioMediaStream(IAudioMediaStream
*iface)
+{
+ return CONTAINING_RECORD(iface, AudioMediaStreamImpl, IAudioMediaStream_iface);
+}
+
+/*** IUnknown methods ***/
+static HRESULT WINAPI
AudioMediaStreamImpl_IAudioMediaStream_QueryInterface(IAudioMediaStream *iface,
+ REFIID riid, void **ret_iface)
+{
+ AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
+
+ TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid),
ret_iface);
+
+ if (IsEqualGUID(riid, &IID_IUnknown) ||
+ IsEqualGUID(riid, &IID_IMediaStream) ||
+ IsEqualGUID(riid, &IID_IAudioMediaStream))
+ {
+ IAudioMediaStream_AddRef(iface);
+ *ret_iface = iface;
+ return S_OK;
+ }
+ else if (IsEqualGUID(riid, &IID_IAMMediaStream))
+ {
+ IAudioMediaStream_AddRef(iface);
+ *ret_iface = &This->IAMMediaStream_iface;
+ return S_OK;
+ }
+
+
+ *ret_iface = NULL;
+
+ ERR("(%p/%p)->(%s,%p),not found\n", iface, This, debugstr_guid(riid),
ret_iface);
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI AudioMediaStreamImpl_IAudioMediaStream_AddRef(IAudioMediaStream
*iface)
+{
+ AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
+ ULONG ref = InterlockedIncrement(&This->ref);
+
+ TRACE("(%p/%p): new ref = %u\n", iface, This, ref);
+
+ return ref;
+}
+
+static ULONG WINAPI AudioMediaStreamImpl_IAudioMediaStream_Release(IAudioMediaStream
*iface)
+{
+ AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
+ ULONG ref = InterlockedDecrement(&This->ref);
+
+ TRACE("(%p/%p): new ref = %u\n", iface, This, ref);
+
+ if (!ref)
+ HeapFree(GetProcessHeap(), 0, This);
+
+ return ref;
+}
+
+/*** IMediaStream methods ***/
+static HRESULT WINAPI
AudioMediaStreamImpl_IAudioMediaStream_GetMultiMediaStream(IAudioMediaStream *iface,
+ IMultiMediaStream** multimedia_stream)
+{
+ AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
+
+ FIXME("(%p/%p)->(%p) stub!\n", iface, This, multimedia_stream);
+
+ return S_FALSE;
+}
+
+static HRESULT WINAPI
AudioMediaStreamImpl_IAudioMediaStream_GetInformation(IAudioMediaStream *iface,
+ MSPID *purpose_id, STREAM_TYPE *type)
+{
+ AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
+
+ TRACE("(%p/%p)->(%p,%p)\n", iface, This, purpose_id, type);
+
+ if (purpose_id)
+ *purpose_id = This->purpose_id;
+ if (type)
+ *type = This->stream_type;
+
+ return S_OK;
+}
+
+static HRESULT WINAPI
AudioMediaStreamImpl_IAudioMediaStream_SetSameFormat(IAudioMediaStream *iface,
+ IMediaStream *stream_format, DWORD flags)
+{
+ AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
+
+ FIXME("(%p/%p)->(%p,%x) stub!\n", iface, This, stream_format, flags);
+
+ return S_FALSE;
+}
+
+static HRESULT WINAPI
AudioMediaStreamImpl_IAudioMediaStream_AllocateSample(IAudioMediaStream *iface,
+ DWORD flags, IStreamSample **sample)
+{
+ AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
+
+ FIXME("(%p/%p)->(%x,%p) stub!\n", iface, This, flags, sample);
+
+ return S_FALSE;
+}
+
+static HRESULT WINAPI
AudioMediaStreamImpl_IAudioMediaStream_CreateSharedSample(IAudioMediaStream *iface,
+ IStreamSample *existing_sample, DWORD flags, IStreamSample **sample)
+{
+ AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
+
+ FIXME("(%p/%p)->(%p,%x,%p) stub!\n", iface, This, existing_sample,
flags, sample);
+
+ return S_FALSE;
+}
+
+static HRESULT WINAPI
AudioMediaStreamImpl_IAudioMediaStream_SendEndOfStream(IAudioMediaStream *iface,
+ DWORD flags)
+{
+ AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
+
+ FIXME("(%p/%p)->(%x) stub!\n", iface, This, flags);
+
+ return S_FALSE;
+}
+
+/*** IAudioMediaStream methods ***/
+static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_GetFormat(IAudioMediaStream
*iface, WAVEFORMATEX *wave_format_current)
+{
+ AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
+
+ FIXME("(%p/%p)->(%p) stub!\n", iface, This, wave_format_current);
+
+ if (!wave_format_current)
+ return E_POINTER;
+
+ return MS_E_NOSTREAM;
+
+}
+
+static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_SetFormat(IAudioMediaStream
*iface, const WAVEFORMATEX *wave_format)
+{
+ AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
+
+ FIXME("(%p/%p)->(%p) stub!\n", iface, This, wave_format);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI
AudioMediaStreamImpl_IAudioMediaStream_CreateSample(IAudioMediaStream *iface, IAudioData
*audio_data,
+ DWORD flags, IAudioStreamSample
**sample)
+{
+ AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
+
+ TRACE("(%p/%p)->(%p,%u,%p)\n", iface, This, audio_data, flags, sample);
+
+ if (!audio_data)
+ return E_POINTER;
+
+ return audiostreamsample_create(iface, audio_data, sample);
+}
+
+static const struct IAudioMediaStreamVtbl AudioMediaStreamImpl_IAudioMediaStream_Vtbl =
+{
+ /*** IUnknown methods ***/
+ AudioMediaStreamImpl_IAudioMediaStream_QueryInterface,
+ AudioMediaStreamImpl_IAudioMediaStream_AddRef,
+ AudioMediaStreamImpl_IAudioMediaStream_Release,
+ /*** IMediaStream methods ***/
+ AudioMediaStreamImpl_IAudioMediaStream_GetMultiMediaStream,
+ AudioMediaStreamImpl_IAudioMediaStream_GetInformation,
+ AudioMediaStreamImpl_IAudioMediaStream_SetSameFormat,
+ AudioMediaStreamImpl_IAudioMediaStream_AllocateSample,
+ AudioMediaStreamImpl_IAudioMediaStream_CreateSharedSample,
+ AudioMediaStreamImpl_IAudioMediaStream_SendEndOfStream,
+ /*** IAudioMediaStream methods ***/
+ AudioMediaStreamImpl_IAudioMediaStream_GetFormat,
+ AudioMediaStreamImpl_IAudioMediaStream_SetFormat,
+ AudioMediaStreamImpl_IAudioMediaStream_CreateSample
+};
+
+HRESULT audiomediastream_create(IMultiMediaStream *parent, const MSPID *purpose_id,
+ STREAM_TYPE stream_type, IMediaStream **media_stream)
+{
+ AudioMediaStreamImpl *object;
+
+ TRACE("(%p,%s,%p)\n", parent, debugstr_guid(purpose_id), media_stream);
+
+ object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(AudioMediaStreamImpl));
+ if (!object)
return E_OUTOFMEMORY;
+
+ object->IAMMediaStream_iface.lpVtbl =
&AudioMediaStreamImpl_IAMMediaStream_Vtbl;
+ object->IAudioMediaStream_iface.lpVtbl =
&AudioMediaStreamImpl_IAudioMediaStream_Vtbl;
+ object->ref = 1;
+
+ object->parent = parent;
+ object->purpose_id = *purpose_id;
+ object->stream_type = stream_type;
+
+ *media_stream = (IMediaStream*)&object->IAMMediaStream_iface;
+
+ return S_OK;
+}
+
+typedef struct {
+ IDirectDrawStreamSample IDirectDrawStreamSample_iface;
+ LONG ref;
+ IMediaStream *parent;
+} IDirectDrawStreamSampleImpl;
+
+static inline IDirectDrawStreamSampleImpl
*impl_from_IDirectDrawStreamSample(IDirectDrawStreamSample *iface)
+{
+ return CONTAINING_RECORD(iface, IDirectDrawStreamSampleImpl,
IDirectDrawStreamSample_iface);
+}
+
+/*** IUnknown methods ***/
+static HRESULT WINAPI IDirectDrawStreamSampleImpl_QueryInterface(IDirectDrawStreamSample
*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_IStreamSample) ||
+ IsEqualGUID(riid, &IID_IDirectDrawStreamSample))
+ {
+ IDirectDrawStreamSample_AddRef(iface);
+ *ret_iface = iface;
+ return S_OK;
}
- object->IDirectDrawMediaStream_iface.lpVtbl = &DirectDrawMediaStream_Vtbl;
+ *ret_iface = NULL;
+
+ ERR("(%p)->(%s,%p),not found\n", iface, debugstr_guid(riid),
ret_iface);
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI IDirectDrawStreamSampleImpl_AddRef(IDirectDrawStreamSample *iface)
+{
+ IDirectDrawStreamSampleImpl *This = impl_from_IDirectDrawStreamSample(iface);
+ ULONG ref = InterlockedIncrement(&This->ref);
+
+ TRACE("(%p)->(): new ref = %u\n", iface, ref);
+
+ return ref;
+}
+
+static ULONG WINAPI IDirectDrawStreamSampleImpl_Release(IDirectDrawStreamSample *iface)
+{
+ IDirectDrawStreamSampleImpl *This = impl_from_IDirectDrawStreamSample(iface);
+ ULONG ref = InterlockedDecrement(&This->ref);
+
+ TRACE("(%p)->(): new ref = %u\n", iface, ref);
+
+ if (!ref)
+ HeapFree(GetProcessHeap(), 0, This);
+
+ return ref;
+}
+
+/*** IStreamSample methods ***/
+static HRESULT WINAPI IDirectDrawStreamSampleImpl_GetMediaStream(IDirectDrawStreamSample
*iface, IMediaStream **media_stream)
+{
+ FIXME("(%p)->(%p): stub\n", iface, media_stream);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IDirectDrawStreamSampleImpl_GetSampleTimes(IDirectDrawStreamSample
*iface, STREAM_TIME *start_time,
+ STREAM_TIME *end_time,
STREAM_TIME *current_time)
+{
+ FIXME("(%p)->(%p,%p,%p): stub\n", iface, start_time, end_time,
current_time);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IDirectDrawStreamSampleImpl_SetSampleTimes(IDirectDrawStreamSample
*iface, const STREAM_TIME *start_time,
+ const STREAM_TIME
*end_time)
+{
+ FIXME("(%p)->(%p,%p): stub\n", iface, start_time, end_time);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IDirectDrawStreamSampleImpl_Update(IDirectDrawStreamSample *iface,
DWORD flags, HANDLE event,
+ PAPCFUNC func_APC, DWORD
APC_data)
+{
+ FIXME("(%p)->(%x,%p,%p,%u): stub\n", iface, flags, event, func_APC,
APC_data);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI
IDirectDrawStreamSampleImpl_CompletionStatus(IDirectDrawStreamSample *iface, DWORD flags,
DWORD milliseconds)
+{
+ FIXME("(%p)->(%x,%u): stub\n", iface, flags, milliseconds);
+
+ return E_NOTIMPL;
+}
+
+/*** IDirectDrawStreamSample methods ***/
+static HRESULT WINAPI IDirectDrawStreamSampleImpl_GetSurface(IDirectDrawStreamSample
*iface, IDirectDrawSurface **ddraw_surface,
+ RECT *rect)
+{
+ FIXME("(%p)->(%p,%p): stub\n", iface, ddraw_surface, rect);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IDirectDrawStreamSampleImpl_SetRect(IDirectDrawStreamSample *iface,
const RECT *rect)
+{
+ FIXME("(%p)->(%p): stub\n", iface, rect);
+
+ return E_NOTIMPL;
+}
+
+static const struct IDirectDrawStreamSampleVtbl DirectDrawStreamSample_Vtbl =
+{
+ /*** IUnknown methods ***/
+ IDirectDrawStreamSampleImpl_QueryInterface,
+ IDirectDrawStreamSampleImpl_AddRef,
+ IDirectDrawStreamSampleImpl_Release,
+ /*** IStreamSample methods ***/
+ IDirectDrawStreamSampleImpl_GetMediaStream,
+ IDirectDrawStreamSampleImpl_GetSampleTimes,
+ IDirectDrawStreamSampleImpl_SetSampleTimes,
+ IDirectDrawStreamSampleImpl_Update,
+ IDirectDrawStreamSampleImpl_CompletionStatus,
+ /*** IDirectDrawStreamSample methods ***/
+ IDirectDrawStreamSampleImpl_GetSurface,
+ IDirectDrawStreamSampleImpl_SetRect
+};
+
+static HRESULT ddrawstreamsample_create(IDirectDrawMediaStream *parent,
IDirectDrawStreamSample **ddraw_stream_sample)
+{
+ IDirectDrawStreamSampleImpl *object;
+
+ TRACE("(%p)\n", ddraw_stream_sample);
+
+ object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(IDirectDrawStreamSampleImpl));
+ if (!object)
+ return E_OUTOFMEMORY;
+
+ object->IDirectDrawStreamSample_iface.lpVtbl = &DirectDrawStreamSample_Vtbl;
object->ref = 1;
-
- object->Parent = Parent;
- object->PurposeId = *pPurposeId;
- object->StreamType = StreamType;
-
- *ppMediaStream = (IMediaStream*)&object->IDirectDrawMediaStream_iface;
+ object->parent = (IMediaStream*)parent;
+
+ *ddraw_stream_sample =
(IDirectDrawStreamSample*)&object->IDirectDrawStreamSample_iface;
return S_OK;
}
+
+typedef struct {
+ IAudioStreamSample IAudioStreamSample_iface;
+ LONG ref;
+ IMediaStream *parent;
+ IAudioData *audio_data;
+} IAudioStreamSampleImpl;
+
+static inline IAudioStreamSampleImpl *impl_from_IAudioStreamSample(IAudioStreamSample
*iface)
+{
+ return CONTAINING_RECORD(iface, IAudioStreamSampleImpl, IAudioStreamSample_iface);
+}
+
+/*** IUnknown methods ***/
+static HRESULT WINAPI IAudioStreamSampleImpl_QueryInterface(IAudioStreamSample *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_IStreamSample) ||
+ IsEqualGUID(riid, &IID_IAudioStreamSample))
+ {
+ IAudioStreamSample_AddRef(iface);
+ *ret_iface = iface;
+ return S_OK;
+ }
+
+ *ret_iface = NULL;
+
+ ERR("(%p)->(%s,%p),not found\n", iface, debugstr_guid(riid),
ret_iface);
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI IAudioStreamSampleImpl_AddRef(IAudioStreamSample *iface)
+{
+ IAudioStreamSampleImpl *This = impl_from_IAudioStreamSample(iface);
+ ULONG ref = InterlockedIncrement(&This->ref);
+
+ TRACE("(%p)->(): new ref = %u\n", iface, ref);
+
+ return ref;
+}
+
+static ULONG WINAPI IAudioStreamSampleImpl_Release(IAudioStreamSample *iface)
+{
+ IAudioStreamSampleImpl *This = impl_from_IAudioStreamSample(iface);
+ ULONG ref = InterlockedDecrement(&This->ref);
+
+ TRACE("(%p)->(): new ref = %u\n", iface, ref);
+
+ if (!ref)
+ HeapFree(GetProcessHeap(), 0, This);
+
+ return ref;
+}
+
+/*** IStreamSample methods ***/
+static HRESULT WINAPI IAudioStreamSampleImpl_GetMediaStream(IAudioStreamSample *iface,
IMediaStream **media_stream)
+{
+ FIXME("(%p)->(%p): stub\n", iface, media_stream);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IAudioStreamSampleImpl_GetSampleTimes(IAudioStreamSample *iface,
STREAM_TIME *start_time,
+ STREAM_TIME *end_time,
STREAM_TIME *current_time)
+{
+ FIXME("(%p)->(%p,%p,%p): stub\n", iface, start_time, end_time,
current_time);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IAudioStreamSampleImpl_SetSampleTimes(IAudioStreamSample *iface,
const STREAM_TIME *start_time,
+ const STREAM_TIME
*end_time)
+{
+ FIXME("(%p)->(%p,%p): stub\n", iface, start_time, end_time);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IAudioStreamSampleImpl_Update(IAudioStreamSample *iface, DWORD
flags, HANDLE event,
+ PAPCFUNC func_APC, DWORD
APC_data)
+{
+ FIXME("(%p)->(%x,%p,%p,%u): stub\n", iface, flags, event, func_APC,
APC_data);
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IAudioStreamSampleImpl_CompletionStatus(IAudioStreamSample *iface,
DWORD flags, DWORD milliseconds)
+{
+ FIXME("(%p)->(%x,%u): stub\n", iface, flags, milliseconds);
+
+ return E_NOTIMPL;
+}
+
+/*** IAudioStreamSample methods ***/
+static HRESULT WINAPI IAudioStreamSampleImpl_GetAudioData(IAudioStreamSample *iface,
IAudioData **audio_data)
+{
+ FIXME("(%p)->(%p): stub\n", iface, audio_data);
+
+ return E_NOTIMPL;
+}
+
+static const struct IAudioStreamSampleVtbl AudioStreamSample_Vtbl =
+{
+ /*** IUnknown methods ***/
+ IAudioStreamSampleImpl_QueryInterface,
+ IAudioStreamSampleImpl_AddRef,
+ IAudioStreamSampleImpl_Release,
+ /*** IStreamSample methods ***/
+ IAudioStreamSampleImpl_GetMediaStream,
+ IAudioStreamSampleImpl_GetSampleTimes,
+ IAudioStreamSampleImpl_SetSampleTimes,
+ IAudioStreamSampleImpl_Update,
+ IAudioStreamSampleImpl_CompletionStatus,
+ /*** IAudioStreamSample methods ***/
+ IAudioStreamSampleImpl_GetAudioData
+};
+
+static HRESULT audiostreamsample_create(IAudioMediaStream *parent, IAudioData
*audio_data, IAudioStreamSample **audio_stream_sample)
+{
+ IAudioStreamSampleImpl *object;
+
+ TRACE("(%p)\n", audio_stream_sample);
+
+ object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(IAudioStreamSampleImpl));
+ if (!object)
+ return E_OUTOFMEMORY;
+
+ object->IAudioStreamSample_iface.lpVtbl = &AudioStreamSample_Vtbl;
+ object->ref = 1;
+ object->parent = (IMediaStream*)parent;
+ object->audio_data = audio_data;
+
+ *audio_stream_sample =
(IAudioStreamSample*)&object->IAudioStreamSample_iface;
+
+ return S_OK;
+}
Modified: trunk/reactos/dll/directx/wine/amstream/mediastreamfilter.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/amstream/…
==============================================================================
--- trunk/reactos/dll/directx/wine/amstream/mediastreamfilter.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/amstream/mediastreamfilter.c [iso-8859-1] Tue Oct 1
15:06:37 2013
@@ -1,7 +1,7 @@
/*
* Implementation of MediaStream Filter
*
- * Copyright 2008 Christian Costa
+ * Copyright 2008, 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
@@ -24,6 +24,9 @@
//#include "winbase.h"
//#include "wingdi.h"
+#include <dshow.h>
+
+#include <wine/strmbase.h>
//#include "amstream_private.h"
#include <amstream.h>
@@ -32,46 +35,191 @@
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 {
- IMediaStreamFilter IMediaStreamFilter_iface;
- LONG ref;
- CRITICAL_SECTION csFilter;
- FILTER_STATE state;
- REFERENCE_TIME rtStreamStart;
- IReferenceClock * pClock;
- FILTER_INFO filterInfo;
+ BaseFilter filter;
+ ULONG nb_streams;
+ IMediaStream** streams;
+ IPin** pins;
} IMediaStreamFilterImpl;
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 ***/
-static HRESULT WINAPI MediaStreamFilterImpl_QueryInterface(IMediaStreamFilter *iface,
REFIID riid,
- void **ppv)
-{
- IMediaStreamFilterImpl *This = impl_from_IMediaStreamFilter(iface);
-
- TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv);
-
- *ppv = NULL;
-
- if (IsEqualIID(riid, &IID_IUnknown))
- *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));
+static HRESULT WINAPI MediaStreamFilterImpl_QueryInterface(IMediaStreamFilter *iface,
REFIID riid, void **ret_iface)
+{
+ TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ret_iface);
+
+ *ret_iface = 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 (*ret_iface)
+ {
+ IMediaStreamFilter_AddRef(*ret_iface);
return S_OK;
}
@@ -81,132 +229,178 @@
static ULONG WINAPI MediaStreamFilterImpl_AddRef(IMediaStreamFilter *iface)
{
IMediaStreamFilterImpl *This = impl_from_IMediaStreamFilter(iface);
- ULONG refCount = InterlockedIncrement(&This->ref);
-
- TRACE("(%p)->() AddRef from %d\n", iface, refCount - 1);
-
- return refCount;
+ ULONG ref = BaseFilterImpl_AddRef(&This->filter.IBaseFilter_iface);
+
+ TRACE("(%p)->(): new ref = %u\n", iface, ref);
+
+ return ref;
}
static ULONG WINAPI MediaStreamFilterImpl_Release(IMediaStreamFilter *iface)
{
IMediaStreamFilterImpl *This = impl_from_IMediaStreamFilter(iface);
- ULONG refCount = InterlockedDecrement(&This->ref);
-
- TRACE("(%p)->() Release from %d\n", iface, refCount + 1);
-
- if (!refCount)
+ ULONG ref = BaseFilterImpl_Release(&This->filter.IBaseFilter_iface);
+
+ TRACE("(%p)->(): new ref = %u\n", iface, ref);
+
+ 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);
-
- return refCount;
+ }
+
+ return ref;
}
/*** IPersist methods ***/
-static HRESULT WINAPI MediaStreamFilterImpl_GetClassID(IMediaStreamFilter * iface, CLSID
* pClsid)
-{
- TRACE("(%p)->(%p)\n", iface, pClsid);
-
- *pClsid = CLSID_MediaStreamFilter;
+static HRESULT WINAPI MediaStreamFilterImpl_GetClassID(IMediaStreamFilter *iface, CLSID
*clsid)
+{
+ IMediaStreamFilterImpl *This = impl_from_IMediaStreamFilter(iface);
+ return BaseFilterImpl_GetClassID(&This->filter.IBaseFilter_iface, clsid);
+}
+
+/*** IBaseFilter 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
start)
+{
+ FIXME("(%p)->(%s): Stub!\n", iface, wine_dbgstr_longlong(start));
+
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI MediaStreamFilterImpl_GetState(IMediaStreamFilter *iface, DWORD
ms_timeout, FILTER_STATE *state)
+{
+ 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;
+}
+
+static HRESULT WINAPI MediaStreamFilterImpl_QueryFilterInfo(IMediaStreamFilter *iface,
FILTER_INFO *info)
+{
+ IMediaStreamFilterImpl *This = impl_from_IMediaStreamFilter(iface);
+ return BaseFilterImpl_QueryFilterInfo(&This->filter.IBaseFilter_iface, info);
+}
+
+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 ***/
+
+static HRESULT WINAPI MediaStreamFilterImpl_AddMediaStream(IMediaStreamFilter* iface,
IAMMediaStream *pAMMediaStream)
+{
+ IMediaStreamFilterImpl *This = impl_from_IMediaStreamFilter(iface);
+ IMediaStream** streams;
+ IPin** pins;
+ MediaStreamFilter_InputPin* pin;
+ HRESULT hr;
+ PIN_INFO info;
+ MSPID purpose_id;
+
+ 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;
}
-/*** 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 ***/
-
-static HRESULT WINAPI MediaStreamFilterImpl_EnumPins(IMediaStreamFilter * iface,
IEnumPins **ppEnum)
-{
- FIXME("(%p)->(%p): Stub!\n", iface, ppEnum);
-
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI MediaStreamFilterImpl_FindPin(IMediaStreamFilter * iface, LPCWSTR
Id, IPin **ppPin)
-{
- FIXME("(%p)->(%s,%p): Stub!\n", iface, debugstr_w(Id), ppPin);
-
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI MediaStreamFilterImpl_QueryFilterInfo(IMediaStreamFilter * iface,
FILTER_INFO *pInfo)
-{
- FIXME("(%p)->(%p): Stub!\n", iface, pInfo);
-
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI MediaStreamFilterImpl_JoinFilterGraph(IMediaStreamFilter * iface,
IFilterGraph *pGraph, LPCWSTR pName)
-{
- FIXME("(%p)->(%p, %s): Stub!\n", iface, pGraph, debugstr_w(pName));
-
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI MediaStreamFilterImpl_QueryVendorInfo(IMediaStreamFilter * iface,
LPWSTR *pVendorInfo)
-{
- FIXME("(%p)->(%p): Stub!\n", iface, pVendorInfo);
-
- return E_NOTIMPL;
-}
-
-/*** IMediaStreamFilter methods ***/
-
-static HRESULT WINAPI MediaStreamFilterImpl_AddMediaStream(IMediaStreamFilter* iface,
IAMMediaStream *pAMMediaStream)
-{
- FIXME("(%p)->(%p): Stub!\n", iface, pAMMediaStream);
-
- return E_NOTIMPL;
-}
-
static HRESULT WINAPI MediaStreamFilterImpl_GetMediaStream(IMediaStreamFilter* iface,
REFMSPID idPurpose, IMediaStream **ppMediaStream)
{
- FIXME("(%p)->(%s,%p): Stub!\n", iface, debugstr_guid(idPurpose),
ppMediaStream);
-
- return E_NOTIMPL;
+ IMediaStreamFilterImpl *This = impl_from_IMediaStreamFilter(iface);
+ MSPID purpose_id;
+ unsigned int i;
+
+ 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)
@@ -286,6 +480,31 @@
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)
{
IMediaStreamFilterImpl* object;
@@ -297,13 +516,9 @@
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(IMediaStreamFilterImpl));
if (!object)
- {
- ERR("Out of memory\n");
return E_OUTOFMEMORY;
- }
-
- object->IMediaStreamFilter_iface.lpVtbl = &MediaStreamFilter_Vtbl;
- object->ref = 1;
+
+ BaseFilter_Init(&object->filter,
(IBaseFilterVtbl*)&MediaStreamFilter_Vtbl, &CLSID_MediaStreamFilter,
(DWORD_PTR)(__FILE__ ": MediaStreamFilterImpl.csFilter"), &BaseFuncTable);
*ppObj = object;
Modified: trunk/reactos/dll/directx/wine/amstream/version.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/amstream/…
==============================================================================
--- trunk/reactos/dll/directx/wine/amstream/version.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/wine/amstream/version.rc [iso-8859-1] Tue Oct 1 15:06:37
2013
@@ -16,7 +16,7 @@
* 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_FILENAME_STR "amstream.dll"
@@ -25,4 +25,4 @@
#define WINE_PRODUCTVERSION 6,5,1,900
#define WINE_PRODUCTVERSION_STR "6.5"
-#include "wine/wine_common_ver.rc"
+#include <wine/wine_common_ver.rc>
Modified: trunk/reactos/media/doc/README.WINE
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
==============================================================================
--- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original)
+++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Tue Oct 1 15:06:37 2013
@@ -27,7 +27,7 @@
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/d3d9 # 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/dinput # Synced to Wine-1.7.1
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/dplay # Synced to Wine-1.7.1
-reactos/dll/directx/wine/dplayx # 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.5.26
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/dxgi # Synced to Wine-1.7.1