Alistair Leslie-Hughes : mfplat: Implement MFCreateMFByteStreamOnStream.
Alexandre Julliard
julliard at winehq.org
Thu Nov 29 15:09:38 CST 2018
Module: wine
Branch: stable
Commit: 17d2834171f46e4c516622ec4bfaa9202aa6a284
URL: https://source.winehq.org/git/wine.git/?a=commit;h=17d2834171f46e4c516622ec4bfaa9202aa6a284
Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Fri Sep 7 00:58:39 2018 +0000
mfplat: Implement MFCreateMFByteStreamOnStream.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45372
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit 6e8e32bb57fc01840b65200ce0ab90c7177e2e1b)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
dlls/mfplat/main.c | 241 +++++++++++++++++++++++++++++++++++++++++++++
dlls/mfplat/mfplat.spec | 2 +-
dlls/mfplat/tests/mfplat.c | 24 +++++
include/mfidl.idl | 1 +
4 files changed, 267 insertions(+), 1 deletion(-)
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c
index 7c5be65..cf098ad 100644
--- a/dlls/mfplat/main.c
+++ b/dlls/mfplat/main.c
@@ -32,6 +32,7 @@
#include "mfidl.h"
#include "mferror.h"
+#include "wine/heap.h"
#include "wine/debug.h"
#include "wine/unicode.h"
@@ -417,6 +418,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 = heap_alloc( 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 a66f4d1..a9502e5 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 f85b00c..6cdd95d 100644
--- a/dlls/mfplat/tests/mfplat.c
+++ b/dlls/mfplat/tests/mfplat.c
@@ -37,6 +37,7 @@
#include "wine/test.h"
static HRESULT (WINAPI *pMFCreateSourceResolver)(IMFSourceResolver **resolver);
+static HRESULT (WINAPI *pMFCreateMFByteStreamOnStream)(IStream *stream, IMFByteStream **bytestream);
DEFINE_GUID(MF_READWRITE_ENABLE_HARDWARE_TRANSFORMS, 0xa634a91c, 0x822b, 0x41b9, 0xa4, 0x94, 0x4d, 0xe4, 0x64, 0x36, 0x12, 0xb0);
@@ -194,6 +195,7 @@ static void init_functions(void)
#define X(f) if (!(p##f = (void*)GetProcAddress(mod, #f))) return;
X(MFCreateSourceResolver);
+ X(MFCreateMFByteStreamOnStream);
#undef X
}
@@ -247,6 +249,27 @@ static void test_MFCreateAttributes(void)
IMFAttributes_Release(attributes);
}
+static void test_MFCreateMFByteStreamOnStream(void)
+{
+ IMFByteStream *bytestream;
+ IStream *stream;
+ HRESULT hr;
+
+ if(!pMFCreateMFByteStreamOnStream)
+ {
+ win_skip("MFCreateMFByteStreamOnStream() not found\n");
+ return;
+ }
+
+ hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+
+ hr = pMFCreateMFByteStreamOnStream(stream, &bytestream );
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+
+ IStream_Release(stream);
+ IMFByteStream_Release(bytestream);
+}
START_TEST(mfplat)
{
@@ -258,6 +281,7 @@ START_TEST(mfplat)
test_source_resolver();
test_MFCreateMediaType();
test_MFCreateAttributes();
+ 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);")
More information about the wine-cvs
mailing list