From: Rémi Bernon rbernon@codeweavers.com
--- dlls/quartz/Makefile.in | 1 + dlls/quartz/decoder.c | 25 +++++++++++++ dlls/quartz/main.c | 36 ++++++++++++++++++ dlls/quartz/quartz_private.h | 1 + dlls/quartz/quartz_strmif.idl | 7 ++++ dlls/winegstreamer/main.c | 39 +------------------- dlls/winegstreamer/winegstreamer_classes.idl | 5 +-- 7 files changed, 74 insertions(+), 40 deletions(-) create mode 100644 dlls/quartz/decoder.c
diff --git a/dlls/quartz/Makefile.in b/dlls/quartz/Makefile.in index d1bd73db9be..6eeeac9a723 100644 --- a/dlls/quartz/Makefile.in +++ b/dlls/quartz/Makefile.in @@ -7,6 +7,7 @@ SOURCES = \ acmwrapper.c \ avidec.c \ control_tlb.idl \ + decoder.c \ dsoundrender.c \ filesource.c \ filtergraph.c \ diff --git a/dlls/quartz/decoder.c b/dlls/quartz/decoder.c new file mode 100644 index 00000000000..2a80db5d3d5 --- /dev/null +++ b/dlls/quartz/decoder.c @@ -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 + */ + +#include "quartz_private.h" + +HRESULT mpeg_audio_codec_create(IUnknown *outer, IUnknown **out) +{ + static const GUID CLSID_wg_mpeg_audio_decoder = {0xc9f285f8,0x4380,0x4121,{0x97,0x1f,0x49,0xa9,0x53,0x16,0xc2,0x7b}}; + return CoCreateInstance(&CLSID_wg_mpeg_audio_decoder, outer, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)out); +} diff --git a/dlls/quartz/main.c b/dlls/quartz/main.c index 57b60445d6d..126b447cfa7 100644 --- a/dlls/quartz/main.c +++ b/dlls/quartz/main.c @@ -66,6 +66,7 @@ static const struct object_creation_info object_creation[] = { &CLSID_AudioRender, dsound_render_create }, { &CLSID_AVIDec, avi_dec_create }, { &CLSID_AviSplitter, avi_splitter_create }, + { &CLSID_CMpegAudioCodec, mpeg_audio_codec_create }, { &CLSID_DSoundRender, dsound_render_create }, { &CLSID_FilterGraph, filter_graph_create }, { &CLSID_FilterGraphNoThread, filter_graph_no_thread_create }, @@ -424,6 +425,36 @@ HRESULT WINAPI DllRegisterServer(void) .rgPins2 = wave_parser_pins, };
+ static const REGPINTYPES mpeg_audio_codec_inputs[] = + { + {&MEDIATYPE_Audio, &MEDIASUBTYPE_MPEG1Packet}, + {&MEDIATYPE_Audio, &MEDIASUBTYPE_MPEG1Payload}, + {&MEDIATYPE_Audio, &MEDIASUBTYPE_MPEG1AudioPayload}, + }; + static const REGPINTYPES mpeg_audio_codec_outputs[] = + { + {&MEDIATYPE_Audio, &MEDIASUBTYPE_PCM}, + }; + static const REGFILTERPINS2 mpeg_audio_codec_pins[] = + { + { + .nMediaTypes = ARRAY_SIZE(mpeg_audio_codec_inputs), + .lpMediaType = mpeg_audio_codec_inputs, + }, + { + .dwFlags = REG_PINFLAG_B_OUTPUT, + .nMediaTypes = ARRAY_SIZE(mpeg_audio_codec_outputs), + .lpMediaType = mpeg_audio_codec_outputs, + }, + }; + static const REGFILTER2 mpeg_audio_codec_reg = + { + .dwVersion = 2, + .dwMerit = 0x03680001, + .cPins2 = ARRAY_SIZE(mpeg_audio_codec_pins), + .rgPins2 = mpeg_audio_codec_pins, + }; + IFilterMapper2 *mapper; HRESULT hr;
@@ -463,6 +494,9 @@ HRESULT WINAPI DllRegisterServer(void) if (FAILED(hr = IFilterMapper2_RegisterFilter(mapper, &CLSID_WAVEParser, L"Wave Parser", NULL, NULL, NULL, &wave_parser_reg))) goto done; + if (FAILED(hr = IFilterMapper2_RegisterFilter(mapper, &CLSID_CMpegAudioCodec, L"MPEG Audio Decoder", NULL, + NULL, NULL, &mpeg_audio_codec_reg))) + goto done;
done: IFilterMapper2_Release(mapper); @@ -504,6 +538,8 @@ HRESULT WINAPI DllUnregisterServer(void) goto done; if (FAILED(hr = IFilterMapper2_UnregisterFilter(mapper, NULL, NULL, &CLSID_WAVEParser))) goto done; + if (FAILED(hr = IFilterMapper2_UnregisterFilter(mapper, NULL, NULL, &CLSID_CMpegAudioCodec))) + goto done;
done: IFilterMapper2_Release(mapper); diff --git a/dlls/quartz/quartz_private.h b/dlls/quartz/quartz_private.h index 5925fc80620..c4ebf0802ad 100644 --- a/dlls/quartz/quartz_private.h +++ b/dlls/quartz/quartz_private.h @@ -57,6 +57,7 @@ HRESULT filter_graph_create(IUnknown *outer, IUnknown **out); 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 mpeg1_splitter_create(IUnknown *outer, IUnknown **out); HRESULT system_clock_create(IUnknown *outer, IUnknown **out); HRESULT seeking_passthrough_create(IUnknown *outer, IUnknown **out); diff --git a/dlls/quartz/quartz_strmif.idl b/dlls/quartz/quartz_strmif.idl index 4ea198c5ea0..b39ac041662 100644 --- a/dlls/quartz/quartz_strmif.idl +++ b/dlls/quartz/quartz_strmif.idl @@ -166,3 +166,10 @@ coclass AviSplitter {} uuid(d51bd5a1-7548-11cf-a520-0080c77ef58a) ] coclass WAVEParser {} + +[ + helpstring("MPEG Audio Decoder"), + threading(both), + uuid(4a2286e0-7bef-11ce-9bd9-0000e202599c) +] +coclass CMpegAudioCodec {} diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c index 33cd3439f62..6e0ce7284ea 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_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_mpeg_audio_decoder = {0xc9f285f8,0x4380,0x4121,{0x97,0x1f,0x49,0xa9,0x53,0x16,0xc2,0x7b}}; 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}}; @@ -1015,7 +1016,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **out) factory = &avi_splitter_cf; else if (IsEqualGUID(clsid, &CLSID_decodebin_parser)) factory = &decodebin_parser_cf; - else if (IsEqualGUID(clsid, &CLSID_CMpegAudioCodec)) + else if (IsEqualGUID(clsid, &CLSID_wg_mpeg_audio_decoder)) factory = &mpeg_audio_codec_cf; else if (IsEqualGUID(clsid, &CLSID_CMpegVideoCodec)) factory = &mpeg_video_codec_cf; @@ -1082,39 +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_audio_codec_sink_mts[3] = -{ - {&MEDIATYPE_Audio, &MEDIASUBTYPE_MPEG1Packet}, - {&MEDIATYPE_Audio, &MEDIASUBTYPE_MPEG1Payload}, - {&MEDIATYPE_Audio, &MEDIASUBTYPE_MPEG1AudioPayload}, -}; - -static const REGPINTYPES reg_mpeg_audio_codec_source_mts[1] = -{ - {&MEDIATYPE_Audio, &MEDIASUBTYPE_PCM}, -}; - -static const REGFILTERPINS2 reg_mpeg_audio_codec_pins[2] = -{ - { - .nMediaTypes = 3, - .lpMediaType = reg_mpeg_audio_codec_sink_mts, - }, - { - .dwFlags = REG_PINFLAG_B_OUTPUT, - .nMediaTypes = 1, - .lpMediaType = reg_mpeg_audio_codec_source_mts, - }, -}; - -static const REGFILTER2 reg_mpeg_audio_codec = -{ - .dwVersion = 2, - .dwMerit = 0x03680001, - .u.s2.cPins2 = 2, - .u.s2.rgPins2 = reg_mpeg_audio_codec_pins, -}; - static const REGPINTYPES reg_mpeg_video_codec_sink_mts[2] = { {&MEDIATYPE_Video, &MEDIASUBTYPE_MPEG1Packet}, @@ -1221,8 +1189,6 @@ HRESULT WINAPI DllRegisterServer(void)
IFilterMapper2_RegisterFilter(mapper, &CLSID_decodebin_parser, L"GStreamer splitter filter", NULL, NULL, NULL, ®_decodebin_parser); - IFilterMapper2_RegisterFilter(mapper, &CLSID_CMpegAudioCodec, - L"MPEG Audio Decoder", NULL, NULL, NULL, ®_mpeg_audio_codec); IFilterMapper2_RegisterFilter(mapper, &CLSID_CMpegVideoCodec, L"MPEG Video Decoder", NULL, NULL, NULL, ®_mpeg_video_codec); IFilterMapper2_RegisterFilter(mapper, &CLSID_mpeg_layer3_decoder, @@ -1248,7 +1214,6 @@ HRESULT WINAPI DllUnregisterServer(void) return hr;
IFilterMapper2_UnregisterFilter(mapper, NULL, NULL, &CLSID_decodebin_parser); - IFilterMapper2_UnregisterFilter(mapper, NULL, NULL, &CLSID_CMpegAudioCodec); IFilterMapper2_UnregisterFilter(mapper, NULL, NULL, &CLSID_CMpegVideoCodec); IFilterMapper2_UnregisterFilter(mapper, NULL, NULL, &CLSID_mpeg_layer3_decoder);
diff --git a/dlls/winegstreamer/winegstreamer_classes.idl b/dlls/winegstreamer/winegstreamer_classes.idl index f34cf998288..821f7db3763 100644 --- a/dlls/winegstreamer/winegstreamer_classes.idl +++ b/dlls/winegstreamer/winegstreamer_classes.idl @@ -28,11 +28,10 @@ coclass wg_avi_splitter {}
[ - helpstring("MPEG Audio Decoder"), threading(both), - uuid(4a2286e0-7bef-11ce-9bd9-0000e202599c) + uuid(c9f285f8-4380-4121-971f-49a95316c27b) ] -coclass CMpegAudioCodec {} +coclass wg_mpeg_audio_decoder {}
[ helpstring("MPEG Video Decoder"),