From f3b9983a5e2f295f130d5b78f594bf80507ac40b Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Tue, 28 Aug 2018 09:25:28 +1000 Subject: [PATCH] Updated mfplat-MFCreateMFByteStreamOnStream patchset --- ...dd-MFCreateMFByteStreamOnStream-stub.patch | 58 ---- ...plement-MFCreateMFByteStreamOnStream.patch | 328 ++++++++++++++++++ .../definition | 4 +- patches/patchinstall.sh | 40 ++- 4 files changed, 356 insertions(+), 74 deletions(-) delete mode 100644 patches/mfplat-MFCreateMFByteStreamOnStream/0001-mfplat-Add-MFCreateMFByteStreamOnStream-stub.patch create mode 100644 patches/mfplat-MFCreateMFByteStreamOnStream/0001-mfplat-Implement-MFCreateMFByteStreamOnStream.patch diff --git a/patches/mfplat-MFCreateMFByteStreamOnStream/0001-mfplat-Add-MFCreateMFByteStreamOnStream-stub.patch b/patches/mfplat-MFCreateMFByteStreamOnStream/0001-mfplat-Add-MFCreateMFByteStreamOnStream-stub.patch deleted file mode 100644 index c2031e29..00000000 --- a/patches/mfplat-MFCreateMFByteStreamOnStream/0001-mfplat-Add-MFCreateMFByteStreamOnStream-stub.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 5708796535b498be35b1ea5be561bfaf7ea420ce Mon Sep 17 00:00:00 2001 -From: Alistair Leslie-Hughes -Date: Fri, 24 Aug 2018 11:20:54 +1000 -Subject: [PATCH] mfplat: Add MFCreateMFByteStreamOnStream stub - -Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45372 -Signed-off-by: Alistair Leslie-Hughes ---- - dlls/mfplat/main.c | 6 ++++++ - dlls/mfplat/mfplat.spec | 2 +- - include/mfidl.idl | 1 + - 3 files changed, 8 insertions(+), 1 deletion(-) - -diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c -index 97b11e7..ff71ff7 100644 ---- a/dlls/mfplat/main.c -+++ b/dlls/mfplat/main.c -@@ -441,6 +441,12 @@ HRESULT WINAPI MFShutdown(void) - return S_OK; - } - -+HRESULT WINAPI MFCreateMFByteStreamOnStream(IStream *stream, IMFByteStream **bytestream) -+{ -+ FIXME("(%p, %p): stub\n", stream, bytestream); -+ return E_NOTIMPL; -+} -+ - static HRESULT WINAPI MFPluginControl_QueryInterface(IMFPluginControl *iface, REFIID riid, void **ppv) - { - if(IsEqualGUID(riid, &IID_IUnknown)) { -diff --git a/dlls/mfplat/mfplat.spec b/dlls/mfplat/mfplat.spec -index 2e2204e..2534b55 100644 ---- a/dlls/mfplat/mfplat.spec -+++ b/dlls/mfplat/mfplat.spec -@@ -45,7 +45,7 @@ - @ stdcall MFCreateEventQueue(ptr) - @ stub MFCreateFile - @ stub MFCreateLegacyMediaBufferOnMFMediaBuffer --@ stub MFCreateMFByteStreamOnStream -+@ stdcall MFCreateMFByteStreamOnStream(ptr ptr) - @ stub MFCreateMFVideoFormatFromMFMediaType - @ stub MFCreateMediaBufferWrapper - @ stub MFCreateMediaEvent -diff --git a/include/mfidl.idl b/include/mfidl.idl -index 12b351d..84be055 100644 ---- a/include/mfidl.idl -+++ b/include/mfidl.idl -@@ -251,6 +251,7 @@ interface IMFGetService : IUnknown - } - - cpp_quote("HRESULT WINAPI MFCreateMediaSession(IMFAttributes *config, IMFMediaSession **session);") -+cpp_quote("HRESULT WINAPI MFCreateMFByteStreamOnStream(IStream *stream, IMFByteStream **bytestream);" ) - cpp_quote("HRESULT WINAPI MFCreateSourceResolver(IMFSourceResolver **resolver);") - cpp_quote("HRESULT WINAPI MFCreateStreamDescriptor(DWORD identifier, DWORD cMediaTypes,") - cpp_quote(" IMFMediaType **types, IMFStreamDescriptor **descriptor);") --- -1.9.1 - diff --git a/patches/mfplat-MFCreateMFByteStreamOnStream/0001-mfplat-Implement-MFCreateMFByteStreamOnStream.patch b/patches/mfplat-MFCreateMFByteStreamOnStream/0001-mfplat-Implement-MFCreateMFByteStreamOnStream.patch new file mode 100644 index 00000000..dd785a19 --- /dev/null +++ b/patches/mfplat-MFCreateMFByteStreamOnStream/0001-mfplat-Implement-MFCreateMFByteStreamOnStream.patch @@ -0,0 +1,328 @@ +From 5a5a686df602a66a5211bee21e127011456e6491 Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Fri, 24 Aug 2018 11:20:54 +1000 +Subject: [PATCH] mfplat: Implement MFCreateMFByteStreamOnStream + +Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45372 +Signed-off-by: Alistair Leslie-Hughes +--- + dlls/mfplat/main.c | 240 +++++++++++++++++++++++++++++++++++++++++++++ + dlls/mfplat/mfplat.spec | 2 +- + dlls/mfplat/tests/mfplat.c | 17 ++++ + include/mfidl.idl | 1 + + 4 files changed, 259 insertions(+), 1 deletion(-) + +diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c +index e429324..2209924 100644 +--- a/dlls/mfplat/main.c ++++ b/dlls/mfplat/main.c +@@ -424,6 +424,246 @@ HRESULT WINAPI MFShutdown(void) + return S_OK; + } + ++ ++typedef struct _mfbytestream ++{ ++ IMFByteStream IMFByteStream_iface; ++ LONG ref; ++} mfbytestream; ++ ++static inline mfbytestream *impl_from_IMFByteStream(IMFByteStream *iface) ++{ ++ return CONTAINING_RECORD(iface, mfbytestream, IMFByteStream_iface); ++} ++ ++static HRESULT WINAPI mfbytestream_QueryInterface(IMFByteStream *iface, REFIID riid, void **out) ++{ ++ mfbytestream *This = impl_from_IMFByteStream(iface); ++ ++ TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), out); ++ ++ if(IsEqualGUID(riid, &IID_IUnknown) || ++ IsEqualGUID(riid, &IID_IMFByteStream)) ++ { ++ *out = &This->IMFByteStream_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 mfbytestream_AddRef(IMFByteStream *iface) ++{ ++ mfbytestream *This = impl_from_IMFByteStream(iface); ++ ULONG ref = InterlockedIncrement(&This->ref); ++ ++ TRACE("(%p) ref=%u\n", This, ref); ++ ++ return ref; ++} ++ ++static ULONG WINAPI mfbytestream_Release(IMFByteStream *iface) ++{ ++ mfbytestream *This = impl_from_IMFByteStream(iface); ++ ULONG ref = InterlockedDecrement(&This->ref); ++ ++ TRACE("(%p) ref=%u\n", This, ref); ++ ++ if (!ref) ++ { ++ HeapFree(GetProcessHeap(), 0, This); ++ } ++ ++ return ref; ++} ++ ++static HRESULT WINAPI mfbytestream_GetCapabilities(IMFByteStream *iface, DWORD *capabilities) ++{ ++ mfbytestream *This = impl_from_IMFByteStream(iface); ++ ++ FIXME("%p, %p\n", This, capabilities); ++ ++ return E_NOTIMPL; ++} ++ ++static HRESULT WINAPI mfbytestream_GetLength(IMFByteStream *iface, QWORD *length) ++{ ++ mfbytestream *This = impl_from_IMFByteStream(iface); ++ ++ FIXME("%p, %p\n", This, length); ++ ++ return E_NOTIMPL; ++} ++ ++static HRESULT WINAPI mfbytestream_SetLength(IMFByteStream *iface, QWORD length) ++{ ++ mfbytestream *This = impl_from_IMFByteStream(iface); ++ ++ FIXME("%p, %s\n", This, wine_dbgstr_longlong(length)); ++ ++ return E_NOTIMPL; ++} ++ ++static HRESULT WINAPI mfbytestream_GetCurrentPosition(IMFByteStream *iface, QWORD *position) ++{ ++ mfbytestream *This = impl_from_IMFByteStream(iface); ++ ++ FIXME("%p, %p\n", This, position); ++ ++ return E_NOTIMPL; ++} ++ ++static HRESULT WINAPI mfbytestream_SetCurrentPosition(IMFByteStream *iface, QWORD position) ++{ ++ mfbytestream *This = impl_from_IMFByteStream(iface); ++ ++ FIXME("%p, %s\n", This, wine_dbgstr_longlong(position)); ++ ++ return E_NOTIMPL; ++} ++ ++static HRESULT WINAPI mfbytestream_IsEndOfStream(IMFByteStream *iface, BOOL *endstream) ++{ ++ mfbytestream *This = impl_from_IMFByteStream(iface); ++ ++ FIXME("%p, %p\n", This, endstream); ++ ++ if(endstream) ++ *endstream = TRUE; ++ ++ return S_OK; ++} ++ ++static HRESULT WINAPI mfbytestream_Read(IMFByteStream *iface, BYTE *data, ULONG count, ULONG *byte_read) ++{ ++ mfbytestream *This = impl_from_IMFByteStream(iface); ++ ++ FIXME("%p, %p, %u, %p\n", This, data, count, byte_read); ++ ++ return E_NOTIMPL; ++} ++ ++static HRESULT WINAPI mfbytestream_BeginRead(IMFByteStream *iface, BYTE *data, ULONG count, ++ IMFAsyncCallback *callback, IUnknown *state) ++{ ++ mfbytestream *This = impl_from_IMFByteStream(iface); ++ ++ FIXME("%p, %p, %u, %p, %p\n", This, data, count, callback, state); ++ ++ return E_NOTIMPL; ++} ++ ++static HRESULT WINAPI mfbytestream_EndRead(IMFByteStream *iface, IMFAsyncResult *result, ULONG *byte_read) ++{ ++ mfbytestream *This = impl_from_IMFByteStream(iface); ++ ++ FIXME("%p, %p, %p\n", This, result, byte_read); ++ ++ return E_NOTIMPL; ++} ++ ++static HRESULT WINAPI mfbytestream_Write(IMFByteStream *iface, const BYTE *data, ULONG count, ULONG *written) ++{ ++ mfbytestream *This = impl_from_IMFByteStream(iface); ++ ++ FIXME("%p, %p, %u, %p\n", This, data, count, written); ++ ++ return E_NOTIMPL; ++} ++ ++static HRESULT WINAPI mfbytestream_BeginWrite(IMFByteStream *iface, const BYTE *data, ULONG count, ++ IMFAsyncCallback *callback, IUnknown *state) ++{ ++ mfbytestream *This = impl_from_IMFByteStream(iface); ++ ++ FIXME("%p, %p, %u, %p, %p\n", This, data, count, callback, state); ++ ++ return E_NOTIMPL; ++} ++ ++static HRESULT WINAPI mfbytestream_EndWrite(IMFByteStream *iface, IMFAsyncResult *result, ULONG *written) ++{ ++ mfbytestream *This = impl_from_IMFByteStream(iface); ++ ++ FIXME("%p, %p, %p\n", This, result, written); ++ ++ return E_NOTIMPL; ++} ++ ++static HRESULT WINAPI mfbytestream_Seek(IMFByteStream *iface, MFBYTESTREAM_SEEK_ORIGIN seek, LONGLONG offset, ++ DWORD flags, QWORD *current) ++{ ++ mfbytestream *This = impl_from_IMFByteStream(iface); ++ ++ FIXME("%p, %u, %s, 0x%08x, %p\n", This, seek, wine_dbgstr_longlong(offset), flags, current); ++ ++ return E_NOTIMPL; ++} ++ ++static HRESULT WINAPI mfbytestream_Flush(IMFByteStream *iface) ++{ ++ mfbytestream *This = impl_from_IMFByteStream(iface); ++ ++ FIXME("%p\n", This); ++ ++ return E_NOTIMPL; ++} ++ ++static HRESULT WINAPI mfbytestream_Close(IMFByteStream *iface) ++{ ++ mfbytestream *This = impl_from_IMFByteStream(iface); ++ ++ FIXME("%p\n", This); ++ ++ return E_NOTIMPL; ++} ++ ++static const IMFByteStreamVtbl mfbytesteam_vtbl = ++{ ++ mfbytestream_QueryInterface, ++ mfbytestream_AddRef, ++ mfbytestream_Release, ++ mfbytestream_GetCapabilities, ++ mfbytestream_GetLength, ++ mfbytestream_SetLength, ++ mfbytestream_GetCurrentPosition, ++ mfbytestream_SetCurrentPosition, ++ mfbytestream_IsEndOfStream, ++ mfbytestream_Read, ++ mfbytestream_BeginRead, ++ mfbytestream_EndRead, ++ mfbytestream_Write, ++ mfbytestream_BeginWrite, ++ mfbytestream_EndWrite, ++ mfbytestream_Seek, ++ mfbytestream_Flush, ++ mfbytestream_Close ++}; ++ ++HRESULT WINAPI MFCreateMFByteStreamOnStream(IStream *stream, IMFByteStream **bytestream) ++{ ++ mfbytestream *object; ++ ++ TRACE("(%p, %p): stub\n", stream, bytestream); ++ ++ object = HeapAlloc( GetProcessHeap(), 0, sizeof(*object) ); ++ if(!object) ++ return E_OUTOFMEMORY; ++ ++ object->ref = 1; ++ object->IMFByteStream_iface.lpVtbl = &mfbytesteam_vtbl; ++ ++ *bytestream = &object->IMFByteStream_iface; ++ ++ return S_OK; ++} ++ + static HRESULT WINAPI MFPluginControl_QueryInterface(IMFPluginControl *iface, REFIID riid, void **ppv) + { + if(IsEqualGUID(riid, &IID_IUnknown)) { +diff --git a/dlls/mfplat/mfplat.spec b/dlls/mfplat/mfplat.spec +index 0ad15a5..b98e24a 100644 +--- a/dlls/mfplat/mfplat.spec ++++ b/dlls/mfplat/mfplat.spec +@@ -45,7 +45,7 @@ + @ stdcall MFCreateEventQueue(ptr) + @ stub MFCreateFile + @ stub MFCreateLegacyMediaBufferOnMFMediaBuffer +-@ stub MFCreateMFByteStreamOnStream ++@ stdcall MFCreateMFByteStreamOnStream(ptr ptr) + @ stub MFCreateMFVideoFormatFromMFMediaType + @ stub MFCreateMediaBufferWrapper + @ stub MFCreateMediaEvent +diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c +index f5a3197..c59f0cc 100644 +--- a/dlls/mfplat/tests/mfplat.c ++++ b/dlls/mfplat/tests/mfplat.c +@@ -266,6 +266,22 @@ static void test_MFSample(void) + IMFSample_Release(sample); + } + ++static void test_MFCreateMFByteStreamOnStream(void) ++{ ++ IMFByteStream *bytestream; ++ IStream *stream; ++ HRESULT hr; ++ ++ hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); ++ ok(hr == S_OK, "got 0x%08x\n", hr); ++ ++ hr = MFCreateMFByteStreamOnStream(stream, &bytestream ); ++ ok(hr == S_OK, "got 0x%08x\n", hr); ++ ++ IStream_Release(stream); ++ IMFByteStream_Release(bytestream); ++} ++ + START_TEST(mfplat) + { + CoInitialize(NULL); +@@ -277,6 +293,7 @@ START_TEST(mfplat) + test_MFCreateMediaType(); + test_MFCreateAttributes(); + test_MFSample(); ++ test_MFCreateMFByteStreamOnStream(); + + CoUninitialize(); + } +diff --git a/include/mfidl.idl b/include/mfidl.idl +index 12b351d..84be055 100644 +--- a/include/mfidl.idl ++++ b/include/mfidl.idl +@@ -251,6 +251,7 @@ interface IMFGetService : IUnknown + } + + cpp_quote("HRESULT WINAPI MFCreateMediaSession(IMFAttributes *config, IMFMediaSession **session);") ++cpp_quote("HRESULT WINAPI MFCreateMFByteStreamOnStream(IStream *stream, IMFByteStream **bytestream);" ) + cpp_quote("HRESULT WINAPI MFCreateSourceResolver(IMFSourceResolver **resolver);") + cpp_quote("HRESULT WINAPI MFCreateStreamDescriptor(DWORD identifier, DWORD cMediaTypes,") + cpp_quote(" IMFMediaType **types, IMFStreamDescriptor **descriptor);") +-- +1.9.1 + diff --git a/patches/mfplat-MFCreateMFByteStreamOnStream/definition b/patches/mfplat-MFCreateMFByteStreamOnStream/definition index 988dad53..bb994699 100644 --- a/patches/mfplat-MFCreateMFByteStreamOnStream/definition +++ b/patches/mfplat-MFCreateMFByteStreamOnStream/definition @@ -1 +1,3 @@ -Fixes: [45372] Add MFCreateMFByteStreamOnStream stu +Fixes: [45372] Implement MFCreateMFByteStreamOnStream. +# Required because of tests. +Depends: mfplat-MFCreateSample diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 4eda6689..cc295273 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -2190,6 +2190,13 @@ if test "$enable_ntdll_ApiSetMap" -eq 1; then enable_ntdll_ThreadTime=1 fi +if test "$enable_mfplat_MFCreateMFByteStreamOnStream" -eq 1; then + if test "$enable_mfplat_MFCreateSample" -gt 1; then + abort "Patchset mfplat-MFCreateSample disabled, but mfplat-MFCreateMFByteStreamOnStream depends on that." + fi + enable_mfplat_MFCreateSample=1 +fi + if test "$enable_loader_OSX_Preloader" -eq 1; then if test "$enable_Staging" -gt 1; then abort "Patchset Staging disabled, but loader-OSX_Preloader depends on that." @@ -4383,21 +4390,6 @@ if test "$enable_loader_OSX_Preloader" -eq 1; then ) >> "$patchlist" fi -# Patchset mfplat-MFCreateMFByteStreamOnStream -# | -# | This patchset fixes the following Wine bugs: -# | * [#45372] Add MFCreateMFByteStreamOnStream stu -# | -# | Modified files: -# | * dlls/mfplat/main.c, dlls/mfplat/mfplat.spec, include/mfidl.idl -# | -if test "$enable_mfplat_MFCreateMFByteStreamOnStream" -eq 1; then - patch_apply mfplat-MFCreateMFByteStreamOnStream/0001-mfplat-Add-MFCreateMFByteStreamOnStream-stub.patch - ( - printf '%s\n' '+ { "Alistair Leslie-Hughes", "mfplat: Add MFCreateMFByteStreamOnStream stub.", 1 },'; - ) >> "$patchlist" -fi - # Patchset mfplat-MFCreateSample # | # | This patchset fixes the following Wine bugs: @@ -4417,6 +4409,24 @@ if test "$enable_mfplat_MFCreateSample" -eq 1; then ) >> "$patchlist" fi +# Patchset mfplat-MFCreateMFByteStreamOnStream +# | +# | This patchset has the following (direct or indirect) dependencies: +# | * mfplat-MFCreateSample +# | +# | This patchset fixes the following Wine bugs: +# | * [#45372] Implement MFCreateMFByteStreamOnStream. +# | +# | Modified files: +# | * dlls/mfplat/main.c, dlls/mfplat/mfplat.spec, dlls/mfplat/tests/mfplat.c, include/mfidl.idl +# | +if test "$enable_mfplat_MFCreateMFByteStreamOnStream" -eq 1; then + patch_apply mfplat-MFCreateMFByteStreamOnStream/0001-mfplat-Implement-MFCreateMFByteStreamOnStream.patch + ( + printf '%s\n' '+ { "Alistair Leslie-Hughes", "mfplat: Implement MFCreateMFByteStreamOnStream.", 1 },'; + ) >> "$patchlist" +fi + # Patchset mfplat-MFTRegisterLocal # | # | This patchset fixes the following Wine bugs: