Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/session.c | 60 +++++++++++++++++++++++++++++++++++++++++----- dlls/mf/tests/mf.c | 7 ++++++ include/mfidl.idl | 22 +++++++++++++++++ 3 files changed, 83 insertions(+), 6 deletions(-)
diff --git a/dlls/mf/session.c b/dlls/mf/session.c index a3c0ee717f..5ed29c8525 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -265,6 +265,52 @@ static struct quality_manager *impl_from_IMFQualityManager(IMFQualityManager *if return CONTAINING_RECORD(iface, struct quality_manager, IMFQualityManager_iface); }
+/* IMFLocalMFTRegistration */ +static HRESULT WINAPI local_mft_registration_QueryInterface(IMFLocalMFTRegistration *iface, REFIID riid, void **obj) +{ + TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), obj); + + if (IsEqualIID(riid, &IID_IMFLocalMFTRegistration) || + IsEqualIID(riid, &IID_IUnknown)) + { + *obj = iface; + IMFLocalMFTRegistration_AddRef(iface); + return S_OK; + } + + WARN("Unexpected %s.\n", debugstr_guid(riid)); + *obj = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI local_mft_registration_AddRef(IMFLocalMFTRegistration *iface) +{ + return 2; +} + +static ULONG WINAPI local_mft_registration_Release(IMFLocalMFTRegistration *iface) +{ + return 1; +} + +static HRESULT WINAPI local_mft_registration_RegisterMFTs(IMFLocalMFTRegistration *iface, MFT_REGISTRATION_INFO *info, + DWORD count) +{ + FIXME("%p, %p, %u.\n", iface, info, count); + + return E_NOTIMPL; +} + +static const IMFLocalMFTRegistrationVtbl local_mft_registration_vtbl = +{ + local_mft_registration_QueryInterface, + local_mft_registration_AddRef, + local_mft_registration_Release, + local_mft_registration_RegisterMFTs, +}; + +static IMFLocalMFTRegistration local_mft_registration = { &local_mft_registration_vtbl }; + static HRESULT WINAPI session_op_QueryInterface(IUnknown *iface, REFIID riid, void **obj) { if (IsEqualIID(riid, &IID_IUnknown)) @@ -915,16 +961,18 @@ static HRESULT WINAPI session_get_service_GetService(IMFGetService *iface, REFGU { *obj = &session->IMFRateControl_iface; } - - if (*obj) - IUnknown_AddRef((IUnknown *)*obj); - - return *obj ? S_OK : E_NOINTERFACE; + } + else if (IsEqualGUID(service, &MF_LOCAL_MFT_REGISTRATION_SERVICE)) + { + return IMFLocalMFTRegistration_QueryInterface(&local_mft_registration, riid, obj); } else FIXME("Unsupported service %s.\n", debugstr_guid(service));
- return E_NOTIMPL; + if (*obj) + IUnknown_AddRef((IUnknown *)*obj); + + return *obj ? S_OK : E_NOINTERFACE; }
static const IMFGetServiceVtbl session_get_service_vtbl = diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index e118c36ec7..7cebb4c555 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -952,6 +952,7 @@ static void test_session_events(IMFMediaSession *session) static void test_media_session(void) { IMFRateControl *rate_control, *rate_control2; + IMFLocalMFTRegistration *local_reg; MFCLOCK_PROPERTIES clock_props; IMFRateSupport *rate_support; IMFAttributes *attributes; @@ -981,6 +982,12 @@ static void test_media_session(void) hr = IMFGetService_GetService(gs, &MF_RATE_CONTROL_SERVICE, &IID_IMFRateControl, (void **)&rate_control); ok(hr == S_OK, "Failed to get rate control interface, hr %#x.\n", hr);
+ hr = IMFGetService_GetService(gs, &MF_LOCAL_MFT_REGISTRATION_SERVICE, &IID_IMFLocalMFTRegistration, + (void **)&local_reg); + ok(hr == S_OK || broken(hr == E_NOINTERFACE) /* Vista */, "Failed to get registration service, hr %#x.\n", hr); + if (SUCCEEDED(hr)) + IMFLocalMFTRegistration_Release(local_reg); + hr = IMFRateSupport_QueryInterface(rate_support, &IID_IMFMediaSession, (void **)&unk); ok(hr == S_OK, "Failed to get session interface, hr %#x.\n", hr); ok(unk == (IUnknown *)session, "Unexpected pointer.\n"); diff --git a/include/mfidl.idl b/include/mfidl.idl index ab6d0d9984..908c659f1d 100644 --- a/include/mfidl.idl +++ b/include/mfidl.idl @@ -762,6 +762,27 @@ interface IMFQualityManager : IUnknown HRESULT Shutdown(); }
+typedef struct _MFT_REGISTRATION_INFO +{ + CLSID clsid; + GUID guidCategory; + UINT32 uiFlags; + LPCWSTR pszName; + DWORD cInTypes; + [size_is(cInTypes)] MFT_REGISTER_TYPE_INFO *pInTypes; + DWORD cOutTypes; + [size_is(cOutTypes)] MFT_REGISTER_TYPE_INFO *pOutTypes; +} MFT_REGISTRATION_INFO; + +[ + object, + uuid(149c4d73-b4be-4f8d-8b87-079e926b6add) +] +interface IMFLocalMFTRegistration : IUnknown +{ + HRESULT RegisterMFTs([in, size_is(count)] MFT_REGISTRATION_INFO *info, [in] DWORD count); +} + cpp_quote("#define MF_RESOLUTION_MEDIASOURCE 0x00000001") cpp_quote("#define MF_RESOLUTION_BYTESTREAM 0x00000002") cpp_quote("#define MF_RESOLUTION_CONTENT_DOES_NOT_HAVE_TO_MATCH_EXTENSION_OR_MIME_TYPE 0x00000010") @@ -862,6 +883,7 @@ cpp_quote("EXTERN_GUID(MF_TOPOLOGY_START_TIME_ON_PRESENTATION_SWITCH, 0xc8cc113f cpp_quote("EXTERN_GUID(MF_TOPOLOGY_STATIC_PLAYBACK_OPTIMIZATIONS, 0xb86cac42, 0x41a6, 0x4b79, 0x89, 0x7a, 0x1a, 0xb0, 0xe5, 0x2b, 0x4a, 0x1b);")
cpp_quote("EXTERN_GUID(MF_RATE_CONTROL_SERVICE, 0x866fa297, 0xb802, 0x4bf8, 0x9d, 0xc9, 0x5e, 0x3b, 0x6a, 0x9f, 0x53, 0xc9);") +cpp_quote("EXTERN_GUID(MF_LOCAL_MFT_REGISTRATION_SERVICE, 0xddf5cf9c, 0x4506, 0x45aa, 0xab, 0xf0, 0x6d, 0x5d, 0x94, 0xdd, 0x1b, 0x4a);")
cpp_quote("EXTERN_GUID(MF_SAMPLEGRABBERSINK_SAMPLE_TIME_OFFSET, 0x62e3d776, 0x8100, 0x4e03, 0xa6, 0xe8, 0xbd, 0x38, 0x57, 0xac, 0x9c, 0x47);") cpp_quote("EXTERN_GUID(MF_SAMPLEGRABBERSINK_IGNORE_CLOCK, 0x0efda2c0, 0x2b69, 0x4e2e, 0xab, 0x8d, 0x46, 0xdc, 0xbf, 0xf7, 0xd2, 0x5d);")