wmadmod: Register the WMA Decoder DMO class.

This commit is contained in:
Rémi Bernon 2024-08-22 21:44:51 +02:00 committed by Alexandre Julliard
parent 008cf28373
commit a01e9eed6b
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 194 additions and 43 deletions

2
configure vendored
View file

@ -1548,6 +1548,7 @@ enable_wlanapi
enable_wlanui
enable_wldap32
enable_wldp
enable_wmadmod
enable_wmasf
enable_wmi
enable_wmiutils
@ -22858,6 +22859,7 @@ wine_fn_config_makefile dlls/wldap32 enable_wldap32
wine_fn_config_makefile dlls/wldap32/tests enable_tests
wine_fn_config_makefile dlls/wldp enable_wldp
wine_fn_config_makefile dlls/wldp/tests enable_tests
wine_fn_config_makefile dlls/wmadmod enable_wmadmod
wine_fn_config_makefile dlls/wmasf enable_wmasf
wine_fn_config_makefile dlls/wmi enable_wmi
wine_fn_config_makefile dlls/wmiutils enable_wmiutils

View file

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

View file

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

View file

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

View file

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

6
dlls/wmadmod/Makefile.in Normal file
View file

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

151
dlls/wmadmod/wmadmod.c Normal file
View file

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

25
dlls/wmadmod/wmadmod.idl Normal file
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(2eeb4adf-4578-4d10-bca7-bb955f56320a)
]
coclass CWMADecMediaObject {}

View file

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

View file

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