diff --git a/dlls/mfplat/Makefile.in b/dlls/mfplat/Makefile.in index 17cda8856c3..261c121cab3 100644 --- a/dlls/mfplat/Makefile.in +++ b/dlls/mfplat/Makefile.in @@ -4,4 +4,5 @@ IMPORTS = advapi32 ole32 C_SRCS = \ main.c \ + mediatype.c \ queue.c diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index 0ffcd88a380..7d90c694189 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -28,7 +28,6 @@ #include "winreg.h" #include "initguid.h" -#include "mfapi.h" #include "mfidl.h" #include "mferror.h" @@ -544,12 +543,6 @@ HRESULT WINAPI MFCopyImage(BYTE *dest, LONG deststride, const BYTE *src, LONG sr return S_OK; } -typedef struct _mfattributes -{ - IMFAttributes IMFAttributes_iface; - LONG ref; -} mfattributes; - static inline mfattributes *impl_from_IMFAttributes(IMFAttributes *iface) { return CONTAINING_RECORD(iface, mfattributes, IMFAttributes_iface); @@ -916,7 +909,7 @@ static const IMFAttributesVtbl mfattributes_vtbl = mfattributes_CopyAllItems }; -static void init_attribute_object(mfattributes *object, UINT32 size) +void init_attribute_object(mfattributes *object, UINT32 size) { object->ref = 1; object->IMFAttributes_iface.lpVtbl = &mfattributes_vtbl; @@ -2107,363 +2100,6 @@ HRESULT WINAPI MFCreateSourceResolver(IMFSourceResolver **resolver) return S_OK; } -typedef struct _mfmediatype -{ - mfattributes attributes; - IMFMediaType IMFMediaType_iface; -} mfmediatype; - -static inline mfmediatype *impl_from_IMFMediaType(IMFMediaType *iface) -{ - return CONTAINING_RECORD(iface, mfmediatype, IMFMediaType_iface); -} - -static HRESULT WINAPI mediatype_QueryInterface(IMFMediaType *iface, REFIID riid, void **object) -{ - mfmediatype *This = impl_from_IMFMediaType(iface); - - TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), object); - - if(IsEqualGUID(riid, &IID_IUnknown) || - IsEqualGUID(riid, &IID_IMFAttributes) || - IsEqualGUID(riid, &IID_IMFMediaType)) - { - *object = &This->IMFMediaType_iface; - } - else - { - FIXME("(%s, %p)\n", debugstr_guid(riid), object); - *object = NULL; - return E_NOINTERFACE; - } - - IUnknown_AddRef((IUnknown*)*object); - return S_OK; -} - -static ULONG WINAPI mediatype_AddRef(IMFMediaType *iface) -{ - mfmediatype *This = impl_from_IMFMediaType(iface); - ULONG ref = InterlockedIncrement(&This->attributes.ref); - - TRACE("(%p) ref=%u\n", This, ref); - - return ref; -} - -static ULONG WINAPI mediatype_Release(IMFMediaType *iface) -{ - mfmediatype *This = impl_from_IMFMediaType(iface); - ULONG ref = InterlockedDecrement(&This->attributes.ref); - - TRACE("(%p) ref=%u\n", This, ref); - - if (!ref) - { - HeapFree(GetProcessHeap(), 0, This); - } - - return ref; -} - -static HRESULT WINAPI mediatype_GetItem(IMFMediaType *iface, REFGUID key, PROPVARIANT *value) -{ - mfmediatype *This = impl_from_IMFMediaType(iface); - 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); - 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); - 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); - 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); - 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); - 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); - 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); - 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); - 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); - 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); - 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); - 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); - 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); - 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); - 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); - return IMFAttributes_SetItem(&This->attributes.IMFAttributes_iface, key, value); -} - -static HRESULT WINAPI mediatype_DeleteItem(IMFMediaType *iface, REFGUID key) -{ - mfmediatype *This = impl_from_IMFMediaType(iface); - return IMFAttributes_DeleteItem(&This->attributes.IMFAttributes_iface, key); -} - -static HRESULT WINAPI mediatype_DeleteAllItems(IMFMediaType *iface) -{ - mfmediatype *This = impl_from_IMFMediaType(iface); - return IMFAttributes_DeleteAllItems(&This->attributes.IMFAttributes_iface); -} - -static HRESULT WINAPI mediatype_SetUINT32(IMFMediaType *iface, REFGUID key, UINT32 value) -{ - mfmediatype *This = impl_from_IMFMediaType(iface); - 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); - 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); - 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); - 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); - 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); - 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); - return IMFAttributes_SetUnknown(&This->attributes.IMFAttributes_iface, key, unknown); -} - -static HRESULT WINAPI mediatype_LockStore(IMFMediaType *iface) -{ - mfmediatype *This = impl_from_IMFMediaType(iface); - return IMFAttributes_LockStore(&This->attributes.IMFAttributes_iface); -} - -static HRESULT WINAPI mediatype_UnlockStore(IMFMediaType *iface) -{ - mfmediatype *This = impl_from_IMFMediaType(iface); - return IMFAttributes_UnlockStore(&This->attributes.IMFAttributes_iface); -} - -static HRESULT WINAPI mediatype_GetCount(IMFMediaType *iface, UINT32 *items) -{ - mfmediatype *This = impl_from_IMFMediaType(iface); - 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); - return IMFAttributes_GetItemByIndex(&This->attributes.IMFAttributes_iface, index, key, value); -} - -static HRESULT WINAPI mediatype_CopyAllItems(IMFMediaType *iface, IMFAttributes *dest) -{ - mfmediatype *This = impl_from_IMFMediaType(iface); - - FIXME("%p, %p\n", This, dest); - - return E_NOTIMPL; -} - -static HRESULT WINAPI mediatype_GetMajorType(IMFMediaType *iface, GUID *guid) -{ - mfmediatype *This = impl_from_IMFMediaType(iface); - - FIXME("%p, %p\n", This, guid); - - return E_NOTIMPL; -} - -static HRESULT WINAPI mediatype_IsCompressedFormat(IMFMediaType *iface, BOOL *compressed) -{ - mfmediatype *This = impl_from_IMFMediaType(iface); - - FIXME("%p, %p\n", This, compressed); - - return E_NOTIMPL; -} - -static HRESULT WINAPI mediatype_IsEqual(IMFMediaType *iface, IMFMediaType *type, DWORD *flags) -{ - mfmediatype *This = impl_from_IMFMediaType(iface); - - FIXME("%p, %p, %p\n", This, type, flags); - - return E_NOTIMPL; -} - -static HRESULT WINAPI mediatype_GetRepresentation(IMFMediaType *iface, GUID guid, void **representation) -{ - mfmediatype *This = impl_from_IMFMediaType(iface); - - FIXME("%p, %s, %p\n", This, debugstr_guid(&guid), representation); - - return E_NOTIMPL; -} - -static HRESULT WINAPI mediatype_FreeRepresentation(IMFMediaType *iface, GUID guid, void *representation) -{ - mfmediatype *This = impl_from_IMFMediaType(iface); - - FIXME("%p, %s, %p\n", This, debugstr_guid(&guid), representation); - - return E_NOTIMPL; -} - -static const IMFMediaTypeVtbl mediatype_vtbl = -{ - mediatype_QueryInterface, - mediatype_AddRef, - mediatype_Release, - mediatype_GetItem, - mediatype_GetItemType, - mediatype_CompareItem, - mediatype_Compare, - mediatype_GetUINT32, - mediatype_GetUINT64, - mediatype_GetDouble, - mediatype_GetGUID, - mediatype_GetStringLength, - mediatype_GetString, - mediatype_GetAllocatedString, - mediatype_GetBlobSize, - mediatype_GetBlob, - mediatype_GetAllocatedBlob, - mediatype_GetUnknown, - mediatype_SetItem, - mediatype_DeleteItem, - mediatype_DeleteAllItems, - mediatype_SetUINT32, - mediatype_SetUINT64, - mediatype_SetDouble, - mediatype_SetGUID, - mediatype_SetString, - mediatype_SetBlob, - mediatype_SetUnknown, - mediatype_LockStore, - mediatype_UnlockStore, - mediatype_GetCount, - mediatype_GetItemByIndex, - mediatype_CopyAllItems, - mediatype_GetMajorType, - mediatype_IsCompressedFormat, - mediatype_IsEqual, - mediatype_GetRepresentation, - mediatype_FreeRepresentation -}; - -/*********************************************************************** - * MFCreateMediaType (mfplat.@) - */ -HRESULT WINAPI MFCreateMediaType(IMFMediaType **type) -{ - mfmediatype *object; - - TRACE("%p\n", type); - - if(!type) - return E_INVALIDARG; - - object = heap_alloc( sizeof(*object) ); - if(!object) - return E_OUTOFMEMORY; - - init_attribute_object(&object->attributes, 0); - object->IMFMediaType_iface.lpVtbl = &mediatype_vtbl; - - *type = &object->IMFMediaType_iface; - - return S_OK; -} - typedef struct _mfmediaevent { mfattributes attributes; diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c new file mode 100644 index 00000000000..b3292a61fef --- /dev/null +++ b/dlls/mfplat/mediatype.c @@ -0,0 +1,366 @@ +/* + * Copyright 2017 Alistair Leslie-Hughes + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define COBJMACROS + +#include "mfplat_private.h" + +#include "wine/debug.h" +#include "wine/heap.h" + +WINE_DEFAULT_DEBUG_CHANNEL(mfplat); + +struct media_type +{ + struct attributes attributes; + IMFMediaType IMFMediaType_iface; +}; + +static inline struct media_type *impl_from_IMFMediaType(IMFMediaType *iface) +{ + return CONTAINING_RECORD(iface, struct media_type, IMFMediaType_iface); +} + +static HRESULT WINAPI mediatype_QueryInterface(IMFMediaType *iface, REFIID riid, void **out) +{ + TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), out); + + if (IsEqualIID(riid, &IID_IMFMediaType) || + IsEqualIID(riid, &IID_IMFAttributes) || + IsEqualIID(riid, &IID_IUnknown)) + { + *out = iface; + IMFMediaType_AddRef(iface); + return S_OK; + } + + WARN("Unsupported %s.\n", debugstr_guid(riid)); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI mediatype_AddRef(IMFMediaType *iface) +{ + struct media_type *media_type = impl_from_IMFMediaType(iface); + ULONG refcount = InterlockedIncrement(&media_type->attributes.ref); + + TRACE("%p, refcount %u.\n", iface, refcount); + + return refcount; +} + +static ULONG WINAPI mediatype_Release(IMFMediaType *iface) +{ + struct media_type *media_type = impl_from_IMFMediaType(iface); + ULONG refcount = InterlockedDecrement(&media_type->attributes.ref); + + TRACE("%p, refcount %u.\n", iface, refcount); + + if (!refcount) + { + heap_free(media_type); + } + + return refcount; +} + +static HRESULT WINAPI mediatype_GetItem(IMFMediaType *iface, REFGUID key, PROPVARIANT *value) +{ + struct media_type *media_type = impl_from_IMFMediaType(iface); + return IMFAttributes_GetItem(&media_type->attributes.IMFAttributes_iface, key, value); +} + +static HRESULT WINAPI mediatype_GetItemType(IMFMediaType *iface, REFGUID key, MF_ATTRIBUTE_TYPE *type) +{ + struct media_type *media_type = impl_from_IMFMediaType(iface); + return IMFAttributes_GetItemType(&media_type->attributes.IMFAttributes_iface, key, type); +} + +static HRESULT WINAPI mediatype_CompareItem(IMFMediaType *iface, REFGUID key, REFPROPVARIANT value, BOOL *result) +{ + struct media_type *media_type = impl_from_IMFMediaType(iface); + return IMFAttributes_CompareItem(&media_type->attributes.IMFAttributes_iface, key, value, result); +} + +static HRESULT WINAPI mediatype_Compare(IMFMediaType *iface, IMFAttributes *attrs, MF_ATTRIBUTES_MATCH_TYPE type, + BOOL *result) +{ + struct media_type *media_type = impl_from_IMFMediaType(iface); + return IMFAttributes_Compare(&media_type->attributes.IMFAttributes_iface, attrs, type, result); +} + +static HRESULT WINAPI mediatype_GetUINT32(IMFMediaType *iface, REFGUID key, UINT32 *value) +{ + struct media_type *media_type = impl_from_IMFMediaType(iface); + return IMFAttributes_GetUINT32(&media_type->attributes.IMFAttributes_iface, key, value); +} + +static HRESULT WINAPI mediatype_GetUINT64(IMFMediaType *iface, REFGUID key, UINT64 *value) +{ + struct media_type *media_type = impl_from_IMFMediaType(iface); + return IMFAttributes_GetUINT64(&media_type->attributes.IMFAttributes_iface, key, value); +} + +static HRESULT WINAPI mediatype_GetDouble(IMFMediaType *iface, REFGUID key, double *value) +{ + struct media_type *media_type = impl_from_IMFMediaType(iface); + return IMFAttributes_GetDouble(&media_type->attributes.IMFAttributes_iface, key, value); +} + +static HRESULT WINAPI mediatype_GetGUID(IMFMediaType *iface, REFGUID key, GUID *value) +{ + struct media_type *media_type = impl_from_IMFMediaType(iface); + return IMFAttributes_GetGUID(&media_type->attributes.IMFAttributes_iface, key, value); +} + +static HRESULT WINAPI mediatype_GetStringLength(IMFMediaType *iface, REFGUID key, UINT32 *length) +{ + struct media_type *media_type = impl_from_IMFMediaType(iface); + return IMFAttributes_GetStringLength(&media_type->attributes.IMFAttributes_iface, key, length); +} + +static HRESULT WINAPI mediatype_GetString(IMFMediaType *iface, REFGUID key, WCHAR *value, + UINT32 size, UINT32 *length) +{ + struct media_type *media_type = impl_from_IMFMediaType(iface); + return IMFAttributes_GetString(&media_type->attributes.IMFAttributes_iface, key, value, size, length); +} + +static HRESULT WINAPI mediatype_GetAllocatedString(IMFMediaType *iface, REFGUID key, + WCHAR **value, UINT32 *length) +{ + struct media_type *media_type = impl_from_IMFMediaType(iface); + return IMFAttributes_GetAllocatedString(&media_type->attributes.IMFAttributes_iface, key, value, length); +} + +static HRESULT WINAPI mediatype_GetBlobSize(IMFMediaType *iface, REFGUID key, UINT32 *size) +{ + struct media_type *media_type = impl_from_IMFMediaType(iface); + return IMFAttributes_GetBlobSize(&media_type->attributes.IMFAttributes_iface, key, size); +} + +static HRESULT WINAPI mediatype_GetBlob(IMFMediaType *iface, REFGUID key, UINT8 *buf, + UINT32 bufsize, UINT32 *blobsize) +{ + struct media_type *media_type = impl_from_IMFMediaType(iface); + return IMFAttributes_GetBlob(&media_type->attributes.IMFAttributes_iface, key, buf, bufsize, blobsize); +} + +static HRESULT WINAPI mediatype_GetAllocatedBlob(IMFMediaType *iface, REFGUID key, UINT8 **buf, UINT32 *size) +{ + struct media_type *media_type = impl_from_IMFMediaType(iface); + return IMFAttributes_GetAllocatedBlob(&media_type->attributes.IMFAttributes_iface, key, buf, size); +} + +static HRESULT WINAPI mediatype_GetUnknown(IMFMediaType *iface, REFGUID key, REFIID riid, void **ppv) +{ + struct media_type *media_type = impl_from_IMFMediaType(iface); + return IMFAttributes_GetUnknown(&media_type->attributes.IMFAttributes_iface, key, riid, ppv); +} + +static HRESULT WINAPI mediatype_SetItem(IMFMediaType *iface, REFGUID key, REFPROPVARIANT value) +{ + struct media_type *media_type = impl_from_IMFMediaType(iface); + return IMFAttributes_SetItem(&media_type->attributes.IMFAttributes_iface, key, value); +} + +static HRESULT WINAPI mediatype_DeleteItem(IMFMediaType *iface, REFGUID key) +{ + struct media_type *media_type = impl_from_IMFMediaType(iface); + return IMFAttributes_DeleteItem(&media_type->attributes.IMFAttributes_iface, key); +} + +static HRESULT WINAPI mediatype_DeleteAllItems(IMFMediaType *iface) +{ + struct media_type *media_type = impl_from_IMFMediaType(iface); + return IMFAttributes_DeleteAllItems(&media_type->attributes.IMFAttributes_iface); +} + +static HRESULT WINAPI mediatype_SetUINT32(IMFMediaType *iface, REFGUID key, UINT32 value) +{ + struct media_type *media_type = impl_from_IMFMediaType(iface); + return IMFAttributes_SetUINT32(&media_type->attributes.IMFAttributes_iface, key, value); +} + +static HRESULT WINAPI mediatype_SetUINT64(IMFMediaType *iface, REFGUID key, UINT64 value) +{ + struct media_type *media_type = impl_from_IMFMediaType(iface); + return IMFAttributes_SetUINT64(&media_type->attributes.IMFAttributes_iface, key, value); +} + +static HRESULT WINAPI mediatype_SetDouble(IMFMediaType *iface, REFGUID key, double value) +{ + struct media_type *media_type = impl_from_IMFMediaType(iface); + return IMFAttributes_SetDouble(&media_type->attributes.IMFAttributes_iface, key, value); +} + +static HRESULT WINAPI mediatype_SetGUID(IMFMediaType *iface, REFGUID key, REFGUID value) +{ + struct media_type *media_type = impl_from_IMFMediaType(iface); + return IMFAttributes_SetGUID(&media_type->attributes.IMFAttributes_iface, key, value); +} + +static HRESULT WINAPI mediatype_SetString(IMFMediaType *iface, REFGUID key, const WCHAR *value) +{ + struct media_type *media_type = impl_from_IMFMediaType(iface); + return IMFAttributes_SetString(&media_type->attributes.IMFAttributes_iface, key, value); +} + +static HRESULT WINAPI mediatype_SetBlob(IMFMediaType *iface, REFGUID key, const UINT8 *buf, UINT32 size) +{ + struct media_type *media_type = impl_from_IMFMediaType(iface); + return IMFAttributes_SetBlob(&media_type->attributes.IMFAttributes_iface, key, buf, size); +} + +static HRESULT WINAPI mediatype_SetUnknown(IMFMediaType *iface, REFGUID key, IUnknown *unknown) +{ + struct media_type *media_type = impl_from_IMFMediaType(iface); + return IMFAttributes_SetUnknown(&media_type->attributes.IMFAttributes_iface, key, unknown); +} + +static HRESULT WINAPI mediatype_LockStore(IMFMediaType *iface) +{ + struct media_type *media_type = impl_from_IMFMediaType(iface); + return IMFAttributes_LockStore(&media_type->attributes.IMFAttributes_iface); +} + +static HRESULT WINAPI mediatype_UnlockStore(IMFMediaType *iface) +{ + struct media_type *media_type = impl_from_IMFMediaType(iface); + return IMFAttributes_UnlockStore(&media_type->attributes.IMFAttributes_iface); +} + +static HRESULT WINAPI mediatype_GetCount(IMFMediaType *iface, UINT32 *items) +{ + struct media_type *media_type = impl_from_IMFMediaType(iface); + return IMFAttributes_GetCount(&media_type->attributes.IMFAttributes_iface, items); +} + +static HRESULT WINAPI mediatype_GetItemByIndex(IMFMediaType *iface, UINT32 index, GUID *key, PROPVARIANT *value) +{ + struct media_type *media_type = impl_from_IMFMediaType(iface); + return IMFAttributes_GetItemByIndex(&media_type->attributes.IMFAttributes_iface, index, key, value); +} + +static HRESULT WINAPI mediatype_CopyAllItems(IMFMediaType *iface, IMFAttributes *dest) +{ + FIXME("%p, %p.\n", iface, dest); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mediatype_GetMajorType(IMFMediaType *iface, GUID *guid) +{ + FIXME("%p, %p.\n", iface, guid); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mediatype_IsCompressedFormat(IMFMediaType *iface, BOOL *compressed) +{ + FIXME("%p, %p.\n", iface, compressed); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mediatype_IsEqual(IMFMediaType *iface, IMFMediaType *type, DWORD *flags) +{ + FIXME("%p, %p, %p.\n", iface, type, flags); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mediatype_GetRepresentation(IMFMediaType *iface, GUID guid, void **representation) +{ + FIXME("%p, %s, %p.\n", iface, debugstr_guid(&guid), representation); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mediatype_FreeRepresentation(IMFMediaType *iface, GUID guid, void *representation) +{ + FIXME("%p, %s, %p.\n", iface, debugstr_guid(&guid), representation); + + return E_NOTIMPL; +} + +static const IMFMediaTypeVtbl mediatypevtbl = +{ + mediatype_QueryInterface, + mediatype_AddRef, + mediatype_Release, + mediatype_GetItem, + mediatype_GetItemType, + mediatype_CompareItem, + mediatype_Compare, + mediatype_GetUINT32, + mediatype_GetUINT64, + mediatype_GetDouble, + mediatype_GetGUID, + mediatype_GetStringLength, + mediatype_GetString, + mediatype_GetAllocatedString, + mediatype_GetBlobSize, + mediatype_GetBlob, + mediatype_GetAllocatedBlob, + mediatype_GetUnknown, + mediatype_SetItem, + mediatype_DeleteItem, + mediatype_DeleteAllItems, + mediatype_SetUINT32, + mediatype_SetUINT64, + mediatype_SetDouble, + mediatype_SetGUID, + mediatype_SetString, + mediatype_SetBlob, + mediatype_SetUnknown, + mediatype_LockStore, + mediatype_UnlockStore, + mediatype_GetCount, + mediatype_GetItemByIndex, + mediatype_CopyAllItems, + mediatype_GetMajorType, + mediatype_IsCompressedFormat, + mediatype_IsEqual, + mediatype_GetRepresentation, + mediatype_FreeRepresentation +}; + +/*********************************************************************** + * MFCreateMediaType (mfplat.@) + */ +HRESULT WINAPI MFCreateMediaType(IMFMediaType **media_type) +{ + struct media_type *object; + + TRACE("%p.\n", media_type); + + if (!media_type) + return E_INVALIDARG; + + object = heap_alloc(sizeof(*object)); + if (!object) + return E_OUTOFMEMORY; + + init_attribute_object(&object->attributes, 0); + object->IMFMediaType_iface.lpVtbl = &mediatypevtbl; + + *media_type = &object->IMFMediaType_iface; + + return S_OK; +} diff --git a/dlls/mfplat/mfplat_private.h b/dlls/mfplat/mfplat_private.h index ac35ff2dca4..02bc2d92872 100644 --- a/dlls/mfplat/mfplat_private.h +++ b/dlls/mfplat/mfplat_private.h @@ -16,6 +16,16 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "mfapi.h" + +typedef struct attributes +{ + IMFAttributes IMFAttributes_iface; + LONG ref; +} mfattributes; + +extern void init_attribute_object(mfattributes *object, UINT32 size) DECLSPEC_HIDDEN; + extern void init_system_queues(void) DECLSPEC_HIDDEN; extern void shutdown_system_queues(void) DECLSPEC_HIDDEN; extern BOOL is_platform_locked(void) DECLSPEC_HIDDEN; diff --git a/dlls/mfplat/queue.c b/dlls/mfplat/queue.c index e3b0687711f..0382b02a271 100644 --- a/dlls/mfplat/queue.c +++ b/dlls/mfplat/queue.c @@ -20,7 +20,6 @@ #define COBJMACROS -#include "mfapi.h" #include "mferror.h" #include "wine/debug.h"