Similarly to !6362 this makes it possible to override these DLLs to use native implementation of the classes.
From: Rémi Bernon rbernon@codeweavers.com
--- configure.ac | 1 + dlls/colorcnv/Makefile.in | 6 + dlls/colorcnv/colorcnv.c | 220 +++++++++++++++++++ dlls/colorcnv/colorcnv.idl | 25 +++ dlls/colorcnv/colorcnv.spec | 3 + dlls/winegstreamer/main.c | 50 +---- dlls/winegstreamer/mfplat.c | 53 ----- dlls/winegstreamer/winegstreamer_classes.idl | 4 +- loader/wine.inf.in | 1 + 9 files changed, 260 insertions(+), 103 deletions(-) create mode 100644 dlls/colorcnv/Makefile.in create mode 100644 dlls/colorcnv/colorcnv.c create mode 100644 dlls/colorcnv/colorcnv.idl create mode 100644 dlls/colorcnv/colorcnv.spec
diff --git a/configure.ac b/configure.ac index f87a234a955..ecc765b082a 100644 --- a/configure.ac +++ b/configure.ac @@ -2480,6 +2480,7 @@ WINE_CONFIG_MAKEFILE(dlls/cfgmgr32) WINE_CONFIG_MAKEFILE(dlls/cfgmgr32/tests) WINE_CONFIG_MAKEFILE(dlls/clusapi) WINE_CONFIG_MAKEFILE(dlls/cng.sys) +WINE_CONFIG_MAKEFILE(dlls/colorcnv) WINE_CONFIG_MAKEFILE(dlls/combase) WINE_CONFIG_MAKEFILE(dlls/combase/tests) WINE_CONFIG_MAKEFILE(dlls/comcat) diff --git a/dlls/colorcnv/Makefile.in b/dlls/colorcnv/Makefile.in new file mode 100644 index 00000000000..1798af91c9b --- /dev/null +++ b/dlls/colorcnv/Makefile.in @@ -0,0 +1,6 @@ +MODULE = colorcnv.dll +IMPORTS = combase mfplat msdmo mfuuid dmoguids strmiids wmcodecdspuuid uuid + +SOURCES = \ + colorcnv.c \ + colorcnv.idl diff --git a/dlls/colorcnv/colorcnv.c b/dlls/colorcnv/colorcnv.c new file mode 100644 index 00000000000..e9bf90932bc --- /dev/null +++ b/dlls/colorcnv/colorcnv.c @@ -0,0 +1,220 @@ +/* + * Copyright 2024 Rémi Bernon 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 <stddef.h> +#include <stdarg.h> + +#define COBJMACROS +#include "windef.h" +#include "winbase.h" + +#include "d3d9.h" +#include "dmoreg.h" +#include "dshow.h" +#include "mfapi.h" +#include "rpcproxy.h" +#include "wmcodecdsp.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dmo); + +#include "initguid.h" + +DEFINE_MEDIATYPE_GUID(MFVideoFormat_ABGR32, D3DFMT_A8B8G8R8); +DEFINE_GUID(DMOVideoFormat_RGB32,D3DFMT_X8R8G8B8,0x524f,0x11ce,0x9f,0x53,0x00,0x20,0xaf,0x0b,0xa7,0x70); +DEFINE_GUID(DMOVideoFormat_RGB24,D3DFMT_R8G8B8,0x524f,0x11ce,0x9f,0x53,0x00,0x20,0xaf,0x0b,0xa7,0x70); +DEFINE_GUID(DMOVideoFormat_RGB565,D3DFMT_R5G6B5,0x524f,0x11ce,0x9f,0x53,0x00,0x20,0xaf,0x0b,0xa7,0x70); +DEFINE_GUID(DMOVideoFormat_RGB555,D3DFMT_X1R5G5B5,0x524f,0x11ce,0x9f,0x53,0x00,0x20,0xaf,0x0b,0xa7,0x70); +DEFINE_GUID(DMOVideoFormat_RGB8,D3DFMT_P8,0x524f,0x11ce,0x9f,0x53,0x00,0x20,0xaf,0x0b,0xa7,0x70); + +static HRESULT WINAPI color_converter_factory_CreateInstance(IClassFactory *iface, IUnknown *outer, + REFIID riid, void **out) +{ + static const GUID CLSID_wg_color_converter = {0xf47e2da5,0xe370,0x47b7,{0x90,0x3a,0x07,0x8d,0xdd,0x45,0xa5,0xcc}}; + return CoCreateInstance(&CLSID_wg_color_converter, outer, CLSCTX_INPROC_SERVER, riid, out); +} + +static HRESULT WINAPI class_factory_QueryInterface(IClassFactory *iface, REFIID riid, void **out) +{ + *out = IsEqualGUID(riid, &IID_IClassFactory) || IsEqualGUID(riid, &IID_IUnknown) ? iface : NULL; + return *out ? S_OK : E_NOINTERFACE; +} +static ULONG WINAPI class_factory_AddRef(IClassFactory *iface) +{ + return 2; +} +static ULONG WINAPI class_factory_Release(IClassFactory *iface) +{ + return 1; +} +static HRESULT WINAPI class_factory_LockServer(IClassFactory *iface, BOOL dolock) +{ + return S_OK; +} + +static const IClassFactoryVtbl color_converter_factory_vtbl = +{ + class_factory_QueryInterface, + class_factory_AddRef, + class_factory_Release, + color_converter_factory_CreateInstance, + class_factory_LockServer, +}; + +static IClassFactory color_converter_factory = {&color_converter_factory_vtbl}; + +/*********************************************************************** + * DllGetClassObject (colorcnv.@) + */ +HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void **out) +{ + if (IsEqualGUID(clsid, &CLSID_CColorConvertDMO)) + return IClassFactory_QueryInterface(&color_converter_factory, riid, out); + + *out = NULL; + FIXME("Unknown clsid %s.\n", debugstr_guid(clsid)); + return CLASS_E_CLASSNOTAVAILABLE; +} + +/*********************************************************************** + * DllRegisterServer (colorcnv.@) + */ +HRESULT WINAPI DllRegisterServer(void) +{ + MFT_REGISTER_TYPE_INFO color_converter_mft_inputs[] = + { + {MFMediaType_Video, MFVideoFormat_YV12}, + {MFMediaType_Video, MFVideoFormat_YUY2}, + {MFMediaType_Video, MFVideoFormat_UYVY}, + {MFMediaType_Video, MFVideoFormat_AYUV}, + {MFMediaType_Video, MFVideoFormat_NV12}, + {MFMediaType_Video, DMOVideoFormat_RGB32}, + {MFMediaType_Video, DMOVideoFormat_RGB565}, + {MFMediaType_Video, MFVideoFormat_I420}, + {MFMediaType_Video, MFVideoFormat_IYUV}, + {MFMediaType_Video, MFVideoFormat_YVYU}, + {MFMediaType_Video, DMOVideoFormat_RGB24}, + {MFMediaType_Video, DMOVideoFormat_RGB555}, + {MFMediaType_Video, DMOVideoFormat_RGB8}, + {MFMediaType_Video, MEDIASUBTYPE_V216}, + {MFMediaType_Video, MEDIASUBTYPE_V410}, + {MFMediaType_Video, MFVideoFormat_NV11}, + {MFMediaType_Video, MFVideoFormat_Y41P}, + {MFMediaType_Video, MFVideoFormat_Y41T}, + {MFMediaType_Video, MFVideoFormat_Y42T}, + {MFMediaType_Video, MFVideoFormat_YVU9}, + }; + MFT_REGISTER_TYPE_INFO color_converter_mft_outputs[] = + { + {MFMediaType_Video, MFVideoFormat_YV12}, + {MFMediaType_Video, MFVideoFormat_YUY2}, + {MFMediaType_Video, MFVideoFormat_UYVY}, + {MFMediaType_Video, MFVideoFormat_AYUV}, + {MFMediaType_Video, MFVideoFormat_NV12}, + {MFMediaType_Video, DMOVideoFormat_RGB32}, + {MFMediaType_Video, DMOVideoFormat_RGB565}, + {MFMediaType_Video, MFVideoFormat_I420}, + {MFMediaType_Video, MFVideoFormat_IYUV}, + {MFMediaType_Video, MFVideoFormat_YVYU}, + {MFMediaType_Video, DMOVideoFormat_RGB24}, + {MFMediaType_Video, DMOVideoFormat_RGB555}, + {MFMediaType_Video, DMOVideoFormat_RGB8}, + {MFMediaType_Video, MEDIASUBTYPE_V216}, + {MFMediaType_Video, MEDIASUBTYPE_V410}, + {MFMediaType_Video, MFVideoFormat_NV11}, + }; + DMO_PARTIAL_MEDIATYPE color_converter_dmo_inputs[] = + { + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_YV12}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_YUY2}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_UYVY}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_AYUV}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_NV12}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB32}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB565}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_I420}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_IYUV}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_YVYU}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB24}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB555}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB8}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_V216}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_V410}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_NV11}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_Y41P}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_Y41T}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_Y42T}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_YVU9}, + }; + DMO_PARTIAL_MEDIATYPE color_converter_dmo_outputs[] = + { + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_YV12}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_YUY2}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_UYVY}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_AYUV}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_NV12}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB32}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB565}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_I420}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_IYUV}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_YVYU}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB24}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB555}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB8}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_V216}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_V410}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_NV11}, + }; + HRESULT hr; + + TRACE("\n"); + + if (FAILED(hr = __wine_register_resources())) + return hr; + if (FAILED(hr = MFTRegister(CLSID_CColorConvertDMO, MFT_CATEGORY_VIDEO_EFFECT, + (WCHAR *)L"Color Converter MFT", MFT_ENUM_FLAG_SYNCMFT, + ARRAY_SIZE(color_converter_mft_inputs), color_converter_mft_inputs, + ARRAY_SIZE(color_converter_mft_outputs), color_converter_mft_outputs, NULL))) + return hr; + if (FAILED(hr = DMORegister(L"Color Converter DMO", &CLSID_CColorConvertDMO, &DMOCATEGORY_VIDEO_EFFECT, 0, + ARRAY_SIZE(color_converter_dmo_inputs), color_converter_dmo_inputs, + ARRAY_SIZE(color_converter_dmo_outputs), color_converter_dmo_outputs))) + return hr; + + return S_OK; +} + +/*********************************************************************** + * DllUnregisterServer (colorcnv.@) + */ +HRESULT WINAPI DllUnregisterServer(void) +{ + HRESULT hr; + + TRACE("\n"); + + if (FAILED(hr = __wine_unregister_resources())) + return hr; + if (FAILED(hr = MFTUnregister(CLSID_CColorConvertDMO))) + return hr; + if (FAILED(hr = DMOUnregister(&CLSID_CColorConvertDMO, &DMOCATEGORY_VIDEO_EFFECT))) + return hr; + + return S_OK; +} diff --git a/dlls/colorcnv/colorcnv.idl b/dlls/colorcnv/colorcnv.idl new file mode 100644 index 00000000000..346821b385e --- /dev/null +++ b/dlls/colorcnv/colorcnv.idl @@ -0,0 +1,25 @@ +/* + * Copyright 2024 Rémi Bernon 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 + +[ + threading(both), + uuid(98230571-0087-4204-b020-3282538e57d3) +] +coclass CColorConvertDMO {} diff --git a/dlls/colorcnv/colorcnv.spec b/dlls/colorcnv/colorcnv.spec new file mode 100644 index 00000000000..b717c9c9371 --- /dev/null +++ b/dlls/colorcnv/colorcnv.spec @@ -0,0 +1,3 @@ +@ stdcall -private DllGetClassObject(ptr ptr ptr) +@ stdcall -private DllRegisterServer() +@ stdcall -private DllUnregisterServer() diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c index 54058f57ba5..0a968bdfdaf 100644 --- a/dlls/winegstreamer/main.c +++ b/dlls/winegstreamer/main.c @@ -991,6 +991,7 @@ static struct class_factory mpeg4_sink_class_factory_cf = {{&class_factory_vtbl}
HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **out) { + static const GUID CLSID_wg_color_converter = {0xf47e2da5,0xe370,0x47b7,{0x90,0x3a,0x07,0x8d,0xdd,0x45,0xa5,0xcc}}; static const GUID CLSID_wg_mp3_sink_factory = {0x1f302877,0xaaab,0x40a3,{0xb9,0xe0,0x9f,0x48,0xda,0xf3,0x5b,0xc8}}; static const GUID CLSID_wg_mpeg4_sink_factory = {0x5d5407d9,0xc6ca,0x4770,{0xa7,0xcc,0x27,0xc0,0xcb,0x8a,0x76,0x27}}; struct class_factory *factory; @@ -1024,7 +1025,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **out) factory = &wmv_decoder_cf; else if (IsEqualGUID(clsid, &CLSID_CResamplerMediaObject)) factory = &resampler_cf; - else if (IsEqualGUID(clsid, &CLSID_CColorConvertDMO)) + else if (IsEqualGUID(clsid, &CLSID_wg_color_converter)) factory = &color_convert_cf; else if (IsEqualGUID(clsid, &CLSID_wg_mp3_sink_factory)) factory = &mp3_sink_class_factory_cf; @@ -1338,48 +1339,6 @@ HRESULT WINAPI DllRegisterServer(void) {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_WVP2}, {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_VC1S}, }; - DMO_PARTIAL_MEDIATYPE color_convert_input[20] = - { - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_YV12}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_YUY2}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_UYVY}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_AYUV}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_NV12}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB32}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB565}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_I420}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_IYUV}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_YVYU}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB24}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB555}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB8}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_V216}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_V410}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_NV11}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_Y41P}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_Y41T}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_Y42T}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_YVU9}, - }; - DMO_PARTIAL_MEDIATYPE color_convert_output[16] = - { - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_YV12}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_YUY2}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_UYVY}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_AYUV}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_NV12}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB32}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB565}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_I420}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_IYUV}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_YVYU}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB24}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB555}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB8}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_V216}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_V410}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_NV11}, - };
IFilterMapper2 *mapper; HRESULT hr; @@ -1417,9 +1376,6 @@ HRESULT WINAPI DllRegisterServer(void) if (FAILED(hr = DMORegister(L"Resampler DMO", &CLSID_CResamplerMediaObject, &DMOCATEGORY_AUDIO_EFFECT, 0, ARRAY_SIZE(audio_convert_types), audio_convert_types, ARRAY_SIZE(audio_convert_types), audio_convert_types))) return hr; - if (FAILED(hr = DMORegister(L"Color Converter DMO", &CLSID_CColorConvertDMO, &DMOCATEGORY_VIDEO_EFFECT, - 0, ARRAY_SIZE(color_convert_input), color_convert_input, ARRAY_SIZE(color_convert_output), color_convert_output))) - return hr;
return mfplat_DllRegisterServer(); } @@ -1448,8 +1404,6 @@ HRESULT WINAPI DllUnregisterServer(void)
IFilterMapper2_Release(mapper);
- if (FAILED(hr = DMOUnregister(&CLSID_CColorConvertDMO, &DMOCATEGORY_VIDEO_EFFECT))) - return hr; if (FAILED(hr = DMOUnregister(&CLSID_CResamplerMediaObject, &DMOCATEGORY_AUDIO_EFFECT))) return hr; if (FAILED(hr = DMOUnregister(&CLSID_WMADecMediaObject, &DMOCATEGORY_AUDIO_DECODER))) diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index d84939ce13d..5df15388066 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -298,49 +298,6 @@ HRESULT mfplat_DllRegisterServer(void) {MFMediaType_Video, DMOVideoFormat_RGB8}, };
- MFT_REGISTER_TYPE_INFO color_convert_input_types[] = - { - {MFMediaType_Video, MFVideoFormat_YV12}, - {MFMediaType_Video, MFVideoFormat_YUY2}, - {MFMediaType_Video, MFVideoFormat_UYVY}, - {MFMediaType_Video, MFVideoFormat_AYUV}, - {MFMediaType_Video, MFVideoFormat_NV12}, - {MFMediaType_Video, DMOVideoFormat_RGB32}, - {MFMediaType_Video, DMOVideoFormat_RGB565}, - {MFMediaType_Video, MFVideoFormat_I420}, - {MFMediaType_Video, MFVideoFormat_IYUV}, - {MFMediaType_Video, MFVideoFormat_YVYU}, - {MFMediaType_Video, DMOVideoFormat_RGB24}, - {MFMediaType_Video, DMOVideoFormat_RGB555}, - {MFMediaType_Video, DMOVideoFormat_RGB8}, - {MFMediaType_Video, MEDIASUBTYPE_V216}, - {MFMediaType_Video, MEDIASUBTYPE_V410}, - {MFMediaType_Video, MFVideoFormat_NV11}, - {MFMediaType_Video, MFVideoFormat_Y41P}, - {MFMediaType_Video, MFVideoFormat_Y41T}, - {MFMediaType_Video, MFVideoFormat_Y42T}, - {MFMediaType_Video, MFVideoFormat_YVU9}, - }; - MFT_REGISTER_TYPE_INFO color_convert_output_types[] = - { - {MFMediaType_Video, MFVideoFormat_YV12}, - {MFMediaType_Video, MFVideoFormat_YUY2}, - {MFMediaType_Video, MFVideoFormat_UYVY}, - {MFMediaType_Video, MFVideoFormat_AYUV}, - {MFMediaType_Video, MFVideoFormat_NV12}, - {MFMediaType_Video, DMOVideoFormat_RGB32}, - {MFMediaType_Video, DMOVideoFormat_RGB565}, - {MFMediaType_Video, MFVideoFormat_I420}, - {MFMediaType_Video, MFVideoFormat_IYUV}, - {MFMediaType_Video, MFVideoFormat_YVYU}, - {MFMediaType_Video, DMOVideoFormat_RGB24}, - {MFMediaType_Video, DMOVideoFormat_RGB555}, - {MFMediaType_Video, DMOVideoFormat_RGB8}, - {MFMediaType_Video, MEDIASUBTYPE_V216}, - {MFMediaType_Video, MEDIASUBTYPE_V410}, - {MFMediaType_Video, MFVideoFormat_NV11}, - }; - struct mft { GUID clsid; @@ -424,16 +381,6 @@ HRESULT mfplat_DllRegisterServer(void) ARRAY_SIZE(resampler_types), resampler_types, }, - { - CLSID_CColorConvertDMO, - MFT_CATEGORY_VIDEO_EFFECT, - L"Color Converter MFT", - MFT_ENUM_FLAG_SYNCMFT, - ARRAY_SIZE(color_convert_input_types), - color_convert_input_types, - ARRAY_SIZE(color_convert_output_types), - color_convert_output_types, - }, };
unsigned int i; diff --git a/dlls/winegstreamer/winegstreamer_classes.idl b/dlls/winegstreamer/winegstreamer_classes.idl index c960051428d..53a46a09d38 100644 --- a/dlls/winegstreamer/winegstreamer_classes.idl +++ b/dlls/winegstreamer/winegstreamer_classes.idl @@ -121,9 +121,9 @@ coclass CResamplerMediaObject {}
[ threading(both), - uuid(98230571-0087-4204-b020-3282538e57d3) + uuid(f47e2da5-e370-47b7-903a-078ddd45a5cc) ] -coclass CColorConvertDMO {} +coclass wg_color_converter {}
[ threading(both), diff --git a/loader/wine.inf.in b/loader/wine.inf.in index f300700b0f8..8df38973681 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2103,6 +2103,7 @@ HKLM,%CurrentVersion%\Telephony\Country List\998,"SameAreaRule",,"G" 11,,shell32.dll,1 11,,quartz.dll,1
+11,,colorcnv.dll,1 11,,cryptdlg.dll,1 11,,cryptnet.dll,1 11,,devenum.dll,1
From: Rémi Bernon rbernon@codeweavers.com
--- configure.ac | 1 + dlls/msvproc/Makefile.in | 6 + dlls/msvproc/msvproc.c | 174 +++++++++++++++++++ dlls/msvproc/msvproc.idl | 25 +++ dlls/msvproc/msvproc.spec | 4 + dlls/winegstreamer/mfplat.c | 63 +------ dlls/winegstreamer/winegstreamer_classes.idl | 4 +- loader/wine.inf.in | 1 + 8 files changed, 215 insertions(+), 63 deletions(-) create mode 100644 dlls/msvproc/Makefile.in create mode 100644 dlls/msvproc/msvproc.c create mode 100644 dlls/msvproc/msvproc.idl create mode 100644 dlls/msvproc/msvproc.spec
diff --git a/configure.ac b/configure.ac index ecc765b082a..12c308bcc8b 100644 --- a/configure.ac +++ b/configure.ac @@ -2949,6 +2949,7 @@ WINE_CONFIG_MAKEFILE(dlls/msvfw32) WINE_CONFIG_MAKEFILE(dlls/msvfw32/tests) WINE_CONFIG_MAKEFILE(dlls/msvidc32) WINE_CONFIG_MAKEFILE(dlls/msvideo.dll16,enable_win16) +WINE_CONFIG_MAKEFILE(dlls/msvproc) WINE_CONFIG_MAKEFILE(dlls/mswsock) WINE_CONFIG_MAKEFILE(dlls/msxml) WINE_CONFIG_MAKEFILE(dlls/msxml2) diff --git a/dlls/msvproc/Makefile.in b/dlls/msvproc/Makefile.in new file mode 100644 index 00000000000..f98b4d6d44b --- /dev/null +++ b/dlls/msvproc/Makefile.in @@ -0,0 +1,6 @@ +MODULE = msvproc.dll +IMPORTS = combase mfplat mfuuid dmoguids dxguid strmiids wmcodecdspuuid uuid + +SOURCES = \ + msvproc.c \ + msvproc.idl diff --git a/dlls/msvproc/msvproc.c b/dlls/msvproc/msvproc.c new file mode 100644 index 00000000000..fdf6a1cddb1 --- /dev/null +++ b/dlls/msvproc/msvproc.c @@ -0,0 +1,174 @@ +/* + * Copyright 2024 Rémi Bernon 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 <stddef.h> +#include <stdarg.h> + +#define COBJMACROS +#include "windef.h" +#include "winbase.h" + +#include "d3d9.h" +#include "mfapi.h" +#include "mfidl.h" +#include "rpcproxy.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dmo); + +#include "initguid.h" + +DEFINE_MEDIATYPE_GUID(MFVideoFormat_ABGR32, D3DFMT_A8B8G8R8); +DEFINE_MEDIATYPE_GUID(MFVideoFormat_P208,MAKEFOURCC('P','2','0','8')); + +static HRESULT WINAPI video_processor_factory_CreateInstance(IClassFactory *iface, IUnknown *outer, + REFIID riid, void **out) +{ + static const GUID CLSID_wg_video_processor = {0xd527607f,0x89cb,0x4e94,{0x95,0x71,0xbc,0xfe,0x62,0x17,0x56,0x13}}; + return CoCreateInstance(&CLSID_wg_video_processor, outer, CLSCTX_INPROC_SERVER, riid, out); +} + +static HRESULT WINAPI class_factory_QueryInterface(IClassFactory *iface, REFIID riid, void **out) +{ + *out = IsEqualGUID(riid, &IID_IClassFactory) || IsEqualGUID(riid, &IID_IUnknown) ? iface : NULL; + return *out ? S_OK : E_NOINTERFACE; +} +static ULONG WINAPI class_factory_AddRef(IClassFactory *iface) +{ + return 2; +} +static ULONG WINAPI class_factory_Release(IClassFactory *iface) +{ + return 1; +} +static HRESULT WINAPI class_factory_LockServer(IClassFactory *iface, BOOL dolock) +{ + return S_OK; +} + +static const IClassFactoryVtbl video_processor_factory_vtbl = +{ + class_factory_QueryInterface, + class_factory_AddRef, + class_factory_Release, + video_processor_factory_CreateInstance, + class_factory_LockServer, +}; + +static IClassFactory video_processor_factory = {&video_processor_factory_vtbl}; + +/*********************************************************************** + * DllGetClassObject (msvproc.@) + */ +HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void **out) +{ + if (IsEqualGUID(clsid, &CLSID_VideoProcessorMFT)) + return IClassFactory_QueryInterface(&video_processor_factory, riid, out); + + *out = NULL; + FIXME("Unknown clsid %s.\n", debugstr_guid(clsid)); + return CLASS_E_CLASSNOTAVAILABLE; +} + +/*********************************************************************** + * DllRegisterServer (msvproc.@) + */ +HRESULT WINAPI DllRegisterServer(void) +{ + MFT_REGISTER_TYPE_INFO video_processor_mft_inputs[] = + { + {MFMediaType_Video, MFVideoFormat_IYUV}, + {MFMediaType_Video, MFVideoFormat_YV12}, + {MFMediaType_Video, MFVideoFormat_NV12}, + {MFMediaType_Video, MFVideoFormat_YUY2}, + {MFMediaType_Video, MFVideoFormat_ARGB32}, + {MFMediaType_Video, MFVideoFormat_RGB32}, + {MFMediaType_Video, MFVideoFormat_NV11}, + {MFMediaType_Video, MFVideoFormat_AYUV}, + {MFMediaType_Video, MFVideoFormat_UYVY}, + {MFMediaType_Video, MFVideoFormat_P208}, + {MFMediaType_Video, MFVideoFormat_RGB24}, + {MFMediaType_Video, MFVideoFormat_RGB555}, + {MFMediaType_Video, MFVideoFormat_RGB565}, + {MFMediaType_Video, MFVideoFormat_RGB8}, + {MFMediaType_Video, MFVideoFormat_I420}, + {MFMediaType_Video, MFVideoFormat_Y216}, + {MFMediaType_Video, MFVideoFormat_v410}, + {MFMediaType_Video, MFVideoFormat_Y41P}, + {MFMediaType_Video, MFVideoFormat_Y41T}, + {MFMediaType_Video, MFVideoFormat_Y42T}, + {MFMediaType_Video, MFVideoFormat_YVYU}, + {MFMediaType_Video, MFVideoFormat_420O}, + }; + MFT_REGISTER_TYPE_INFO video_processor_mft_outputs[] = + { + {MFMediaType_Video, MFVideoFormat_IYUV}, + {MFMediaType_Video, MFVideoFormat_YV12}, + {MFMediaType_Video, MFVideoFormat_NV12}, + {MFMediaType_Video, MFVideoFormat_YUY2}, + {MFMediaType_Video, MFVideoFormat_ARGB32}, + {MFMediaType_Video, MFVideoFormat_RGB32}, + {MFMediaType_Video, MFVideoFormat_NV11}, + {MFMediaType_Video, MFVideoFormat_AYUV}, + {MFMediaType_Video, MFVideoFormat_UYVY}, + {MFMediaType_Video, MFVideoFormat_P208}, + {MFMediaType_Video, MFVideoFormat_RGB24}, + {MFMediaType_Video, MFVideoFormat_RGB555}, + {MFMediaType_Video, MFVideoFormat_RGB565}, + {MFMediaType_Video, MFVideoFormat_RGB8}, + {MFMediaType_Video, MFVideoFormat_I420}, + {MFMediaType_Video, MFVideoFormat_Y216}, + {MFMediaType_Video, MFVideoFormat_v410}, + {MFMediaType_Video, MFVideoFormat_Y41P}, + {MFMediaType_Video, MFVideoFormat_Y41T}, + {MFMediaType_Video, MFVideoFormat_Y42T}, + {MFMediaType_Video, MFVideoFormat_YVYU}, + }; + + HRESULT hr; + + TRACE("\n"); + + if (FAILED(hr = __wine_register_resources())) + return hr; + if (FAILED(hr = MFTRegister(CLSID_VideoProcessorMFT, MFT_CATEGORY_VIDEO_PROCESSOR, + (WCHAR *)L"Microsoft Video Processor MFT", MFT_ENUM_FLAG_SYNCMFT, + ARRAY_SIZE(video_processor_mft_inputs), video_processor_mft_inputs, + ARRAY_SIZE(video_processor_mft_outputs), video_processor_mft_outputs, NULL))) + return hr; + + return S_OK; +} + +/*********************************************************************** + * DllUnregisterServer (msvproc.@) + */ +HRESULT WINAPI DllUnregisterServer(void) +{ + HRESULT hr; + + TRACE("\n"); + + if (FAILED(hr = __wine_unregister_resources())) + return hr; + if (FAILED(hr = MFTUnregister(CLSID_VideoProcessorMFT))) + return hr; + + return S_OK; +} diff --git a/dlls/msvproc/msvproc.idl b/dlls/msvproc/msvproc.idl new file mode 100644 index 00000000000..c64155fd265 --- /dev/null +++ b/dlls/msvproc/msvproc.idl @@ -0,0 +1,25 @@ +/* + * Copyright 2024 Rémi Bernon 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 + +[ + threading(both), + uuid(88753b26-5b24-49bd-b2e7-0c445c78c982) +] +coclass VideoProcessorMFT {} diff --git a/dlls/msvproc/msvproc.spec b/dlls/msvproc/msvproc.spec new file mode 100644 index 00000000000..b16365d0c9f --- /dev/null +++ b/dlls/msvproc/msvproc.spec @@ -0,0 +1,4 @@ +@ stdcall -private DllCanUnloadNow() +@ stdcall -private DllGetClassObject(ptr ptr ptr) +@ stdcall -private DllRegisterServer() +@ stdcall -private DllUnregisterServer() diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index 5df15388066..ca2227656d9 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -121,6 +121,7 @@ static const IClassFactoryVtbl class_factory_vtbl = };
static const GUID CLSID_GStreamerByteStreamHandler = {0x317df618, 0x5e5a, 0x468a, {0x9f, 0x15, 0xd8, 0x27, 0xa9, 0xa0, 0x81, 0x62}}; +static const GUID CLSID_wg_video_processor = {0xd527607f,0x89cb,0x4e94,{0x95,0x71,0xbc,0xfe,0x62,0x17,0x56,0x13}};
static const struct class_object { @@ -129,7 +130,7 @@ static const struct class_object } class_objects[] = { - { &CLSID_VideoProcessorMFT, &video_processor_create }, + { &CLSID_wg_video_processor, &video_processor_create }, { &CLSID_GStreamerByteStreamHandler, &gstreamer_byte_stream_handler_create }, { &CLSID_MSAACDecMFT, &aac_decoder_create }, { &CLSID_MSH264DecoderMFT, &h264_decoder_create }, @@ -221,56 +222,6 @@ HRESULT mfplat_DllRegisterServer(void) {MFMediaType_Video, MFVideoFormat_H264}, };
- MFT_REGISTER_TYPE_INFO video_processor_input_types[] = - { - {MFMediaType_Video, MFVideoFormat_IYUV}, - {MFMediaType_Video, MFVideoFormat_YV12}, - {MFMediaType_Video, MFVideoFormat_NV12}, - {MFMediaType_Video, MFVideoFormat_YUY2}, - {MFMediaType_Video, MFVideoFormat_ARGB32}, - {MFMediaType_Video, MFVideoFormat_RGB32}, - {MFMediaType_Video, MFVideoFormat_NV11}, - {MFMediaType_Video, MFVideoFormat_AYUV}, - {MFMediaType_Video, MFVideoFormat_UYVY}, - {MFMediaType_Video, MEDIASUBTYPE_P208}, - {MFMediaType_Video, MFVideoFormat_RGB24}, - {MFMediaType_Video, MFVideoFormat_RGB555}, - {MFMediaType_Video, MFVideoFormat_RGB565}, - {MFMediaType_Video, MFVideoFormat_RGB8}, - {MFMediaType_Video, MFVideoFormat_I420}, - {MFMediaType_Video, MFVideoFormat_Y216}, - {MFMediaType_Video, MFVideoFormat_v410}, - {MFMediaType_Video, MFVideoFormat_Y41P}, - {MFMediaType_Video, MFVideoFormat_Y41T}, - {MFMediaType_Video, MFVideoFormat_Y42T}, - {MFMediaType_Video, MFVideoFormat_YVYU}, - {MFMediaType_Video, MFVideoFormat_420O}, - }; - MFT_REGISTER_TYPE_INFO video_processor_output_types[] = - { - {MFMediaType_Video, MFVideoFormat_IYUV}, - {MFMediaType_Video, MFVideoFormat_YV12}, - {MFMediaType_Video, MFVideoFormat_NV12}, - {MFMediaType_Video, MFVideoFormat_YUY2}, - {MFMediaType_Video, MFVideoFormat_ARGB32}, - {MFMediaType_Video, MFVideoFormat_RGB32}, - {MFMediaType_Video, MFVideoFormat_NV11}, - {MFMediaType_Video, MFVideoFormat_AYUV}, - {MFMediaType_Video, MFVideoFormat_UYVY}, - {MFMediaType_Video, MEDIASUBTYPE_P208}, - {MFMediaType_Video, MFVideoFormat_RGB24}, - {MFMediaType_Video, MFVideoFormat_RGB555}, - {MFMediaType_Video, MFVideoFormat_RGB565}, - {MFMediaType_Video, MFVideoFormat_RGB8}, - {MFMediaType_Video, MFVideoFormat_I420}, - {MFMediaType_Video, MFVideoFormat_Y216}, - {MFMediaType_Video, MFVideoFormat_v410}, - {MFMediaType_Video, MFVideoFormat_Y41P}, - {MFMediaType_Video, MFVideoFormat_Y41T}, - {MFMediaType_Video, MFVideoFormat_Y42T}, - {MFMediaType_Video, MFVideoFormat_YVYU}, - }; - MFT_REGISTER_TYPE_INFO wmv_decoder_input_types[] = { {MFMediaType_Video, MFVideoFormat_WMV1}, @@ -361,16 +312,6 @@ HRESULT mfplat_DllRegisterServer(void) ARRAY_SIZE(wmv_decoder_output_types), wmv_decoder_output_types, }, - { - CLSID_VideoProcessorMFT, - MFT_CATEGORY_VIDEO_PROCESSOR, - L"Microsoft Video Processor MFT", - MFT_ENUM_FLAG_SYNCMFT, - ARRAY_SIZE(video_processor_input_types), - video_processor_input_types, - ARRAY_SIZE(video_processor_output_types), - video_processor_output_types, - }, { CLSID_CResamplerMediaObject, MFT_CATEGORY_AUDIO_EFFECT, diff --git a/dlls/winegstreamer/winegstreamer_classes.idl b/dlls/winegstreamer/winegstreamer_classes.idl index 53a46a09d38..421424a9577 100644 --- a/dlls/winegstreamer/winegstreamer_classes.idl +++ b/dlls/winegstreamer/winegstreamer_classes.idl @@ -72,9 +72,9 @@ coclass decodebin_parser {}
[ threading(both), - uuid(88753b26-5b24-49bd-b2e7-0c445c78c982) + uuid(d527607f-89cb-4e94-9571-bcfe62175613) ] -coclass VideoProcessorMFT {} +coclass wg_video_processor {}
[ helpstring("Generic Decodebin Byte Stream Handler"), diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 8df38973681..a529a9d9408 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2113,6 +2113,7 @@ HKLM,%CurrentVersion%\Telephony\Country List\998,"SameAreaRule",,"G" 11,,mscoree.dll,1 11,,mshtml.dll,1 11,,msisip.dll,1 +11,,msvproc.dll,1 11,,qcap.dll,1 11,,qedit.dll,1 11,,urlmon.dll,1
From: Rémi Bernon rbernon@codeweavers.com
--- configure.ac | 1 + dlls/resampledmo/Makefile.in | 6 + dlls/resampledmo/resampledmo.c | 136 +++++++++++++++++++ dlls/resampledmo/resampledmo.idl | 25 ++++ dlls/resampledmo/resampledmo.spec | 4 + dlls/winegstreamer/main.c | 13 +- dlls/winegstreamer/mfplat.c | 16 --- dlls/winegstreamer/winegstreamer_classes.idl | 4 +- loader/wine.inf.in | 1 + 9 files changed, 177 insertions(+), 29 deletions(-) create mode 100644 dlls/resampledmo/Makefile.in create mode 100644 dlls/resampledmo/resampledmo.c create mode 100644 dlls/resampledmo/resampledmo.idl create mode 100644 dlls/resampledmo/resampledmo.spec
diff --git a/configure.ac b/configure.ac index 12c308bcc8b..56f24f721df 100644 --- a/configure.ac +++ b/configure.ac @@ -3063,6 +3063,7 @@ WINE_CONFIG_MAKEFILE(dlls/rasapi32) WINE_CONFIG_MAKEFILE(dlls/rasapi32/tests) WINE_CONFIG_MAKEFILE(dlls/rasdlg) WINE_CONFIG_MAKEFILE(dlls/regapi) +WINE_CONFIG_MAKEFILE(dlls/resampledmo) WINE_CONFIG_MAKEFILE(dlls/resutils) WINE_CONFIG_MAKEFILE(dlls/riched20) WINE_CONFIG_MAKEFILE(dlls/riched20/tests) diff --git a/dlls/resampledmo/Makefile.in b/dlls/resampledmo/Makefile.in new file mode 100644 index 00000000000..73c59999c02 --- /dev/null +++ b/dlls/resampledmo/Makefile.in @@ -0,0 +1,6 @@ +MODULE = resampledmo.dll +IMPORTS = combase mfplat msdmo mfuuid dmoguids strmiids wmcodecdspuuid uuid + +SOURCES = \ + resampledmo.c \ + resampledmo.idl diff --git a/dlls/resampledmo/resampledmo.c b/dlls/resampledmo/resampledmo.c new file mode 100644 index 00000000000..486a379b7de --- /dev/null +++ b/dlls/resampledmo/resampledmo.c @@ -0,0 +1,136 @@ +/* + * Copyright 2024 Rémi Bernon 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 <stddef.h> +#include <stdarg.h> + +#define COBJMACROS +#include "windef.h" +#include "winbase.h" + +#include "dmoreg.h" +#include "dshow.h" +#include "mfapi.h" +#include "rpcproxy.h" +#include "wmcodecdsp.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dmo); + +static HRESULT WINAPI resampler_factory_CreateInstance(IClassFactory *iface, IUnknown *outer, + REFIID riid, void **out) +{ + static const GUID CLSID_wg_resampler = {0x92f35e78,0x15a5,0x486b,{0x88,0x8e,0x57,0x5f,0x99,0x65,0x1c,0xe2}}; + return CoCreateInstance(&CLSID_wg_resampler, outer, CLSCTX_INPROC_SERVER, riid, out); +} + +static HRESULT WINAPI class_factory_QueryInterface(IClassFactory *iface, REFIID riid, void **out) +{ + *out = IsEqualGUID(riid, &IID_IClassFactory) || IsEqualGUID(riid, &IID_IUnknown) ? iface : NULL; + return *out ? S_OK : E_NOINTERFACE; +} +static ULONG WINAPI class_factory_AddRef(IClassFactory *iface) +{ + return 2; +} +static ULONG WINAPI class_factory_Release(IClassFactory *iface) +{ + return 1; +} +static HRESULT WINAPI class_factory_LockServer(IClassFactory *iface, BOOL dolock) +{ + return S_OK; +} + +static const IClassFactoryVtbl resampler_factory_vtbl = +{ + class_factory_QueryInterface, + class_factory_AddRef, + class_factory_Release, + resampler_factory_CreateInstance, + class_factory_LockServer, +}; + +static IClassFactory resampler_factory = {&resampler_factory_vtbl}; + +/*********************************************************************** + * DllGetClassObject (resampledmo.@) + */ +HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void **out) +{ + if (IsEqualGUID(clsid, &CLSID_CResamplerMediaObject)) + return IClassFactory_QueryInterface(&resampler_factory, riid, out); + + *out = NULL; + FIXME("Unknown clsid %s.\n", debugstr_guid(clsid)); + return CLASS_E_CLASSNOTAVAILABLE; +} + +/*********************************************************************** + * DllRegisterServer (resampledmo.@) + */ +HRESULT WINAPI DllRegisterServer(void) +{ + MFT_REGISTER_TYPE_INFO resampler_mft_types[] = + { + {MFMediaType_Audio, MFAudioFormat_PCM}, + {MFMediaType_Audio, MFAudioFormat_Float}, + }; + DMO_PARTIAL_MEDIATYPE resampler_dmo_types[] = + { + {.type = MEDIATYPE_Audio, .subtype = MEDIASUBTYPE_PCM}, + {.type = MEDIATYPE_Audio, .subtype = MEDIASUBTYPE_IEEE_FLOAT}, + }; + HRESULT hr; + + TRACE("\n"); + + if (FAILED(hr = __wine_register_resources())) + return hr; + if (FAILED(hr = MFTRegister(CLSID_CResamplerMediaObject, MFT_CATEGORY_AUDIO_EFFECT, + (WCHAR *)L"Resampler MFT", MFT_ENUM_FLAG_SYNCMFT, + ARRAY_SIZE(resampler_mft_types), resampler_mft_types, + ARRAY_SIZE(resampler_mft_types), resampler_mft_types, NULL))) + return hr; + if (FAILED(hr = DMORegister(L"Resampler DMO", &CLSID_CResamplerMediaObject, &DMOCATEGORY_AUDIO_EFFECT, 0, + ARRAY_SIZE(resampler_dmo_types), resampler_dmo_types, + ARRAY_SIZE(resampler_dmo_types), resampler_dmo_types))) + return hr; + + return S_OK; +} + +/*********************************************************************** + * DllUnregisterServer (resampledmo.@) + */ +HRESULT WINAPI DllUnregisterServer(void) +{ + HRESULT hr; + + TRACE("\n"); + + if (FAILED(hr = __wine_unregister_resources())) + return hr; + if (FAILED(hr = MFTUnregister(CLSID_CResamplerMediaObject))) + return hr; + if (FAILED(hr = DMOUnregister(&CLSID_CResamplerMediaObject, &DMOCATEGORY_AUDIO_EFFECT))) + return hr; + + return S_OK; +} diff --git a/dlls/resampledmo/resampledmo.idl b/dlls/resampledmo/resampledmo.idl new file mode 100644 index 00000000000..40069e6d63f --- /dev/null +++ b/dlls/resampledmo/resampledmo.idl @@ -0,0 +1,25 @@ +/* + * Copyright 2024 Rémi Bernon 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 + +[ + threading(both), + uuid(f447b69e-1884-4a7e-8055-346f74d6edb3) +] +coclass CResamplerMediaObject {} diff --git a/dlls/resampledmo/resampledmo.spec b/dlls/resampledmo/resampledmo.spec new file mode 100644 index 00000000000..b16365d0c9f --- /dev/null +++ b/dlls/resampledmo/resampledmo.spec @@ -0,0 +1,4 @@ +@ stdcall -private DllCanUnloadNow() +@ stdcall -private DllGetClassObject(ptr ptr ptr) +@ stdcall -private DllRegisterServer() +@ stdcall -private DllUnregisterServer() diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c index 0a968bdfdaf..ccb3e9f52e5 100644 --- a/dlls/winegstreamer/main.c +++ b/dlls/winegstreamer/main.c @@ -994,6 +994,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **out) static const GUID CLSID_wg_color_converter = {0xf47e2da5,0xe370,0x47b7,{0x90,0x3a,0x07,0x8d,0xdd,0x45,0xa5,0xcc}}; static const GUID CLSID_wg_mp3_sink_factory = {0x1f302877,0xaaab,0x40a3,{0xb9,0xe0,0x9f,0x48,0xda,0xf3,0x5b,0xc8}}; static const GUID CLSID_wg_mpeg4_sink_factory = {0x5d5407d9,0xc6ca,0x4770,{0xa7,0xcc,0x27,0xc0,0xcb,0x8a,0x76,0x27}}; + static const GUID CLSID_wg_resampler = {0x92f35e78,0x15a5,0x486b,{0x88,0x8e,0x57,0x5f,0x99,0x65,0x1c,0xe2}}; struct class_factory *factory; HRESULT hr;
@@ -1023,7 +1024,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **out) factory = &wma_decoder_cf; else if (IsEqualGUID(clsid, &CLSID_WMVDecoderMFT)) factory = &wmv_decoder_cf; - else if (IsEqualGUID(clsid, &CLSID_CResamplerMediaObject)) + else if (IsEqualGUID(clsid, &CLSID_wg_resampler)) factory = &resampler_cf; else if (IsEqualGUID(clsid, &CLSID_wg_color_converter)) factory = &color_convert_cf; @@ -1297,11 +1298,6 @@ static const REGFILTER2 reg_decodebin_parser =
HRESULT WINAPI DllRegisterServer(void) { - DMO_PARTIAL_MEDIATYPE audio_convert_types[2] = - { - {.type = MEDIATYPE_Audio, .subtype = MEDIASUBTYPE_PCM}, - {.type = MEDIATYPE_Audio, .subtype = MEDIASUBTYPE_IEEE_FLOAT}, - }; DMO_PARTIAL_MEDIATYPE wma_decoder_output[2] = { {.type = MEDIATYPE_Audio, .subtype = MEDIASUBTYPE_PCM}, @@ -1373,9 +1369,6 @@ HRESULT WINAPI DllRegisterServer(void) if (FAILED(hr = DMORegister(L"WMVideo Decoder DMO", &CLSID_WMVDecoderMFT, &DMOCATEGORY_VIDEO_DECODER, 0, ARRAY_SIZE(wmv_decoder_input), wmv_decoder_input, ARRAY_SIZE(wmv_decoder_output), wmv_decoder_output))) return hr; - if (FAILED(hr = DMORegister(L"Resampler DMO", &CLSID_CResamplerMediaObject, &DMOCATEGORY_AUDIO_EFFECT, - 0, ARRAY_SIZE(audio_convert_types), audio_convert_types, ARRAY_SIZE(audio_convert_types), audio_convert_types))) - return hr;
return mfplat_DllRegisterServer(); } @@ -1404,8 +1397,6 @@ HRESULT WINAPI DllUnregisterServer(void)
IFilterMapper2_Release(mapper);
- if (FAILED(hr = DMOUnregister(&CLSID_CResamplerMediaObject, &DMOCATEGORY_AUDIO_EFFECT))) - return hr; if (FAILED(hr = DMOUnregister(&CLSID_WMADecMediaObject, &DMOCATEGORY_AUDIO_DECODER))) return hr; if (FAILED(hr = DMOUnregister(&CLSID_WMVDecoderMFT, &DMOCATEGORY_VIDEO_DECODER))) diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index ca2227656d9..afa04f152dc 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -165,12 +165,6 @@ HRESULT mfplat_get_class_object(REFCLSID rclsid, REFIID riid, void **obj)
HRESULT mfplat_DllRegisterServer(void) { - MFT_REGISTER_TYPE_INFO resampler_types[] = - { - {MFMediaType_Audio, MFAudioFormat_PCM}, - {MFMediaType_Audio, MFAudioFormat_Float}, - }; - MFT_REGISTER_TYPE_INFO aac_decoder_input_types[] = { {MFMediaType_Audio, MFAudioFormat_AAC}, @@ -312,16 +306,6 @@ HRESULT mfplat_DllRegisterServer(void) ARRAY_SIZE(wmv_decoder_output_types), wmv_decoder_output_types, }, - { - CLSID_CResamplerMediaObject, - MFT_CATEGORY_AUDIO_EFFECT, - L"Resampler MFT", - MFT_ENUM_FLAG_SYNCMFT, - ARRAY_SIZE(resampler_types), - resampler_types, - ARRAY_SIZE(resampler_types), - resampler_types, - }, };
unsigned int i; diff --git a/dlls/winegstreamer/winegstreamer_classes.idl b/dlls/winegstreamer/winegstreamer_classes.idl index 421424a9577..7b38084badc 100644 --- a/dlls/winegstreamer/winegstreamer_classes.idl +++ b/dlls/winegstreamer/winegstreamer_classes.idl @@ -115,9 +115,9 @@ coclass CMSH264EncoderMFT {}
[ threading(both), - uuid(f447b69e-1884-4a7e-8055-346f74d6edb3) + uuid(92f35e78-15a5-486b-888e-575f99651ce2) ] -coclass CResamplerMediaObject {} +coclass wg_resampler {}
[ threading(both), diff --git a/loader/wine.inf.in b/loader/wine.inf.in index a529a9d9408..cd862135cef 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2116,6 +2116,7 @@ HKLM,%CurrentVersion%\Telephony\Country List\998,"SameAreaRule",,"G" 11,,msvproc.dll,1 11,,qcap.dll,1 11,,qedit.dll,1 +11,,resampledmo.dll,1 11,,urlmon.dll,1 11,,windowscodecs.dll,1 11,,winegstreamer.dll,1
From: Rémi Bernon rbernon@codeweavers.com
--- configure.ac | 1 + dlls/winegstreamer/main.c | 20 +-- dlls/winegstreamer/mfplat.c | 23 --- dlls/winegstreamer/winegstreamer_classes.idl | 4 +- dlls/wmadmod/Makefile.in | 6 + dlls/wmadmod/wmadmod.c | 151 +++++++++++++++++++ dlls/wmadmod/wmadmod.idl | 25 +++ dlls/wmadmod/wmadmod.spec | 4 + loader/wine.inf.in | 1 + 9 files changed, 192 insertions(+), 43 deletions(-) create mode 100644 dlls/wmadmod/Makefile.in create mode 100644 dlls/wmadmod/wmadmod.c create mode 100644 dlls/wmadmod/wmadmod.idl create mode 100644 dlls/wmadmod/wmadmod.spec
diff --git a/configure.ac b/configure.ac index 56f24f721df..fc05179a940 100644 --- a/configure.ac +++ b/configure.ac @@ -3335,6 +3335,7 @@ WINE_CONFIG_MAKEFILE(dlls/wldap32) WINE_CONFIG_MAKEFILE(dlls/wldap32/tests) WINE_CONFIG_MAKEFILE(dlls/wldp) WINE_CONFIG_MAKEFILE(dlls/wldp/tests) +WINE_CONFIG_MAKEFILE(dlls/wmadmod) WINE_CONFIG_MAKEFILE(dlls/wmasf) WINE_CONFIG_MAKEFILE(dlls/wmi) WINE_CONFIG_MAKEFILE(dlls/wmiutils) diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c index ccb3e9f52e5..fbe5274f14a 100644 --- a/dlls/winegstreamer/main.c +++ b/dlls/winegstreamer/main.c @@ -995,6 +995,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **out) static const GUID CLSID_wg_mp3_sink_factory = {0x1f302877,0xaaab,0x40a3,{0xb9,0xe0,0x9f,0x48,0xda,0xf3,0x5b,0xc8}}; static const GUID CLSID_wg_mpeg4_sink_factory = {0x5d5407d9,0xc6ca,0x4770,{0xa7,0xcc,0x27,0xc0,0xcb,0x8a,0x76,0x27}}; static const GUID CLSID_wg_resampler = {0x92f35e78,0x15a5,0x486b,{0x88,0x8e,0x57,0x5f,0x99,0x65,0x1c,0xe2}}; + static const GUID CLSID_wg_wma_decoder = {0x5b4d4e54,0x0620,0x4cf9,{0x94,0xae,0x78,0x23,0x96,0x5c,0x28,0xb6}}; struct class_factory *factory; HRESULT hr;
@@ -1020,7 +1021,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **out) factory = &mpeg_splitter_cf; else if (IsEqualGUID(clsid, &CLSID_WAVEParser)) factory = &wave_parser_cf; - else if (IsEqualGUID(clsid, &CLSID_WMADecMediaObject)) + else if (IsEqualGUID(clsid, &CLSID_wg_wma_decoder)) factory = &wma_decoder_cf; else if (IsEqualGUID(clsid, &CLSID_WMVDecoderMFT)) factory = &wmv_decoder_cf; @@ -1298,18 +1299,6 @@ static const REGFILTER2 reg_decodebin_parser =
HRESULT WINAPI DllRegisterServer(void) { - DMO_PARTIAL_MEDIATYPE wma_decoder_output[2] = - { - {.type = MEDIATYPE_Audio, .subtype = MEDIASUBTYPE_PCM}, - {.type = MEDIATYPE_Audio, .subtype = MEDIASUBTYPE_IEEE_FLOAT}, - }; - DMO_PARTIAL_MEDIATYPE wma_decoder_input[4] = - { - {.type = MEDIATYPE_Audio, .subtype = MEDIASUBTYPE_MSAUDIO1}, - {.type = MEDIATYPE_Audio, .subtype = MEDIASUBTYPE_WMAUDIO2}, - {.type = MEDIATYPE_Audio, .subtype = MEDIASUBTYPE_WMAUDIO3}, - {.type = MEDIATYPE_Audio, .subtype = MEDIASUBTYPE_WMAUDIO_LOSSLESS}, - }; DMO_PARTIAL_MEDIATYPE wmv_decoder_output[11] = { {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_YV12}, @@ -1363,9 +1352,6 @@ HRESULT WINAPI DllRegisterServer(void)
IFilterMapper2_Release(mapper);
- if (FAILED(hr = DMORegister(L"WMAudio Decoder DMO", &CLSID_WMADecMediaObject, &DMOCATEGORY_AUDIO_DECODER, - 0, ARRAY_SIZE(wma_decoder_input), wma_decoder_input, ARRAY_SIZE(wma_decoder_output), wma_decoder_output))) - return hr; if (FAILED(hr = DMORegister(L"WMVideo Decoder DMO", &CLSID_WMVDecoderMFT, &DMOCATEGORY_VIDEO_DECODER, 0, ARRAY_SIZE(wmv_decoder_input), wmv_decoder_input, ARRAY_SIZE(wmv_decoder_output), wmv_decoder_output))) return hr; @@ -1397,8 +1383,6 @@ HRESULT WINAPI DllUnregisterServer(void)
IFilterMapper2_Release(mapper);
- if (FAILED(hr = DMOUnregister(&CLSID_WMADecMediaObject, &DMOCATEGORY_AUDIO_DECODER))) - return hr; if (FAILED(hr = DMOUnregister(&CLSID_WMVDecoderMFT, &DMOCATEGORY_VIDEO_DECODER))) return hr;
diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index afa04f152dc..e84d10d013e 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -177,19 +177,6 @@ HRESULT mfplat_DllRegisterServer(void) {MFMediaType_Audio, MFAudioFormat_PCM}, };
- MFT_REGISTER_TYPE_INFO wma_decoder_input_types[] = - { - {MFMediaType_Audio, MEDIASUBTYPE_MSAUDIO1}, - {MFMediaType_Audio, MFAudioFormat_WMAudioV8}, - {MFMediaType_Audio, MFAudioFormat_WMAudioV9}, - {MFMediaType_Audio, MFAudioFormat_WMAudio_Lossless}, - }; - MFT_REGISTER_TYPE_INFO wma_decoder_output_types[] = - { - {MFMediaType_Audio, MFAudioFormat_PCM}, - {MFMediaType_Audio, MFAudioFormat_Float}, - }; - MFT_REGISTER_TYPE_INFO h264_decoder_input_types[] = { {MFMediaType_Video, MFVideoFormat_H264}, @@ -266,16 +253,6 @@ HRESULT mfplat_DllRegisterServer(void) ARRAY_SIZE(aac_decoder_output_types), aac_decoder_output_types, }, - { - CLSID_WMADecMediaObject, - MFT_CATEGORY_AUDIO_DECODER, - L"WMAudio Decoder MFT", - MFT_ENUM_FLAG_SYNCMFT, - ARRAY_SIZE(wma_decoder_input_types), - wma_decoder_input_types, - ARRAY_SIZE(wma_decoder_output_types), - wma_decoder_output_types, - }, { CLSID_MSH264DecoderMFT, MFT_CATEGORY_VIDEO_DECODER, diff --git a/dlls/winegstreamer/winegstreamer_classes.idl b/dlls/winegstreamer/winegstreamer_classes.idl index 7b38084badc..3636e9863a9 100644 --- a/dlls/winegstreamer/winegstreamer_classes.idl +++ b/dlls/winegstreamer/winegstreamer_classes.idl @@ -85,9 +85,9 @@ coclass GStreamerByteStreamHandler {}
[ threading(both), - uuid(2eeb4adf-4578-4d10-bca7-bb955f56320a) + uuid(5b4d4e54-0620-4cf9-94ae-7823965c28b6) ] -coclass CWMADecMediaObject {}; +coclass wg_wma_decoder {};
[ threading(both), diff --git a/dlls/wmadmod/Makefile.in b/dlls/wmadmod/Makefile.in new file mode 100644 index 00000000000..bd22cb82b61 --- /dev/null +++ b/dlls/wmadmod/Makefile.in @@ -0,0 +1,6 @@ +MODULE = wmadmod.dll +IMPORTS = combase mfplat msdmo mfuuid dmoguids strmiids wmcodecdspuuid uuid + +SOURCES = \ + wmadmod.c \ + wmadmod.idl diff --git a/dlls/wmadmod/wmadmod.c b/dlls/wmadmod/wmadmod.c new file mode 100644 index 00000000000..3d619d93a35 --- /dev/null +++ b/dlls/wmadmod/wmadmod.c @@ -0,0 +1,151 @@ +/* + * Copyright 2024 Rémi Bernon 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 <stddef.h> +#include <stdarg.h> + +#define COBJMACROS +#include "windef.h" +#include "winbase.h" + +#include "dmoreg.h" +#include "dshow.h" +#include "mfapi.h" +#include "mfidl.h" +#include "rpcproxy.h" +#include "wmcodecdsp.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dmo); + +static HRESULT WINAPI wma_decoder_factory_CreateInstance(IClassFactory *iface, IUnknown *outer, + REFIID riid, void **out) +{ + static const GUID CLSID_wg_wma_decoder = {0x5b4d4e54,0x0620,0x4cf9,{0x94,0xae,0x78,0x23,0x96,0x5c,0x28,0xb6}}; + return CoCreateInstance(&CLSID_wg_wma_decoder, outer, CLSCTX_INPROC_SERVER, riid, out); +} + +static HRESULT WINAPI class_factory_QueryInterface(IClassFactory *iface, REFIID riid, void **out) +{ + *out = IsEqualGUID(riid, &IID_IClassFactory) || IsEqualGUID(riid, &IID_IUnknown) ? iface : NULL; + return *out ? S_OK : E_NOINTERFACE; +} +static ULONG WINAPI class_factory_AddRef(IClassFactory *iface) +{ + return 2; +} +static ULONG WINAPI class_factory_Release(IClassFactory *iface) +{ + return 1; +} +static HRESULT WINAPI class_factory_LockServer(IClassFactory *iface, BOOL dolock) +{ + return S_OK; +} + +static const IClassFactoryVtbl wma_decoder_factory_vtbl = +{ + class_factory_QueryInterface, + class_factory_AddRef, + class_factory_Release, + wma_decoder_factory_CreateInstance, + class_factory_LockServer, +}; + +static IClassFactory wma_decoder_factory = {&wma_decoder_factory_vtbl}; + +/*********************************************************************** + * DllGetClassObject (wmadmod.@) + */ +HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void **out) +{ + if (IsEqualGUID(clsid, &CLSID_WMADecMediaObject)) + return IClassFactory_QueryInterface(&wma_decoder_factory, riid, out); + + *out = NULL; + FIXME("Unknown clsid %s.\n", debugstr_guid(clsid)); + return CLASS_E_CLASSNOTAVAILABLE; +} + +/*********************************************************************** + * DllRegisterServer (wmadmod.@) + */ +HRESULT WINAPI DllRegisterServer(void) +{ + MFT_REGISTER_TYPE_INFO wma_decoder_mft_inputs[] = + { + {MFMediaType_Audio, MEDIASUBTYPE_MSAUDIO1}, + {MFMediaType_Audio, MFAudioFormat_WMAudioV8}, + {MFMediaType_Audio, MFAudioFormat_WMAudioV9}, + {MFMediaType_Audio, MFAudioFormat_WMAudio_Lossless}, + }; + MFT_REGISTER_TYPE_INFO wma_decoder_mft_outputs[] = + { + {MFMediaType_Audio, MFAudioFormat_PCM}, + {MFMediaType_Audio, MFAudioFormat_Float}, + }; + DMO_PARTIAL_MEDIATYPE wma_decoder_dmo_outputs[] = + { + {.type = MEDIATYPE_Audio, .subtype = MEDIASUBTYPE_PCM}, + {.type = MEDIATYPE_Audio, .subtype = MEDIASUBTYPE_IEEE_FLOAT}, + }; + DMO_PARTIAL_MEDIATYPE wma_decoder_dmo_inputs[] = + { + {.type = MEDIATYPE_Audio, .subtype = MEDIASUBTYPE_MSAUDIO1}, + {.type = MEDIATYPE_Audio, .subtype = MEDIASUBTYPE_WMAUDIO2}, + {.type = MEDIATYPE_Audio, .subtype = MEDIASUBTYPE_WMAUDIO3}, + {.type = MEDIATYPE_Audio, .subtype = MEDIASUBTYPE_WMAUDIO_LOSSLESS}, + }; + HRESULT hr; + + TRACE("\n"); + + if (FAILED(hr = __wine_register_resources())) + return hr; + if (FAILED(hr = MFTRegister(CLSID_WMADecMediaObject, MFT_CATEGORY_AUDIO_DECODER, + (WCHAR *)L"WMAudio Decoder MFT", MFT_ENUM_FLAG_SYNCMFT, + ARRAY_SIZE(wma_decoder_mft_inputs), wma_decoder_mft_inputs, + ARRAY_SIZE(wma_decoder_mft_outputs), wma_decoder_mft_outputs, NULL))) + return hr; + if (FAILED(hr = DMORegister(L"WMAudio Decoder DMO", &CLSID_WMADecMediaObject, &DMOCATEGORY_AUDIO_DECODER, 0, + ARRAY_SIZE(wma_decoder_dmo_inputs), wma_decoder_dmo_inputs, + ARRAY_SIZE(wma_decoder_dmo_outputs), wma_decoder_dmo_outputs))) + return hr; + + return S_OK; +} + +/*********************************************************************** + * DllUnregisterServer (wmadmod.@) + */ +HRESULT WINAPI DllUnregisterServer(void) +{ + HRESULT hr; + + TRACE("\n"); + + if (FAILED(hr = __wine_unregister_resources())) + return hr; + if (FAILED(hr = MFTUnregister(CLSID_WMADecMediaObject))) + return hr; + if (FAILED(hr = DMOUnregister(&CLSID_WMADecMediaObject, &DMOCATEGORY_AUDIO_DECODER))) + return hr; + + return S_OK; +} diff --git a/dlls/wmadmod/wmadmod.idl b/dlls/wmadmod/wmadmod.idl new file mode 100644 index 00000000000..4ca0507d651 --- /dev/null +++ b/dlls/wmadmod/wmadmod.idl @@ -0,0 +1,25 @@ +/* + * Copyright 2024 Rémi Bernon 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 + +[ + threading(both), + uuid(2eeb4adf-4578-4d10-bca7-bb955f56320a) +] +coclass CWMADecMediaObject {} diff --git a/dlls/wmadmod/wmadmod.spec b/dlls/wmadmod/wmadmod.spec new file mode 100644 index 00000000000..b16365d0c9f --- /dev/null +++ b/dlls/wmadmod/wmadmod.spec @@ -0,0 +1,4 @@ +@ stdcall -private DllCanUnloadNow() +@ stdcall -private DllGetClassObject(ptr ptr ptr) +@ stdcall -private DllRegisterServer() +@ stdcall -private DllUnregisterServer() diff --git a/loader/wine.inf.in b/loader/wine.inf.in index cd862135cef..278f7fedffc 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2124,6 +2124,7 @@ HKLM,%CurrentVersion%\Telephony\Country List\998,"SameAreaRule",,"G" 11,,winevulkan.dll,1 55,,winprint.dll,1 11,,wintrust.dll,1 +11,,wmadmod.dll,1 11,,iexplore.exe,1
; 32bit-only fake dlls
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/msauddecmft/Makefile.in | 4 +- dlls/msauddecmft/msauddecmft.c | 133 +++++++++++++++++++ dlls/msauddecmft/{main.c => msauddecmft.idl} | 16 +-- dlls/winegstreamer/mfplat.c | 25 +--- dlls/winegstreamer/winegstreamer_classes.idl | 4 +- loader/wine.inf.in | 1 + 6 files changed, 148 insertions(+), 35 deletions(-) create mode 100644 dlls/msauddecmft/msauddecmft.c rename dlls/msauddecmft/{main.c => msauddecmft.idl} (70%)
diff --git a/dlls/msauddecmft/Makefile.in b/dlls/msauddecmft/Makefile.in index e5b23ed11ee..e8590cbe18c 100644 --- a/dlls/msauddecmft/Makefile.in +++ b/dlls/msauddecmft/Makefile.in @@ -1,4 +1,6 @@ MODULE = msauddecmft.dll +IMPORTS = combase mfplat mfuuid dmoguids strmiids wmcodecdspuuid uuid
SOURCES = \ - main.c + msauddecmft.c \ + msauddecmft.idl diff --git a/dlls/msauddecmft/msauddecmft.c b/dlls/msauddecmft/msauddecmft.c new file mode 100644 index 00000000000..813d81387b5 --- /dev/null +++ b/dlls/msauddecmft/msauddecmft.c @@ -0,0 +1,133 @@ +/* + * Copyright 2024 Rémi Bernon 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 <stddef.h> +#include <stdarg.h> + +#define COBJMACROS +#include "windef.h" +#include "winbase.h" + +#include "mfapi.h" +#include "mfidl.h" +#include "rpcproxy.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dmo); + +#include "initguid.h" + +DEFINE_MEDIATYPE_GUID(MFAudioFormat_RAW_AAC,WAVE_FORMAT_RAW_AAC1); + +static HRESULT WINAPI aac_decoder_factory_CreateInstance(IClassFactory *iface, IUnknown *outer, + REFIID riid, void **out) +{ + static const GUID CLSID_wg_aac_decoder = {0xe7889a8a,0x2083,0x4844,{0x83,0x70,0x5e,0xe3,0x49,0xb1,0x45,0x03}}; + return CoCreateInstance(&CLSID_wg_aac_decoder, outer, CLSCTX_INPROC_SERVER, riid, out); +} + +static HRESULT WINAPI class_factory_QueryInterface(IClassFactory *iface, REFIID riid, void **out) +{ + *out = IsEqualGUID(riid, &IID_IClassFactory) || IsEqualGUID(riid, &IID_IUnknown) ? iface : NULL; + return *out ? S_OK : E_NOINTERFACE; +} +static ULONG WINAPI class_factory_AddRef(IClassFactory *iface) +{ + return 2; +} +static ULONG WINAPI class_factory_Release(IClassFactory *iface) +{ + return 1; +} +static HRESULT WINAPI class_factory_LockServer(IClassFactory *iface, BOOL dolock) +{ + return S_OK; +} + +static const IClassFactoryVtbl aac_decoder_factory_vtbl = +{ + class_factory_QueryInterface, + class_factory_AddRef, + class_factory_Release, + aac_decoder_factory_CreateInstance, + class_factory_LockServer, +}; + +static IClassFactory aac_decoder_factory = {&aac_decoder_factory_vtbl}; + +/*********************************************************************** + * DllGetClassObject (msauddecmft.@) + */ +HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void **out) +{ + if (IsEqualGUID(clsid, &CLSID_MSAACDecMFT)) + return IClassFactory_QueryInterface(&aac_decoder_factory, riid, out); + + *out = NULL; + FIXME("Unknown clsid %s.\n", debugstr_guid(clsid)); + return CLASS_E_CLASSNOTAVAILABLE; +} + +/*********************************************************************** + * DllRegisterServer (msauddecmft.@) + */ +HRESULT WINAPI DllRegisterServer(void) +{ + MFT_REGISTER_TYPE_INFO aac_decoder_mft_inputs[] = + { + {MFMediaType_Audio, MFAudioFormat_AAC}, + {MFMediaType_Audio, MFAudioFormat_RAW_AAC}, + {MFMediaType_Audio, MFAudioFormat_ADTS}, + }; + MFT_REGISTER_TYPE_INFO aac_decoder_mft_outputs[] = + { + {MFMediaType_Audio, MFAudioFormat_Float}, + {MFMediaType_Audio, MFAudioFormat_PCM}, + }; + HRESULT hr; + + TRACE("\n"); + + if (FAILED(hr = __wine_register_resources())) + return hr; + if (FAILED(hr = MFTRegister(CLSID_MSAACDecMFT, MFT_CATEGORY_AUDIO_DECODER, + (WCHAR *)L"Microsoft AAC Audio Decoder MFT", MFT_ENUM_FLAG_SYNCMFT, + ARRAY_SIZE(aac_decoder_mft_inputs), aac_decoder_mft_inputs, + ARRAY_SIZE(aac_decoder_mft_outputs), aac_decoder_mft_outputs, NULL))) + return hr; + + return S_OK; +} + +/*********************************************************************** + * DllUnregisterServer (msauddecmft.@) + */ +HRESULT WINAPI DllUnregisterServer(void) +{ + HRESULT hr; + + TRACE("\n"); + + if (FAILED(hr = __wine_unregister_resources())) + return hr; + if (FAILED(hr = MFTUnregister(CLSID_MSAACDecMFT))) + return hr; + + return S_OK; +} diff --git a/dlls/msauddecmft/main.c b/dlls/msauddecmft/msauddecmft.idl similarity index 70% rename from dlls/msauddecmft/main.c rename to dlls/msauddecmft/msauddecmft.idl index ae3ebf162c1..f1b2a62a2d2 100644 --- a/dlls/msauddecmft/main.c +++ b/dlls/msauddecmft/msauddecmft.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 Mohamad Al-Jaf + * Copyright 2024 Rémi Bernon for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -16,12 +16,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include "wine/debug.h" +#pragma makedep register
-WINE_DEFAULT_DEBUG_CHANNEL(msauddecmft); - -HRESULT WINAPI DllGetClassObject( REFCLSID clsid, REFIID riid, void **out ) -{ - FIXME( "clsid %s, riid %s, out %p stub!\n", debugstr_guid(clsid), debugstr_guid(riid), out ); - return CLASS_E_CLASSNOTAVAILABLE; -} +[ + threading(both), + uuid(32d186a7-218f-4c75-8876-dd77273a8999) +] +coclass CMSAACDecMFT {} diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index e84d10d013e..785c11c7ebb 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -122,6 +122,7 @@ static const IClassFactoryVtbl class_factory_vtbl =
static const GUID CLSID_GStreamerByteStreamHandler = {0x317df618, 0x5e5a, 0x468a, {0x9f, 0x15, 0xd8, 0x27, 0xa9, 0xa0, 0x81, 0x62}}; static const GUID CLSID_wg_video_processor = {0xd527607f,0x89cb,0x4e94,{0x95,0x71,0xbc,0xfe,0x62,0x17,0x56,0x13}}; +static const GUID CLSID_wg_aac_decoder = {0xe7889a8a,0x2083,0x4844,{0x83,0x70,0x5e,0xe3,0x49,0xb1,0x45,0x03}};
static const struct class_object { @@ -132,7 +133,7 @@ class_objects[] = { { &CLSID_wg_video_processor, &video_processor_create }, { &CLSID_GStreamerByteStreamHandler, &gstreamer_byte_stream_handler_create }, - { &CLSID_MSAACDecMFT, &aac_decoder_create }, + { &CLSID_wg_aac_decoder, &aac_decoder_create }, { &CLSID_MSH264DecoderMFT, &h264_decoder_create }, { &CLSID_MSH264EncoderMFT, &h264_encoder_create }, }; @@ -165,18 +166,6 @@ HRESULT mfplat_get_class_object(REFCLSID rclsid, REFIID riid, void **obj)
HRESULT mfplat_DllRegisterServer(void) { - MFT_REGISTER_TYPE_INFO aac_decoder_input_types[] = - { - {MFMediaType_Audio, MFAudioFormat_AAC}, - {MFMediaType_Audio, MFAudioFormat_RAW_AAC}, - {MFMediaType_Audio, MFAudioFormat_ADTS}, - }; - MFT_REGISTER_TYPE_INFO aac_decoder_output_types[] = - { - {MFMediaType_Audio, MFAudioFormat_Float}, - {MFMediaType_Audio, MFAudioFormat_PCM}, - }; - MFT_REGISTER_TYPE_INFO h264_decoder_input_types[] = { {MFMediaType_Video, MFVideoFormat_H264}, @@ -243,16 +232,6 @@ HRESULT mfplat_DllRegisterServer(void) } mfts[] = { - { - CLSID_MSAACDecMFT, - MFT_CATEGORY_AUDIO_DECODER, - L"Microsoft AAC Audio Decoder MFT", - MFT_ENUM_FLAG_SYNCMFT, - ARRAY_SIZE(aac_decoder_input_types), - aac_decoder_input_types, - ARRAY_SIZE(aac_decoder_output_types), - aac_decoder_output_types, - }, { CLSID_MSH264DecoderMFT, MFT_CATEGORY_VIDEO_DECODER, diff --git a/dlls/winegstreamer/winegstreamer_classes.idl b/dlls/winegstreamer/winegstreamer_classes.idl index 3636e9863a9..79e382c9300 100644 --- a/dlls/winegstreamer/winegstreamer_classes.idl +++ b/dlls/winegstreamer/winegstreamer_classes.idl @@ -91,9 +91,9 @@ coclass wg_wma_decoder {};
[ threading(both), - uuid(32d186a7-218f-4c75-8876-dd77273a8999) + uuid(e7889a8a-2083-4844-8370-5ee349b14503) ] -coclass CMSAACDecMFT {} +coclass wg_aac_decoder {}
[ threading(both), diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 278f7fedffc..9c56ea430da 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2110,6 +2110,7 @@ HKLM,%CurrentVersion%\Telephony\Country List\998,"SameAreaRule",,"G" 11,,mfasfsrcsnk.dll,1 11,,mfmp4srcsnk.dll,1 11,,mp3dmod.dll,1 +11,,msauddecmft.dll,1 11,,mscoree.dll,1 11,,mshtml.dll,1 11,,msisip.dll,1
From: Rémi Bernon rbernon@codeweavers.com
--- configure.ac | 1 + dlls/winegstreamer/main.c | 36 +---- dlls/winegstreamer/mfplat.c | 37 ----- dlls/winegstreamer/winegstreamer_classes.idl | 4 +- dlls/wmvdecod/Makefile.in | 7 + dlls/wmvdecod/video_decoder.c | 42 ++++++ dlls/wmvdecod/video_decoder.h | 50 +++++++ dlls/wmvdecod/wmvdecod.c | 144 +++++++++++++++++++ dlls/wmvdecod/wmvdecod.idl | 25 ++++ dlls/wmvdecod/wmvdecod.spec | 4 + loader/wine.inf.in | 1 + 11 files changed, 278 insertions(+), 73 deletions(-) create mode 100644 dlls/wmvdecod/Makefile.in create mode 100644 dlls/wmvdecod/video_decoder.c create mode 100644 dlls/wmvdecod/video_decoder.h create mode 100644 dlls/wmvdecod/wmvdecod.c create mode 100644 dlls/wmvdecod/wmvdecod.idl create mode 100644 dlls/wmvdecod/wmvdecod.spec
diff --git a/configure.ac b/configure.ac index fc05179a940..5d31816bd2a 100644 --- a/configure.ac +++ b/configure.ac @@ -3345,6 +3345,7 @@ WINE_CONFIG_MAKEFILE(dlls/wmp/tests) WINE_CONFIG_MAKEFILE(dlls/wmphoto) WINE_CONFIG_MAKEFILE(dlls/wmvcore) WINE_CONFIG_MAKEFILE(dlls/wmvcore/tests) +WINE_CONFIG_MAKEFILE(dlls/wmvdecod) WINE_CONFIG_MAKEFILE(dlls/wnaspi32) WINE_CONFIG_MAKEFILE(dlls/wofutil) WINE_CONFIG_MAKEFILE(dlls/wow32,enable_win16) diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c index fbe5274f14a..a49573ecdd2 100644 --- a/dlls/winegstreamer/main.c +++ b/dlls/winegstreamer/main.c @@ -996,6 +996,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **out) static const GUID CLSID_wg_mpeg4_sink_factory = {0x5d5407d9,0xc6ca,0x4770,{0xa7,0xcc,0x27,0xc0,0xcb,0x8a,0x76,0x27}}; static const GUID CLSID_wg_resampler = {0x92f35e78,0x15a5,0x486b,{0x88,0x8e,0x57,0x5f,0x99,0x65,0x1c,0xe2}}; static const GUID CLSID_wg_wma_decoder = {0x5b4d4e54,0x0620,0x4cf9,{0x94,0xae,0x78,0x23,0x96,0x5c,0x28,0xb6}}; + static const GUID CLSID_wg_wmv_decoder = {0x62ee5ddb,0x4f52,0x48e2,{0x89,0x28,0x78,0x7b,0x02,0x53,0xa0,0xbc}}; struct class_factory *factory; HRESULT hr;
@@ -1023,7 +1024,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **out) factory = &wave_parser_cf; else if (IsEqualGUID(clsid, &CLSID_wg_wma_decoder)) factory = &wma_decoder_cf; - else if (IsEqualGUID(clsid, &CLSID_WMVDecoderMFT)) + else if (IsEqualGUID(clsid, &CLSID_wg_wmv_decoder)) factory = &wmv_decoder_cf; else if (IsEqualGUID(clsid, &CLSID_wg_resampler)) factory = &resampler_cf; @@ -1299,32 +1300,6 @@ static const REGFILTER2 reg_decodebin_parser =
HRESULT WINAPI DllRegisterServer(void) { - DMO_PARTIAL_MEDIATYPE wmv_decoder_output[11] = - { - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_YV12}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_YUY2}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_UYVY}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_YVYU}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_NV11}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_NV12}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB32}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB24}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB565}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB555}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB8}, - }; - DMO_PARTIAL_MEDIATYPE wmv_decoder_input[8] = - { - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_WMV1}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_WMV2}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_WMV3}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_WMVA}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_WVC1}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_WMVP}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_WVP2}, - {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_VC1S}, - }; - IFilterMapper2 *mapper; HRESULT hr;
@@ -1352,10 +1327,6 @@ HRESULT WINAPI DllRegisterServer(void)
IFilterMapper2_Release(mapper);
- if (FAILED(hr = DMORegister(L"WMVideo Decoder DMO", &CLSID_WMVDecoderMFT, &DMOCATEGORY_VIDEO_DECODER, - 0, ARRAY_SIZE(wmv_decoder_input), wmv_decoder_input, ARRAY_SIZE(wmv_decoder_output), wmv_decoder_output))) - return hr; - return mfplat_DllRegisterServer(); }
@@ -1383,8 +1354,5 @@ HRESULT WINAPI DllUnregisterServer(void)
IFilterMapper2_Release(mapper);
- if (FAILED(hr = DMOUnregister(&CLSID_WMVDecoderMFT, &DMOCATEGORY_VIDEO_DECODER))) - return hr; - return S_OK; } diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index 785c11c7ebb..0e3aed20efa 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -192,33 +192,6 @@ HRESULT mfplat_DllRegisterServer(void) {MFMediaType_Video, MFVideoFormat_H264}, };
- MFT_REGISTER_TYPE_INFO wmv_decoder_input_types[] = - { - {MFMediaType_Video, MFVideoFormat_WMV1}, - {MFMediaType_Video, MFVideoFormat_WMV2}, - {MFMediaType_Video, MFVideoFormat_WMV3}, - {MFMediaType_Video, MEDIASUBTYPE_WMVP}, - {MFMediaType_Video, MEDIASUBTYPE_WVP2}, - {MFMediaType_Video, MEDIASUBTYPE_WMVR}, - {MFMediaType_Video, MEDIASUBTYPE_WMVA}, - {MFMediaType_Video, MFVideoFormat_WVC1}, - {MFMediaType_Video, MFVideoFormat_VC1S}, - }; - MFT_REGISTER_TYPE_INFO wmv_decoder_output_types[] = - { - {MFMediaType_Video, MFVideoFormat_YV12}, - {MFMediaType_Video, MFVideoFormat_YUY2}, - {MFMediaType_Video, MFVideoFormat_UYVY}, - {MFMediaType_Video, MFVideoFormat_YVYU}, - {MFMediaType_Video, MFVideoFormat_NV11}, - {MFMediaType_Video, MFVideoFormat_NV12}, - {MFMediaType_Video, DMOVideoFormat_RGB32}, - {MFMediaType_Video, DMOVideoFormat_RGB24}, - {MFMediaType_Video, DMOVideoFormat_RGB565}, - {MFMediaType_Video, DMOVideoFormat_RGB555}, - {MFMediaType_Video, DMOVideoFormat_RGB8}, - }; - struct mft { GUID clsid; @@ -252,16 +225,6 @@ HRESULT mfplat_DllRegisterServer(void) ARRAY_SIZE(h264_encoder_output_types), h264_encoder_output_types, }, - { - CLSID_WMVDecoderMFT, - MFT_CATEGORY_VIDEO_DECODER, - L"WMVideo Decoder MFT", - MFT_ENUM_FLAG_SYNCMFT, - ARRAY_SIZE(wmv_decoder_input_types), - wmv_decoder_input_types, - ARRAY_SIZE(wmv_decoder_output_types), - wmv_decoder_output_types, - }, };
unsigned int i; diff --git a/dlls/winegstreamer/winegstreamer_classes.idl b/dlls/winegstreamer/winegstreamer_classes.idl index 79e382c9300..ba848b5a837 100644 --- a/dlls/winegstreamer/winegstreamer_classes.idl +++ b/dlls/winegstreamer/winegstreamer_classes.idl @@ -97,9 +97,9 @@ coclass wg_aac_decoder {}
[ threading(both), - uuid(82d353df-90bd-4382-8bc2-3f6192b76e34) + uuid(62ee5ddb-4f52-48e2-8928-787b0253a0bc) ] -coclass CWMVDecMediaObject {} +coclass wg_wmv_decoder {}
[ threading(both), diff --git a/dlls/wmvdecod/Makefile.in b/dlls/wmvdecod/Makefile.in new file mode 100644 index 00000000000..3946bad65de --- /dev/null +++ b/dlls/wmvdecod/Makefile.in @@ -0,0 +1,7 @@ +MODULE = wmvdecod.dll +IMPORTS = combase mfplat msdmo mfuuid dmoguids strmiids wmcodecdspuuid uuid + +SOURCES = \ + video_decoder.c \ + wmvdecod.c \ + wmvdecod.idl diff --git a/dlls/wmvdecod/video_decoder.c b/dlls/wmvdecod/video_decoder.c new file mode 100644 index 00000000000..1b0ba9d972a --- /dev/null +++ b/dlls/wmvdecod/video_decoder.c @@ -0,0 +1,42 @@ +/* + * Copyright 2024 Rémi Bernon 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 "video_decoder.h" + +#include "initguid.h" + +DEFINE_MEDIATYPE_GUID(MEDIASUBTYPE_VC1S,MAKEFOURCC('V','C','1','S')); +DEFINE_GUID(MEDIASUBTYPE_WMV_Unknown, 0x7ce12ca9,0xbfbf,0x43d9,0x9d,0x00,0x82,0xb8,0xed,0x54,0x31,0x6b); + +static HRESULT WINAPI wmv_decoder_factory_CreateInstance(IClassFactory *iface, IUnknown *outer, + REFIID riid, void **out) +{ + static const GUID CLSID_wg_wmv_decoder = {0x62ee5ddb,0x4f52,0x48e2,{0x89,0x28,0x78,0x7b,0x02,0x53,0xa0,0xbc}}; + return CoCreateInstance(&CLSID_wg_wmv_decoder, outer, CLSCTX_INPROC_SERVER, riid, out); +} + +static const IClassFactoryVtbl wmv_decoder_factory_vtbl = +{ + class_factory_QueryInterface, + class_factory_AddRef, + class_factory_Release, + wmv_decoder_factory_CreateInstance, + class_factory_LockServer, +}; + +IClassFactory wmv_decoder_factory = {&wmv_decoder_factory_vtbl}; diff --git a/dlls/wmvdecod/video_decoder.h b/dlls/wmvdecod/video_decoder.h new file mode 100644 index 00000000000..bd426de3600 --- /dev/null +++ b/dlls/wmvdecod/video_decoder.h @@ -0,0 +1,50 @@ +/* + * Copyright 2024 Rémi Bernon 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 <stddef.h> +#include <stdarg.h> + +#define COBJMACROS +#include "windef.h" +#include "winbase.h" + +#include "d3d9.h" +#include "dshow.h" +#include "mfapi.h" +#include "mfidl.h" +#include "wmcodecdsp.h" + +extern IClassFactory wmv_decoder_factory; + +static inline HRESULT WINAPI class_factory_QueryInterface(IClassFactory *iface, REFIID riid, void **out) +{ + *out = IsEqualGUID(riid, &IID_IClassFactory) || IsEqualGUID(riid, &IID_IUnknown) ? iface : NULL; + return *out ? S_OK : E_NOINTERFACE; +} +static inline ULONG WINAPI class_factory_AddRef(IClassFactory *iface) +{ + return 2; +} +static inline ULONG WINAPI class_factory_Release(IClassFactory *iface) +{ + return 1; +} +static inline HRESULT WINAPI class_factory_LockServer(IClassFactory *iface, BOOL dolock) +{ + return S_OK; +} diff --git a/dlls/wmvdecod/wmvdecod.c b/dlls/wmvdecod/wmvdecod.c new file mode 100644 index 00000000000..3a4e49b89de --- /dev/null +++ b/dlls/wmvdecod/wmvdecod.c @@ -0,0 +1,144 @@ +/* + * Copyright 2024 Rémi Bernon 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 "video_decoder.h" + +#include "dmoreg.h" +#include "rpcproxy.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dmo); + +extern GUID MEDIASUBTYPE_WMV_Unknown; +extern GUID MEDIASUBTYPE_VC1S; + +#include "initguid.h" + +DEFINE_GUID(DMOVideoFormat_RGB32,D3DFMT_X8R8G8B8,0x524f,0x11ce,0x9f,0x53,0x00,0x20,0xaf,0x0b,0xa7,0x70); +DEFINE_GUID(DMOVideoFormat_RGB24,D3DFMT_R8G8B8,0x524f,0x11ce,0x9f,0x53,0x00,0x20,0xaf,0x0b,0xa7,0x70); +DEFINE_GUID(DMOVideoFormat_RGB565,D3DFMT_R5G6B5,0x524f,0x11ce,0x9f,0x53,0x00,0x20,0xaf,0x0b,0xa7,0x70); +DEFINE_GUID(DMOVideoFormat_RGB555,D3DFMT_X1R5G5B5,0x524f,0x11ce,0x9f,0x53,0x00,0x20,0xaf,0x0b,0xa7,0x70); +DEFINE_GUID(DMOVideoFormat_RGB8,D3DFMT_P8,0x524f,0x11ce,0x9f,0x53,0x00,0x20,0xaf,0x0b,0xa7,0x70); + +/*********************************************************************** + * DllGetClassObject (wmvdecod.@) + */ +HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void **out) +{ + if (IsEqualGUID(clsid, &CLSID_WMVDecoderMFT)) + return IClassFactory_QueryInterface(&wmv_decoder_factory, riid, out); + + *out = NULL; + FIXME("Unknown clsid %s.\n", debugstr_guid(clsid)); + return CLASS_E_CLASSNOTAVAILABLE; +} + +/*********************************************************************** + * DllRegisterServer (wmvdecod.@) + */ +HRESULT WINAPI DllRegisterServer(void) +{ + MFT_REGISTER_TYPE_INFO wmv_decoder_mft_inputs[] = + { + {MFMediaType_Video, MFVideoFormat_WMV1}, + {MFMediaType_Video, MFVideoFormat_WMV2}, + {MFMediaType_Video, MFVideoFormat_WMV3}, + {MFMediaType_Video, MEDIASUBTYPE_WMVP}, + {MFMediaType_Video, MEDIASUBTYPE_WVP2}, + {MFMediaType_Video, MEDIASUBTYPE_WMVR}, + {MFMediaType_Video, MEDIASUBTYPE_WMVA}, + {MFMediaType_Video, MFVideoFormat_WVC1}, + {MFMediaType_Video, MEDIASUBTYPE_VC1S}, + }; + MFT_REGISTER_TYPE_INFO wmv_decoder_mft_outputs[] = + { + {MFMediaType_Video, MFVideoFormat_YV12}, + {MFMediaType_Video, MFVideoFormat_YUY2}, + {MFMediaType_Video, MFVideoFormat_UYVY}, + {MFMediaType_Video, MFVideoFormat_YVYU}, + {MFMediaType_Video, MFVideoFormat_NV11}, + {MFMediaType_Video, MFVideoFormat_NV12}, + {MFMediaType_Video, DMOVideoFormat_RGB32}, + {MFMediaType_Video, DMOVideoFormat_RGB24}, + {MFMediaType_Video, DMOVideoFormat_RGB565}, + {MFMediaType_Video, DMOVideoFormat_RGB555}, + {MFMediaType_Video, DMOVideoFormat_RGB8}, + }; + DMO_PARTIAL_MEDIATYPE wmv_decoder_dmo_outputs[] = + { + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_YV12}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_YUY2}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_UYVY}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_YVYU}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_NV11}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_NV12}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB32}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB24}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB565}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB555}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB8}, + }; + DMO_PARTIAL_MEDIATYPE wmv_decoder_dmo_inputs[] = + { + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_WMV1}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_WMV2}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_WMV3}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_WMVA}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_WVC1}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_WMVP}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_WVP2}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_VC1S}, + }; + HRESULT hr; + + TRACE("\n"); + + if (FAILED(hr = __wine_register_resources())) + return hr; + if (FAILED(hr = MFTRegister(CLSID_WMVDecoderMFT, MFT_CATEGORY_VIDEO_DECODER, + (WCHAR *)L"WMVideo Decoder MFT", MFT_ENUM_FLAG_SYNCMFT, + ARRAY_SIZE(wmv_decoder_mft_inputs), wmv_decoder_mft_inputs, + ARRAY_SIZE(wmv_decoder_mft_outputs), wmv_decoder_mft_outputs, NULL))) + return hr; + if (FAILED(hr = DMORegister(L"WMVideo Decoder DMO", &CLSID_WMVDecoderMFT, &DMOCATEGORY_VIDEO_DECODER, 0, + ARRAY_SIZE(wmv_decoder_dmo_inputs), wmv_decoder_dmo_inputs, + ARRAY_SIZE(wmv_decoder_dmo_outputs), wmv_decoder_dmo_outputs))) + return hr; + + return S_OK; +} + +/*********************************************************************** + * DllUnregisterServer (wmvdecod.@) + */ +HRESULT WINAPI DllUnregisterServer(void) +{ + HRESULT hr; + + TRACE("\n"); + + if (FAILED(hr = __wine_unregister_resources())) + return hr; + if (FAILED(hr = MFTUnregister(CLSID_WMVDecoderMFT))) + return hr; + if (FAILED(hr = DMOUnregister(&CLSID_WMVDecoderMFT, &DMOCATEGORY_VIDEO_DECODER))) + return hr; + + return S_OK; +} diff --git a/dlls/wmvdecod/wmvdecod.idl b/dlls/wmvdecod/wmvdecod.idl new file mode 100644 index 00000000000..8d1984ee475 --- /dev/null +++ b/dlls/wmvdecod/wmvdecod.idl @@ -0,0 +1,25 @@ +/* + * Copyright 2024 Rémi Bernon 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 + +[ + threading(both), + uuid(82d353df-90bd-4382-8bc2-3f6192b76e34) +] +coclass CWMVDecMediaObject {} diff --git a/dlls/wmvdecod/wmvdecod.spec b/dlls/wmvdecod/wmvdecod.spec new file mode 100644 index 00000000000..b16365d0c9f --- /dev/null +++ b/dlls/wmvdecod/wmvdecod.spec @@ -0,0 +1,4 @@ +@ stdcall -private DllCanUnloadNow() +@ stdcall -private DllGetClassObject(ptr ptr ptr) +@ stdcall -private DllRegisterServer() +@ stdcall -private DllUnregisterServer() diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 9c56ea430da..1777c17ac77 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2126,6 +2126,7 @@ HKLM,%CurrentVersion%\Telephony\Country List\998,"SameAreaRule",,"G" 55,,winprint.dll,1 11,,wintrust.dll,1 11,,wmadmod.dll,1 +11,,wmvdecod.dll,1 11,,iexplore.exe,1
; 32bit-only fake dlls
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/msmpeg2vdec/Makefile.in | 6 +- dlls/msmpeg2vdec/msmpeg2vdec.c | 88 ++++++++++++++++++++ dlls/msmpeg2vdec/{main.c => msmpeg2vdec.idl} | 16 ++-- dlls/winegstreamer/mfplat.c | 27 +----- dlls/winegstreamer/winegstreamer_classes.idl | 4 +- dlls/wmvdecod/video_decoder.c | 18 ++++ dlls/wmvdecod/video_decoder.h | 1 + loader/wine.inf.in | 1 + 8 files changed, 124 insertions(+), 37 deletions(-) create mode 100644 dlls/msmpeg2vdec/msmpeg2vdec.c rename dlls/msmpeg2vdec/{main.c => msmpeg2vdec.idl} (70%)
diff --git a/dlls/msmpeg2vdec/Makefile.in b/dlls/msmpeg2vdec/Makefile.in index 74a2cdffceb..efbcb6aa238 100644 --- a/dlls/msmpeg2vdec/Makefile.in +++ b/dlls/msmpeg2vdec/Makefile.in @@ -1,4 +1,8 @@ MODULE = msmpeg2vdec.dll +IMPORTS = combase mfplat mfuuid dmoguids strmiids wmcodecdspuuid uuid +PARENTSRC = ../wmvdecod
SOURCES = \ - main.c + msmpeg2vdec.c \ + msmpeg2vdec.idl \ + video_decoder.c diff --git a/dlls/msmpeg2vdec/msmpeg2vdec.c b/dlls/msmpeg2vdec/msmpeg2vdec.c new file mode 100644 index 00000000000..2bb07296dbf --- /dev/null +++ b/dlls/msmpeg2vdec/msmpeg2vdec.c @@ -0,0 +1,88 @@ +/* + * Copyright 2024 Rémi Bernon 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 "video_decoder.h" + +#include "rpcproxy.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dmo); + +/*********************************************************************** + * DllGetClassObject (msmpeg2vdec.@) + */ +HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void **out) +{ + if (IsEqualGUID(clsid, &CLSID_MSH264DecoderMFT)) + return IClassFactory_QueryInterface(&h264_decoder_factory, riid, out); + + *out = NULL; + FIXME("Unknown clsid %s.\n", debugstr_guid(clsid)); + return CLASS_E_CLASSNOTAVAILABLE; +} + +/*********************************************************************** + * DllRegisterServer (msmpeg2vdec.@) + */ +HRESULT WINAPI DllRegisterServer(void) +{ + MFT_REGISTER_TYPE_INFO h264_decoder_mft_inputs[] = + { + {MFMediaType_Video, MFVideoFormat_H264}, + {MFMediaType_Video, MFVideoFormat_H264_ES}, + }; + MFT_REGISTER_TYPE_INFO h264_decoder_mft_outputs[] = + { + {MFMediaType_Video, MFVideoFormat_NV12}, + {MFMediaType_Video, MFVideoFormat_YV12}, + {MFMediaType_Video, MFVideoFormat_IYUV}, + {MFMediaType_Video, MFVideoFormat_I420}, + {MFMediaType_Video, MFVideoFormat_YUY2}, + }; + HRESULT hr; + + TRACE("\n"); + + if (FAILED(hr = __wine_register_resources())) + return hr; + if (FAILED(hr = MFTRegister(CLSID_MSH264DecoderMFT, MFT_CATEGORY_VIDEO_DECODER, + (WCHAR *)L"Microsoft H264 Video Decoder MFT", MFT_ENUM_FLAG_SYNCMFT, + ARRAY_SIZE(h264_decoder_mft_inputs), h264_decoder_mft_inputs, + ARRAY_SIZE(h264_decoder_mft_outputs), h264_decoder_mft_outputs, NULL))) + return hr; + + return S_OK; +} + +/*********************************************************************** + * DllUnregisterServer (msmpeg2vdec.@) + */ +HRESULT WINAPI DllUnregisterServer(void) +{ + HRESULT hr; + + TRACE("\n"); + + if (FAILED(hr = __wine_unregister_resources())) + return hr; + if (FAILED(hr = MFTUnregister(CLSID_MSH264DecoderMFT))) + return hr; + + return S_OK; +} diff --git a/dlls/msmpeg2vdec/main.c b/dlls/msmpeg2vdec/msmpeg2vdec.idl similarity index 70% rename from dlls/msmpeg2vdec/main.c rename to dlls/msmpeg2vdec/msmpeg2vdec.idl index 0ff52f5d1cb..f2ddcdef819 100644 --- a/dlls/msmpeg2vdec/main.c +++ b/dlls/msmpeg2vdec/msmpeg2vdec.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 Mohamad Al-Jaf + * Copyright 2024 Rémi Bernon for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -16,12 +16,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include "wine/debug.h" +#pragma makedep register
-WINE_DEFAULT_DEBUG_CHANNEL(msmpeg2vdec); - -HRESULT WINAPI DllGetClassObject( REFCLSID clsid, REFIID riid, void **out ) -{ - FIXME( "clsid %s, riid %s, out %p stub!\n", debugstr_guid(clsid), debugstr_guid(riid), out ); - return CLASS_E_CLASSNOTAVAILABLE; -} +[ + threading(both), + uuid(62ce7e72-4c71-4d20-b15d-452831a87d9d) +] +coclass CMSH264DecoderMFT {} diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index 0e3aed20efa..2b627ffc706 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -123,6 +123,7 @@ static const IClassFactoryVtbl class_factory_vtbl = static const GUID CLSID_GStreamerByteStreamHandler = {0x317df618, 0x5e5a, 0x468a, {0x9f, 0x15, 0xd8, 0x27, 0xa9, 0xa0, 0x81, 0x62}}; static const GUID CLSID_wg_video_processor = {0xd527607f,0x89cb,0x4e94,{0x95,0x71,0xbc,0xfe,0x62,0x17,0x56,0x13}}; static const GUID CLSID_wg_aac_decoder = {0xe7889a8a,0x2083,0x4844,{0x83,0x70,0x5e,0xe3,0x49,0xb1,0x45,0x03}}; +static const GUID CLSID_wg_h264_decoder = {0x1f1e273d,0x12c0,0x4b3a,{0x8e,0x9b,0x19,0x33,0xc2,0x49,0x8a,0xea}};
static const struct class_object { @@ -134,7 +135,7 @@ class_objects[] = { &CLSID_wg_video_processor, &video_processor_create }, { &CLSID_GStreamerByteStreamHandler, &gstreamer_byte_stream_handler_create }, { &CLSID_wg_aac_decoder, &aac_decoder_create }, - { &CLSID_MSH264DecoderMFT, &h264_decoder_create }, + { &CLSID_wg_h264_decoder, &h264_decoder_create }, { &CLSID_MSH264EncoderMFT, &h264_encoder_create }, };
@@ -166,20 +167,6 @@ HRESULT mfplat_get_class_object(REFCLSID rclsid, REFIID riid, void **obj)
HRESULT mfplat_DllRegisterServer(void) { - MFT_REGISTER_TYPE_INFO h264_decoder_input_types[] = - { - {MFMediaType_Video, MFVideoFormat_H264}, - {MFMediaType_Video, MFVideoFormat_H264_ES}, - }; - MFT_REGISTER_TYPE_INFO h264_decoder_output_types[] = - { - {MFMediaType_Video, MFVideoFormat_NV12}, - {MFMediaType_Video, MFVideoFormat_YV12}, - {MFMediaType_Video, MFVideoFormat_IYUV}, - {MFMediaType_Video, MFVideoFormat_I420}, - {MFMediaType_Video, MFVideoFormat_YUY2}, - }; - MFT_REGISTER_TYPE_INFO h264_encoder_input_types[] = { {MFMediaType_Video, MFVideoFormat_IYUV}, @@ -205,16 +192,6 @@ HRESULT mfplat_DllRegisterServer(void) } mfts[] = { - { - CLSID_MSH264DecoderMFT, - MFT_CATEGORY_VIDEO_DECODER, - L"Microsoft H264 Video Decoder MFT", - MFT_ENUM_FLAG_SYNCMFT, - ARRAY_SIZE(h264_decoder_input_types), - h264_decoder_input_types, - ARRAY_SIZE(h264_decoder_output_types), - h264_decoder_output_types, - }, { CLSID_MSH264EncoderMFT, MFT_CATEGORY_VIDEO_ENCODER, diff --git a/dlls/winegstreamer/winegstreamer_classes.idl b/dlls/winegstreamer/winegstreamer_classes.idl index ba848b5a837..f030a11875a 100644 --- a/dlls/winegstreamer/winegstreamer_classes.idl +++ b/dlls/winegstreamer/winegstreamer_classes.idl @@ -103,9 +103,9 @@ coclass wg_wmv_decoder {}
[ threading(both), - uuid(62ce7e72-4c71-4d20-b15d-452831a87d9d) + uuid(1f1e273d-12c0-4b3a-8e9b-1933c2498aea) ] -coclass CMSH264DecoderMFT {} +coclass wg_h264_decoder {}
[ threading(both), diff --git a/dlls/wmvdecod/video_decoder.c b/dlls/wmvdecod/video_decoder.c index 1b0ba9d972a..7c4c0ddd683 100644 --- a/dlls/wmvdecod/video_decoder.c +++ b/dlls/wmvdecod/video_decoder.c @@ -23,6 +23,24 @@ DEFINE_MEDIATYPE_GUID(MEDIASUBTYPE_VC1S,MAKEFOURCC('V','C','1','S')); DEFINE_GUID(MEDIASUBTYPE_WMV_Unknown, 0x7ce12ca9,0xbfbf,0x43d9,0x9d,0x00,0x82,0xb8,0xed,0x54,0x31,0x6b);
+static HRESULT WINAPI h264_decoder_factory_CreateInstance(IClassFactory *iface, IUnknown *outer, + REFIID riid, void **out) +{ + static const GUID CLSID_wg_h264_decoder = {0x1f1e273d,0x12c0,0x4b3a,{0x8e,0x9b,0x19,0x33,0xc2,0x49,0x8a,0xea}}; + return CoCreateInstance(&CLSID_wg_h264_decoder, outer, CLSCTX_INPROC_SERVER, riid, out); +} + +static const IClassFactoryVtbl h264_decoder_factory_vtbl = +{ + class_factory_QueryInterface, + class_factory_AddRef, + class_factory_Release, + h264_decoder_factory_CreateInstance, + class_factory_LockServer, +}; + +IClassFactory h264_decoder_factory = {&h264_decoder_factory_vtbl}; + static HRESULT WINAPI wmv_decoder_factory_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **out) { diff --git a/dlls/wmvdecod/video_decoder.h b/dlls/wmvdecod/video_decoder.h index bd426de3600..3784eda4684 100644 --- a/dlls/wmvdecod/video_decoder.h +++ b/dlls/wmvdecod/video_decoder.h @@ -29,6 +29,7 @@ #include "mfidl.h" #include "wmcodecdsp.h"
+extern IClassFactory h264_decoder_factory; extern IClassFactory wmv_decoder_factory;
static inline HRESULT WINAPI class_factory_QueryInterface(IClassFactory *iface, REFIID riid, void **out) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 1777c17ac77..096257904a9 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2114,6 +2114,7 @@ HKLM,%CurrentVersion%\Telephony\Country List\998,"SameAreaRule",,"G" 11,,mscoree.dll,1 11,,mshtml.dll,1 11,,msisip.dll,1 +11,,msmpeg2vdec.dll,1 11,,msvproc.dll,1 11,,qcap.dll,1 11,,qedit.dll,1
From: Rémi Bernon rbernon@codeweavers.com
--- configure.ac | 1 + dlls/mfh264enc/Makefile.in | 6 + dlls/mfh264enc/mfh264enc.c | 129 +++++++++++++++++++ dlls/mfh264enc/mfh264enc.idl | 25 ++++ dlls/mfh264enc/mfh264enc.spec | 4 + dlls/winegstreamer/gst_private.h | 1 - dlls/winegstreamer/main.c | 2 +- dlls/winegstreamer/mfplat.c | 60 +-------- dlls/winegstreamer/winegstreamer_classes.idl | 4 +- loader/wine.inf.in | 1 + 10 files changed, 171 insertions(+), 62 deletions(-) create mode 100644 dlls/mfh264enc/Makefile.in create mode 100644 dlls/mfh264enc/mfh264enc.c create mode 100644 dlls/mfh264enc/mfh264enc.idl create mode 100644 dlls/mfh264enc/mfh264enc.spec
diff --git a/configure.ac b/configure.ac index 5d31816bd2a..4dcb780013a 100644 --- a/configure.ac +++ b/configure.ac @@ -2808,6 +2808,7 @@ WINE_CONFIG_MAKEFILE(dlls/mf/tests) WINE_CONFIG_MAKEFILE(dlls/mf3216) WINE_CONFIG_MAKEFILE(dlls/mfasfsrcsnk) WINE_CONFIG_MAKEFILE(dlls/mferror) +WINE_CONFIG_MAKEFILE(dlls/mfh264enc) WINE_CONFIG_MAKEFILE(dlls/mfmediaengine) WINE_CONFIG_MAKEFILE(dlls/mfmediaengine/tests) WINE_CONFIG_MAKEFILE(dlls/mfmp4srcsnk) diff --git a/dlls/mfh264enc/Makefile.in b/dlls/mfh264enc/Makefile.in new file mode 100644 index 00000000000..d5b288d608b --- /dev/null +++ b/dlls/mfh264enc/Makefile.in @@ -0,0 +1,6 @@ +MODULE = mfh264enc.dll +IMPORTS = combase mfplat mfuuid dmoguids strmiids wmcodecdspuuid uuid + +SOURCES = \ + mfh264enc.c \ + mfh264enc.idl diff --git a/dlls/mfh264enc/mfh264enc.c b/dlls/mfh264enc/mfh264enc.c new file mode 100644 index 00000000000..4e8244af550 --- /dev/null +++ b/dlls/mfh264enc/mfh264enc.c @@ -0,0 +1,129 @@ +/* + * Copyright 2024 Rémi Bernon 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 <stddef.h> +#include <stdarg.h> + +#define COBJMACROS +#include "windef.h" +#include "winbase.h" + +#include "mfapi.h" +#include "mfidl.h" +#include "rpcproxy.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dmo); + +static HRESULT WINAPI h264_encoder_factory_CreateInstance(IClassFactory *iface, IUnknown *outer, + REFIID riid, void **out) +{ + static const GUID CLSID_wg_h264_encoder = {0x6c34de69,0x4670,0x46cd,{0x8c,0xb4,0x1f,0x2f,0xa1,0xdf,0xfb,0x65}}; + return CoCreateInstance(&CLSID_wg_h264_encoder, outer, CLSCTX_INPROC_SERVER, riid, out); +} + +static HRESULT WINAPI class_factory_QueryInterface(IClassFactory *iface, REFIID riid, void **out) +{ + *out = IsEqualGUID(riid, &IID_IClassFactory) || IsEqualGUID(riid, &IID_IUnknown) ? iface : NULL; + return *out ? S_OK : E_NOINTERFACE; +} +static ULONG WINAPI class_factory_AddRef(IClassFactory *iface) +{ + return 2; +} +static ULONG WINAPI class_factory_Release(IClassFactory *iface) +{ + return 1; +} +static HRESULT WINAPI class_factory_LockServer(IClassFactory *iface, BOOL dolock) +{ + return S_OK; +} + +static const IClassFactoryVtbl h264_encoder_factory_vtbl = +{ + class_factory_QueryInterface, + class_factory_AddRef, + class_factory_Release, + h264_encoder_factory_CreateInstance, + class_factory_LockServer, +}; + +static IClassFactory h264_encoder_factory = {&h264_encoder_factory_vtbl}; + +/*********************************************************************** + * DllGetClassObject (mfh264enc.@) + */ +HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void **out) +{ + if (IsEqualGUID(clsid, &CLSID_MSH264EncoderMFT)) + return IClassFactory_QueryInterface(&h264_encoder_factory, riid, out); + + *out = NULL; + FIXME("Unknown clsid %s.\n", debugstr_guid(clsid)); + return CLASS_E_CLASSNOTAVAILABLE; +} + +/*********************************************************************** + * DllRegisterServer (mfh264enc.@) + */ +HRESULT WINAPI DllRegisterServer(void) +{ + MFT_REGISTER_TYPE_INFO h264_encoder_mft_inputs[] = + { + {MFMediaType_Video, MFVideoFormat_IYUV}, + {MFMediaType_Video, MFVideoFormat_YV12}, + {MFMediaType_Video, MFVideoFormat_NV12}, + {MFMediaType_Video, MFVideoFormat_YUY2}, + }; + MFT_REGISTER_TYPE_INFO h264_encoder_mft_outputs[] = + { + {MFMediaType_Video, MFVideoFormat_H264}, + }; + HRESULT hr; + + TRACE("\n"); + + if (FAILED(hr = __wine_register_resources())) + return hr; + if (FAILED(hr = MFTRegister(CLSID_MSH264EncoderMFT, MFT_CATEGORY_VIDEO_ENCODER, + (WCHAR *)L"H264 Encoder MFT", MFT_ENUM_FLAG_SYNCMFT, + ARRAY_SIZE(h264_encoder_mft_inputs), h264_encoder_mft_inputs, + ARRAY_SIZE(h264_encoder_mft_outputs), h264_encoder_mft_outputs, NULL))) + return hr; + + return S_OK; +} + +/*********************************************************************** + * DllUnregisterServer (mfh264enc.@) + */ +HRESULT WINAPI DllUnregisterServer(void) +{ + HRESULT hr; + + TRACE("\n"); + + if (FAILED(hr = __wine_unregister_resources())) + return hr; + if (FAILED(hr = MFTUnregister(CLSID_MSH264EncoderMFT))) + return hr; + + return S_OK; +} diff --git a/dlls/mfh264enc/mfh264enc.idl b/dlls/mfh264enc/mfh264enc.idl new file mode 100644 index 00000000000..3d03d518c47 --- /dev/null +++ b/dlls/mfh264enc/mfh264enc.idl @@ -0,0 +1,25 @@ +/* + * Copyright 2024 Rémi Bernon 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 + +[ + threading(both), + uuid(6ca50344-051a-4ded-9779-a43305165e35) +] +coclass CMSH264EncoderMFT {} diff --git a/dlls/mfh264enc/mfh264enc.spec b/dlls/mfh264enc/mfh264enc.spec new file mode 100644 index 00000000000..b16365d0c9f --- /dev/null +++ b/dlls/mfh264enc/mfh264enc.spec @@ -0,0 +1,4 @@ +@ stdcall -private DllCanUnloadNow() +@ stdcall -private DllGetClassObject(ptr ptr ptr) +@ stdcall -private DllRegisterServer() +@ stdcall -private DllUnregisterServer() diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index 0f7d945ba37..9db484c033f 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -151,7 +151,6 @@ bool amt_to_wg_format(const AM_MEDIA_TYPE *mt, struct wg_format *format); BOOL init_gstreamer(void);
extern HRESULT mfplat_get_class_object(REFCLSID rclsid, REFIID riid, void **obj); -extern HRESULT mfplat_DllRegisterServer(void);
IMFMediaType *mf_media_type_from_wg_format(const struct wg_format *format); void mf_media_type_to_wg_format(IMFMediaType *type, struct wg_format *format); diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c index a49573ecdd2..006cd370d99 100644 --- a/dlls/winegstreamer/main.c +++ b/dlls/winegstreamer/main.c @@ -1327,7 +1327,7 @@ HRESULT WINAPI DllRegisterServer(void)
IFilterMapper2_Release(mapper);
- return mfplat_DllRegisterServer(); + return S_OK; }
HRESULT WINAPI DllUnregisterServer(void) diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index 2b627ffc706..fd2c6995d8c 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -124,6 +124,7 @@ static const GUID CLSID_GStreamerByteStreamHandler = {0x317df618, 0x5e5a, 0x468a static const GUID CLSID_wg_video_processor = {0xd527607f,0x89cb,0x4e94,{0x95,0x71,0xbc,0xfe,0x62,0x17,0x56,0x13}}; static const GUID CLSID_wg_aac_decoder = {0xe7889a8a,0x2083,0x4844,{0x83,0x70,0x5e,0xe3,0x49,0xb1,0x45,0x03}}; static const GUID CLSID_wg_h264_decoder = {0x1f1e273d,0x12c0,0x4b3a,{0x8e,0x9b,0x19,0x33,0xc2,0x49,0x8a,0xea}}; +static const GUID CLSID_wg_h264_encoder = {0x6c34de69,0x4670,0x46cd,{0x8c,0xb4,0x1f,0x2f,0xa1,0xdf,0xfb,0x65}};
static const struct class_object { @@ -136,7 +137,7 @@ class_objects[] = { &CLSID_GStreamerByteStreamHandler, &gstreamer_byte_stream_handler_create }, { &CLSID_wg_aac_decoder, &aac_decoder_create }, { &CLSID_wg_h264_decoder, &h264_decoder_create }, - { &CLSID_MSH264EncoderMFT, &h264_encoder_create }, + { &CLSID_wg_h264_encoder, &h264_encoder_create }, };
HRESULT mfplat_get_class_object(REFCLSID rclsid, REFIID riid, void **obj) @@ -165,63 +166,6 @@ HRESULT mfplat_get_class_object(REFCLSID rclsid, REFIID riid, void **obj) return CLASS_E_CLASSNOTAVAILABLE; }
-HRESULT mfplat_DllRegisterServer(void) -{ - MFT_REGISTER_TYPE_INFO h264_encoder_input_types[] = - { - {MFMediaType_Video, MFVideoFormat_IYUV}, - {MFMediaType_Video, MFVideoFormat_YV12}, - {MFMediaType_Video, MFVideoFormat_NV12}, - {MFMediaType_Video, MFVideoFormat_YUY2}, - }; - MFT_REGISTER_TYPE_INFO h264_encoder_output_types[] = - { - {MFMediaType_Video, MFVideoFormat_H264}, - }; - - struct mft - { - GUID clsid; - GUID category; - WCHAR name[MAX_PATH]; - UINT32 flags; - UINT32 input_types_count; - MFT_REGISTER_TYPE_INFO *input_types; - UINT32 output_types_count; - MFT_REGISTER_TYPE_INFO *output_types; - } - mfts[] = - { - { - CLSID_MSH264EncoderMFT, - MFT_CATEGORY_VIDEO_ENCODER, - L"H264 Encoder MFT", - MFT_ENUM_FLAG_SYNCMFT, - ARRAY_SIZE(h264_encoder_input_types), - h264_encoder_input_types, - ARRAY_SIZE(h264_encoder_output_types), - h264_encoder_output_types, - }, - }; - - unsigned int i; - HRESULT hr; - - for (i = 0; i < ARRAY_SIZE(mfts); i++) - { - hr = MFTRegister(mfts[i].clsid, mfts[i].category, mfts[i].name, mfts[i].flags, mfts[i].input_types_count, - mfts[i].input_types, mfts[i].output_types_count, mfts[i].output_types, NULL); - - if (FAILED(hr)) - { - FIXME("Failed to register MFT, hr %#lx.\n", hr); - return hr; - } - } - - return S_OK; -} - static const struct { const GUID *subtype; diff --git a/dlls/winegstreamer/winegstreamer_classes.idl b/dlls/winegstreamer/winegstreamer_classes.idl index f030a11875a..65d3e3c5c1a 100644 --- a/dlls/winegstreamer/winegstreamer_classes.idl +++ b/dlls/winegstreamer/winegstreamer_classes.idl @@ -109,9 +109,9 @@ coclass wg_h264_decoder {}
[ threading(both), - uuid(6ca50344-051a-4ded-9779-a43305165e35) + uuid(6c34de69-4670-46cd-8cb4-1f2fa1dffb65) ] -coclass CMSH264EncoderMFT {} +coclass wg_h264_encoder {}
[ threading(both), diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 096257904a9..7adba6e080a 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2108,6 +2108,7 @@ HKLM,%CurrentVersion%\Telephony\Country List\998,"SameAreaRule",,"G" 11,,cryptnet.dll,1 11,,devenum.dll,1 11,,mfasfsrcsnk.dll,1 +11,,mfh264enc.dll,1 11,,mfmp4srcsnk.dll,1 11,,mp3dmod.dll,1 11,,msauddecmft.dll,1