[PATCH] mfplat: Forward IMFMediaType to IMFAttributes

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Tue Sep 11 19:19:07 CDT 2018


Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
 dlls/mfplat/main.c | 170 ++++++++++++++---------------------------------------
 1 file changed, 43 insertions(+), 127 deletions(-)

diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c
index 9f381ef..1c10561 100644
--- a/dlls/mfplat/main.c
+++ b/dlls/mfplat/main.c
@@ -1148,6 +1148,12 @@ static const IMFAttributesVtbl mfattributes_vtbl =
     mfattributes_CopyAllItems
 };
 
+static void init_attribute_object(mfattributes *object, UINT32 size)
+{
+    object->ref = 1;
+    object->IMFAttributes_iface.lpVtbl = &mfattributes_vtbl;
+}
+
 /***********************************************************************
  *      MFCreateAttributes (mfplat.@)
  */
@@ -1161,10 +1167,9 @@ HRESULT WINAPI MFCreateAttributes(IMFAttributes **attributes, UINT32 size)
     if(!object)
         return E_OUTOFMEMORY;
 
-    object->ref = 1;
-    object->IMFAttributes_iface.lpVtbl = &mfattributes_vtbl;
-
+    init_attribute_object(object, size);
     *attributes = &object->IMFAttributes_iface;
+
     return S_OK;
 }
 
@@ -1335,8 +1340,8 @@ HRESULT WINAPI MFCreateSourceResolver(IMFSourceResolver **resolver)
 
 typedef struct _mfmediatype
 {
+    mfattributes attributes;
     IMFMediaType IMFMediaType_iface;
-    LONG ref;
 } mfmediatype;
 
 static inline mfmediatype *impl_from_IMFMediaType(IMFMediaType *iface)
