From: Rémi Bernon rbernon@codeweavers.com
--- dlls/quartz/Makefile.in | 1 + dlls/quartz/main.c | 3 ++ dlls/quartz/parser.c | 37 ++++++++++++++ dlls/quartz/quartz_private.h | 20 ++++++++ dlls/quartz/quartz_strmif.idl | 7 +++ dlls/quartz/regsvr.c | 47 ++++++++++++++++++ dlls/winegstreamer/main.c | 52 +------------------- dlls/winegstreamer/winegstreamer_classes.idl | 5 +- 8 files changed, 119 insertions(+), 53 deletions(-) create mode 100644 dlls/quartz/parser.c
diff --git a/dlls/quartz/Makefile.in b/dlls/quartz/Makefile.in index db6280f27ed..ec0c641df07 100644 --- a/dlls/quartz/Makefile.in +++ b/dlls/quartz/Makefile.in @@ -13,6 +13,7 @@ SOURCES = \ filtermapper.c \ main.c \ memallocator.c \ + parser.c \ passthrough.c \ quartz.rc \ quartz_strmif.idl \ diff --git a/dlls/quartz/main.c b/dlls/quartz/main.c index f52884afb34..a6932d3210c 100644 --- a/dlls/quartz/main.c +++ b/dlls/quartz/main.c @@ -169,6 +169,9 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
+ if (IsEqualGUID(rclsid, &CLSID_MPEG1Splitter)) + return IClassFactory_QueryInterface(&mpeg1_splitter_factory, riid, ppv); + if (IsEqualGUID( &IID_IClassFactory, riid ) || IsEqualGUID( &IID_IUnknown, riid)) { for (i = 0; i < ARRAY_SIZE(object_creation); i++) diff --git a/dlls/quartz/parser.c b/dlls/quartz/parser.c new file mode 100644 index 00000000000..3acb7e4e0ab --- /dev/null +++ b/dlls/quartz/parser.c @@ -0,0 +1,37 @@ +/* + * 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" + +static HRESULT WINAPI mpeg1_splitter_factory_CreateInstance(IClassFactory *iface, IUnknown *outer, + REFIID riid, void **out) +{ + static const GUID CLSID_wg_mpeg1_splitter = {0xa8edbf98,0x2442,0x42c5,{0x85,0xa1,0xab,0x05,0xa5,0x80,0xdf,0x53}}; + return CoCreateInstance(&CLSID_wg_mpeg1_splitter, outer, CLSCTX_INPROC_SERVER, riid, out); +} + +static const IClassFactoryVtbl mpeg1_splitter_factory_vtbl = +{ + class_factory_QueryInterface, + class_factory_AddRef, + class_factory_Release, + mpeg1_splitter_factory_CreateInstance, + class_factory_LockServer, +}; + +IClassFactory mpeg1_splitter_factory = {&mpeg1_splitter_factory_vtbl}; diff --git a/dlls/quartz/quartz_private.h b/dlls/quartz/quartz_private.h index 946709f936a..bc3204ed64f 100644 --- a/dlls/quartz/quartz_private.h +++ b/dlls/quartz/quartz_private.h @@ -48,6 +48,8 @@ #define MEDIATIME_FROM_BYTES(x) ((LONGLONG)(x) * 10000000) #define BYTES_FROM_MEDIATIME(time) ((time) / 10000000)
+extern IClassFactory mpeg1_splitter_factory; + HRESULT acm_wrapper_create(IUnknown *outer, IUnknown **out); HRESULT avi_dec_create(IUnknown *outer, IUnknown **out); HRESULT async_reader_create(IUnknown *outer, IUnknown **out); @@ -145,4 +147,22 @@ HRESULT WINAPI BaseControlWindowImpl_GetRestorePosition(IVideoWindow *iface, LON HRESULT WINAPI BaseControlWindowImpl_HideCursor(IVideoWindow *iface, LONG HideCursor); HRESULT WINAPI BaseControlWindowImpl_IsCursorHidden(IVideoWindow *iface, LONG *CursorHidden);
+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; +} + #endif /* __QUARTZ_PRIVATE_INCLUDED__ */ diff --git a/dlls/quartz/quartz_strmif.idl b/dlls/quartz/quartz_strmif.idl index 51812f4be30..bca51a59b31 100644 --- a/dlls/quartz/quartz_strmif.idl +++ b/dlls/quartz/quartz_strmif.idl @@ -145,3 +145,10 @@ coclass VideoMixingRenderer9 { interface IBaseFilter; } uuid(99d54f63-1a69-41ae-aa4d-c976eb3f0713) ] coclass AllocPresenter {} + +[ + helpstring("MPEG-I Stream Splitter"), + threading(both), + uuid(336475d0-942a-11ce-a870-00aa002feab5) +] +coclass MPEG1Splitter {} diff --git a/dlls/quartz/regsvr.c b/dlls/quartz/regsvr.c index 28ae50ade0c..3a27c83418e 100644 --- a/dlls/quartz/regsvr.c +++ b/dlls/quartz/regsvr.c @@ -168,6 +168,48 @@ HRESULT WINAPI DllRegisterServer(void) .rgPins2 = acm_wrapper_pins, };
+ static const REGPINTYPES mpeg_splitter_inputs[] = + { + {&MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG1Audio}, + {&MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG1Video}, + {&MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG1System}, + {&MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG1VideoCD}, + }; + static const REGPINTYPES mpeg_splitter_audio_outputs[] = + { + {&MEDIATYPE_Audio, &MEDIASUBTYPE_MPEG1Packet}, + {&MEDIATYPE_Audio, &MEDIASUBTYPE_MPEG1AudioPayload}, + }; + static const REGPINTYPES mpeg_splitter_video_outputs[] = + { + {&MEDIATYPE_Video, &MEDIASUBTYPE_MPEG1Packet}, + {&MEDIATYPE_Video, &MEDIASUBTYPE_MPEG1Payload}, + }; + static const REGFILTERPINS2 mpeg_splitter_pins[] = + { + { + .nMediaTypes = ARRAY_SIZE(mpeg_splitter_inputs), + .lpMediaType = mpeg_splitter_inputs, + }, + { + .dwFlags = REG_PINFLAG_B_ZERO | REG_PINFLAG_B_OUTPUT, + .nMediaTypes = ARRAY_SIZE(mpeg_splitter_audio_outputs), + .lpMediaType = mpeg_splitter_audio_outputs, + }, + { + .dwFlags = REG_PINFLAG_B_ZERO | REG_PINFLAG_B_OUTPUT, + .nMediaTypes = ARRAY_SIZE(mpeg_splitter_video_outputs), + .lpMediaType = mpeg_splitter_video_outputs, + }, + }; + static const REGFILTER2 mpeg_splitter_reg = + { + .dwVersion = 2, + .dwMerit = MERIT_NORMAL, + .cPins2 = ARRAY_SIZE(mpeg_splitter_pins), + .rgPins2 = mpeg_splitter_pins, + }; + IFilterMapper2 *mapper; HRESULT hr;
@@ -198,6 +240,9 @@ HRESULT WINAPI DllRegisterServer(void) if (FAILED(hr = IFilterMapper2_RegisterFilter(mapper, &CLSID_ACMWrapper, L"ACM Wrapper", NULL, &CLSID_LegacyAmFilterCategory, NULL, &acm_wrapper_reg))) goto done; + if (FAILED(hr = IFilterMapper2_RegisterFilter(mapper, &CLSID_MPEG1Splitter, L"MPEG-I Stream Splitter", NULL, + NULL, NULL, &mpeg_splitter_reg))) + goto done;
done: IFilterMapper2_Release(mapper); @@ -233,6 +278,8 @@ HRESULT WINAPI DllUnregisterServer(void) goto done; if (FAILED(hr = IFilterMapper2_UnregisterFilter(mapper, &CLSID_LegacyAmFilterCategory, NULL, &CLSID_ACMWrapper))) goto done; + if (FAILED(hr = IFilterMapper2_UnregisterFilter(mapper, NULL, NULL, &CLSID_MPEG1Splitter))) + goto done;
done: IFilterMapper2_Release(mapper); diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c index 006cd370d99..6bc37e7e024 100644 --- a/dlls/winegstreamer/main.c +++ b/dlls/winegstreamer/main.c @@ -997,6 +997,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_mpeg1_splitter = {0xa8edbf98,0x2442,0x42c5,{0x85,0xa1,0xab,0x05,0xa5,0x80,0xdf,0x53}}; struct class_factory *factory; HRESULT hr;
@@ -1018,7 +1019,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **out) factory = &mpeg_video_codec_cf; else if (IsEqualGUID(clsid, &CLSID_mpeg_layer3_decoder)) factory = &mpeg_layer3_decoder_cf; - else if (IsEqualGUID(clsid, &CLSID_MPEG1Splitter)) + else if (IsEqualGUID(clsid, &CLSID_wg_mpeg1_splitter)) factory = &mpeg_splitter_cf; else if (IsEqualGUID(clsid, &CLSID_WAVEParser)) factory = &wave_parser_cf; @@ -1198,52 +1199,6 @@ static const REGFILTER2 reg_mpeg_layer3_decoder = .u.s2.rgPins2 = reg_mpeg_layer3_decoder_pins, };
-static const REGPINTYPES reg_mpeg_splitter_sink_mts[4] = -{ - {&MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG1Audio}, - {&MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG1Video}, - {&MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG1System}, - {&MEDIATYPE_Stream, &MEDIASUBTYPE_MPEG1VideoCD}, -}; - -static const REGPINTYPES reg_mpeg_splitter_audio_mts[2] = -{ - {&MEDIATYPE_Audio, &MEDIASUBTYPE_MPEG1Packet}, - {&MEDIATYPE_Audio, &MEDIASUBTYPE_MPEG1AudioPayload}, -}; - -static const REGPINTYPES reg_mpeg_splitter_video_mts[2] = -{ - {&MEDIATYPE_Video, &MEDIASUBTYPE_MPEG1Packet}, - {&MEDIATYPE_Video, &MEDIASUBTYPE_MPEG1Payload}, -}; - -static const REGFILTERPINS2 reg_mpeg_splitter_pins[3] = -{ - { - .nMediaTypes = 4, - .lpMediaType = reg_mpeg_splitter_sink_mts, - }, - { - .dwFlags = REG_PINFLAG_B_ZERO | REG_PINFLAG_B_OUTPUT, - .nMediaTypes = 2, - .lpMediaType = reg_mpeg_splitter_audio_mts, - }, - { - .dwFlags = REG_PINFLAG_B_ZERO | REG_PINFLAG_B_OUTPUT, - .nMediaTypes = 2, - .lpMediaType = reg_mpeg_splitter_video_mts, - }, -}; - -static const REGFILTER2 reg_mpeg_splitter = -{ - .dwVersion = 2, - .dwMerit = MERIT_NORMAL, - .u.s2.cPins2 = 3, - .u.s2.rgPins2 = reg_mpeg_splitter_pins, -}; - static const REGPINTYPES reg_wave_parser_sink_mts[3] = { {&MEDIATYPE_Stream, &MEDIASUBTYPE_WAVE}, @@ -1321,8 +1276,6 @@ HRESULT WINAPI DllRegisterServer(void) L"MPEG Video Decoder", NULL, NULL, NULL, ®_mpeg_video_codec); IFilterMapper2_RegisterFilter(mapper, &CLSID_mpeg_layer3_decoder, L"MPEG Layer-3 Decoder", NULL, NULL, NULL, ®_mpeg_layer3_decoder); - IFilterMapper2_RegisterFilter(mapper, &CLSID_MPEG1Splitter, - L"MPEG-I Stream Splitter", NULL, NULL, NULL, ®_mpeg_splitter); IFilterMapper2_RegisterFilter(mapper, &CLSID_WAVEParser, L"Wave Parser", NULL, NULL, NULL, ®_wave_parser);
IFilterMapper2_Release(mapper); @@ -1349,7 +1302,6 @@ HRESULT WINAPI DllUnregisterServer(void) IFilterMapper2_UnregisterFilter(mapper, NULL, NULL, &CLSID_CMpegAudioCodec); IFilterMapper2_UnregisterFilter(mapper, NULL, NULL, &CLSID_CMpegVideoCodec); IFilterMapper2_UnregisterFilter(mapper, NULL, NULL, &CLSID_mpeg_layer3_decoder); - IFilterMapper2_UnregisterFilter(mapper, NULL, NULL, &CLSID_MPEG1Splitter); IFilterMapper2_UnregisterFilter(mapper, NULL, NULL, &CLSID_WAVEParser);
IFilterMapper2_Release(mapper); diff --git a/dlls/winegstreamer/winegstreamer_classes.idl b/dlls/winegstreamer/winegstreamer_classes.idl index 65d3e3c5c1a..34170690de9 100644 --- a/dlls/winegstreamer/winegstreamer_classes.idl +++ b/dlls/winegstreamer/winegstreamer_classes.idl @@ -50,11 +50,10 @@ coclass CMpegVideoCodec {} coclass mpeg_layer3_decoder {}
[ - helpstring("MPEG-I Stream Splitter"), threading(both), - uuid(336475d0-942a-11ce-a870-00aa002feab5) + uuid(a8edbf98-2442-42c5-85a1-ab05a580df53) ] -coclass MPEG1Splitter {} +coclass wg_mpeg1_splitter {}
[ helpstring("Wave Parser"),