mfplat: Improve CreatePresentationDescriptor stub in IMFMediaSource.

Signed-off-by: Sven Baars <sven.wine@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Sven Baars 2018-11-25 20:45:05 +01:00 committed by Alexandre Julliard
parent d4ff44427e
commit 7a3f08c7a3
2 changed files with 352 additions and 1 deletions

View File

@ -1315,6 +1315,340 @@ HRESULT WINAPI MFGetPluginControl(IMFPluginControl **ret)
return S_OK;
}
typedef struct _mfpresentationdescriptor
{
mfattributes attributes;
IMFPresentationDescriptor IMFPresentationDescriptor_iface;
} mfpresentationdescriptor;
static inline mfpresentationdescriptor *impl_from_IMFPresentationDescriptor(IMFPresentationDescriptor *iface)
{
return CONTAINING_RECORD(iface, mfpresentationdescriptor, IMFPresentationDescriptor_iface);
}
static HRESULT WINAPI mfpresentationdescriptor_QueryInterface(IMFPresentationDescriptor *iface, REFIID riid, void **out)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), out);
if(IsEqualGUID(riid, &IID_IUnknown) ||
IsEqualGUID(riid, &IID_IMFAttributes) ||
IsEqualGUID(riid, &IID_IMFPresentationDescriptor))
{
*out = &This->IMFPresentationDescriptor_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 mfpresentationdescriptor_AddRef(IMFPresentationDescriptor *iface)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
ULONG ref = InterlockedIncrement(&This->attributes.ref);
TRACE("(%p) ref=%u\n", This, ref);
return ref;
}
static ULONG WINAPI mfpresentationdescriptor_Release(IMFPresentationDescriptor *iface)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(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 mfpresentationdescriptor_GetItem(IMFPresentationDescriptor *iface, REFGUID key, PROPVARIANT *value)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
return IMFAttributes_GetItem(&This->attributes.IMFAttributes_iface, key, value);
}
static HRESULT WINAPI mfpresentationdescriptor_GetItemType(IMFPresentationDescriptor *iface, REFGUID key, MF_ATTRIBUTE_TYPE *type)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
return IMFAttributes_GetItemType(&This->attributes.IMFAttributes_iface, key, type);
}
static HRESULT WINAPI mfpresentationdescriptor_CompareItem(IMFPresentationDescriptor *iface, REFGUID key, REFPROPVARIANT value, BOOL *result)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
return IMFAttributes_CompareItem(&This->attributes.IMFAttributes_iface, key, value, result);
}
static HRESULT WINAPI mfpresentationdescriptor_Compare(IMFPresentationDescriptor *iface, IMFAttributes *attrs, MF_ATTRIBUTES_MATCH_TYPE type,
BOOL *result)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
return IMFAttributes_Compare(&This->attributes.IMFAttributes_iface, attrs, type, result);
}
static HRESULT WINAPI mfpresentationdescriptor_GetUINT32(IMFPresentationDescriptor *iface, REFGUID key, UINT32 *value)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
return IMFAttributes_GetUINT32(&This->attributes.IMFAttributes_iface, key, value);
}
static HRESULT WINAPI mfpresentationdescriptor_GetUINT64(IMFPresentationDescriptor *iface, REFGUID key, UINT64 *value)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
return IMFAttributes_GetUINT64(&This->attributes.IMFAttributes_iface, key, value);
}
static HRESULT WINAPI mfpresentationdescriptor_GetDouble(IMFPresentationDescriptor *iface, REFGUID key, double *value)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
return IMFAttributes_GetDouble(&This->attributes.IMFAttributes_iface, key, value);
}
static HRESULT WINAPI mfpresentationdescriptor_GetGUID(IMFPresentationDescriptor *iface, REFGUID key, GUID *value)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
return IMFAttributes_GetGUID(&This->attributes.IMFAttributes_iface, key, value);
}
static HRESULT WINAPI mfpresentationdescriptor_GetStringLength(IMFPresentationDescriptor *iface, REFGUID key, UINT32 *length)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
return IMFAttributes_GetStringLength(&This->attributes.IMFAttributes_iface, key, length);
}
static HRESULT WINAPI mfpresentationdescriptor_GetString(IMFPresentationDescriptor *iface, REFGUID key, WCHAR *value,
UINT32 size, UINT32 *length)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
return IMFAttributes_GetString(&This->attributes.IMFAttributes_iface, key, value, size, length);
}
static HRESULT WINAPI mfpresentationdescriptor_GetAllocatedString(IMFPresentationDescriptor *iface, REFGUID key,
WCHAR **value, UINT32 *length)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
return IMFAttributes_GetAllocatedString(&This->attributes.IMFAttributes_iface, key, value, length);
}
static HRESULT WINAPI mfpresentationdescriptor_GetBlobSize(IMFPresentationDescriptor *iface, REFGUID key, UINT32 *size)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
return IMFAttributes_GetBlobSize(&This->attributes.IMFAttributes_iface, key, size);
}
static HRESULT WINAPI mfpresentationdescriptor_GetBlob(IMFPresentationDescriptor *iface, REFGUID key, UINT8 *buf,
UINT32 bufsize, UINT32 *blobsize)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
return IMFAttributes_GetBlob(&This->attributes.IMFAttributes_iface, key, buf, bufsize, blobsize);
}
static HRESULT WINAPI mfpresentationdescriptor_GetAllocatedBlob(IMFPresentationDescriptor *iface, REFGUID key, UINT8 **buf, UINT32 *size)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
return IMFAttributes_GetAllocatedBlob(&This->attributes.IMFAttributes_iface, key, buf, size);
}
static HRESULT WINAPI mfpresentationdescriptor_GetUnknown(IMFPresentationDescriptor *iface, REFGUID key, REFIID riid, void **ppv)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
return IMFAttributes_GetUnknown(&This->attributes.IMFAttributes_iface, key, riid, ppv);
}
static HRESULT WINAPI mfpresentationdescriptor_SetItem(IMFPresentationDescriptor *iface, REFGUID key, REFPROPVARIANT value)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
return IMFAttributes_SetItem(&This->attributes.IMFAttributes_iface, key, value);
}
static HRESULT WINAPI mfpresentationdescriptor_DeleteItem(IMFPresentationDescriptor *iface, REFGUID key)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
return IMFAttributes_DeleteItem(&This->attributes.IMFAttributes_iface, key);
}
static HRESULT WINAPI mfpresentationdescriptor_DeleteAllItems(IMFPresentationDescriptor *iface)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
return IMFAttributes_DeleteAllItems(&This->attributes.IMFAttributes_iface);
}
static HRESULT WINAPI mfpresentationdescriptor_SetUINT32(IMFPresentationDescriptor *iface, REFGUID key, UINT32 value)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
return IMFAttributes_SetUINT32(&This->attributes.IMFAttributes_iface, key, value);
}
static HRESULT WINAPI mfpresentationdescriptor_SetUINT64(IMFPresentationDescriptor *iface, REFGUID key, UINT64 value)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
return IMFAttributes_SetUINT64(&This->attributes.IMFAttributes_iface, key, value);
}
static HRESULT WINAPI mfpresentationdescriptor_SetDouble(IMFPresentationDescriptor *iface, REFGUID key, double value)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
return IMFAttributes_SetDouble(&This->attributes.IMFAttributes_iface, key, value);
}
static HRESULT WINAPI mfpresentationdescriptor_SetGUID(IMFPresentationDescriptor *iface, REFGUID key, REFGUID value)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
return IMFAttributes_SetGUID(&This->attributes.IMFAttributes_iface, key, value);
}
static HRESULT WINAPI mfpresentationdescriptor_SetString(IMFPresentationDescriptor *iface, REFGUID key, const WCHAR *value)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
return IMFAttributes_SetString(&This->attributes.IMFAttributes_iface, key, value);
}
static HRESULT WINAPI mfpresentationdescriptor_SetBlob(IMFPresentationDescriptor *iface, REFGUID key, const UINT8 *buf, UINT32 size)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
return IMFAttributes_SetBlob(&This->attributes.IMFAttributes_iface, key, buf, size);
}
static HRESULT WINAPI mfpresentationdescriptor_SetUnknown(IMFPresentationDescriptor *iface, REFGUID key, IUnknown *unknown)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
return IMFAttributes_SetUnknown(&This->attributes.IMFAttributes_iface, key, unknown);
}
static HRESULT WINAPI mfpresentationdescriptor_LockStore(IMFPresentationDescriptor *iface)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
return IMFAttributes_LockStore(&This->attributes.IMFAttributes_iface);
}
static HRESULT WINAPI mfpresentationdescriptor_UnlockStore(IMFPresentationDescriptor *iface)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
return IMFAttributes_UnlockStore(&This->attributes.IMFAttributes_iface);
}
static HRESULT WINAPI mfpresentationdescriptor_GetCount(IMFPresentationDescriptor *iface, UINT32 *items)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
return IMFAttributes_GetCount(&This->attributes.IMFAttributes_iface, items);
}
static HRESULT WINAPI mfpresentationdescriptor_GetItemByIndex(IMFPresentationDescriptor *iface, UINT32 index, GUID *key, PROPVARIANT *value)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
return IMFAttributes_GetItemByIndex(&This->attributes.IMFAttributes_iface, index, key, value);
}
static HRESULT WINAPI mfpresentationdescriptor_CopyAllItems(IMFPresentationDescriptor *iface, IMFAttributes *dest)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
FIXME("%p, %p\n", This, dest);
return E_NOTIMPL;
}
static HRESULT WINAPI mfpresentationdescriptor_GetStreamDescriptorCount(IMFPresentationDescriptor *iface, DWORD *descriptor_count)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
FIXME("%p, %p\n", This, descriptor_count);
return E_NOTIMPL;
}
static HRESULT WINAPI mfpresentationdescriptor_GetStreamDescriptorByIndex(IMFPresentationDescriptor *iface, DWORD index,
BOOL *selected, IMFStreamDescriptor **descriptor)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
FIXME("%p, %#x, %p, %p\n", This, index, selected, descriptor);
return E_NOTIMPL;
}
static HRESULT WINAPI mfpresentationdescriptor_SelectStream(IMFPresentationDescriptor *iface, DWORD index)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
FIXME("%p, %#x\n", This, index);
return E_NOTIMPL;
}
static HRESULT WINAPI mfpresentationdescriptor_DeselectStream(IMFPresentationDescriptor *iface, DWORD index)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
FIXME("%p, %#x\n", This, index);
return E_NOTIMPL;
}
static HRESULT WINAPI mfpresentationdescriptor_Clone(IMFPresentationDescriptor *iface, IMFPresentationDescriptor **descriptor)
{
mfpresentationdescriptor *This = impl_from_IMFPresentationDescriptor(iface);
FIXME("%p, %p\n", This, descriptor);
return E_NOTIMPL;
}
static const IMFPresentationDescriptorVtbl mfpresentationdescriptor_vtbl =
{
mfpresentationdescriptor_QueryInterface,
mfpresentationdescriptor_AddRef,
mfpresentationdescriptor_Release,
mfpresentationdescriptor_GetItem,
mfpresentationdescriptor_GetItemType,
mfpresentationdescriptor_CompareItem,
mfpresentationdescriptor_Compare,
mfpresentationdescriptor_GetUINT32,
mfpresentationdescriptor_GetUINT64,
mfpresentationdescriptor_GetDouble,
mfpresentationdescriptor_GetGUID,
mfpresentationdescriptor_GetStringLength,
mfpresentationdescriptor_GetString,
mfpresentationdescriptor_GetAllocatedString,
mfpresentationdescriptor_GetBlobSize,
mfpresentationdescriptor_GetBlob,
mfpresentationdescriptor_GetAllocatedBlob,
mfpresentationdescriptor_GetUnknown,
mfpresentationdescriptor_SetItem,
mfpresentationdescriptor_DeleteItem,
mfpresentationdescriptor_DeleteAllItems,
mfpresentationdescriptor_SetUINT32,
mfpresentationdescriptor_SetUINT64,
mfpresentationdescriptor_SetDouble,
mfpresentationdescriptor_SetGUID,
mfpresentationdescriptor_SetString,
mfpresentationdescriptor_SetBlob,
mfpresentationdescriptor_SetUnknown,
mfpresentationdescriptor_LockStore,
mfpresentationdescriptor_UnlockStore,
mfpresentationdescriptor_GetCount,
mfpresentationdescriptor_GetItemByIndex,
mfpresentationdescriptor_CopyAllItems,
mfpresentationdescriptor_GetStreamDescriptorCount,
mfpresentationdescriptor_GetStreamDescriptorByIndex,
mfpresentationdescriptor_SelectStream,
mfpresentationdescriptor_DeselectStream,
mfpresentationdescriptor_Clone,
};
typedef struct _mfsource
{
IMFMediaSource IMFMediaSource_iface;
@ -1424,9 +1758,19 @@ static HRESULT WINAPI mfsource_CreatePresentationDescriptor(IMFMediaSource *ifac
{
mfsource *This = impl_from_IMFMediaSource(iface);
mfpresentationdescriptor *object;
FIXME("(%p)->(%p): stub\n", This, descriptor);
return E_NOTIMPL;
object = HeapAlloc( GetProcessHeap(), 0, sizeof(*object) );
if (!object)
return E_OUTOFMEMORY;
init_attribute_object(&object->attributes, 0);
object->IMFPresentationDescriptor_iface.lpVtbl = &mfpresentationdescriptor_vtbl;
*descriptor = &object->IMFPresentationDescriptor_iface;
return S_OK;
}
static HRESULT WINAPI mfsource_Start(IMFMediaSource *iface, IMFPresentationDescriptor *descriptor,

View File

@ -205,6 +205,7 @@ static void test_source_resolver(void)
IMFByteStream *bytestream;
IMFAttributes *attributes;
IMFMediaSource *mediasource;
IMFPresentationDescriptor *descriptor;
MF_OBJECT_TYPE obj_type;
HRESULT hr;
WCHAR *filename;
@ -286,6 +287,12 @@ static void test_source_resolver(void)
ok(mediasource != NULL, "got %p\n", mediasource);
ok(obj_type == MF_OBJECT_MEDIASOURCE, "got %d\n", obj_type);
hr = IMFMediaSource_CreatePresentationDescriptor(
mediasource, &descriptor);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(descriptor != NULL, "got %p\n", descriptor);
IMFPresentationDescriptor_Release(descriptor);
IMFMediaSource_Release(mediasource);
IMFByteStream_Release(bytestream);