forked from Mirrors/wine-wine
mf: Add a stub for sample grabber activation object.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>stable
parent
f73fefd24c
commit
3170638758
|
@ -4,6 +4,7 @@ IMPORTS = mfplat mfuuid
|
|||
|
||||
C_SRCS = \
|
||||
main.c \
|
||||
samplegrabber.c \
|
||||
session.c \
|
||||
topology.c
|
||||
|
||||
|
|
436
dlls/mf/main.c
436
dlls/mf/main.c
|
@ -35,6 +35,8 @@
|
|||
#include "mfapi.h"
|
||||
#include "mferror.h"
|
||||
|
||||
#include "mf_private.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
#include "wine/heap.h"
|
||||
#include "wine/unicode.h"
|
||||
|
@ -44,6 +46,440 @@ WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
|
|||
|
||||
static HINSTANCE mf_instance;
|
||||
|
||||
struct activate_object
|
||||
{
|
||||
IMFActivate IMFActivate_iface;
|
||||
LONG refcount;
|
||||
IMFAttributes *attributes;
|
||||
IUnknown *object;
|
||||
const struct activate_funcs *funcs;
|
||||
void *context;
|
||||
};
|
||||
|
||||
static struct activate_object *impl_from_IMFActivate(IMFActivate *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, struct activate_object, IMFActivate_iface);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI activate_object_QueryInterface(IMFActivate *iface, REFIID riid, void **obj)
|
||||
{
|
||||
TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), obj);
|
||||
|
||||
if (IsEqualIID(riid, &IID_IMFActivate) ||
|
||||
IsEqualIID(riid, &IID_IMFAttributes) ||
|
||||
IsEqualIID(riid, &IID_IUnknown))
|
||||
{
|
||||
*obj = iface;
|
||||
IMFActivate_AddRef(iface);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
WARN("Unsupported %s.\n", debugstr_guid(riid));
|
||||
*obj = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI activate_object_AddRef(IMFActivate *iface)
|
||||
{
|
||||
struct activate_object *activate = impl_from_IMFActivate(iface);
|
||||
ULONG refcount = InterlockedIncrement(&activate->refcount);
|
||||
|
||||
TRACE("%p, refcount %u.\n", iface, refcount);
|
||||
|
||||
return refcount;
|
||||
}
|
||||
|
||||
static ULONG WINAPI activate_object_Release(IMFActivate *iface)
|
||||
{
|
||||
struct activate_object *activate = impl_from_IMFActivate(iface);
|
||||
ULONG refcount = InterlockedDecrement(&activate->refcount);
|
||||
|
||||
TRACE("%p, refcount %u.\n", iface, refcount);
|
||||
|
||||
if (!refcount)
|
||||
{
|
||||
activate->funcs->free_private(activate->context);
|
||||
if (activate->object)
|
||||
IUnknown_Release(activate->object);
|
||||
IMFAttributes_Release(activate->attributes);
|
||||
heap_free(activate);
|
||||
}
|
||||
|
||||
return refcount;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI activate_object_GetItem(IMFActivate *iface, REFGUID key, PROPVARIANT *value)
|
||||
{
|
||||
struct activate_object *activate = impl_from_IMFActivate(iface);
|
||||
|
||||
TRACE("%p, %s, %p.\n", iface, debugstr_guid(key), value);
|
||||
|
||||
return IMFAttributes_GetItem(activate->attributes, key, value);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI activate_object_GetItemType(IMFActivate *iface, REFGUID key, MF_ATTRIBUTE_TYPE *type)
|
||||
{
|
||||
struct activate_object *activate = impl_from_IMFActivate(iface);
|
||||
|
||||
TRACE("%p, %s, %p.\n", iface, debugstr_guid(key), type);
|
||||
|
||||
return IMFAttributes_GetItemType(activate->attributes, key, type);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI activate_object_CompareItem(IMFActivate *iface, REFGUID key, REFPROPVARIANT value, BOOL *result)
|
||||
{
|
||||
struct activate_object *activate = impl_from_IMFActivate(iface);
|
||||
|
||||
TRACE("%p, %s, %p, %p.\n", iface, debugstr_guid(key), value, result);
|
||||
|
||||
return IMFAttributes_CompareItem(activate->attributes, key, value, result);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI activate_object_Compare(IMFActivate *iface, IMFAttributes *theirs, MF_ATTRIBUTES_MATCH_TYPE type,
|
||||
BOOL *result)
|
||||
{
|
||||
struct activate_object *activate = impl_from_IMFActivate(iface);
|
||||
|
||||
TRACE("%p, %p, %d, %p.\n", iface, theirs, type, result);
|
||||
|
||||
return IMFAttributes_Compare(activate->attributes, theirs, type, result);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI activate_object_GetUINT32(IMFActivate *iface, REFGUID key, UINT32 *value)
|
||||
{
|
||||
struct activate_object *activate = impl_from_IMFActivate(iface);
|
||||
|
||||
TRACE("%p, %s, %p.\n", iface, debugstr_guid(key), value);
|
||||
|
||||
return IMFAttributes_GetUINT32(activate->attributes, key, value);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI activate_object_GetUINT64(IMFActivate *iface, REFGUID key, UINT64 *value)
|
||||
{
|
||||
struct activate_object *activate = impl_from_IMFActivate(iface);
|
||||
|
||||
TRACE("%p, %s, %p.\n", iface, debugstr_guid(key), value);
|
||||
|
||||
return IMFAttributes_GetUINT64(activate->attributes, key, value);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI activate_object_GetDouble(IMFActivate *iface, REFGUID key, double *value)
|
||||
{
|
||||
struct activate_object *activate = impl_from_IMFActivate(iface);
|
||||
|
||||
TRACE("%p, %s, %p.\n", iface, debugstr_guid(key), value);
|
||||
|
||||
return IMFAttributes_GetDouble(activate->attributes, key, value);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI activate_object_GetGUID(IMFActivate *iface, REFGUID key, GUID *value)
|
||||
{
|
||||
struct activate_object *activate = impl_from_IMFActivate(iface);
|
||||
|
||||
TRACE("%p, %s, %p.\n", iface, debugstr_guid(key), value);
|
||||
|
||||
return IMFAttributes_GetGUID(activate->attributes, key, value);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI activate_object_GetStringLength(IMFActivate *iface, REFGUID key, UINT32 *length)
|
||||
{
|
||||
struct activate_object *activate = impl_from_IMFActivate(iface);
|
||||
|
||||
TRACE("%p, %s, %p.\n", iface, debugstr_guid(key), length);
|
||||
|
||||
return IMFAttributes_GetStringLength(activate->attributes, key, length);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI activate_object_GetString(IMFActivate *iface, REFGUID key, WCHAR *value,
|
||||
UINT32 size, UINT32 *length)
|
||||
{
|
||||
struct activate_object *activate = impl_from_IMFActivate(iface);
|
||||
|
||||
TRACE("%p, %s, %p, %d, %p.\n", iface, debugstr_guid(key), value, size, length);
|
||||
|
||||
return IMFAttributes_GetString(activate->attributes, key, value, size, length);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI activate_object_GetAllocatedString(IMFActivate *iface, REFGUID key,
|
||||
WCHAR **value, UINT32 *length)
|
||||
{
|
||||
struct activate_object *activate = impl_from_IMFActivate(iface);
|
||||
|
||||
TRACE("%p, %s, %p, %p.\n", iface, debugstr_guid(key), value, length);
|
||||
|
||||
return IMFAttributes_GetAllocatedString(activate->attributes, key, value, length);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI activate_object_GetBlobSize(IMFActivate *iface, REFGUID key, UINT32 *size)
|
||||
{
|
||||
struct activate_object *activate = impl_from_IMFActivate(iface);
|
||||
|
||||
TRACE("%p, %s, %p.\n", iface, debugstr_guid(key), size);
|
||||
|
||||
return IMFAttributes_GetBlobSize(activate->attributes, key, size);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI activate_object_GetBlob(IMFActivate *iface, REFGUID key, UINT8 *buf,
|
||||
UINT32 bufsize, UINT32 *blobsize)
|
||||
{
|
||||
struct activate_object *activate = impl_from_IMFActivate(iface);
|
||||
|
||||
TRACE("%p, %s, %p, %d, %p.\n", iface, debugstr_guid(key), buf, bufsize, blobsize);
|
||||
|
||||
return IMFAttributes_GetBlob(activate->attributes, key, buf, bufsize, blobsize);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI activate_object_GetAllocatedBlob(IMFActivate *iface, REFGUID key, UINT8 **buf, UINT32 *size)
|
||||
{
|
||||
struct activate_object *activate = impl_from_IMFActivate(iface);
|
||||
|
||||
TRACE("%p, %s, %p, %p.\n", iface, debugstr_guid(key), buf, size);
|
||||
|
||||
return IMFAttributes_GetAllocatedBlob(activate->attributes, key, buf, size);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI activate_object_GetUnknown(IMFActivate *iface, REFGUID key, REFIID riid, void **ppv)
|
||||
{
|
||||
struct activate_object *activate = impl_from_IMFActivate(iface);
|
||||
|
||||
TRACE("%p, %s, %s, %p.\n", iface, debugstr_guid(key), debugstr_guid(riid), ppv);
|
||||
|
||||
return IMFAttributes_GetUnknown(activate->attributes, key, riid, ppv);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI activate_object_SetItem(IMFActivate *iface, REFGUID key, REFPROPVARIANT value)
|
||||
{
|
||||
struct activate_object *activate = impl_from_IMFActivate(iface);
|
||||
|
||||
TRACE("%p, %s, %p.\n", iface, debugstr_guid(key), value);
|
||||
|
||||
return IMFAttributes_SetItem(activate->attributes, key, value);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI activate_object_DeleteItem(IMFActivate *iface, REFGUID key)
|
||||
{
|
||||
struct activate_object *activate = impl_from_IMFActivate(iface);
|
||||
|
||||
TRACE("%p, %s.\n", iface, debugstr_guid(key));
|
||||
|
||||
return IMFAttributes_DeleteItem(activate->attributes, key);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI activate_object_DeleteAllItems(IMFActivate *iface)
|
||||
{
|
||||
struct activate_object *activate = impl_from_IMFActivate(iface);
|
||||
|
||||
TRACE("%p.\n", iface);
|
||||
|
||||
return IMFAttributes_DeleteAllItems(activate->attributes);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI activate_object_SetUINT32(IMFActivate *iface, REFGUID key, UINT32 value)
|
||||
{
|
||||
struct activate_object *activate = impl_from_IMFActivate(iface);
|
||||
|
||||
TRACE("%p, %s, %d.\n", iface, debugstr_guid(key), value);
|
||||
|
||||
return IMFAttributes_SetUINT32(activate->attributes, key, value);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI activate_object_SetUINT64(IMFActivate *iface, REFGUID key, UINT64 value)
|
||||
{
|
||||
struct activate_object *activate = impl_from_IMFActivate(iface);
|
||||
|
||||
TRACE("%p, %s, %s.\n", iface, debugstr_guid(key), wine_dbgstr_longlong(value));
|
||||
|
||||
return IMFAttributes_SetUINT64(activate->attributes, key, value);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI activate_object_SetDouble(IMFActivate *iface, REFGUID key, double value)
|
||||
{
|
||||
struct activate_object *activate = impl_from_IMFActivate(iface);
|
||||
|
||||
TRACE("%p, %s, %f.\n", iface, debugstr_guid(key), value);
|
||||
|
||||
return IMFAttributes_SetDouble(activate->attributes, key, value);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI activate_object_SetGUID(IMFActivate *iface, REFGUID key, REFGUID value)
|
||||
{
|
||||
struct activate_object *activate = impl_from_IMFActivate(iface);
|
||||
|
||||
TRACE("%p, %s, %s.\n", iface, debugstr_guid(key), debugstr_guid(value));
|
||||
|
||||
return IMFAttributes_SetGUID(activate->attributes, key, value);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI activate_object_SetString(IMFActivate *iface, REFGUID key, const WCHAR *value)
|
||||
{
|
||||
struct activate_object *activate = impl_from_IMFActivate(iface);
|
||||
|
||||
TRACE("%p, %s, %s.\n", iface, debugstr_guid(key), debugstr_w(value));
|
||||
|
||||
return IMFAttributes_SetString(activate->attributes, key, value);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI activate_object_SetBlob(IMFActivate *iface, REFGUID key, const UINT8 *buf, UINT32 size)
|
||||
{
|
||||
struct activate_object *activate = impl_from_IMFActivate(iface);
|
||||
|
||||
TRACE("%p, %s, %p, %d.\n", iface, debugstr_guid(key), buf, size);
|
||||
|
||||
return IMFAttributes_SetBlob(activate->attributes, key, buf, size);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI activate_object_SetUnknown(IMFActivate *iface, REFGUID key, IUnknown *unknown)
|
||||
{
|
||||
struct activate_object *activate = impl_from_IMFActivate(iface);
|
||||
|
||||
TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(key), unknown);
|
||||
|
||||
return IMFAttributes_SetUnknown(activate->attributes, key, unknown);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI activate_object_LockStore(IMFActivate *iface)
|
||||
{
|
||||
struct activate_object *activate = impl_from_IMFActivate(iface);
|
||||
|
||||
TRACE("%p.\n", iface);
|
||||
|
||||
return IMFAttributes_LockStore(activate->attributes);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI activate_object_UnlockStore(IMFActivate *iface)
|
||||
{
|
||||
struct activate_object *activate = impl_from_IMFActivate(iface);
|
||||
|
||||
TRACE("%p.\n", iface);
|
||||
|
||||
return IMFAttributes_UnlockStore(activate->attributes);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI activate_object_GetCount(IMFActivate *iface, UINT32 *count)
|
||||
{
|
||||
struct activate_object *activate = impl_from_IMFActivate(iface);
|
||||
|
||||
TRACE("%p, %p.\n", iface, count);
|
||||
|
||||
return IMFAttributes_GetCount(activate->attributes, count);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI activate_object_GetItemByIndex(IMFActivate *iface, UINT32 index, GUID *key, PROPVARIANT *value)
|
||||
{
|
||||
struct activate_object *activate = impl_from_IMFActivate(iface);
|
||||
|
||||
TRACE("%p, %u, %p, %p.\n", iface, index, key, value);
|
||||
|
||||
return IMFAttributes_GetItemByIndex(activate->attributes, index, key, value);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI activate_object_CopyAllItems(IMFActivate *iface, IMFAttributes *dest)
|
||||
{
|
||||
struct activate_object *activate = impl_from_IMFActivate(iface);
|
||||
|
||||
TRACE("%p, %p.\n", iface, dest);
|
||||
|
||||
return IMFAttributes_CopyAllItems(activate->attributes, dest);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI activate_object_ActivateObject(IMFActivate *iface, REFIID riid, void **obj)
|
||||
{
|
||||
struct activate_object *activate = impl_from_IMFActivate(iface);
|
||||
IUnknown *object;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), obj);
|
||||
|
||||
if (!activate->object)
|
||||
{
|
||||
if (FAILED(hr = activate->funcs->create_object(activate->context, &object)))
|
||||
return hr;
|
||||
|
||||
if (!InterlockedCompareExchangePointer((void **)&activate->object, object, NULL))
|
||||
IUnknown_Release(object);
|
||||
}
|
||||
|
||||
return IUnknown_QueryInterface(activate->object, riid, obj);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI activate_object_ShutdownObject(IMFActivate *iface)
|
||||
{
|
||||
FIXME("%p.\n", iface);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI activate_object_DetachObject(IMFActivate *iface)
|
||||
{
|
||||
FIXME("%p.\n", iface);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static const IMFActivateVtbl activate_object_vtbl =
|
||||
{
|
||||
activate_object_QueryInterface,
|
||||
activate_object_AddRef,
|
||||
activate_object_Release,
|
||||
activate_object_GetItem,
|
||||
activate_object_GetItemType,
|
||||
activate_object_CompareItem,
|
||||
activate_object_Compare,
|
||||
activate_object_GetUINT32,
|
||||
activate_object_GetUINT64,
|
||||
activate_object_GetDouble,
|
||||
activate_object_GetGUID,
|
||||
activate_object_GetStringLength,
|
||||
activate_object_GetString,
|
||||
activate_object_GetAllocatedString,
|
||||
activate_object_GetBlobSize,
|
||||
activate_object_GetBlob,
|
||||
activate_object_GetAllocatedBlob,
|
||||
activate_object_GetUnknown,
|
||||
activate_object_SetItem,
|
||||
activate_object_DeleteItem,
|
||||
activate_object_DeleteAllItems,
|
||||
activate_object_SetUINT32,
|
||||
activate_object_SetUINT64,
|
||||
activate_object_SetDouble,
|
||||
activate_object_SetGUID,
|
||||
activate_object_SetString,
|
||||
activate_object_SetBlob,
|
||||
activate_object_SetUnknown,
|
||||
activate_object_LockStore,
|
||||
activate_object_UnlockStore,
|
||||
activate_object_GetCount,
|
||||
activate_object_GetItemByIndex,
|
||||
activate_object_CopyAllItems,
|
||||
activate_object_ActivateObject,
|
||||
activate_object_ShutdownObject,
|
||||
activate_object_DetachObject,
|
||||
};
|
||||
|
||||
HRESULT create_activation_object(void *context, const struct activate_funcs *funcs, IMFActivate **ret)
|
||||
{
|
||||
struct activate_object *object;
|
||||
HRESULT hr;
|
||||
|
||||
object = heap_alloc_zero(sizeof(*object));
|
||||
if (!object)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
object->IMFActivate_iface.lpVtbl = &activate_object_vtbl;
|
||||
object->refcount = 1;
|
||||
if (FAILED(hr = MFCreateAttributes(&object->attributes, 0)))
|
||||
{
|
||||
heap_free(object);
|
||||
return hr;
|
||||
}
|
||||
object->funcs = funcs;
|
||||
object->context = context;
|
||||
|
||||
*ret = &object->IMFActivate_iface;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
struct class_factory
|
||||
{
|
||||
IClassFactory IClassFactory_iface;
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
@ stub MFCreateRemoteDesktopPlugin
|
||||
@ stub MFCreateSAMIByteStreamPlugin
|
||||
@ stub MFCreateSampleCopierMFT
|
||||
@ stub MFCreateSampleGrabberSinkActivate
|
||||
@ stdcall MFCreateSampleGrabberSinkActivate(ptr ptr ptr)
|
||||
@ stub MFCreateSecureHttpSchemePlugin
|
||||
@ stub MFCreateSequencerSegmentOffset
|
||||
@ stdcall MFCreateSequencerSource(ptr ptr)
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright 2019 Nikolay Sivov for CodeWeavers
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#include "mfidl.h"
|
||||
|
||||
struct activate_funcs
|
||||
{
|
||||
HRESULT (*create_object)(void *context, IUnknown **object);
|
||||
void (*free_private)(void *context);
|
||||
};
|
||||
|
||||
HRESULT create_activation_object(void *context, const struct activate_funcs *funcs, IMFActivate **ret) DECLSPEC_HIDDEN;
|
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
* Copyright 2019 Nikolay Sivov for CodeWeavers
|
||||
*
|
||||
* 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 "mfidl.h"
|
||||
#include "mf_private.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
#include "wine/heap.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
|
||||
|
||||
struct sample_grabber_activate_context
|
||||
{
|
||||
IMFMediaType *media_type;
|
||||
IMFSampleGrabberSinkCallback *callback;
|
||||
};
|
||||
|
||||
static void sample_grabber_free_private(void *user_context)
|
||||
{
|
||||
struct sample_grabber_activate_context *context = user_context;
|
||||
IMFMediaType_Release(context->media_type);
|
||||
IMFSampleGrabberSinkCallback_Release(context->callback);
|
||||
heap_free(context);
|
||||
}
|
||||
|
||||
static HRESULT sample_grabber_create_object(void *user_context, IUnknown **obj)
|
||||
{
|
||||
FIXME("%p, %p.\n", user_context, obj);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static const struct activate_funcs sample_grabber_activate_funcs =
|
||||
{
|
||||
sample_grabber_create_object,
|
||||
sample_grabber_free_private,
|
||||
};
|
||||
|
||||
/***********************************************************************
|
||||
* MFCreateSampleGrabberSinkActivate (mf.@)
|
||||
*/
|
||||
HRESULT WINAPI MFCreateSampleGrabberSinkActivate(IMFMediaType *media_type, IMFSampleGrabberSinkCallback *callback,
|
||||
IMFActivate **activate)
|
||||
{
|
||||
struct sample_grabber_activate_context *context;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("%p, %p, %p.\n", media_type, callback, activate);
|
||||
|
||||
if (!media_type || !callback || !activate)
|
||||
return E_POINTER;
|
||||
|
||||
context = heap_alloc_zero(sizeof(*context));
|
||||
if (!context)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
context->media_type = media_type;
|
||||
IMFMediaType_AddRef(context->media_type);
|
||||
context->callback = callback;
|
||||
IMFSampleGrabberSinkCallback_AddRef(context->callback);
|
||||
|
||||
if (FAILED(hr = create_activation_object(context, &sample_grabber_activate_funcs, activate)))
|
||||
sample_grabber_free_private(context);
|
||||
|
||||
return hr;
|
||||
}
|
|
@ -940,6 +940,115 @@ todo_wine
|
|||
ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI grabber_callback_QueryInterface(IMFSampleGrabberSinkCallback *iface, REFIID riid, void **obj)
|
||||
{
|
||||
if (IsEqualIID(riid, &IID_IMFSampleGrabberSinkCallback) ||
|
||||
IsEqualIID(riid, &IID_IMFClockStateSink) ||
|
||||
IsEqualIID(riid, &IID_IUnknown))
|
||||
{
|
||||
*obj = iface;
|
||||
IMFSampleGrabberSinkCallback_AddRef(iface);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
*obj = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI grabber_callback_AddRef(IMFSampleGrabberSinkCallback *iface)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
static ULONG WINAPI grabber_callback_Release(IMFSampleGrabberSinkCallback *iface)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI grabber_callback_OnClockStart(IMFSampleGrabberSinkCallback *iface, MFTIME time, LONGLONG offset)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI grabber_callback_OnClockStop(IMFSampleGrabberSinkCallback *iface, MFTIME time)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI grabber_callback_OnClockPause(IMFSampleGrabberSinkCallback *iface, MFTIME time)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI grabber_callback_OnClockRestart(IMFSampleGrabberSinkCallback *iface, MFTIME time)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI grabber_callback_OnClockSetRate(IMFSampleGrabberSinkCallback *iface, MFTIME time, float rate)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI grabber_callback_OnSetPresentationClock(IMFSampleGrabberSinkCallback *iface,
|
||||
IMFPresentationClock *clock)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI grabber_callback_OnProcessSample(IMFSampleGrabberSinkCallback *iface, REFGUID major_type,
|
||||
DWORD sample_flags, LONGLONG sample_time, LONGLONG sample_duration, const BYTE *buffer, DWORD sample_size)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI grabber_callback_OnShutdown(IMFSampleGrabberSinkCallback *iface)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static const IMFSampleGrabberSinkCallbackVtbl grabber_callback_vtbl =
|
||||
{
|
||||
grabber_callback_QueryInterface,
|
||||
grabber_callback_AddRef,
|
||||
grabber_callback_Release,
|
||||
grabber_callback_OnClockStart,
|
||||
grabber_callback_OnClockStop,
|
||||
grabber_callback_OnClockPause,
|
||||
grabber_callback_OnClockRestart,
|
||||
grabber_callback_OnClockSetRate,
|
||||
grabber_callback_OnSetPresentationClock,
|
||||
grabber_callback_OnProcessSample,
|
||||
grabber_callback_OnShutdown,
|
||||
};
|
||||
|
||||
static IMFSampleGrabberSinkCallback grabber_callback = { &grabber_callback_vtbl };
|
||||
|
||||
static void test_sample_grabber(void)
|
||||
{
|
||||
IMFMediaType *media_type;
|
||||
IMFActivate *activate;
|
||||
ULONG refcount;
|
||||
HRESULT hr;
|
||||
|
||||
hr = MFCreateMediaType(&media_type);
|
||||
ok(hr == S_OK, "Failed to create media type, hr %#x.\n", hr);
|
||||
|
||||
hr = MFCreateSampleGrabberSinkActivate(NULL, NULL, &activate);
|
||||
ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = MFCreateSampleGrabberSinkActivate(NULL, &grabber_callback, &activate);
|
||||
ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = MFCreateSampleGrabberSinkActivate(media_type, &grabber_callback, &activate);
|
||||
ok(hr == S_OK, "Failed to create grabber activate, hr %#x.\n", hr);
|
||||
|
||||
refcount = IMFMediaType_Release(media_type);
|
||||
ok(refcount == 1, "Unexpected refcount %u.\n", refcount);
|
||||
|
||||
IMFActivate_Release(activate);
|
||||
}
|
||||
|
||||
START_TEST(mf)
|
||||
{
|
||||
test_topology();
|
||||
|
@ -949,4 +1058,5 @@ START_TEST(mf)
|
|||
test_media_session();
|
||||
test_MFShutdownObject();
|
||||
test_presentation_clock();
|
||||
test_sample_grabber();
|
||||
}
|
||||
|
|
|
@ -463,8 +463,30 @@ interface IMFSequencerSource : IUnknown
|
|||
HRESULT UpdateTopologyFlags(
|
||||
[in] MFSequencerElementId id,
|
||||
[in] DWORD flags );
|
||||
}
|
||||
|
||||
};
|
||||
interface IMFPresentationClock;
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(8c7b80bf-ee42-4b59-b1df-55668e1bdca8),
|
||||
local
|
||||
]
|
||||
interface IMFSampleGrabberSinkCallback : IMFClockStateSink
|
||||
{
|
||||
HRESULT OnSetPresentationClock(
|
||||
[in] IMFPresentationClock *clock);
|
||||
|
||||
HRESULT OnProcessSample(
|
||||
[in] REFGUID major_type,
|
||||
[in] DWORD sample_flags,
|
||||
[in] LONGLONG sample_time,
|
||||
[in] LONGLONG sample_duration,
|
||||
[in] const BYTE *buffer,
|
||||
[in] DWORD sample_size);
|
||||
|
||||
HRESULT OnShutdown();
|
||||
}
|
||||
|
||||
cpp_quote("HRESULT WINAPI MFCreateMediaSession(IMFAttributes *config, IMFMediaSession **session);")
|
||||
cpp_quote("HRESULT WINAPI MFCreateMFByteStreamOnStream(IStream *stream, IMFByteStream **bytestream);" )
|
||||
|
@ -472,6 +494,8 @@ cpp_quote("HRESULT WINAPI MFCreateMFByteStreamOnStreamEx(IUnknown *stream, IMFBy
|
|||
cpp_quote("HRESULT WINAPI MFCreatePresentationClock(IMFPresentationClock **clock);")
|
||||
cpp_quote("HRESULT WINAPI MFCreatePresentationDescriptor(DWORD count, IMFStreamDescriptor **descriptors,")
|
||||
cpp_quote(" IMFPresentationDescriptor **presentation_desc);")
|
||||
cpp_quote("HRESULT WINAPI MFCreateSampleGrabberSinkActivate(IMFMediaType *media_type,")
|
||||
cpp_quote(" IMFSampleGrabberSinkCallback *callback, IMFActivate **activate);")
|
||||
cpp_quote("HRESULT WINAPI MFCreateSequencerSource(IUnknown *reserved, IMFSequencerSource **seq_source);" )
|
||||
cpp_quote("HRESULT WINAPI MFCreateSourceResolver(IMFSourceResolver **resolver);")
|
||||
cpp_quote("HRESULT WINAPI MFCreateStreamDescriptor(DWORD identifier, DWORD cMediaTypes,")
|
||||
|
|
Loading…
Reference in New Issue