Commit a1d3a7f7 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mfplat: Return stub IMFSourceResolver from MFCreateSourceResolver().

parent 008a2fa0
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
@ stub MFCreateSequencerSource @ stub MFCreateSequencerSource
@ stub MFCreateSequencerSourceRemoteStream @ stub MFCreateSequencerSourceRemoteStream
@ stub MFCreateSimpleTypeHandler @ stub MFCreateSimpleTypeHandler
@ stub MFCreateSourceResolver @ stdcall MFCreateSourceResolver(ptr) mfplat.MFCreateSourceResolver
@ stub MFCreateStandardQualityManager @ stub MFCreateStandardQualityManager
@ stub MFCreateTopoLoader @ stub MFCreateTopoLoader
@ stub MFCreateTopology @ stub MFCreateTopology
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "initguid.h" #include "initguid.h"
#include "mfapi.h" #include "mfapi.h"
#include "mfidl.h"
#include "mferror.h" #include "mferror.h"
#include "wine/debug.h" #include "wine/debug.h"
...@@ -869,7 +870,7 @@ static const IMFAttributesVtbl mfattributes_vtbl = ...@@ -869,7 +870,7 @@ static const IMFAttributesVtbl mfattributes_vtbl =
}; };
/*********************************************************************** /***********************************************************************
* MFMFCreateAttributes (mfplat.@) * MFCreateAttributes (mfplat.@)
*/ */
HRESULT WINAPI MFCreateAttributes(IMFAttributes **attributes, UINT32 size) HRESULT WINAPI MFCreateAttributes(IMFAttributes **attributes, UINT32 size)
{ {
...@@ -887,3 +888,168 @@ HRESULT WINAPI MFCreateAttributes(IMFAttributes **attributes, UINT32 size) ...@@ -887,3 +888,168 @@ HRESULT WINAPI MFCreateAttributes(IMFAttributes **attributes, UINT32 size)
*attributes = &object->IMFAttributes_iface; *attributes = &object->IMFAttributes_iface;
return S_OK; return S_OK;
} }
typedef struct _mfsourceresolver
{
IMFSourceResolver IMFSourceResolver_iface;
LONG ref;
} mfsourceresolver;
static inline mfsourceresolver *impl_from_IMFSourceResolver(IMFSourceResolver *iface)
{
return CONTAINING_RECORD(iface, mfsourceresolver, IMFSourceResolver_iface);
}
static HRESULT WINAPI mfsourceresolver_QueryInterface(IMFSourceResolver *iface, REFIID riid, void **obj)
{
mfsourceresolver *This = impl_from_IMFSourceResolver(iface);
TRACE("(%p->(%s, %p)\n", This, debugstr_guid(riid), obj);
if (IsEqualIID(riid, &IID_IMFSourceResolver) ||
IsEqualIID(riid, &IID_IUnknown))
{
*obj = &This->IMFSourceResolver_iface;
}
else
{
*obj = NULL;
FIXME("unsupported interface %s\n", debugstr_guid(riid));
return E_NOINTERFACE;
}
IUnknown_AddRef((IUnknown *)*obj);
return S_OK;
}
static ULONG WINAPI mfsourceresolver_AddRef(IMFSourceResolver *iface)
{
mfsourceresolver *This = impl_from_IMFSourceResolver(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->(%u)\n", This, ref);
return ref;
}
static ULONG WINAPI mfsourceresolver_Release(IMFSourceResolver *iface)
{
mfsourceresolver *This = impl_from_IMFSourceResolver(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(%u)\n", This, ref);
if (!ref)
HeapFree(GetProcessHeap(), 0, This);
return ref;
}
static HRESULT WINAPI mfsourceresolver_CreateObjectFromURL(IMFSourceResolver *iface, const WCHAR *url,
DWORD flags, IPropertyStore *props, MF_OBJECT_TYPE *obj_type, IUnknown **object)
{
mfsourceresolver *This = impl_from_IMFSourceResolver(iface);
FIXME("(%p)->(%s, %#x, %p, %p, %p): stub\n", This, debugstr_w(url), flags, props, obj_type, object);
return E_NOTIMPL;
}
static HRESULT WINAPI mfsourceresolver_CreateObjectFromByteStream(IMFSourceResolver *iface, IMFByteStream *stream,
const WCHAR *url, DWORD flags, IPropertyStore *props, MF_OBJECT_TYPE *obj_type, IUnknown **object)
{
mfsourceresolver *This = impl_from_IMFSourceResolver(iface);
FIXME("(%p)->(%p, %s, %#x, %p, %p, %p): stub\n", This, stream, debugstr_w(url), flags, props, obj_type, object);
return E_NOTIMPL;
}
static HRESULT WINAPI mfsourceresolver_BeginCreateObjectFromURL(IMFSourceResolver *iface, const WCHAR *url,
DWORD flags, IPropertyStore *props, IUnknown **cancel_cookie, IMFAsyncCallback *callback, IUnknown *unk_state)
{
mfsourceresolver *This = impl_from_IMFSourceResolver(iface);
FIXME("(%p)->(%s, %#x, %p, %p, %p, %p): stub\n", This, debugstr_w(url), flags, props, cancel_cookie,
callback, unk_state);
return E_NOTIMPL;
}
static HRESULT WINAPI mfsourceresolver_EndCreateObjectFromURL(IMFSourceResolver *iface, IMFAsyncResult *result,
MF_OBJECT_TYPE *obj_type, IUnknown **object)
{
mfsourceresolver *This = impl_from_IMFSourceResolver(iface);
FIXME("(%p)->(%p, %p, %p): stub\n", This, result, obj_type, object);
return E_NOTIMPL;
}
static HRESULT WINAPI mfsourceresolver_BeginCreateObjectFromByteStream(IMFSourceResolver *iface, IMFByteStream *stream,
const WCHAR *url, DWORD flags, IPropertyStore *props, IUnknown **cancel_cookie, IMFAsyncCallback *callback,
IUnknown *unk_state)
{
mfsourceresolver *This = impl_from_IMFSourceResolver(iface);
FIXME("(%p)->(%p, %s, %#x, %p, %p, %p, %p): stub\n", This, stream, debugstr_w(url), flags, props, cancel_cookie,
callback, unk_state);
return E_NOTIMPL;
}
static HRESULT WINAPI mfsourceresolver_EndCreateObjectFromByteStream(IMFSourceResolver *iface, IMFAsyncResult *result,
MF_OBJECT_TYPE *obj_type, IUnknown **object)
{
mfsourceresolver *This = impl_from_IMFSourceResolver(iface);
FIXME("(%p)->(%p, %p, %p): stub\n", This, result, obj_type, object);
return E_NOTIMPL;
}
static HRESULT WINAPI mfsourceresolver_CancelObjectCreation(IMFSourceResolver *iface, IUnknown *cancel_cookie)
{
mfsourceresolver *This = impl_from_IMFSourceResolver(iface);
FIXME("(%p)->(%p): stub\n", This, cancel_cookie);
return E_NOTIMPL;
}
static const IMFSourceResolverVtbl mfsourceresolvervtbl =
{
mfsourceresolver_QueryInterface,
mfsourceresolver_AddRef,
mfsourceresolver_Release,
mfsourceresolver_CreateObjectFromURL,
mfsourceresolver_CreateObjectFromByteStream,
mfsourceresolver_BeginCreateObjectFromURL,
mfsourceresolver_EndCreateObjectFromURL,
mfsourceresolver_BeginCreateObjectFromByteStream,
mfsourceresolver_EndCreateObjectFromByteStream,
mfsourceresolver_CancelObjectCreation,
};
/***********************************************************************
* MFCreateSourceResolver (mfplat.@)
*/
HRESULT WINAPI MFCreateSourceResolver(IMFSourceResolver **resolver)
{
mfsourceresolver *object;
TRACE("%p\n", resolver);
if (!resolver)
return E_POINTER;
object = HeapAlloc( GetProcessHeap(), 0, sizeof(*object) );
if (!object)
return E_OUTOFMEMORY;
object->IMFSourceResolver_iface.lpVtbl = &mfsourceresolvervtbl;
object->ref = 1;
*resolver = &object->IMFSourceResolver_iface;
return S_OK;
}
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
@ stub MFCreateSample @ stub MFCreateSample
@ stub MFCreateSocket @ stub MFCreateSocket
@ stub MFCreateSocketListener @ stub MFCreateSocketListener
@ stub MFCreateSourceResolver @ stdcall MFCreateSourceResolver(ptr)
@ stub MFCreateStreamDescriptor @ stub MFCreateStreamDescriptor
@ stub MFCreateSystemTimeSource @ stub MFCreateSystemTimeSource
@ stub MFCreateSystemUnderlyingClock @ stub MFCreateSystemUnderlyingClock
......
...@@ -30,10 +30,13 @@ ...@@ -30,10 +30,13 @@
#include "initguid.h" #include "initguid.h"
#include "mfapi.h" #include "mfapi.h"
#include "mfidl.h"
#include "mferror.h" #include "mferror.h"
#include "wine/test.h" #include "wine/test.h"
static HRESULT (WINAPI *pMFCreateSourceResolver)(IMFSourceResolver **resolver);
DEFINE_GUID(MFT_CATEGORY_OTHER, 0x90175d57,0xb7ea,0x4901,0xae,0xb3,0x93,0x3a,0x87,0x47,0x75,0x6f); DEFINE_GUID(MFT_CATEGORY_OTHER, 0x90175d57,0xb7ea,0x4901,0xae,0xb3,0x93,0x3a,0x87,0x47,0x75,0x6f);
DEFINE_GUID(DUMMY_CLSID, 0x12345678,0x1234,0x1234,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19); DEFINE_GUID(DUMMY_CLSID, 0x12345678,0x1234,0x1234,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19);
...@@ -154,12 +157,48 @@ if(0) ...@@ -154,12 +157,48 @@ if(0)
ok(ret == S_OK || broken(ret == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)), "got %x\n", ret); ok(ret == S_OK || broken(ret == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)), "got %x\n", ret);
} }
static void test_source_resolver(void)
{
IMFSourceResolver *resolver, *resolver2;
HRESULT hr;
if (!pMFCreateSourceResolver)
{
win_skip("MFCreateSourceResolver() not found\n");
return;
}
hr = pMFCreateSourceResolver(NULL);
ok(hr == E_POINTER, "got %#x\n", hr);
hr = pMFCreateSourceResolver(&resolver);
ok(hr == S_OK, "got %#x\n", hr);
hr = pMFCreateSourceResolver(&resolver2);
ok(hr == S_OK, "got %#x\n", hr);
ok(resolver != resolver2, "Expected new instance\n");
IMFSourceResolver_Release(resolver);
IMFSourceResolver_Release(resolver2);
}
static void init_functions(void)
{
HMODULE mod = GetModuleHandleA("mfplat.dll");
#define X(f) if (!(p##f = (void*)GetProcAddress(mod, #f))) return;
X(MFCreateSourceResolver);
#undef X
}
START_TEST(mfplat) START_TEST(mfplat)
{ {
CoInitialize(NULL); CoInitialize(NULL);
init_functions();
test_register(); test_register();
test_source_resolver();
CoUninitialize(); CoUninitialize();
} }
...@@ -162,3 +162,5 @@ interface IMFSourceResolver : IUnknown ...@@ -162,3 +162,5 @@ interface IMFSourceResolver : IUnknown
[out] MF_OBJECT_TYPE *obj_type, [out] IUnknown **object); [out] MF_OBJECT_TYPE *obj_type, [out] IUnknown **object);
[local] HRESULT CanceObjectCreation([in] IUnknown *cancel_cookie); [local] HRESULT CanceObjectCreation([in] IUnknown *cancel_cookie);
} }
cpp_quote("HRESULT WINAPI MFCreateSourceResolver(IMFSourceResolver **resolver);")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment