Module: wine Branch: master Commit: bf0cad095fabea99dd84d00144aa7c01782b513f URL: http://source.winehq.org/git/wine.git/?a=commit;h=bf0cad095fabea99dd84d00144...
Author: Alistair Leslie-Hughes leslie_alistair@hotmail.com Date: Thu Jul 6 02:38:10 2017 +0000
mfreadwrite: Implement MFCreateSourceReaderFromByteStream.
Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/mfreadwrite/main.c | 172 ++++++++++++++++++++++++++++++++++++++ dlls/mfreadwrite/mfreadwrite.spec | 2 +- include/mfreadwrite.idl | 2 + 3 files changed, 175 insertions(+), 1 deletion(-)
diff --git a/dlls/mfreadwrite/main.c b/dlls/mfreadwrite/main.c index d3feeaf..e09120d 100644 --- a/dlls/mfreadwrite/main.c +++ b/dlls/mfreadwrite/main.c @@ -20,8 +20,11 @@
#include <stdarg.h>
+#define COBJMACROS + #include "windef.h" #include "winbase.h" +#include "initguid.h" #include "mfreadwrite.h"
#include "wine/debug.h" @@ -50,3 +53,172 @@ HRESULT WINAPI MFCreateSourceReaderFromMediaSource(IMFMediaSource *source, IMFAt
return E_NOTIMPL; } + +typedef struct _srcreader +{ + IMFSourceReader IMFSourceReader_iface; + LONG ref; +} srcreader; + +static inline srcreader *impl_from_IMFSourceReader(IMFSourceReader *iface) +{ + return CONTAINING_RECORD(iface, srcreader, IMFSourceReader_iface); +} + +static HRESULT WINAPI src_reader_QueryInterface(IMFSourceReader *iface, REFIID riid, void **out) +{ + srcreader *This = impl_from_IMFSourceReader(iface); + + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), out); + + if(IsEqualGUID(riid, &IID_IUnknown) || + IsEqualGUID(riid, &IID_IMFSourceReader)) + { + *out = &This->IMFSourceReader_iface; + } + else + { + FIXME("(%s, %p)\n", debugstr_guid(riid), out); + *out = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown*)*out); + return S_OK; +} + +static ULONG WINAPI src_reader_AddRef(IMFSourceReader *iface) +{ + srcreader *This = impl_from_IMFSourceReader(iface); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) ref=%u\n", This, ref); + + return ref; +} + +static ULONG WINAPI src_reader_Release(IMFSourceReader *iface) +{ + srcreader *This = impl_from_IMFSourceReader(iface); + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) ref=%u\n", This, ref); + + if (!ref) + { + HeapFree(GetProcessHeap(), 0, This); + } + + return ref; +} + +static HRESULT WINAPI src_reader_GetStreamSelection(IMFSourceReader *iface, DWORD index, BOOL *selected) +{ + srcreader *This = impl_from_IMFSourceReader(iface); + FIXME("%p, 0x%08x, %p\n", This, index, selected); + return E_NOTIMPL; +} + +static HRESULT WINAPI src_reader_SetStreamSelection(IMFSourceReader *iface, DWORD index, BOOL selected) +{ + srcreader *This = impl_from_IMFSourceReader(iface); + FIXME("%p, 0x%08x, %d\n", This, index, selected); + return E_NOTIMPL; +} + +static HRESULT WINAPI src_reader_GetNativeMediaType(IMFSourceReader *iface, DWORD index, DWORD typeindex, + IMFMediaType **type) +{ + srcreader *This = impl_from_IMFSourceReader(iface); + FIXME("%p, 0x%08x, %d, %p\n", This, index, typeindex, type); + return E_NOTIMPL; +} + +static HRESULT WINAPI src_reader_GetCurrentMediaType(IMFSourceReader *iface, DWORD index, IMFMediaType **type) +{ + srcreader *This = impl_from_IMFSourceReader(iface); + FIXME("%p, 0x%08x, %p\n", This, index, type); + return E_NOTIMPL; +} + +static HRESULT WINAPI src_reader_SetCurrentMediaType(IMFSourceReader *iface, DWORD index, DWORD *reserved, + IMFMediaType *type) +{ + srcreader *This = impl_from_IMFSourceReader(iface); + FIXME("%p, 0x%08x, %p, %p\n", This, index, reserved, type); + return E_NOTIMPL; +} + +static HRESULT WINAPI src_reader_SetCurrentPosition(IMFSourceReader *iface, REFGUID format, REFPROPVARIANT position) +{ + srcreader *This = impl_from_IMFSourceReader(iface); + FIXME("%p, %s, %p\n", This, debugstr_guid(format), position); + return E_NOTIMPL; +} + +static HRESULT WINAPI src_reader_ReadSample(IMFSourceReader *iface, DWORD index, + DWORD flags, DWORD *actualindex, DWORD *sampleflags, LONGLONG *timestamp, + IMFSample **sample) +{ + srcreader *This = impl_from_IMFSourceReader(iface); + FIXME("%p, 0x%08x, 0x%08x, %p, %p, %p, %p\n", This, index, flags, actualindex, + sampleflags, timestamp, sample); + return E_NOTIMPL; +} + +static HRESULT WINAPI src_reader_Flush(IMFSourceReader *iface, DWORD index) +{ + srcreader *This = impl_from_IMFSourceReader(iface); + FIXME("%p, 0x%08x\n", This, index); + return E_NOTIMPL; +} + +static HRESULT WINAPI src_reader_GetServiceForStream(IMFSourceReader *iface, DWORD index, REFGUID service, + REFIID riid, void **object) +{ + srcreader *This = impl_from_IMFSourceReader(iface); + FIXME("%p, 0x%08x, %s, %s, %p\n", This, index, debugstr_guid(service), debugstr_guid(riid), object); + return E_NOTIMPL; +} + +static HRESULT WINAPI src_reader_GetPresentationAttribute(IMFSourceReader *iface, DWORD index, + REFGUID guid, PROPVARIANT *attr) +{ + srcreader *This = impl_from_IMFSourceReader(iface); + FIXME("%p, 0x%08x, %s, %p\n", This, index, debugstr_guid(guid), attr); + return E_NOTIMPL; +} + +struct IMFSourceReaderVtbl srcreader_vtbl = +{ + src_reader_QueryInterface, + src_reader_AddRef, + src_reader_Release, + src_reader_GetStreamSelection, + src_reader_SetStreamSelection, + src_reader_GetNativeMediaType, + src_reader_GetCurrentMediaType, + src_reader_SetCurrentMediaType, + src_reader_SetCurrentPosition, + src_reader_ReadSample, + src_reader_Flush, + src_reader_GetServiceForStream, + src_reader_GetPresentationAttribute +}; + +HRESULT WINAPI MFCreateSourceReaderFromByteStream(IMFByteStream *stream, IMFAttributes *attributes, IMFSourceReader **reader) +{ + srcreader *object; + + TRACE("%p, %p, %p\n", stream, attributes, reader); + + object = HeapAlloc( GetProcessHeap(), 0, sizeof(*object) ); + if(!object) + return E_OUTOFMEMORY; + + object->ref = 1; + object->IMFSourceReader_iface.lpVtbl = &srcreader_vtbl; + + *reader = &object->IMFSourceReader_iface; + return S_OK; +} diff --git a/dlls/mfreadwrite/mfreadwrite.spec b/dlls/mfreadwrite/mfreadwrite.spec index 70b95a8..4272b71 100644 --- a/dlls/mfreadwrite/mfreadwrite.spec +++ b/dlls/mfreadwrite/mfreadwrite.spec @@ -2,6 +2,6 @@ @ stub DllGetClassObject @ stub MFCreateSinkWriterFromMediaSink @ stub MFCreateSinkWriterFromURL -@ stub MFCreateSourceReaderFromByteStream +@ stdcall MFCreateSourceReaderFromByteStream(ptr ptr ptr) @ stdcall MFCreateSourceReaderFromMediaSource(ptr ptr ptr) @ stub MFCreateSourceReaderFromURL diff --git a/include/mfreadwrite.idl b/include/mfreadwrite.idl index c8816cd..dd8c124 100644 --- a/include/mfreadwrite.idl +++ b/include/mfreadwrite.idl @@ -93,5 +93,7 @@ interface IMFSinkWriter : IUnknown HRESULT GetStatistics([in] DWORD index, [out] MF_SINK_WRITER_STATISTICS *stats); };
+cpp_quote( "HRESULT WINAPI MFCreateSourceReaderFromByteStream(IMFByteStream *stream, IMFAttributes *attributes," ) +cpp_quote( " IMFSourceReader **reader);" ) cpp_quote( "HRESULT WINAPI MFCreateSourceReaderFromMediaSource(IMFMediaSource *source, IMFAttributes *attributes," ) cpp_quote( " IMFSourceReader **reader);" )