l3codecx.ax: Register the MP3 Decoder class.

This commit is contained in:
Rémi Bernon 2024-09-05 10:46:17 +02:00 committed by Alexandre Julliard
parent 398822c759
commit 03c616f83e
Notes: Alexandre Julliard 2024-09-06 22:37:56 +02:00
Approved-by: Elizabeth Figura (@zfigura)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/wine/merge_requests/6441
10 changed files with 200 additions and 41 deletions

2
configure vendored
View file

@ -1209,6 +1209,7 @@ enable_ksproxy_ax
enable_ksuser
enable_ktmw32
enable_l3codeca_acm
enable_l3codecx_ax
enable_light_msstyles
enable_loadperf
enable_localspl
@ -22225,6 +22226,7 @@ wine_fn_config_makefile dlls/ksproxy.ax enable_ksproxy_ax
wine_fn_config_makefile dlls/ksuser enable_ksuser
wine_fn_config_makefile dlls/ktmw32 enable_ktmw32
wine_fn_config_makefile dlls/l3codeca.acm enable_l3codeca_acm
wine_fn_config_makefile dlls/l3codecx.ax enable_l3codecx_ax
wine_fn_config_makefile dlls/light.msstyles enable_light_msstyles
wine_fn_config_makefile dlls/loadperf enable_loadperf
wine_fn_config_makefile dlls/localspl enable_localspl

View file

@ -2753,6 +2753,7 @@ WINE_CONFIG_MAKEFILE(dlls/ksproxy.ax)
WINE_CONFIG_MAKEFILE(dlls/ksuser)
WINE_CONFIG_MAKEFILE(dlls/ktmw32)
WINE_CONFIG_MAKEFILE(dlls/l3codeca.acm)
WINE_CONFIG_MAKEFILE(dlls/l3codecx.ax)
WINE_CONFIG_MAKEFILE(dlls/light.msstyles)
WINE_CONFIG_MAKEFILE(dlls/loadperf)
WINE_CONFIG_MAKEFILE(dlls/localspl)

View file

@ -0,0 +1,6 @@
MODULE = l3codecx.ax
IMPORTS = combase msdmo dmoguids strmiids wmcodecdspuuid uuid
SOURCES = \
l3codecx.c \
l3codecx.idl

View file

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

156
dlls/l3codecx.ax/l3codecx.c Normal file
View file

