diff --git a/configure b/configure index 98fbab893f6..d17ff5e32ee 100755 --- a/configure +++ b/configure @@ -18237,7 +18237,8 @@ wine_fn_config_dll mcicda enable_mcicda wine_fn_config_dll mciqtz32 enable_mciqtz32 wine_fn_config_dll mciseq enable_mciseq wine_fn_config_dll mciwave enable_mciwave -wine_fn_config_dll mf enable_mf +wine_fn_config_dll mf enable_mf implib +wine_fn_config_test dlls/mf/tests mf_test wine_fn_config_dll mf3216 enable_mf3216 wine_fn_config_dll mfplat enable_mfplat implib wine_fn_config_test dlls/mfplat/tests mfplat_test diff --git a/configure.ac b/configure.ac index 365e61fa0a2..129a8f62c7e 100644 --- a/configure.ac +++ b/configure.ac @@ -3181,7 +3181,8 @@ WINE_CONFIG_DLL(mcicda) WINE_CONFIG_DLL(mciqtz32) WINE_CONFIG_DLL(mciseq) WINE_CONFIG_DLL(mciwave) -WINE_CONFIG_DLL(mf) +WINE_CONFIG_DLL(mf,,[implib]) +WINE_CONFIG_TEST(dlls/mf/tests) WINE_CONFIG_DLL(mf3216) WINE_CONFIG_DLL(mfplat,,[implib]) WINE_CONFIG_TEST(dlls/mfplat/tests) diff --git a/dlls/mf/Makefile.in b/dlls/mf/Makefile.in index d7fdb61c092..6725d5bf14a 100644 --- a/dlls/mf/Makefile.in +++ b/dlls/mf/Makefile.in @@ -1,4 +1,6 @@ MODULE = mf.dll +IMPORTLIB = mf C_SRCS = \ - main.c + main.c \ + topology.c diff --git a/dlls/mf/mf.spec b/dlls/mf/mf.spec index e04c471e634..cd6d3dcab77 100644 --- a/dlls/mf/mf.spec +++ b/dlls/mf/mf.spec @@ -60,7 +60,7 @@ @ stdcall MFCreateSourceResolver(ptr) mfplat.MFCreateSourceResolver @ stub MFCreateStandardQualityManager @ stub MFCreateTopoLoader -@ stub MFCreateTopology +@ stdcall MFCreateTopology(ptr) @ stub MFCreateTopologyNode @ stub MFCreateTranscodeProfile @ stub MFCreateTranscodeSinkActivate diff --git a/dlls/mf/tests/Makefile.in b/dlls/mf/tests/Makefile.in new file mode 100644 index 00000000000..f989baa2300 --- /dev/null +++ b/dlls/mf/tests/Makefile.in @@ -0,0 +1,5 @@ +TESTDLL = mf.dll +IMPORTS = mf + +C_SRCS = \ + mf.c diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c new file mode 100644 index 00000000000..f28c6e048da --- /dev/null +++ b/dlls/mf/tests/mf.c @@ -0,0 +1,49 @@ +/* + * Unit tests for mf.dll. + * + * Copyright 2017 Nikolay Sivov + * + * 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 +#include + +#define COBJMACROS + +#include "windef.h" +#include "winbase.h" + +#include "mfidl.h" + +#include "wine/test.h" + +static void test_topology(void) +{ + IMFTopology *topology; + HRESULT hr; + + hr = MFCreateTopology(NULL); + ok(hr == E_POINTER, "got %#x\n", hr); + + hr = MFCreateTopology(&topology); + ok(hr == S_OK, "got %#x\n", hr); + IMFTopology_Release(topology); +} + +START_TEST(mf) +{ + test_topology(); +} diff --git a/dlls/mf/topology.c b/dlls/mf/topology.c new file mode 100644 index 00000000000..924d3863c85 --- /dev/null +++ b/dlls/mf/topology.c @@ -0,0 +1,523 @@ +/* + * Copyright 2017 Nikolay Sivov + * + * 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 "config.h" + +#include + +#define COBJMACROS + +#include "windef.h" +#include "winbase.h" +#include "initguid.h" +#include "mfidl.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(mfplat); + +typedef struct mftopology +{ + IMFTopology IMFTopology_iface; + LONG ref; +} mftopology; + +static inline mftopology *impl_from_IMFTopology(IMFTopology *iface) +{ + return CONTAINING_RECORD(iface, mftopology, IMFTopology_iface); +} + +static HRESULT WINAPI mftopology_QueryInterface(IMFTopology *iface, REFIID riid, void **out) +{ + mftopology *This = impl_from_IMFTopology(iface); + + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), out); + + if (IsEqualIID(riid, &IID_IMFTopology) || + IsEqualIID(riid, &IID_IMFAttributes) || + IsEqualIID(riid, &IID_IUnknown)) + { + *out = &This->IMFTopology_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 mftopology_AddRef(IMFTopology *iface) +{ + mftopology *This = impl_from_IMFTopology(iface); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) ref=%u\n", This, ref); + + return ref; +} + +static ULONG WINAPI mftopology_Release(IMFTopology *iface) +{ + mftopology *This = impl_from_IMFTopology(iface); + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) ref=%u\n", This, ref); + + if (!ref) + { + HeapFree(GetProcessHeap(), 0, This); + } + + return ref; +} + +static HRESULT WINAPI mftopology_GetItem(IMFTopology *iface, REFGUID key, PROPVARIANT *value) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%s, %p)\n", This, debugstr_guid(key), value); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_GetItemType(IMFTopology *iface, REFGUID key, MF_ATTRIBUTE_TYPE *type) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%s, %p)\n", This, debugstr_guid(key), type); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_CompareItem(IMFTopology *iface, REFGUID key, REFPROPVARIANT value, BOOL *result) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%s, %p, %p)\n", This, debugstr_guid(key), value, result); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_Compare(IMFTopology *iface, IMFAttributes *theirs, MF_ATTRIBUTES_MATCH_TYPE type, + BOOL *result) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%p, %d, %p)\n", This, theirs, type, result); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_GetUINT32(IMFTopology *iface, REFGUID key, UINT32 *value) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%s, %p)\n", This, debugstr_guid(key), value); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_GetUINT64(IMFTopology *iface, REFGUID key, UINT64 *value) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%s, %p)\n", This, debugstr_guid(key), value); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_GetDouble(IMFTopology *iface, REFGUID key, double *value) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%s, %p)\n", This, debugstr_guid(key), value); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_GetGUID(IMFTopology *iface, REFGUID key, GUID *value) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%s, %p)\n", This, debugstr_guid(key), value); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_GetStringLength(IMFTopology *iface, REFGUID key, UINT32 *length) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%s, %p)\n", This, debugstr_guid(key), length); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_GetString(IMFTopology *iface, REFGUID key, WCHAR *value, + UINT32 size, UINT32 *length) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%s, %p, %d, %p)\n", This, debugstr_guid(key), value, size, length); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_GetAllocatedString(IMFTopology *iface, REFGUID key, + WCHAR **value, UINT32 *length) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%s, %p, %p)\n", This, debugstr_guid(key), value, length); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_GetBlobSize(IMFTopology *iface, REFGUID key, UINT32 *size) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%s, %p)\n", This, debugstr_guid(key), size); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_GetBlob(IMFTopology *iface, REFGUID key, UINT8 *buf, + UINT32 bufsize, UINT32 *blobsize) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%s, %p, %d, %p)\n", This, debugstr_guid(key), buf, bufsize, blobsize); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_GetAllocatedBlob(IMFTopology *iface, REFGUID key, UINT8 **buf, UINT32 *size) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%s, %p, %p)\n", This, debugstr_guid(key), buf, size); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_GetUnknown(IMFTopology *iface, REFGUID key, REFIID riid, void **ppv) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%s, %s, %p)\n", This, debugstr_guid(key), debugstr_guid(riid), ppv); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_SetItem(IMFTopology *iface, REFGUID key, REFPROPVARIANT Value) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%s, %p)\n", This, debugstr_guid(key), Value); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_DeleteItem(IMFTopology *iface, REFGUID key) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%s)\n", This, debugstr_guid(key)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_DeleteAllItems(IMFTopology *iface) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)\n", This); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_SetUINT32(IMFTopology *iface, REFGUID key, UINT32 value) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%s, %d)\n", This, debugstr_guid(key), value); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_SetUINT64(IMFTopology *iface, REFGUID key, UINT64 value) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%s, %s)\n", This, debugstr_guid(key), wine_dbgstr_longlong(value)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_SetDouble(IMFTopology *iface, REFGUID key, double value) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%s, %f)\n", This, debugstr_guid(key), value); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_SetGUID(IMFTopology *iface, REFGUID key, REFGUID value) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%s, %s)\n", This, debugstr_guid(key), debugstr_guid(value)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_SetString(IMFTopology *iface, REFGUID key, const WCHAR *value) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%s, %s)\n", This, debugstr_guid(key), debugstr_w(value)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_SetBlob(IMFTopology *iface, REFGUID key, const UINT8 *buf, UINT32 size) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%s, %p, %d)\n", This, debugstr_guid(key), buf, size); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_SetUnknown(IMFTopology *iface, REFGUID key, IUnknown *unknown) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%s, %p)\n", This, debugstr_guid(key), unknown); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_LockStore(IMFTopology *iface) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)\n", This); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_UnlockStore(IMFTopology *iface) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)\n", This); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_GetCount(IMFTopology *iface, UINT32 *count) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%p)\n", This, count); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_GetItemByIndex(IMFTopology *iface, UINT32 index, GUID *key, PROPVARIANT *value) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%u, %p, %p)\n", This, index, key, value); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_CopyAllItems(IMFTopology *iface, IMFAttributes *dest) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%p)\n", This, dest); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_GetTopologyID(IMFTopology *iface, TOPOID *id) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%p)\n", This, id); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_AddNode(IMFTopology *iface, IMFTopologyNode *node) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%p)\n", This, node); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_RemoveNode(IMFTopology *iface, IMFTopologyNode *node) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%p)\n", This, node); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_GetNodeCount(IMFTopology *iface, WORD *count) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%p)\n", This, count); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_GetNode(IMFTopology *iface, WORD index, IMFTopologyNode **node) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%u, %p)\n", This, index, node); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_Clear(IMFTopology *iface) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)\n", This); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_CloneFrom(IMFTopology *iface, IMFTopology *topology) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%p)\n", This, topology); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_GetNodeByID(IMFTopology *iface, TOPOID id, IMFTopologyNode **node) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%p)\n", This, node); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_GetSourceNodeCollection(IMFTopology *iface, IMFCollection **collection) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%p)\n", This, collection); + + return E_NOTIMPL; +} + +static HRESULT WINAPI mftopology_GetOutputNodeCollection(IMFTopology *iface, IMFCollection **collection) +{ + mftopology *This = impl_from_IMFTopology(iface); + + FIXME("(%p)->(%p)\n", This, collection); + + return E_NOTIMPL; +} + +static const IMFTopologyVtbl mftopologyvtbl = +{ + mftopology_QueryInterface, + mftopology_AddRef, + mftopology_Release, + mftopology_GetItem, + mftopology_GetItemType, + mftopology_CompareItem, + mftopology_Compare, + mftopology_GetUINT32, + mftopology_GetUINT64, + mftopology_GetDouble, + mftopology_GetGUID, + mftopology_GetStringLength, + mftopology_GetString, + mftopology_GetAllocatedString, + mftopology_GetBlobSize, + mftopology_GetBlob, + mftopology_GetAllocatedBlob, + mftopology_GetUnknown, + mftopology_SetItem, + mftopology_DeleteItem, + mftopology_DeleteAllItems, + mftopology_SetUINT32, + mftopology_SetUINT64, + mftopology_SetDouble, + mftopology_SetGUID, + mftopology_SetString, + mftopology_SetBlob, + mftopology_SetUnknown, + mftopology_LockStore, + mftopology_UnlockStore, + mftopology_GetCount, + mftopology_GetItemByIndex, + mftopology_CopyAllItems, + mftopology_GetTopologyID, + mftopology_AddNode, + mftopology_RemoveNode, + mftopology_GetNodeCount, + mftopology_GetNode, + mftopology_Clear, + mftopology_CloneFrom, + mftopology_GetNodeByID, + mftopology_GetSourceNodeCollection, + mftopology_GetOutputNodeCollection, +}; + +/*********************************************************************** + * MFCreateTopology (mf.@) + */ +HRESULT WINAPI MFCreateTopology(IMFTopology **topology) +{ + mftopology *object; + + if (!topology) + return E_POINTER; + + object = HeapAlloc(GetProcessHeap(), 0, sizeof(*object)); + if (!object) + return E_OUTOFMEMORY; + + object->IMFTopology_iface.lpVtbl = &mftopologyvtbl; + object->ref = 1; + + *topology = &object->IMFTopology_iface; + + return S_OK; +} diff --git a/include/mfidl.idl b/include/mfidl.idl index 925fbcc4fab..767ff4229e6 100644 --- a/include/mfidl.idl +++ b/include/mfidl.idl @@ -164,3 +164,4 @@ interface IMFSourceResolver : IUnknown } cpp_quote("HRESULT WINAPI MFCreateSourceResolver(IMFSourceResolver **resolver);") +cpp_quote("HRESULT WINAPI MFCreateTopology(IMFTopology **topology);")