mfmediaengine: Add MFMediaEngineClassFactory stub.

Signed-off-by: Jactry Zeng <jzeng@codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jactry Zeng 2019-08-29 23:50:41 +08:00 committed by Alexandre Julliard
parent 05aa105355
commit 3a3ace8b06
9 changed files with 272 additions and 2 deletions

1
configure vendored
View File

@ -20490,6 +20490,7 @@ wine_fn_config_makefile dlls/mf/tests enable_tests
wine_fn_config_makefile dlls/mf3216 enable_mf3216 wine_fn_config_makefile dlls/mf3216 enable_mf3216
wine_fn_config_makefile dlls/mferror enable_mferror wine_fn_config_makefile dlls/mferror enable_mferror
wine_fn_config_makefile dlls/mfmediaengine enable_mfmediaengine wine_fn_config_makefile dlls/mfmediaengine enable_mfmediaengine
wine_fn_config_makefile dlls/mfmediaengine/tests enable_tests
wine_fn_config_makefile dlls/mfplat enable_mfplat wine_fn_config_makefile dlls/mfplat enable_mfplat
wine_fn_config_makefile dlls/mfplat/tests enable_tests wine_fn_config_makefile dlls/mfplat/tests enable_tests
wine_fn_config_makefile dlls/mfplay enable_mfplay wine_fn_config_makefile dlls/mfplay enable_mfplay

View File

@ -3394,6 +3394,7 @@ WINE_CONFIG_MAKEFILE(dlls/mf/tests)
WINE_CONFIG_MAKEFILE(dlls/mf3216) WINE_CONFIG_MAKEFILE(dlls/mf3216)
WINE_CONFIG_MAKEFILE(dlls/mferror) WINE_CONFIG_MAKEFILE(dlls/mferror)
WINE_CONFIG_MAKEFILE(dlls/mfmediaengine) WINE_CONFIG_MAKEFILE(dlls/mfmediaengine)
WINE_CONFIG_MAKEFILE(dlls/mfmediaengine/tests)
WINE_CONFIG_MAKEFILE(dlls/mfplat) WINE_CONFIG_MAKEFILE(dlls/mfplat)
WINE_CONFIG_MAKEFILE(dlls/mfplat/tests) WINE_CONFIG_MAKEFILE(dlls/mfplat/tests)
WINE_CONFIG_MAKEFILE(dlls/mfplay) WINE_CONFIG_MAKEFILE(dlls/mfplay)

View File

@ -1,7 +1,12 @@
MODULE = mfmediaengine.dll MODULE = mfmediaengine.dll
IMPORTLIB = mfmediaengine IMPORTLIB = mfmediaengine
IMPORTS = mfuuid uuid
EXTRADLLFLAGS = -mno-cygwin EXTRADLLFLAGS = -mno-cygwin
C_SRCS = \ C_SRCS = \
main.c main.c
IDL_SRCS = \
mediaengine.idl \
mediaengine_classes.idl

View File