@ -0,0 +1,156 @@
/*
* 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 <stdarg.h>
#include <stddef.h>
#define COBJMACROS
#include "windef.h"
#include "winbase.h"
#include "dshow.h"
#include "mpegtype.h"
#include "rpcproxy.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "initguid.h"
DEFINE_GUID(CLSID_MPEGLayer3Decoder,0x38be3000,0xdbf4,0x11d0,0x86,0x0e,0x00,0xa0,0x24,0xcf,0xef,0x6d);
DEFINE_GUID(MEDIASUBTYPE_MP3,WAVE_FORMAT_MPEGLAYER3,0x0000,0x0010,0x80,0x00,0x00,0xaa,0x00,0x38,0x9b,0x71);
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 HRESULT WINAPI mpeg_layer3_decoder_factory_CreateInstance(IClassFactory *iface,
IUnknown *outer, REFIID riid, void **out)
{
static const GUID CLSID_wg_mp3_decoder = {0x84cd8e3e,0xb221,0x434a,{0x88,0x82,0x9d,0x6c,0x8d,0xf4,0x90,0xe1}};
return CoCreateInstance(&CLSID_wg_mp3_decoder, outer, CLSCTX_INPROC_SERVER, riid, out);
}
static inline HRESULT WINAPI class_factory_LockServer(IClassFactory *iface, BOOL dolock)
{
return S_OK;
}
static const IClassFactoryVtbl mpeg_layer3_decoder_factory_vtbl =
{
class_factory_QueryInterface,
class_factory_AddRef,
class_factory_Release,
mpeg_layer3_decoder_factory_CreateInstance,
class_factory_LockServer,
};
static IClassFactory mpeg_layer3_decoder_factory = {&mpeg_layer3_decoder_factory_vtbl};
/***********************************************************************
* DllGetClassObject (l3codecx.@)
*/
HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **out)
{
if (IsEqualGUID(clsid, &CLSID_MPEGLayer3Decoder))
return IClassFactory_QueryInterface(&mpeg_layer3_decoder_factory, iid, out);
*out = NULL;
FIXME("Unknown clsid %s.\n", debugstr_guid(clsid));
return CLASS_E_CLASSNOTAVAILABLE;
}
/***********************************************************************
* DllRegisterServer (l3codecx.@)
*/
HRESULT WINAPI DllRegisterServer(void)
{
static const REGPINTYPES mpeg_layer3_decoder_inputs[] =
{
{&MEDIATYPE_Audio, &MEDIASUBTYPE_MP3},
};
static const REGPINTYPES mpeg_layer3_decoder_outputs[] =
{
{&MEDIATYPE_Audio, &MEDIASUBTYPE_PCM},
};
static const REGFILTERPINS2 mpeg_layer3_decoder_pins[] =
{
{
.nMediaTypes = ARRAY_SIZE(mpeg_layer3_decoder_inputs),
.lpMediaType = mpeg_layer3_decoder_inputs,
},
{
.dwFlags = REG_PINFLAG_B_OUTPUT,
.nMediaTypes = ARRAY_SIZE(mpeg_layer3_decoder_outputs),
.lpMediaType = mpeg_layer3_decoder_outputs,
},
};
static const REGFILTER2 mpeg_layer3_decoder_desc =
{
.dwVersion = 2,
.dwMerit = 0x00810000,
.cPins2 = ARRAY_SIZE(mpeg_layer3_decoder_pins),
.rgPins2 = mpeg_layer3_decoder_pins,
};
IFilterMapper2 *mapper;
HRESULT hr;
TRACE(".\n");
if (FAILED(hr = __wine_register_resources()))
return hr;
if (FAILED(hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER,
&IID_IFilterMapper2, (void **)&mapper)))
return hr;
hr = IFilterMapper2_RegisterFilter(mapper, &CLSID_MPEGLayer3Decoder, L"MPEG Layer-3 Decoder", NULL,
NULL, NULL, &mpeg_layer3_decoder_desc);
IFilterMapper2_Release(mapper);
return hr;
}
/***********************************************************************
* DllUnregisterServer (l3codecx.@)
*/
HRESULT WINAPI DllUnregisterServer(void)
{
IFilterMapper2 *mapper;
HRESULT hr;
TRACE(".\n");
if (FAILED(hr = __wine_unregister_resources()))
return hr;
if (FAILED(hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER,
&IID_IFilterMapper2, (void **)&mapper)))
return hr;
hr = IFilterMapper2_UnregisterFilter(mapper, NULL, NULL, &CLSID_MPEGLayer3Decoder);
IFilterMapper2_Release(mapper);
return S_OK;
}

View file