@@ -1370,7 +1375,7 @@ static HRESULT WINAPI mediatype_QueryInterface(IMFMediaType *iface, REFIID riid,
 static ULONG WINAPI mediatype_AddRef(IMFMediaType *iface)
 {
     mfmediatype *This = impl_from_IMFMediaType(iface);
-    ULONG ref = InterlockedIncrement(&This->ref);
+    ULONG ref = InterlockedIncrement(&This->attributes.ref);
 
     TRACE("(%p) ref=%u\n", This, ref);
 
@@ -1380,7 +1385,7 @@ static ULONG WINAPI mediatype_AddRef(IMFMediaType *iface)
 static ULONG WINAPI mediatype_Release(IMFMediaType *iface)
 {
     mfmediatype *This = impl_from_IMFMediaType(iface);
-    ULONG ref = InterlockedDecrement(&This->ref);
+    ULONG ref = InterlockedDecrement(&This->attributes.ref);
 
     TRACE("(%p) ref=%u\n", This, ref);
 
@@ -1395,269 +1400,179 @@ static ULONG WINAPI mediatype_Release(IMFMediaType *iface)
 static HRESULT WINAPI mediatype_GetItem(IMFMediaType *iface, REFGUID key, PROPVARIANT *value)
 {
     mfmediatype *This = impl_from_IMFMediaType(iface);
-
-    FIXME("%p, %s, %p\n", This, debugstr_guid(key), value);
-
-    return E_NOTIMPL;
+    return IMFAttributes_GetItem(&This->attributes.IMFAttributes_iface, key, value);
 }
 
 static HRESULT WINAPI mediatype_GetItemType(IMFMediaType *iface, REFGUID key, MF_ATTRIBUTE_TYPE *type)
 {
     mfmediatype *This = impl_from_IMFMediaType(iface);
-
-    FIXME("%p, %s, %p\n", This, debugstr_guid(key), type);
-
-    return E_NOTIMPL;
+    return IMFAttributes_GetItemType(&This->attributes.IMFAttributes_iface, key, type);
 }
 
 static HRESULT WINAPI mediatype_CompareItem(IMFMediaType *iface, REFGUID key, REFPROPVARIANT value, BOOL *result)
 {
     mfmediatype *This = impl_from_IMFMediaType(iface);
-
-    FIXME("%p, %s, %p, %p\n", This, debugstr_guid(key), value, result);
-
-    return E_NOTIMPL;
+    return IMFAttributes_CompareItem(&This->attributes.IMFAttributes_iface, key, value, result);
 }
 
 static HRESULT WINAPI mediatype_Compare(IMFMediaType *iface, IMFAttributes *attrs, MF_ATTRIBUTES_MATCH_TYPE type,
                 BOOL *result)
 {
     mfmediatype *This = impl_from_IMFMediaType(iface);
-
-    FIXME("%p, %p, %d, %p\n", This, attrs, type, result);
-
-    return E_NOTIMPL;
+    return IMFAttributes_Compare(&This->attributes.IMFAttributes_iface, attrs, type, result);
 }
 
 static HRESULT WINAPI mediatype_GetUINT32(IMFMediaType *iface, REFGUID key, UINT32 *value)
 {
     mfmediatype *This = impl_from_IMFMediaType(iface);
-
-    FIXME("%p, %s, %p\n", This, debugstr_guid(key), value);
-
-    return E_NOTIMPL;
+    return IMFAttributes_GetUINT32(&This->attributes.IMFAttributes_iface, key, value);
 }
 
 static HRESULT WINAPI mediatype_GetUINT64(IMFMediaType *iface, REFGUID key, UINT64 *value)
 {
     mfmediatype *This = impl_from_IMFMediaType(iface);
-
-    FIXME("%p, %s, %p\n", This, debugstr_guid(key), value);
-
-    return E_NOTIMPL;
+    return IMFAttributes_GetUINT64(&This->attributes.IMFAttributes_iface, key, value);
 }
 
 static HRESULT WINAPI mediatype_GetDouble(IMFMediaType *iface, REFGUID key, double *value)
 {
     mfmediatype *This = impl_from_IMFMediaType(iface);
-
-    FIXME("%p, %s, %p\n", This, debugstr_guid(key), value);
-
-    return E_NOTIMPL;
+    return IMFAttributes_GetDouble(&This->attributes.IMFAttributes_iface, key, value);
 }
 
 static HRESULT WINAPI mediatype_GetGUID(IMFMediaType *iface, REFGUID key, GUID *value)
 {
     mfmediatype *This = impl_from_IMFMediaType(iface);
-
-    FIXME("%p, %s, %p\n", This, debugstr_guid(key), value);
-
-    return E_NOTIMPL;
+    return IMFAttributes_GetGUID(&This->attributes.IMFAttributes_iface, key, value);
 }
 
 static HRESULT WINAPI mediatype_GetStringLength(IMFMediaType *iface, REFGUID key, UINT32 *length)
 {
     mfmediatype *This = impl_from_IMFMediaType(iface);
-
-    FIXME("%p, %s, %p\n", This, debugstr_guid(key), length);
-
-    return E_NOTIMPL;
+    return IMFAttributes_GetStringLength(&This->attributes.IMFAttributes_iface, key, length);
 }
 
 static HRESULT WINAPI mediatype_GetString(IMFMediaType *iface, REFGUID key, WCHAR *value,
                 UINT32 size, UINT32 *length)
 {
     mfmediatype *This = impl_from_IMFMediaType(iface);
-
-    FIXME("%p, %s, %p, %d, %p\n", This, debugstr_guid(key), value, size, length);
-
-    return E_NOTIMPL;
+    return IMFAttributes_GetString(&This->attributes.IMFAttributes_iface, key, value, size, length);
 }
 
 static HRESULT WINAPI mediatype_GetAllocatedString(IMFMediaType *iface, REFGUID key,
                 WCHAR **value, UINT32 *length)
 {
     mfmediatype *This = impl_from_IMFMediaType(iface);
-
-    FIXME("%p, %s, %p, %p\n", This, debugstr_guid(key), value, length);
-
-    return E_NOTIMPL;
+    return IMFAttributes_GetAllocatedString(&This->attributes.IMFAttributes_iface, key, value, length);
 }
 
 static HRESULT WINAPI mediatype_GetBlobSize(IMFMediaType *iface, REFGUID key, UINT32 *size)
 {
     mfmediatype *This = impl_from_IMFMediaType(iface);
-
-    FIXME("%p, %s, %p\n", This, debugstr_guid(key), size);
-
-    return E_NOTIMPL;
+    return IMFAttributes_GetBlobSize(&This->attributes.IMFAttributes_iface, key, size);
 }
 
 static HRESULT WINAPI mediatype_GetBlob(IMFMediaType *iface, REFGUID key, UINT8 *buf,
                 UINT32 bufsize, UINT32 *blobsize)
 {
     mfmediatype *This = impl_from_IMFMediaType(iface);
-
-    FIXME("%p, %s, %p, %d, %p\n", This, debugstr_guid(key), buf, bufsize, blobsize);
-
-    return E_NOTIMPL;
+    return IMFAttributes_GetBlob(&This->attributes.IMFAttributes_iface, key, buf, bufsize, blobsize);
 }
 
 static HRESULT WINAPI mediatype_GetAllocatedBlob(IMFMediaType *iface, REFGUID key, UINT8 **buf, UINT32 *size)
 {
     mfmediatype *This = impl_from_IMFMediaType(iface);
-
-    FIXME("%p, %s, %p, %p\n", This, debugstr_guid(key), buf, size);
-
-    return E_NOTIMPL;
+    return IMFAttributes_GetAllocatedBlob(&This->attributes.IMFAttributes_iface, key, buf, size);
 }
 
 static HRESULT WINAPI mediatype_GetUnknown(IMFMediaType *iface, REFGUID key, REFIID riid, void **ppv)
 {
     mfmediatype *This = impl_from_IMFMediaType(iface);
-
-    FIXME("%p, %s, %s, %p\n", This, debugstr_guid(key), debugstr_guid(riid), ppv);
-
-    return E_NOTIMPL;
+    return IMFAttributes_GetUnknown(&This->attributes.IMFAttributes_iface, key, riid, ppv);
 }
 
 static HRESULT WINAPI mediatype_SetItem(IMFMediaType *iface, REFGUID key, REFPROPVARIANT value)
 {
     mfmediatype *This = impl_from_IMFMediaType(iface);
-
-    FIXME("%p, %s, %p\n", This, debugstr_guid(key), value);
-
-    return E_NOTIMPL;
+    return IMFAttributes_SetItem(&This->attributes.IMFAttributes_iface, key, value);
 }
 
 static HRESULT WINAPI mediatype_DeleteItem(IMFMediaType *iface, REFGUID key)
 {
     mfmediatype *This = impl_from_IMFMediaType(iface);
-
-    FIXME("%p, %s\n", This, debugstr_guid(key));
-
-    return E_NOTIMPL;
+    return IMFAttributes_DeleteItem(&This->attributes.IMFAttributes_iface, key);
 }
 
 static HRESULT WINAPI mediatype_DeleteAllItems(IMFMediaType *iface)
 {
     mfmediatype *This = impl_from_IMFMediaType(iface);
-
-    FIXME("%p\n", This);
-
-    return E_NOTIMPL;
+    return IMFAttributes_DeleteAllItems(&This->attributes.IMFAttributes_iface);
 }
 
 static HRESULT WINAPI mediatype_SetUINT32(IMFMediaType *iface, REFGUID key, UINT32 value)
 {
     mfmediatype *This = impl_from_IMFMediaType(iface);
-
-    FIXME("%p, %s, %d\n", This, debugstr_guid(key), value);
-
-    return E_NOTIMPL;
+    return IMFAttributes_SetUINT32(&This->attributes.IMFAttributes_iface, key, value);
 }
 
 static HRESULT WINAPI mediatype_SetUINT64(IMFMediaType *iface, REFGUID key, UINT64 value)
 {
     mfmediatype *This = impl_from_IMFMediaType(iface);
-
-    FIXME("%p, %s, %s\n", This, debugstr_guid(key), wine_dbgstr_longlong(value));
-
-    return E_NOTIMPL;
+    return IMFAttributes_SetUINT64(&This->attributes.IMFAttributes_iface, key, value);
 }
 
 static HRESULT WINAPI mediatype_SetDouble(IMFMediaType *iface, REFGUID key, double value)
 {
     mfmediatype *This = impl_from_IMFMediaType(iface);
-
-    FIXME("%p, %s, %f\n", This, debugstr_guid(key), value);
-
-    return E_NOTIMPL;
+    return IMFAttributes_SetDouble(&This->attributes.IMFAttributes_iface, key, value);
 }
 
 static HRESULT WINAPI mediatype_SetGUID(IMFMediaType *iface, REFGUID key, REFGUID value)
 {
     mfmediatype *This = impl_from_IMFMediaType(iface);
-
-    FIXME("%p, %s, %s\n", This, debugstr_guid(key), debugstr_guid(value));
-
-    return E_NOTIMPL;
+    return IMFAttributes_SetGUID(&This->attributes.IMFAttributes_iface, key, value);
 }
 
 static HRESULT WINAPI mediatype_SetString(IMFMediaType *iface, REFGUID key, const WCHAR *value)
 {
     mfmediatype *This = impl_from_IMFMediaType(iface);
-
-    FIXME("%p, %s, %s\n", This, debugstr_guid(key), debugstr_w(value));
-
-    return E_NOTIMPL;
+    return IMFAttributes_SetString(&This->attributes.IMFAttributes_iface, key, value);
 }
 
 static HRESULT WINAPI mediatype_SetBlob(IMFMediaType *iface, REFGUID key, const UINT8 *buf, UINT32 size)
 {
     mfmediatype *This = impl_from_IMFMediaType(iface);
-
-    FIXME("%p, %s, %p, %d\n", This, debugstr_guid(key), buf, size);
-
-    return E_NOTIMPL;
+    return IMFAttributes_SetBlob(&This->attributes.IMFAttributes_iface, key, buf, size);
 }
 
 static HRESULT WINAPI mediatype_SetUnknown(IMFMediaType *iface, REFGUID key, IUnknown *unknown)
 {
     mfmediatype *This = impl_from_IMFMediaType(iface);
-
-    FIXME("%p, %s, %p\n", This, debugstr_guid(key), unknown);
-
-    return E_NOTIMPL;
+    return IMFAttributes_SetUnknown(&This->attributes.IMFAttributes_iface, key, unknown);
 }
 
 static HRESULT WINAPI mediatype_LockStore(IMFMediaType *iface)
 {
     mfmediatype *This = impl_from_IMFMediaType(iface);
-
-    FIXME("%p\n", This);
-
-    return E_NOTIMPL;
+    return IMFAttributes_LockStore(&This->attributes.IMFAttributes_iface);
 }
 
 static HRESULT WINAPI mediatype_UnlockStore(IMFMediaType *iface)
 {
     mfmediatype *This = impl_from_IMFMediaType(iface);
-
-    FIXME("%p\n", This);
-
-    return E_NOTIMPL;
+    return IMFAttributes_UnlockStore(&This->attributes.IMFAttributes_iface);
 }
 
 static HRESULT WINAPI mediatype_GetCount(IMFMediaType *iface, UINT32 *items)
 {
     mfmediatype *This = impl_from_IMFMediaType(iface);
-
-    FIXME("%p, %p\n", This, items);
-
-    if(items)
-        *items = 0;
-
-    return E_NOTIMPL;
+    return IMFAttributes_GetCount(&This->attributes.IMFAttributes_iface, items);
 }
 
 static HRESULT WINAPI mediatype_GetItemByIndex(IMFMediaType *iface, UINT32 index, GUID *key, PROPVARIANT *value)
 {
     mfmediatype *This = impl_from_IMFMediaType(iface);
-
-    FIXME("%p, %d, %p, %p\n", This, index, key, value);
-
-    return E_NOTIMPL;
+    return IMFAttributes_GetItemByIndex(&This->attributes.IMFAttributes_iface, index, key, value);
 }
 
 static HRESULT WINAPI mediatype_CopyAllItems(IMFMediaType *iface, IMFAttributes *dest)
@@ -1768,14 +1683,15 @@ HRESULT WINAPI MFCreateMediaType(IMFMediaType **type)
     if(!type)
         return E_INVALIDARG;
 
-    object = HeapAlloc( GetProcessHeap(), 0, sizeof(*object) );
+    object = heap_alloc( sizeof(*object) );
     if(!object)
         return E_OUTOFMEMORY;
 
-    object->ref = 1;
+    init_attribute_object(&object->attributes, 0);
     object->IMFMediaType_iface.lpVtbl = &mediatype_vtbl;
 
     *type = &object->IMFMediaType_iface;
+
     return S_OK;
 }
 
-- 
1.9.1




More information about the wine-devel mailing list