[PATCH 1/2] mfplat: Implement MFCreateStreamDescriptor

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Fri Sep 8 06:00:12 CDT 2017


Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
 dlls/mfplat/main.c      | 411 ++++++++++++++++++++++++++++++++++++++++++++++++
 dlls/mfplat/mfplat.spec |   2 +-
 include/mfidl.idl       |   2 +
 3 files changed, 414 insertions(+), 1 deletion(-)

diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c
index 7e12be4b52..47450946dd 100644
--- a/dlls/mfplat/main.c
+++ b/dlls/mfplat/main.c
@@ -1526,3 +1526,414 @@ HRESULT WINAPI MFCreateEventQueue(IMFMediaEventQueue **queue)
 
     return E_FAIL;
 }
+
+typedef struct _mfdescriptor
+{
+    IMFStreamDescriptor IMFStreamDescriptor_iface;
+    LONG ref;
+} mfdescriptor;
+
+static inline mfdescriptor *impl_from_IMFStreamDescriptor(IMFStreamDescriptor *iface)
+{
+    return CONTAINING_RECORD(iface, mfdescriptor, IMFStreamDescriptor_iface);
+}
+
+static HRESULT WINAPI mfdescriptor_QueryInterface(IMFStreamDescriptor *iface, REFIID riid, void **out)
+{
+    mfdescriptor *This = impl_from_IMFStreamDescriptor(iface);
+
+    TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), out);
+
+    if(IsEqualGUID(riid, &IID_IUnknown)      ||
+       IsEqualGUID(riid, &IID_IMFAttributes) ||
+       IsEqualGUID(riid, &IID_IMFStreamDescriptor))
+    {
+        *out = &This->IMFStreamDescriptor_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 mfdescriptor_AddRef(IMFStreamDescriptor *iface)
+{
+    mfdescriptor *This = impl_from_IMFStreamDescriptor(iface);
+    ULONG ref = InterlockedIncrement(&This->ref);
+
+    TRACE("(%p) ref=%u\n", This, ref);
+
+    return ref;
+}
+
+static ULONG WINAPI mfdescriptor_Release(IMFStreamDescriptor *iface)
+{
+    mfdescriptor *This = impl_from_IMFStreamDescriptor(iface);
+    ULONG ref = InterlockedDecrement(&This->ref);
+
+    TRACE("(%p) ref=%u\n", This, ref);
+
+    if (!ref)
+    {
+        HeapFree(GetProcessHeap(), 0, This);
+    }
+
+    return ref;
+}
+
+static HRESULT WINAPI mfdescriptor_GetItem(IMFStreamDescriptor *iface, REFGUID key, PROPVARIANT *value)
+{
+    mfdescriptor *This = impl_from_IMFStreamDescriptor(iface);
+
+    FIXME("%p, %s, %p\n", This, debugstr_guid(key), value);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI mfdescriptor_GetItemType(IMFStreamDescriptor *iface, REFGUID key, MF_ATTRIBUTE_TYPE *type)
+{
+    mfdescriptor *This = impl_from_IMFStreamDescriptor(iface);
+
+    FIXME("%p, %s, %p\n", This, debugstr_guid(key), type);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI mfdescriptor_CompareItem(IMFStreamDescriptor *iface, REFGUID key, REFPROPVARIANT value, BOOL *result)
+{
+    mfdescriptor *This = impl_from_IMFStreamDescriptor(iface);
+
+    FIXME("%p, %s, %p, %p\n", This, debugstr_guid(key), value, result);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI mfdescriptor_Compare(IMFStreamDescriptor *iface, IMFAttributes *theirs, MF_ATTRIBUTES_MATCH_TYPE type,
+                BOOL *result)
+{
+    mfdescriptor *This = impl_from_IMFStreamDescriptor(iface);
+
+    FIXME("%p, %p, %d, %p\n", This, theirs, type, result);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI mfdescriptor_GetUINT32(IMFStreamDescriptor *iface, REFGUID key, UINT32 *value)
+{
+    mfdescriptor *This = impl_from_IMFStreamDescriptor(iface);
+
+    FIXME("%p, %s, %p\n", This, debugstr_guid(key), value);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI mfdescriptor_GetUINT64(IMFStreamDescriptor *iface, REFGUID key, UINT64 *value)
+{
+    mfdescriptor *This = impl_from_IMFStreamDescriptor(iface);
+
+    FIXME("%p, %s, %p\n", This, debugstr_guid(key), value);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI mfdescriptor_GetDouble(IMFStreamDescriptor *iface, REFGUID key, double *value)
+{
+    mfdescriptor *This = impl_from_IMFStreamDescriptor(iface);
+
+    FIXME("%p, %s, %p\n", This, debugstr_guid(key), value);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI mfdescriptor_GetGUID(IMFStreamDescriptor *iface, REFGUID key, GUID *value)
+{
+    mfdescriptor *This = impl_from_IMFStreamDescriptor(iface);
+
+    FIXME("%p, %s, %p\n", This, debugstr_guid(key), value);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI mfdescriptor_GetStringLength(IMFStreamDescriptor *iface, REFGUID key, UINT32 *length)
+{
+    mfdescriptor *This = impl_from_IMFStreamDescriptor(iface);
+
+    FIXME("%p, %s, %p\n", This, debugstr_guid(key), length);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI mfdescriptor_GetString(IMFStreamDescriptor *iface, REFGUID key, WCHAR *value,
+                UINT32 size, UINT32 *length)
+{
+    mfdescriptor *This = impl_from_IMFStreamDescriptor(iface);
+
+    FIXME("%p, %s, %p, %d, %p\n", This, debugstr_guid(key), value, size, length);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI mfdescriptor_GetAllocatedString(IMFStreamDescriptor *iface, REFGUID key,
+                                      WCHAR **value, UINT32 *length)
+{
+    mfdescriptor *This = impl_from_IMFStreamDescriptor(iface);
+
+    FIXME("%p, %s, %p, %p\n", This, debugstr_guid(key), value, length);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI mfdescriptor_GetBlobSize(IMFStreamDescriptor *iface, REFGUID key, UINT32 *size)
+{
+    mfdescriptor *This = impl_from_IMFStreamDescriptor(iface);
+
+    FIXME("%p, %s, %p\n", This, debugstr_guid(key), size);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI mfdescriptor_GetBlob(IMFStreamDescriptor *iface, REFGUID key, UINT8 *buf,
+                UINT32 bufsize, UINT32 *blobsize)
+{
+    mfdescriptor *This = impl_from_IMFStreamDescriptor(iface);
+
+    FIXME("%p, %s, %p, %d, %p\n", This, debugstr_guid(key), buf, bufsize, blobsize);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI mfdescriptor_GetAllocatedBlob(IMFStreamDescriptor *iface, REFGUID key, UINT8 **buf, UINT32 *size)
+{
+    mfdescriptor *This = impl_from_IMFStreamDescriptor(iface);
+
+    FIXME("%p, %s, %p, %p\n", This, debugstr_guid(key), buf, size);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI mfdescriptor_GetUnknown(IMFStreamDescriptor *iface, REFGUID key, REFIID riid, void **ppv)
+{
+    mfdescriptor *This = impl_from_IMFStreamDescriptor(iface);
+
+    FIXME("%p, %s, %s, %p\n", This, debugstr_guid(key), debugstr_guid(riid), ppv);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI mfdescriptor_SetItem(IMFStreamDescriptor *iface, REFGUID key, REFPROPVARIANT Value)
+{
+    mfdescriptor *This = impl_from_IMFStreamDescriptor(iface);
+
+    FIXME("%p, %s, %p\n", This, debugstr_guid(key), Value);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI mfdescriptor_DeleteItem(IMFStreamDescriptor *iface, REFGUID key)
+{
+    mfdescriptor *This = impl_from_IMFStreamDescriptor(iface);
+
+    FIXME("%p, %s\n", This, debugstr_guid(key));
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI mfdescriptor_DeleteAllItems(IMFStreamDescriptor *iface)
+{
+    mfdescriptor *This = impl_from_IMFStreamDescriptor(iface);
+
+    FIXME("%p\n", This);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI mfdescriptor_SetUINT32(IMFStreamDescriptor *iface, REFGUID key, UINT32 value)
+{
+    mfdescriptor *This = impl_from_IMFStreamDescriptor(iface);
+
+    FIXME("%p, %s, %d\n", This, debugstr_guid(key), value);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI mfdescriptor_SetUINT64(IMFStreamDescriptor *iface, REFGUID key, UINT64 value)
+{
+    mfdescriptor *This = impl_from_IMFStreamDescriptor(iface);
+
+    FIXME("%p, %s, %s\n", This, debugstr_guid(key), wine_dbgstr_longlong(value));
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI mfdescriptor_SetDouble(IMFStreamDescriptor *iface, REFGUID key, double value)
+{
+    mfdescriptor *This = impl_from_IMFStreamDescriptor(iface);
+
+    FIXME("%p, %s, %f\n", This, debugstr_guid(key), value);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI mfdescriptor_SetGUID(IMFStreamDescriptor *iface, REFGUID key, REFGUID value)
+{
+    mfdescriptor *This = impl_from_IMFStreamDescriptor(iface);
+
+    FIXME("%p, %s, %s\n", This, debugstr_guid(key), debugstr_guid(value));
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI mfdescriptor_SetString(IMFStreamDescriptor *iface, REFGUID key, const WCHAR *value)
+{
+    mfdescriptor *This = impl_from_IMFStreamDescriptor(iface);
+
+    FIXME("%p, %s, %s\n", This, debugstr_guid(key), debugstr_w(value));
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI mfdescriptor_SetBlob(IMFStreamDescriptor *iface, REFGUID key, const UINT8 *buf, UINT32 size)
+{
+    mfdescriptor *This = impl_from_IMFStreamDescriptor(iface);
+
+    FIXME("%p, %s, %p, %d\n", This, debugstr_guid(key), buf, size);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI mfdescriptor_SetUnknown(IMFStreamDescriptor *iface, REFGUID key, IUnknown *unknown)
+{
+    mfdescriptor *This = impl_from_IMFStreamDescriptor(iface);
+
+    FIXME("%p, %s, %p\n", This, debugstr_guid(key), unknown);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI mfdescriptor_LockStore(IMFStreamDescriptor *iface)
+{
+    mfdescriptor *This = impl_from_IMFStreamDescriptor(iface);
+
+    FIXME("%p\n", This);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI mfdescriptor_UnlockStore(IMFStreamDescriptor *iface)
+{
+    mfdescriptor *This = impl_from_IMFStreamDescriptor(iface);
+
+    FIXME("%p\n", This);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI mfdescriptor_GetCount(IMFStreamDescriptor *iface, UINT32 *items)
+{
+    mfdescriptor *This = impl_from_IMFStreamDescriptor(iface);
+
+    FIXME("%p, %p\n", This, items);
+
+    if(items)
+        *items = 0;
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI mfdescriptor_GetItemByIndex(IMFStreamDescriptor *iface, UINT32 index, GUID *key, PROPVARIANT *value)
+{
+    mfdescriptor *This = impl_from_IMFStreamDescriptor(iface);
+
+    FIXME("%p, %d, %p, %p\n", This, index, key, value);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI mfdescriptor_CopyAllItems(IMFStreamDescriptor *iface, IMFAttributes *dest)
+{
+    mfdescriptor *This = impl_from_IMFStreamDescriptor(iface);
+
+    FIXME("%p, %p\n", This, dest);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI mfdescriptor_GetStreamIdentifier(IMFStreamDescriptor *iface, DWORD *identifier)
+{
+    mfdescriptor *This = impl_from_IMFStreamDescriptor(iface);
+
+    FIXME("%p, %p\n", This, identifier);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI mfdescriptor_GetMediaTypeHandler(IMFStreamDescriptor *iface, IMFMediaTypeHandler **handler)
+{
+    mfdescriptor *This = impl_from_IMFStreamDescriptor(iface);
+
+    FIXME("%p, %p\n", This, handler);
+
+    return E_NOTIMPL;
+}
+
+static const IMFStreamDescriptorVtbl mfdescriptor_vtbl =
+{
+    mfdescriptor_QueryInterface,
+    mfdescriptor_AddRef,
+    mfdescriptor_Release,
+    mfdescriptor_GetItem,
+    mfdescriptor_GetItemType,
+    mfdescriptor_CompareItem,
+    mfdescriptor_Compare,
+    mfdescriptor_GetUINT32,
+    mfdescriptor_GetUINT64,
+    mfdescriptor_GetDouble,
+    mfdescriptor_GetGUID,
+    mfdescriptor_GetStringLength,
+    mfdescriptor_GetString,
+    mfdescriptor_GetAllocatedString,
+    mfdescriptor_GetBlobSize,
+    mfdescriptor_GetBlob,
+    mfdescriptor_GetAllocatedBlob,
+    mfdescriptor_GetUnknown,
+    mfdescriptor_SetItem,
+    mfdescriptor_DeleteItem,
+    mfdescriptor_DeleteAllItems,
+    mfdescriptor_SetUINT32,
+    mfdescriptor_SetUINT64,
+    mfdescriptor_SetDouble,
+    mfdescriptor_SetGUID,
+    mfdescriptor_SetString,
+    mfdescriptor_SetBlob,
+    mfdescriptor_SetUnknown,
+    mfdescriptor_LockStore,
+    mfdescriptor_UnlockStore,
+    mfdescriptor_GetCount,
+    mfdescriptor_GetItemByIndex,
+    mfdescriptor_CopyAllItems,
+    mfdescriptor_GetStreamIdentifier,
+    mfdescriptor_GetMediaTypeHandler
+};
+
+HRESULT WINAPI MFCreateStreamDescriptor(DWORD identifier, DWORD count,
+        IMFMediaType **types, IMFStreamDescriptor **descriptor)
+{
+    mfdescriptor *object;
+
+    TRACE("%d, %d, %p, %p\n", identifier, count, types, descriptor);
+
+    object = HeapAlloc( GetProcessHeap(), 0, sizeof(*object) );
+    if(!object)
+        return E_OUTOFMEMORY;
+
+    object->ref = 1;
+    object->IMFStreamDescriptor_iface.lpVtbl = &mfdescriptor_vtbl;
+
+    *descriptor = &object->IMFStreamDescriptor_iface;
+    return S_OK;
+}
diff --git a/dlls/mfplat/mfplat.spec b/dlls/mfplat/mfplat.spec
index e9c0eecb7c..a66f4d1817 100644
--- a/dlls/mfplat/mfplat.spec
+++ b/dlls/mfplat/mfplat.spec
@@ -59,7 +59,7 @@
 @ stub MFCreateSocket
 @ stub MFCreateSocketListener
 @ stdcall MFCreateSourceResolver(ptr)
-@ stub MFCreateStreamDescriptor
+@ stdcall MFCreateStreamDescriptor(long long ptr ptr)
 @ stub MFCreateSystemTimeSource
 @ stub MFCreateSystemUnderlyingClock
 @ stub MFCreateTempFile
diff --git a/include/mfidl.idl b/include/mfidl.idl
index b0fadbada7..77d4af8a9d 100644
--- a/include/mfidl.idl
+++ b/include/mfidl.idl
@@ -214,4 +214,6 @@ interface IMFStreamDescriptor : IMFAttributes
 
 cpp_quote("HRESULT WINAPI MFCreateMediaSession(IMFAttributes *config, IMFMediaSession **session);")
 cpp_quote("HRESULT WINAPI MFCreateSourceResolver(IMFSourceResolver **resolver);")
+cpp_quote("HRESULT WINAPI MFCreateStreamDescriptor(DWORD identifier, DWORD cMediaTypes,")
+cpp_quote("     IMFMediaType **types, IMFStreamDescriptor **descriptor);")
 cpp_quote("HRESULT WINAPI MFCreateTopology(IMFTopology **topology);")
-- 
2.14.1




More information about the wine-patches mailing list