@ -0,0 +1,26 @@
/*
* 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
[
helpstring("MPEG Layer-3 Decoder"),
threading(both),
uuid(38be3000-dbf4-11d0-860e-00a024cfef6d)
]
coclass MPEGLayer3Decoder {}

View file

@ -58,6 +58,7 @@ HRESULT filter_graph_no_thread_create(IUnknown *outer, IUnknown **out);
HRESULT filter_mapper_create(IUnknown *outer, IUnknown **out);
HRESULT mem_allocator_create(IUnknown *outer, IUnknown **out);
HRESULT mpeg_audio_codec_create(IUnknown *outer, IUnknown **out);
HRESULT mpeg_layer3_decoder_create(IUnknown *outer, IUnknown **out);
HRESULT mpeg_video_codec_create(IUnknown *outer, IUnknown **out);
HRESULT mpeg1_splitter_create(IUnknown *outer, IUnknown **out);
HRESULT system_clock_create(IUnknown *outer, IUnknown **out);

View file

@ -41,8 +41,6 @@ WINE_DECLARE_DEBUG_CHANNEL(wmvcore);
DEFINE_GUID(GUID_NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
DEFINE_GUID(MEDIASUBTYPE_VC1S,MAKEFOURCC('V','C','1','S'),0x0000,0x0010,0x80,0x00,0x00,0xaa,0x00,0x38,0x9b,0x71);
static const GUID MEDIASUBTYPE_MP3 = {0x00000055, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
bool array_reserve(void **elements, size_t *capacity, size_t count, size_t size)
{
unsigned int new_capacity, max_capacity;
@ -1000,6 +998,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **out)
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}};
static const GUID CLSID_wg_mp3_decoder = {0x84cd8e3e,0xb221,0x434a,{0x88,0x82,0x9d,0x6c,0x8d,0xf4,0x90,0xe1}};
static const GUID CLSID_wg_mpeg1_splitter = {0xa8edbf98,0x2442,0x42c5,{0x85,0xa1,0xab,0x05,0xa5,0x80,0xdf,0x53}};
static const GUID CLSID_wg_wave_parser = {0x3f839ec7,0x5ea6,0x49e1,{0x80,0xc2,0x1e,0xa3,0x00,0xf8,0xb0,0xe0}};
struct class_factory *factory;
@ -1021,7 +1020,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **out)
factory = &mpeg_audio_codec_cf;
else if (IsEqualGUID(clsid, &CLSID_wg_mpeg_video_decoder))
factory = &mpeg_video_codec_cf;
else if (IsEqualGUID(clsid, &CLSID_mpeg_layer3_decoder))
else if (IsEqualGUID(clsid, &CLSID_wg_mp3_decoder))
factory = &mpeg_layer3_decoder_cf;
else if (IsEqualGUID(clsid, &CLSID_wg_mpeg1_splitter))
factory = &mpeg_splitter_cf;
@ -1084,38 +1083,6 @@ static const REGPINTYPES reg_audio_mt = {&MEDIATYPE_Audio, &GUID_NULL};
static const REGPINTYPES reg_stream_mt = {&MEDIATYPE_Stream, &GUID_NULL};
static const REGPINTYPES reg_video_mt = {&MEDIATYPE_Video, &GUID_NULL};
static const REGPINTYPES reg_mpeg_layer3_decoder_sink_mts[1] =
{
{&MEDIATYPE_Audio, &MEDIASUBTYPE_MP3},
};
static const REGPINTYPES reg_mpeg_layer3_decoder_source_mts[1] =
{
{&MEDIATYPE_Audio, &MEDIASUBTYPE_PCM},
};
static const REGFILTERPINS2 reg_mpeg_layer3_decoder_pins[2] =
{
{
.nMediaTypes = 1,
.lpMediaType = reg_mpeg_layer3_decoder_sink_mts,
},
{
.dwFlags = REG_PINFLAG_B_OUTPUT,
.nMediaTypes = 1,
.lpMediaType = reg_mpeg_layer3_decoder_source_mts,
},
};
static const REGFILTER2 reg_mpeg_layer3_decoder =
{
.dwVersion = 2,
.dwMerit = 0x00810000,
.u.s2.cPins2 = 2,
.u.s2.rgPins2 = reg_mpeg_layer3_decoder_pins,
};
static const REGFILTERPINS2 reg_decodebin_parser_pins[3] =
{
{
@ -1158,8 +1125,6 @@ HRESULT WINAPI DllRegisterServer(void)
IFilterMapper2_RegisterFilter(mapper, &CLSID_decodebin_parser,
L"GStreamer splitter filter", NULL, NULL, NULL, &reg_decodebin_parser);
IFilterMapper2_RegisterFilter(mapper, &CLSID_mpeg_layer3_decoder,
L"MPEG Layer-3 Decoder", NULL, NULL, NULL, &reg_mpeg_layer3_decoder);
IFilterMapper2_Release(mapper);
@ -1181,7 +1146,6 @@ HRESULT WINAPI DllUnregisterServer(void)
return hr;
IFilterMapper2_UnregisterFilter(mapper, NULL, NULL, &CLSID_decodebin_parser);
IFilterMapper2_UnregisterFilter(mapper, NULL, NULL, &CLSID_mpeg_layer3_decoder);
IFilterMapper2_Release(mapper);

View file

@ -40,11 +40,10 @@ coclass wg_mpeg_audio_decoder {}
coclass wg_mpeg_video_decoder {}
[
helpstring("MPEG Layer-3 Decoder"),
threading(both),
uuid(38be3000-dbf4-11d0-860e-00a024cfef6d)
uuid(84cd8e3e-b221-434a-8882-9d6c8df490e1)
]
coclass mpeg_layer3_decoder {}
coclass wg_mp3_decoder {}
[
threading(both),

View file

@ -2107,6 +2107,7 @@ HKLM,%CurrentVersion%\Telephony\Country List\998,"SameAreaRule",,"G"
11,,cryptdlg.dll,1
11,,cryptnet.dll,1
11,,devenum.dll,1
11,,l3codecx.ax,1
11,,mfasfsrcsnk.dll,1
11,,mfh264enc.dll,1
11,,mfmp4srcsnk.dll,1