@ -16,11 +16,19 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#define COBJMACROS
#include <stdarg.h> #include <stdarg.h>
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "mfmediaengine.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
{ {
switch (reason) switch (reason)
@ -34,3 +42,136 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
return TRUE; return TRUE;
} }
static HRESULT WINAPI media_engine_factory_QueryInterface(IMFMediaEngineClassFactory *iface, REFIID riid, void **obj)
{
if (IsEqualIID(riid, &IID_IMFMediaEngineClassFactory) ||
IsEqualIID(riid, &IID_IUnknown))
{
*obj = iface;
IMFMediaEngineClassFactory_AddRef(iface);
return S_OK;
}
WARN("Unsupported interface %s.\n", debugstr_guid(riid));
*obj = NULL;
return E_NOINTERFACE;
}
static ULONG WINAPI media_engine_factory_AddRef(IMFMediaEngineClassFactory *iface)
{
return 2;
}
static ULONG WINAPI media_engine_factory_Release(IMFMediaEngineClassFactory *iface)
{
return 1;
}
static HRESULT WINAPI media_engine_factory_CreateInstance(IMFMediaEngineClassFactory *iface, DWORD flags,
IMFAttributes *attributes, IMFMediaEngine **engine)
{
FIXME("(%p, %#x, %p, %p): stub.\n", iface, flags, attributes, engine);
return E_NOTIMPL;
}
static HRESULT WINAPI media_engine_factory_CreateTimeRange(IMFMediaEngineClassFactory *iface,
IMFMediaTimeRange **range)
{
FIXME("(%p, %p): stub.\n", iface, range);
return E_NOTIMPL;
}
static HRESULT WINAPI media_engine_factory_CreateError(IMFMediaEngineClassFactory *iface, IMFMediaError **error)
{
FIXME("(%p, %p): stub.\n", iface, error);
return E_NOTIMPL;
}
static const IMFMediaEngineClassFactoryVtbl media_engine_factory_vtbl =
{
media_engine_factory_QueryInterface,
media_engine_factory_AddRef,
media_engine_factory_Release,
media_engine_factory_CreateInstance,
media_engine_factory_CreateTimeRange,
media_engine_factory_CreateError,
};
static IMFMediaEngineClassFactory media_engine_factory = { &media_engine_factory_vtbl };
static HRESULT WINAPI classfactory_QueryInterface(IClassFactory *iface, REFIID riid, void **obj)
{
TRACE("(%s, %p).\n", debugstr_guid(riid), obj);
if (IsEqualGUID(riid, &IID_IClassFactory) ||
IsEqualGUID(riid, &IID_IUnknown))
{
IClassFactory_AddRef(iface);
*obj = iface;
return S_OK;
}
WARN("interface %s not implemented.\n", debugstr_guid(riid));
*obj = NULL;
return E_NOINTERFACE;
}
static ULONG WINAPI classfactory_AddRef(IClassFactory *iface)
{
return 2;
}
static ULONG WINAPI classfactory_Release(IClassFactory *iface)
{
return 1;
}
static HRESULT WINAPI classfactory_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **obj)
{
TRACE("(%p, %s, %p).\n", outer, debugstr_guid(riid), obj);
*obj = NULL;
if (outer)
return CLASS_E_NOAGGREGATION;
return IMFMediaEngineClassFactory_QueryInterface(&media_engine_factory, riid, obj);
}
static HRESULT WINAPI classfactory_LockServer(IClassFactory *iface, BOOL dolock)
{
FIXME("(%d): stub.\n", dolock);
return S_OK;
}
static const struct IClassFactoryVtbl class_factory_vtbl =
{
classfactory_QueryInterface,
classfactory_AddRef,
classfactory_Release,
classfactory_CreateInstance,
classfactory_LockServer,
};
static IClassFactory classfactory = { &class_factory_vtbl };
HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void **obj)
{
TRACE("(%s, %s, %p).\n", debugstr_guid(clsid), debugstr_guid(riid), obj);
if (IsEqualGUID(clsid, &CLSID_MFMediaEngineClassFactory))
return IClassFactory_QueryInterface(&classfactory, riid, obj);
WARN("Unsupported class %s.\n", debugstr_guid(clsid));
*obj = NULL;
return CLASS_E_CLASSNOTAVAILABLE;
}
HRESULT WINAPI DllCanUnloadNow(void)
{
return S_FALSE;
}

View File

@ -0,0 +1,26 @@
/*
* Copyright 2019 Jactry Zeng 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
*/
#pragma makedep register
[
helpstring("Media Engine Class Factory"),
threading(both),
uuid(b44392da-499b-446b-a4cb-005fead0e6d5)
]
coclass MFMediaEngineClassFactory { interface IMFMediaEngineClassFactory; }

View File

@ -0,0 +1,26 @@
/*
* Copyright 2019 Jactry Zeng 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
*/
#pragma makedep register
[
helpstring("Media Engine Class Factory"),
threading(both),
uuid(b44392da-499b-446b-a4cb-005fead0e6d5)
]
coclass MFMediaEngineClassFactory { interface IMFMediaEngineClassFactory; }

View File

@ -1,3 +1,3 @@
@ stub DllCanUnloadNow @ stdcall -private DllCanUnloadNow()
@ stub DllGetActivationFactory @ stub DllGetActivationFactory
@ stub DllGetClassObject @ stdcall -private DllGetClassObject(ptr ptr ptr)

View File

@ -0,0 +1,5 @@
TESTDLL = mfmediaengine.dll
IMPORTS = ole32 mfplat mfmediaengine mfuuid
C_SRCS = \
mfmediaengine.c

View File

@ -0,0 +1,65 @@
/*
* Copyright 2019 Jactry Zeng 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 <stdarg.h>
#define COBJMACROS
#include "windef.h"
#include "winbase.h"
#include "mfapi.h"
#include "mfmediaengine.h"
#include "wine/heap.h"
#include "wine/test.h"
static void test_factory(void)
{
IMFMediaEngineClassFactory *factory, *factory2;
HRESULT hr;
CoInitialize(NULL);
hr = CoCreateInstance(&CLSID_MFMediaEngineClassFactory, NULL, CLSCTX_INPROC_SERVER,
&IID_IMFMediaEngineClassFactory, (void **)&factory);
ok(hr == S_OK || broken(hr == REGDB_E_CLASSNOTREG) /* pre-win8 */,
"Failed to create class factory, hr %#x.\n", hr);
hr = CoCreateInstance(&CLSID_MFMediaEngineClassFactory, (IUnknown *)factory, CLSCTX_INPROC_SERVER,
&IID_IMFMediaEngineClassFactory, (void **)&factory2);
ok(hr == CLASS_E_NOAGGREGATION || broken(hr == REGDB_E_CLASSNOTREG) /* pre-win8 */,
"Unexpected hr %#x.\n", hr);
if (factory)
IMFMediaEngineClassFactory_Release(factory);
CoUninitialize();
}
START_TEST(mfmediaengine)
{
HRESULT hr;
hr = MFStartup(MF_VERSION, MFSTARTUP_FULL);
ok(hr == S_OK, "MFStartup failed: %#x.\n", hr);
test_factory();
MFShutdown();
}