resampledmo: Register the Resampler DMO class.

This commit is contained in:
Rémi Bernon 2024-08-22 22:08:29 +02:00 committed by Alexandre Julliard
parent d8cfc9c474
commit 008cf28373
Notes: Alexandre Julliard 2024-09-03 23:30:11 +02:00
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/wine/merge_requests/6430
10 changed files with 179 additions and 29 deletions

2
configure vendored
View file

@ -1387,6 +1387,7 @@ enable_qwave
enable_rasapi32
enable_rasdlg
enable_regapi
enable_resampledmo
enable_resutils
enable_riched20
enable_riched32
@ -22585,6 +22586,7 @@ wine_fn_config_makefile dlls/rasapi32 enable_rasapi32
wine_fn_config_makefile dlls/rasapi32/tests enable_tests
wine_fn_config_makefile dlls/rasdlg enable_rasdlg
wine_fn_config_makefile dlls/regapi enable_regapi
wine_fn_config_makefile dlls/resampledmo enable_resampledmo
wine_fn_config_makefile dlls/resutils enable_resutils
wine_fn_config_makefile dlls/riched20 enable_riched20
wine_fn_config_makefile dlls/riched20/tests enable_tests

View file

@ -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)

View file

@ -0,0 +1,6 @@
MODULE = resampledmo.dll
IMPORTS = combase mfplat msdmo mfuuid dmoguids strmiids wmcodecdspuuid uuid
SOURCES = \
resampledmo.c \
resampledmo.idl

View file

@ -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;
}

View file

@ -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 {}

View file

@ -0,0 +1,4 @@
@ stdcall -private DllCanUnloadNow()
@ stdcall -private DllGetClassObject(ptr ptr ptr)
@ stdcall -private DllRegisterServer()
@ stdcall -private DllUnregisterServer()

View file

@ -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)))

View file

@ -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;

View file

@ -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),

View file

@ -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