This allows to use DLLOVERRIDES with native DLLs, making it more convenient for testing and debugging. This will also makes it possible to create an alternative media source implementation with a different backend without breaking the current one.
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/mfsrcsnk/factory.c | 86 ++------------------------------ dlls/mfsrcsnk/mfsrcsnk_private.h | 50 ++++++++++++++++++- dlls/mfsrcsnk/wave.c | 61 ++++++++++------------ 3 files changed, 80 insertions(+), 117 deletions(-)
diff --git a/dlls/mfsrcsnk/factory.c b/dlls/mfsrcsnk/factory.c index 2e03451a523..66434ef7092 100644 --- a/dlls/mfsrcsnk/factory.c +++ b/dlls/mfsrcsnk/factory.c @@ -16,86 +16,12 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#define COBJMACROS - -#include "mfidl.h" -#include "wine/mfinternal.h" - #include "mfsrcsnk_private.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
-struct class_factory -{ - IClassFactory IClassFactory_iface; - HRESULT (*create_instance)(REFIID riid, void **out); -}; - -static inline struct class_factory *impl_from_IClassFactory(IClassFactory *iface) -{ - return CONTAINING_RECORD(iface, struct class_factory, IClassFactory_iface); -} - -static HRESULT WINAPI class_factory_QueryInterface(IClassFactory *iface, REFIID riid, void **out) -{ - if (IsEqualGUID(riid, &IID_IClassFactory) || - IsEqualGUID(riid, &IID_IUnknown)) - { - IClassFactory_AddRef(iface); - *out = iface; - return S_OK; - } - - *out = NULL; - WARN("Interface %s is not supported.\n", debugstr_guid(riid)); - return 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_CreateInstance(IClassFactory *iface, IUnknown *outer, - REFIID riid, void **out) -{ - struct class_factory *factory = impl_from_IClassFactory(iface); - - TRACE("%p, %s, %p.\n", outer, debugstr_guid(riid), out); - - *out = NULL; - - if (outer) - return CLASS_E_NOAGGREGATION; - - return factory->create_instance(riid, out); -} - -static HRESULT WINAPI class_factory_LockServer(IClassFactory *iface, BOOL dolock) -{ - FIXME("%p, %d.\n", iface, dolock); - - return S_OK; -} - -static const IClassFactoryVtbl class_factory_vtbl = -{ - class_factory_QueryInterface, - class_factory_AddRef, - class_factory_Release, - class_factory_CreateInstance, - class_factory_LockServer, -}; - -static struct class_factory wave_sink_factory = { { &class_factory_vtbl }, wave_sink_factory_create }; - /*********************************************************************** * DllGetClassObject (mfsrcsnk.@) */ @@ -104,12 +30,8 @@ HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void **out) *out = NULL;
if (IsEqualGUID(clsid, &CLSID_MFWAVESinkClassFactory)) - { - return IClassFactory_QueryInterface(&wave_sink_factory.IClassFactory_iface, riid, out); - } - else - { - FIXME("Unknown clsid %s.\n", debugstr_guid(clsid)); - return CLASS_E_CLASSNOTAVAILABLE; - } + return IClassFactory_QueryInterface(wave_sink_class_factory, riid, out); + + FIXME("Unknown clsid %s.\n", debugstr_guid(clsid)); + return CLASS_E_CLASSNOTAVAILABLE; } diff --git a/dlls/mfsrcsnk/mfsrcsnk_private.h b/dlls/mfsrcsnk/mfsrcsnk_private.h index 6654daebbd3..28caea2a1d2 100644 --- a/dlls/mfsrcsnk/mfsrcsnk_private.h +++ b/dlls/mfsrcsnk/mfsrcsnk_private.h @@ -16,6 +16,54 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
+#define COBJMACROS + +#include "mfapi.h" +#include "mfidl.h" +#include "mferror.h" + #include "wine/mfinternal.h"
-extern HRESULT wave_sink_factory_create(REFIID riid, void **out); +extern IClassFactory *wave_sink_class_factory; + +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; +} + +struct sink_class_factory +{ + IClassFactory IClassFactory_iface; + IMFSinkClassFactory IMFSinkClassFactory_iface; +}; + +static inline struct sink_class_factory *sink_class_factory_from_IClassFactory(IClassFactory *iface) +{ + return CONTAINING_RECORD(iface, struct sink_class_factory, IClassFactory_iface); +} +static inline HRESULT WINAPI sink_class_factory_QueryInterface(IMFSinkClassFactory *iface, REFIID riid, void **out) +{ + *out = IsEqualGUID(riid, &IID_IMFSinkClassFactory) || IsEqualGUID(riid, &IID_IUnknown) ? iface : NULL; + return *out ? S_OK : E_NOINTERFACE; +} +static inline ULONG WINAPI sink_class_factory_AddRef(IMFSinkClassFactory *iface) +{ + return 2; +} +static inline ULONG WINAPI sink_class_factory_Release(IMFSinkClassFactory *iface) +{ + return 1; +} diff --git a/dlls/mfsrcsnk/wave.c b/dlls/mfsrcsnk/wave.c index 736bbb5aa3c..bae70960a72 100644 --- a/dlls/mfsrcsnk/wave.c +++ b/dlls/mfsrcsnk/wave.c @@ -16,12 +16,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#define COBJMACROS - -#include "mfapi.h" -#include "mfidl.h" -#include "mferror.h" - #include "mfsrcsnk_private.h"
#include "wine/debug.h" @@ -1000,30 +994,6 @@ failed: return hr; }
-static HRESULT WINAPI sink_class_factory_QueryInterface(IMFSinkClassFactory *iface, REFIID riid, void **out) -{ - if (IsEqualIID(riid, &IID_IMFSinkClassFactory) - || IsEqualIID(riid, &IID_IUnknown)) - { - *out = iface; - IMFSinkClassFactory_AddRef(iface); - return S_OK; - } - - *out = NULL; - return E_NOINTERFACE; -} - -static ULONG WINAPI sink_class_factory_AddRef(IMFSinkClassFactory *iface) -{ - return 2; -} - -static ULONG WINAPI sink_class_factory_Release(IMFSinkClassFactory *iface) -{ - return 1; -} - static HRESULT WINAPI sink_class_factory_CreateMediaSink(IMFSinkClassFactory *iface, IMFByteStream *stream, IMFMediaType *video_type, IMFMediaType *audio_type, IMFMediaSink **sink) { @@ -1040,9 +1010,32 @@ static const IMFSinkClassFactoryVtbl wave_sink_factory_vtbl = sink_class_factory_CreateMediaSink, };
-static IMFSinkClassFactory wave_sink_factory = { &wave_sink_factory_vtbl }; - -HRESULT wave_sink_factory_create(REFIID riid, void **out) +static HRESULT WINAPI class_factory_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **out) { - return IMFSinkClassFactory_QueryInterface(&wave_sink_factory, riid, out); + struct sink_class_factory *factory = sink_class_factory_from_IClassFactory(iface); + + TRACE("iface %p, outer %p, riid %s, out %p stub!.\n", iface, outer, debugstr_guid(riid), out); + + *out = NULL; + if (outer) + return CLASS_E_NOAGGREGATION; + + return IMFSinkClassFactory_QueryInterface(&factory->IMFSinkClassFactory_iface, riid, out); } + +static const IClassFactoryVtbl wave_sink_class_factory_vtbl = +{ + class_factory_QueryInterface, + class_factory_AddRef, + class_factory_Release, + class_factory_CreateInstance, + class_factory_LockServer, +}; + +struct sink_class_factory wave_sink_factory = +{ + { &wave_sink_class_factory_vtbl }, + { &wave_sink_factory_vtbl }, +}; + +IClassFactory *wave_sink_class_factory = &wave_sink_factory.IClassFactory_iface;
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/mfsrcsnk/Makefile.in | 2 ++ dlls/mfsrcsnk/factory.c | 4 +++- dlls/mfsrcsnk/media_source.c | 39 ++++++++++++++++++++++++++++++++++++ dlls/mfsrcsnk/media_source.h | 23 +++++++++++++++++++++ dlls/mfsrcsnk/mfsrcsnk.idl | 7 +++++++ dlls/mfsrcsnk/mfsrcsnk.rc | 24 ++++++++++++++++++++++ dlls/mfsrcsnk/mfsrcsnk.rgs | 31 ++++++++++++++++++++++++++++ include/wine/mfinternal.idl | 2 ++ 8 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 dlls/mfsrcsnk/media_source.c create mode 100644 dlls/mfsrcsnk/media_source.h create mode 100644 dlls/mfsrcsnk/mfsrcsnk.rc create mode 100644 dlls/mfsrcsnk/mfsrcsnk.rgs
diff --git a/dlls/mfsrcsnk/Makefile.in b/dlls/mfsrcsnk/Makefile.in index 7a3f947eb0c..4b4d209e8c2 100644 --- a/dlls/mfsrcsnk/Makefile.in +++ b/dlls/mfsrcsnk/Makefile.in @@ -6,5 +6,7 @@ EXTRADLLFLAGS = -Wb,--prefer-native
SOURCES = \ factory.c \ + media_source.c \ mfsrcsnk.idl \ + mfsrcsnk.rc \ wave.c diff --git a/dlls/mfsrcsnk/factory.c b/dlls/mfsrcsnk/factory.c index 66434ef7092..e89129f9e03 100644 --- a/dlls/mfsrcsnk/factory.c +++ b/dlls/mfsrcsnk/factory.c @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include "mfsrcsnk_private.h" +#include "media_source.h"
#include "wine/debug.h"
@@ -29,6 +29,8 @@ HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void **out) { *out = NULL;
+ if (IsEqualGUID(clsid, &CLSID_AVIByteStreamPlugin)) + return IClassFactory_QueryInterface(&avi_byte_stream_plugin_factory, riid, out); if (IsEqualGUID(clsid, &CLSID_MFWAVESinkClassFactory)) return IClassFactory_QueryInterface(wave_sink_class_factory, riid, out);
diff --git a/dlls/mfsrcsnk/media_source.c b/dlls/mfsrcsnk/media_source.c new file mode 100644 index 00000000000..0c765ab9494 --- /dev/null +++ b/dlls/mfsrcsnk/media_source.c @@ -0,0 +1,39 @@ +/* + * 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 "mfsrcsnk_private.h" + +#include "wine/debug.h" + +static HRESULT WINAPI avi_byte_stream_plugin_factory_CreateInstance(IClassFactory *iface, + IUnknown *outer, REFIID riid, void **out) +{ + static const GUID CLSID_GStreamerByteStreamHandler = {0x317df618,0x5e5a,0x468a,{0x9f,0x15,0xd8,0x27,0xa9,0xa0,0x81,0x62}}; + return CoCreateInstance(&CLSID_GStreamerByteStreamHandler, outer, CLSCTX_INPROC_SERVER, riid, out); +} + +static const IClassFactoryVtbl avi_byte_stream_plugin_factory_vtbl = +{ + class_factory_QueryInterface, + class_factory_AddRef, + class_factory_Release, + avi_byte_stream_plugin_factory_CreateInstance, + class_factory_LockServer, +}; + +IClassFactory avi_byte_stream_plugin_factory = {&avi_byte_stream_plugin_factory_vtbl}; diff --git a/dlls/mfsrcsnk/media_source.h b/dlls/mfsrcsnk/media_source.h new file mode 100644 index 00000000000..63333658086 --- /dev/null +++ b/dlls/mfsrcsnk/media_source.h @@ -0,0 +1,23 @@ +/* + * 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 "mfsrcsnk_private.h" + +#include "wine/debug.h" + +extern IClassFactory avi_byte_stream_plugin_factory; diff --git a/dlls/mfsrcsnk/mfsrcsnk.idl b/dlls/mfsrcsnk/mfsrcsnk.idl index 13bdac2977e..e40831d7a7f 100644 --- a/dlls/mfsrcsnk/mfsrcsnk.idl +++ b/dlls/mfsrcsnk/mfsrcsnk.idl @@ -18,6 +18,13 @@
#pragma makedep register
+[ + helpstring("AVI Byte Stream Handler"), + threading(both), + uuid(7afa253e-f823-42f6-a5d9-714bde467412) +] +coclass AVIByteStreamPlugin { } + [ helpstring("MF WAVE Sink Factory"), threading(both), diff --git a/dlls/mfsrcsnk/mfsrcsnk.rc b/dlls/mfsrcsnk/mfsrcsnk.rc new file mode 100644 index 00000000000..363aa8aa971 --- /dev/null +++ b/dlls/mfsrcsnk/mfsrcsnk.rc @@ -0,0 +1,24 @@ +/* + * 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 "windef.h" + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL + +/* @makedep: mfsrcsnk.rgs */ +1 WINE_REGISTRY mfsrcsnk.rgs diff --git a/dlls/mfsrcsnk/mfsrcsnk.rgs b/dlls/mfsrcsnk/mfsrcsnk.rgs new file mode 100644 index 00000000000..ee897e464a2 --- /dev/null +++ b/dlls/mfsrcsnk/mfsrcsnk.rgs @@ -0,0 +1,31 @@ +HKLM +{ + NoRemove 'Software' + { + NoRemove 'Microsoft' + { + NoRemove 'Windows Media Foundation' + { + NoRemove 'ByteStreamHandlers' + { + '.avi' + { + val '{7afa253e-f823-42f6-a5d9-714bde467412}' = s 'AVI Byte Stream Handler' + } + 'video/avi' + { + val '{7afa253e-f823-42f6-a5d9-714bde467412}' = s 'AVI Byte Stream Handler' + } + 'video/msvideo' + { + val '{7afa253e-f823-42f6-a5d9-714bde467412}' = s 'AVI Byte Stream Handler' + } + 'video/x-msvideo' + { + val '{7afa253e-f823-42f6-a5d9-714bde467412}' = s 'AVI Byte Stream Handler' + } + } + } + } + } +} diff --git a/include/wine/mfinternal.idl b/include/wine/mfinternal.idl index 9dbb5fcb47e..41cac45bbbb 100644 --- a/include/wine/mfinternal.idl +++ b/include/wine/mfinternal.idl @@ -52,3 +52,5 @@ cpp_quote("DEFINE_GUID(CLSID_MFFMPEG4SinkClassFactory, 0x60f9f51e, 0x4613, 0x4b3 cpp_quote("DEFINE_GUID(CLSID_MFMP3SinkClassFactory, 0x11275a82, 0x5e5a, 0x47fd, 0xa0, 0x1c, 0x36, 0x83, 0xc1, 0x2f, 0xb1, 0x96);") cpp_quote("DEFINE_GUID(CLSID_MFMPEG4SinkClassFactory, 0xa22c4fc7, 0x6e91, 0x4e1d, 0x89, 0xe9, 0x53, 0xb2, 0x66, 0x7b, 0x72, 0xba);") cpp_quote("DEFINE_GUID(CLSID_MFWAVESinkClassFactory, 0x36f99745, 0x23c9, 0x4c9c, 0x8d, 0xd5, 0xcc, 0x31, 0xce, 0x96, 0x43, 0x90);") + +cpp_quote("DEFINE_GUID(CLSID_AVIByteStreamPlugin, 0x7afa253e, 0xf823, 0x42f6, 0xa5, 0xd9, 0x71, 0x4b, 0xde, 0x46, 0x74, 0x12);")
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/mfsrcsnk/factory.c | 3 +++ dlls/mfsrcsnk/media_source.c | 18 ++++++++++++++++++ dlls/mfsrcsnk/media_source.h | 1 + dlls/mfsrcsnk/mfsrcsnk.idl | 7 +++++++ dlls/mfsrcsnk/mfsrcsnk.rgs | 13 +++++++++++++ include/wine/mfinternal.idl | 1 + 6 files changed, 43 insertions(+)
diff --git a/dlls/mfsrcsnk/factory.c b/dlls/mfsrcsnk/factory.c index e89129f9e03..c0a02d5fa9d 100644 --- a/dlls/mfsrcsnk/factory.c +++ b/dlls/mfsrcsnk/factory.c @@ -31,6 +31,9 @@ HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void **out)
if (IsEqualGUID(clsid, &CLSID_AVIByteStreamPlugin)) return IClassFactory_QueryInterface(&avi_byte_stream_plugin_factory, riid, out); + if (IsEqualGUID(clsid, &CLSID_WAVByteStreamPlugin)) + return IClassFactory_QueryInterface(&wav_byte_stream_plugin_factory, riid, out); + if (IsEqualGUID(clsid, &CLSID_MFWAVESinkClassFactory)) return IClassFactory_QueryInterface(wave_sink_class_factory, riid, out);
diff --git a/dlls/mfsrcsnk/media_source.c b/dlls/mfsrcsnk/media_source.c index 0c765ab9494..5c3605b8cdf 100644 --- a/dlls/mfsrcsnk/media_source.c +++ b/dlls/mfsrcsnk/media_source.c @@ -37,3 +37,21 @@ static const IClassFactoryVtbl avi_byte_stream_plugin_factory_vtbl = };
IClassFactory avi_byte_stream_plugin_factory = {&avi_byte_stream_plugin_factory_vtbl}; + +static HRESULT WINAPI wav_byte_stream_plugin_factory_CreateInstance(IClassFactory *iface, + IUnknown *outer, REFIID riid, void **out) +{ + static const GUID CLSID_GStreamerByteStreamHandler = {0x317df618,0x5e5a,0x468a,{0x9f,0x15,0xd8,0x27,0xa9,0xa0,0x81,0x62}}; + return CoCreateInstance(&CLSID_GStreamerByteStreamHandler, outer, CLSCTX_INPROC_SERVER, riid, out); +} + +static const IClassFactoryVtbl wav_byte_stream_plugin_factory_vtbl = +{ + class_factory_QueryInterface, + class_factory_AddRef, + class_factory_Release, + wav_byte_stream_plugin_factory_CreateInstance, + class_factory_LockServer, +}; + +IClassFactory wav_byte_stream_plugin_factory = {&wav_byte_stream_plugin_factory_vtbl}; diff --git a/dlls/mfsrcsnk/media_source.h b/dlls/mfsrcsnk/media_source.h index 63333658086..5c555c31a95 100644 --- a/dlls/mfsrcsnk/media_source.h +++ b/dlls/mfsrcsnk/media_source.h @@ -21,3 +21,4 @@ #include "wine/debug.h"
extern IClassFactory avi_byte_stream_plugin_factory; +extern IClassFactory wav_byte_stream_plugin_factory; diff --git a/dlls/mfsrcsnk/mfsrcsnk.idl b/dlls/mfsrcsnk/mfsrcsnk.idl index e40831d7a7f..10b41769060 100644 --- a/dlls/mfsrcsnk/mfsrcsnk.idl +++ b/dlls/mfsrcsnk/mfsrcsnk.idl @@ -31,3 +31,10 @@ coclass AVIByteStreamPlugin { } uuid(36f99745-23c9-4c9c-8dd5-cc31ce964390) ] coclass MFWAVESinkClassFactory { } + +[ + helpstring("WAV Byte Stream Handler"), + threading(both), + uuid(42c9b9f5-16fc-47ef-af22-da05f7c842e3) +] +coclass WAVByteStreamPlugin {} diff --git a/dlls/mfsrcsnk/mfsrcsnk.rgs b/dlls/mfsrcsnk/mfsrcsnk.rgs index ee897e464a2..c8272189273 100644 --- a/dlls/mfsrcsnk/mfsrcsnk.rgs +++ b/dlls/mfsrcsnk/mfsrcsnk.rgs @@ -24,6 +24,19 @@ HKLM { val '{7afa253e-f823-42f6-a5d9-714bde467412}' = s 'AVI Byte Stream Handler' } + + '.wav' + { + val '{42c9b9f5-16fc-47ef-af22-da05f7c842e3}' = s 'WAV Byte Stream Handler' + } + 'audio/wav' + { + val '{42c9b9f5-16fc-47ef-af22-da05f7c842e3}' = s 'WAV Byte Stream Handler' + } + 'audio/x-wav' + { + val '{42c9b9f5-16fc-47ef-af22-da05f7c842e3}' = s 'WAV Byte Stream Handler' + } } } } diff --git a/include/wine/mfinternal.idl b/include/wine/mfinternal.idl index 41cac45bbbb..a014faf4c3c 100644 --- a/include/wine/mfinternal.idl +++ b/include/wine/mfinternal.idl @@ -54,3 +54,4 @@ cpp_quote("DEFINE_GUID(CLSID_MFMPEG4SinkClassFactory, 0xa22c4fc7, 0x6e91, 0x4e1d cpp_quote("DEFINE_GUID(CLSID_MFWAVESinkClassFactory, 0x36f99745, 0x23c9, 0x4c9c, 0x8d, 0xd5, 0xcc, 0x31, 0xce, 0x96, 0x43, 0x90);")
cpp_quote("DEFINE_GUID(CLSID_AVIByteStreamPlugin, 0x7afa253e, 0xf823, 0x42f6, 0xa5, 0xd9, 0x71, 0x4b, 0xde, 0x46, 0x74, 0x12);") +cpp_quote("DEFINE_GUID(CLSID_WAVByteStreamPlugin, 0x42c9b9f5, 0x16fc, 0x47ef, 0xaf, 0x22, 0xda, 0x05, 0xf7, 0xc8, 0x42, 0xe3);")
From: Rémi Bernon rbernon@codeweavers.com
This introduces a new module, sharing source with mfsrcsnk, to register the classes in the same module as native, and prefer native by default. --- configure.ac | 1 + dlls/mfmp4srcsnk/Makefile.in | 11 ++++ dlls/mfmp4srcsnk/mfmp4srcsnk.c | 37 ++++++++++++ dlls/mfmp4srcsnk/mfmp4srcsnk.idl | 27 +++++++++ dlls/mfmp4srcsnk/mfmp4srcsnk.rc | 24 ++++++++ dlls/mfmp4srcsnk/mfmp4srcsnk.rgs | 95 +++++++++++++++++++++++++++++++ dlls/mfmp4srcsnk/mfmp4srcsnk.spec | 3 + dlls/mfsrcsnk/media_source.c | 18 ++++++ dlls/mfsrcsnk/media_source.h | 1 + include/wine/mfinternal.idl | 1 + loader/wine.inf.in | 1 + 11 files changed, 219 insertions(+) create mode 100644 dlls/mfmp4srcsnk/Makefile.in create mode 100644 dlls/mfmp4srcsnk/mfmp4srcsnk.c create mode 100644 dlls/mfmp4srcsnk/mfmp4srcsnk.idl create mode 100644 dlls/mfmp4srcsnk/mfmp4srcsnk.rc create mode 100644 dlls/mfmp4srcsnk/mfmp4srcsnk.rgs create mode 100644 dlls/mfmp4srcsnk/mfmp4srcsnk.spec
diff --git a/configure.ac b/configure.ac index 2d841d0d496..d47e8fd8050 100644 --- a/configure.ac +++ b/configure.ac @@ -2808,6 +2808,7 @@ WINE_CONFIG_MAKEFILE(dlls/mf3216) WINE_CONFIG_MAKEFILE(dlls/mferror) WINE_CONFIG_MAKEFILE(dlls/mfmediaengine) WINE_CONFIG_MAKEFILE(dlls/mfmediaengine/tests) +WINE_CONFIG_MAKEFILE(dlls/mfmp4srcsnk) WINE_CONFIG_MAKEFILE(dlls/mfplat) WINE_CONFIG_MAKEFILE(dlls/mfplat/tests) WINE_CONFIG_MAKEFILE(dlls/mfplay) diff --git a/dlls/mfmp4srcsnk/Makefile.in b/dlls/mfmp4srcsnk/Makefile.in new file mode 100644 index 00000000000..d32a1744bc0 --- /dev/null +++ b/dlls/mfmp4srcsnk/Makefile.in @@ -0,0 +1,11 @@ +MODULE = mfmp4srcsnk.dll +IMPORTS = ole32 mfplat mfuuid uuid +PARENTSRC = ../mfsrcsnk + +EXTRADLLFLAGS = -Wb,--prefer-native + +SOURCES = \ + media_source.c \ + mfmp4srcsnk.c \ + mfmp4srcsnk.idl \ + mfmp4srcsnk.rc diff --git a/dlls/mfmp4srcsnk/mfmp4srcsnk.c b/dlls/mfmp4srcsnk/mfmp4srcsnk.c new file mode 100644 index 00000000000..c6a99334ca7 --- /dev/null +++ b/dlls/mfmp4srcsnk/mfmp4srcsnk.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 "media_source.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(mfplat); + +/*********************************************************************** + * DllGetClassObject (mfsrcsnk.@) + */ +HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void **out) +{ + *out = NULL; + + if (IsEqualGUID(clsid, &CLSID_MPEG4ByteStreamHandlerPlugin)) + return IClassFactory_QueryInterface(&mpeg4_byte_stream_plugin_factory, riid, out); + + FIXME("Unknown clsid %s.\n", debugstr_guid(clsid)); + return CLASS_E_CLASSNOTAVAILABLE; +} diff --git a/dlls/mfmp4srcsnk/mfmp4srcsnk.idl b/dlls/mfmp4srcsnk/mfmp4srcsnk.idl new file mode 100644 index 00000000000..67c6ca58724 --- /dev/null +++ b/dlls/mfmp4srcsnk/mfmp4srcsnk.idl @@ -0,0 +1,27 @@ +/* + * 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("MPEG4 Byte Stream Handler"), + threading(both), + uuid(271c3902-6095-4c45-a22f-20091816ee9e) +] +coclass MPEG4ByteStreamHandlerPlugin {} + diff --git a/dlls/mfmp4srcsnk/mfmp4srcsnk.rc b/dlls/mfmp4srcsnk/mfmp4srcsnk.rc new file mode 100644 index 00000000000..ec9c8c7ddab --- /dev/null +++ b/dlls/mfmp4srcsnk/mfmp4srcsnk.rc @@ -0,0 +1,24 @@ +/* + * 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 "windef.h" + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL + +/* @makedep: mfmp4srcsnk.rgs */ +1 WINE_REGISTRY mfmp4srcsnk.rgs diff --git a/dlls/mfmp4srcsnk/mfmp4srcsnk.rgs b/dlls/mfmp4srcsnk/mfmp4srcsnk.rgs new file mode 100644 index 00000000000..e3669dc705c --- /dev/null +++ b/dlls/mfmp4srcsnk/mfmp4srcsnk.rgs @@ -0,0 +1,95 @@ +HKLM +{ + NoRemove 'Software' + { + NoRemove 'Microsoft' + { + NoRemove 'Windows Media Foundation' + { + NoRemove 'ByteStreamHandlers' + { + '.3g2' + { + val '{271c3902-6095-4c45-a22f-20091816ee9e}' = s 'MPEG4 Byte Stream Handler' + } + '.3gp' + { + val '{271c3902-6095-4c45-a22f-20091816ee9e}' = s 'MPEG4 Byte Stream Handler' + } + '.3gp2' + { + val '{271c3902-6095-4c45-a22f-20091816ee9e}' = s 'MPEG4 Byte Stream Handler' + } + '.3gpp' + { + val '{271c3902-6095-4c45-a22f-20091816ee9e}' = s 'MPEG4 Byte Stream Handler' + } + '.m4a' + { + val '{271c3902-6095-4c45-a22f-20091816ee9e}' = s 'MPEG4 Byte Stream Handler' + } + '.m4v' + { + val '{271c3902-6095-4c45-a22f-20091816ee9e}' = s 'MPEG4 Byte Stream Handler' + } + '.mov' + { + val '{271c3902-6095-4c45-a22f-20091816ee9e}' = s 'MPEG4 Byte Stream Handler' + } + '.mp4' + { + val '{271c3902-6095-4c45-a22f-20091816ee9e}' = s 'MPEG4 Byte Stream Handler' + } + '.mp4v' + { + val '{271c3902-6095-4c45-a22f-20091816ee9e}' = s 'MPEG4 Byte Stream Handler' + } + '.uvu' + { + val '{271c3902-6095-4c45-a22f-20091816ee9e}' = s 'MPEG4 Byte Stream Handler' + } + 'audio/3gpp' + { + val '{271c3902-6095-4c45-a22f-20091816ee9e}' = s 'MPEG4 Byte Stream Handler' + } + 'audio/3gpp2' + { + val '{271c3902-6095-4c45-a22f-20091816ee9e}' = s 'MPEG4 Byte Stream Handler' + } + 'audio/mp4' + { + val '{271c3902-6095-4c45-a22f-20091816ee9e}' = s 'MPEG4 Byte Stream Handler' + } + 'audio/MP4A-LATM' + { + val '{271c3902-6095-4c45-a22f-20091816ee9e}' = s 'MPEG4 Byte Stream Handler' + } + 'audio/x-m4a' + { + val '{271c3902-6095-4c45-a22f-20091816ee9e}' = s 'MPEG4 Byte Stream Handler' + } + 'video/3gpp' + { + val '{271c3902-6095-4c45-a22f-20091816ee9e}' = s 'MPEG4 Byte Stream Handler' + } + 'video/3gpp2' + { + val '{271c3902-6095-4c45-a22f-20091816ee9e}' = s 'MPEG4 Byte Stream Handler' + } + 'video/mp4' + { + val '{271c3902-6095-4c45-a22f-20091816ee9e}' = s 'MPEG4 Byte Stream Handler' + } + 'video/vnd.dece.mp4' + { + val '{271c3902-6095-4c45-a22f-20091816ee9e}' = s 'MPEG4 Byte Stream Handler' + } + 'video/x-m4v' + { + val '{271c3902-6095-4c45-a22f-20091816ee9e}' = s 'MPEG4 Byte Stream Handler' + } + } + } + } + } +} diff --git a/dlls/mfmp4srcsnk/mfmp4srcsnk.spec b/dlls/mfmp4srcsnk/mfmp4srcsnk.spec new file mode 100644 index 00000000000..b717c9c9371 --- /dev/null +++ b/dlls/mfmp4srcsnk/mfmp4srcsnk.spec @@ -0,0 +1,3 @@ +@ stdcall -private DllGetClassObject(ptr ptr ptr) +@ stdcall -private DllRegisterServer() +@ stdcall -private DllUnregisterServer() diff --git a/dlls/mfsrcsnk/media_source.c b/dlls/mfsrcsnk/media_source.c index 5c3605b8cdf..cdd00ece965 100644 --- a/dlls/mfsrcsnk/media_source.c +++ b/dlls/mfsrcsnk/media_source.c @@ -38,6 +38,24 @@ static const IClassFactoryVtbl avi_byte_stream_plugin_factory_vtbl =
IClassFactory avi_byte_stream_plugin_factory = {&avi_byte_stream_plugin_factory_vtbl};
+static HRESULT WINAPI mpeg4_byte_stream_plugin_factory_CreateInstance(IClassFactory *iface, + IUnknown *outer, REFIID riid, void **out) +{ + static const GUID CLSID_GStreamerByteStreamHandler = {0x317df618,0x5e5a,0x468a,{0x9f,0x15,0xd8,0x27,0xa9,0xa0,0x81,0x62}}; + return CoCreateInstance(&CLSID_GStreamerByteStreamHandler, outer, CLSCTX_INPROC_SERVER, riid, out); +} + +static const IClassFactoryVtbl mpeg4_byte_stream_plugin_factory_vtbl = +{ + class_factory_QueryInterface, + class_factory_AddRef, + class_factory_Release, + mpeg4_byte_stream_plugin_factory_CreateInstance, + class_factory_LockServer, +}; + +IClassFactory mpeg4_byte_stream_plugin_factory = {&mpeg4_byte_stream_plugin_factory_vtbl}; + static HRESULT WINAPI wav_byte_stream_plugin_factory_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **out) { diff --git a/dlls/mfsrcsnk/media_source.h b/dlls/mfsrcsnk/media_source.h index 5c555c31a95..6ac052c1594 100644 --- a/dlls/mfsrcsnk/media_source.h +++ b/dlls/mfsrcsnk/media_source.h @@ -21,4 +21,5 @@ #include "wine/debug.h"
extern IClassFactory avi_byte_stream_plugin_factory; +extern IClassFactory mpeg4_byte_stream_plugin_factory; extern IClassFactory wav_byte_stream_plugin_factory; diff --git a/include/wine/mfinternal.idl b/include/wine/mfinternal.idl index a014faf4c3c..e2a33c9cf2f 100644 --- a/include/wine/mfinternal.idl +++ b/include/wine/mfinternal.idl @@ -54,4 +54,5 @@ cpp_quote("DEFINE_GUID(CLSID_MFMPEG4SinkClassFactory, 0xa22c4fc7, 0x6e91, 0x4e1d cpp_quote("DEFINE_GUID(CLSID_MFWAVESinkClassFactory, 0x36f99745, 0x23c9, 0x4c9c, 0x8d, 0xd5, 0xcc, 0x31, 0xce, 0x96, 0x43, 0x90);")
cpp_quote("DEFINE_GUID(CLSID_AVIByteStreamPlugin, 0x7afa253e, 0xf823, 0x42f6, 0xa5, 0xd9, 0x71, 0x4b, 0xde, 0x46, 0x74, 0x12);") +cpp_quote("DEFINE_GUID(CLSID_MPEG4ByteStreamHandlerPlugin, 0x271c3902, 0x6095, 0x4c45, 0xa2, 0x2f, 0x20, 0x09, 0x18, 0x16, 0xee, 0x9e);") cpp_quote("DEFINE_GUID(CLSID_WAVByteStreamPlugin, 0x42c9b9f5, 0x16fc, 0x47ef, 0xaf, 0x22, 0xda, 0x05, 0xf7, 0xc8, 0x42, 0xe3);") diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 2903badd840..b7a11f86b53 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2106,6 +2106,7 @@ HKLM,%CurrentVersion%\Telephony\Country List\998,"SameAreaRule",,"G" 11,,cryptdlg.dll,1 11,,cryptnet.dll,1 11,,devenum.dll,1 +11,,mfmp4srcsnk.dll,1 11,,mp3dmod.dll,1 11,,mscoree.dll,1 11,,mshtml.dll,1
From: Rémi Bernon rbernon@codeweavers.com
--- configure.ac | 1 + dlls/mfasfsrcsnk/Makefile.in | 11 ++++++++ dlls/mfasfsrcsnk/mfasfsrcsnk.c | 36 +++++++++++++++++++++++ dlls/mfasfsrcsnk/mfasfsrcsnk.idl | 26 +++++++++++++++++ dlls/mfasfsrcsnk/mfasfsrcsnk.rc | 24 ++++++++++++++++ dlls/mfasfsrcsnk/mfasfsrcsnk.rgs | 47 +++++++++++++++++++++++++++++++ dlls/mfasfsrcsnk/mfasfsrcsnk.spec | 3 ++ dlls/mfsrcsnk/media_source.c | 18 ++++++++++++ dlls/mfsrcsnk/media_source.h | 1 + include/wine/mfinternal.idl | 1 + loader/wine.inf.in | 1 + 11 files changed, 169 insertions(+) create mode 100644 dlls/mfasfsrcsnk/Makefile.in create mode 100644 dlls/mfasfsrcsnk/mfasfsrcsnk.c create mode 100644 dlls/mfasfsrcsnk/mfasfsrcsnk.idl create mode 100644 dlls/mfasfsrcsnk/mfasfsrcsnk.rc create mode 100644 dlls/mfasfsrcsnk/mfasfsrcsnk.rgs create mode 100644 dlls/mfasfsrcsnk/mfasfsrcsnk.spec
diff --git a/configure.ac b/configure.ac index d47e8fd8050..f87a234a955 100644 --- a/configure.ac +++ b/configure.ac @@ -2805,6 +2805,7 @@ WINE_CONFIG_MAKEFILE(dlls/mciwave) WINE_CONFIG_MAKEFILE(dlls/mf) WINE_CONFIG_MAKEFILE(dlls/mf/tests) WINE_CONFIG_MAKEFILE(dlls/mf3216) +WINE_CONFIG_MAKEFILE(dlls/mfasfsrcsnk) WINE_CONFIG_MAKEFILE(dlls/mferror) WINE_CONFIG_MAKEFILE(dlls/mfmediaengine) WINE_CONFIG_MAKEFILE(dlls/mfmediaengine/tests) diff --git a/dlls/mfasfsrcsnk/Makefile.in b/dlls/mfasfsrcsnk/Makefile.in new file mode 100644 index 00000000000..f450c304d3b --- /dev/null +++ b/dlls/mfasfsrcsnk/Makefile.in @@ -0,0 +1,11 @@ +MODULE = mfasfsrcsnk.dll +IMPORTS = ole32 mfplat mfuuid uuid +PARENTSRC = ../mfsrcsnk + +EXTRADLLFLAGS = -Wb,--prefer-native + +SOURCES = \ + media_source.c \ + mfasfsrcsnk.c \ + mfasfsrcsnk.idl \ + mfasfsrcsnk.rc diff --git a/dlls/mfasfsrcsnk/mfasfsrcsnk.c b/dlls/mfasfsrcsnk/mfasfsrcsnk.c new file mode 100644 index 00000000000..090ac14a8aa --- /dev/null +++ b/dlls/mfasfsrcsnk/mfasfsrcsnk.c @@ -0,0 +1,36 @@ +/* + * 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 "media_source.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(mfplat); + +/*********************************************************************** + * DllGetClassObject (mfsrcsnk.@) + */ +HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void **out) +{ + if (IsEqualGUID(clsid, &CLSID_AsfByteStreamPlugin)) + return IClassFactory_QueryInterface(&asf_byte_stream_plugin_factory, riid, out); + + *out = NULL; + FIXME("Unknown clsid %s.\n", debugstr_guid(clsid)); + return CLASS_E_CLASSNOTAVAILABLE; +} diff --git a/dlls/mfasfsrcsnk/mfasfsrcsnk.idl b/dlls/mfasfsrcsnk/mfasfsrcsnk.idl new file mode 100644 index 00000000000..2a368106cb9 --- /dev/null +++ b/dlls/mfasfsrcsnk/mfasfsrcsnk.idl @@ -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("ASF Byte Stream Handler"), + threading(both), + uuid(41457294-644c-4298-a28a-bd69f2c0cf3b) +] +coclass AsfByteStreamPlugin {} diff --git a/dlls/mfasfsrcsnk/mfasfsrcsnk.rc b/dlls/mfasfsrcsnk/mfasfsrcsnk.rc new file mode 100644 index 00000000000..4761406f699 --- /dev/null +++ b/dlls/mfasfsrcsnk/mfasfsrcsnk.rc @@ -0,0 +1,24 @@ +/* + * 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 "windef.h" + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL + +/* @makedep: mfasfsrcsnk.rgs */ +1 WINE_REGISTRY mfasfsrcsnk.rgs diff --git a/dlls/mfasfsrcsnk/mfasfsrcsnk.rgs b/dlls/mfasfsrcsnk/mfasfsrcsnk.rgs new file mode 100644 index 00000000000..39761c1e6fb --- /dev/null +++ b/dlls/mfasfsrcsnk/mfasfsrcsnk.rgs @@ -0,0 +1,47 @@ +HKLM +{ + NoRemove 'Software' + { + NoRemove 'Microsoft' + { + NoRemove 'Windows Media Foundation' + { + NoRemove 'ByteStreamHandlers' + { + '.asf' + { + val '{41457294-644c-4298-a28a-bd69f2c0cf3b}' = s 'ASF Byte Stream Handler' + } + '.wm' + { + val '{41457294-644c-4298-a28a-bd69f2c0cf3b}' = s 'ASF Byte Stream Handler' + } + '.wma' + { + val '{41457294-644c-4298-a28a-bd69f2c0cf3b}' = s 'ASF Byte Stream Handler' + } + '.wmv' + { + val '{41457294-644c-4298-a28a-bd69f2c0cf3b}' = s 'ASF Byte Stream Handler' + } + 'audio/x-ms-wma' + { + val '{41457294-644c-4298-a28a-bd69f2c0cf3b}' = s 'ASF Byte Stream Handler' + } + 'video/x-ms-asf' + { + val '{41457294-644c-4298-a28a-bd69f2c0cf3b}' = s 'ASF Byte Stream Handler' + } + 'video/x-ms-wm' + { + val '{41457294-644c-4298-a28a-bd69f2c0cf3b}' = s 'ASF Byte Stream Handler' + } + 'video/x-ms-wmv' + { + val '{41457294-644c-4298-a28a-bd69f2c0cf3b}' = s 'ASF Byte Stream Handler' + } + } + } + } + } +} diff --git a/dlls/mfasfsrcsnk/mfasfsrcsnk.spec b/dlls/mfasfsrcsnk/mfasfsrcsnk.spec new file mode 100644 index 00000000000..b717c9c9371 --- /dev/null +++ b/dlls/mfasfsrcsnk/mfasfsrcsnk.spec @@ -0,0 +1,3 @@ +@ stdcall -private DllGetClassObject(ptr ptr ptr) +@ stdcall -private DllRegisterServer() +@ stdcall -private DllUnregisterServer() diff --git a/dlls/mfsrcsnk/media_source.c b/dlls/mfsrcsnk/media_source.c index cdd00ece965..8c02743e811 100644 --- a/dlls/mfsrcsnk/media_source.c +++ b/dlls/mfsrcsnk/media_source.c @@ -20,6 +20,24 @@
#include "wine/debug.h"
+static HRESULT WINAPI asf_byte_stream_plugin_factory_CreateInstance(IClassFactory *iface, + IUnknown *outer, REFIID riid, void **out) +{ + static const GUID CLSID_GStreamerByteStreamHandler = {0x317df618,0x5e5a,0x468a,{0x9f,0x15,0xd8,0x27,0xa9,0xa0,0x81,0x62}}; + return CoCreateInstance(&CLSID_GStreamerByteStreamHandler, outer, CLSCTX_INPROC_SERVER, riid, out); +} + +static const IClassFactoryVtbl asf_byte_stream_plugin_factory_vtbl = +{ + class_factory_QueryInterface, + class_factory_AddRef, + class_factory_Release, + asf_byte_stream_plugin_factory_CreateInstance, + class_factory_LockServer, +}; + +IClassFactory asf_byte_stream_plugin_factory = {&asf_byte_stream_plugin_factory_vtbl}; + static HRESULT WINAPI avi_byte_stream_plugin_factory_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **out) { diff --git a/dlls/mfsrcsnk/media_source.h b/dlls/mfsrcsnk/media_source.h index 6ac052c1594..1e6c90ea7d5 100644 --- a/dlls/mfsrcsnk/media_source.h +++ b/dlls/mfsrcsnk/media_source.h @@ -20,6 +20,7 @@
#include "wine/debug.h"
+extern IClassFactory asf_byte_stream_plugin_factory; extern IClassFactory avi_byte_stream_plugin_factory; extern IClassFactory mpeg4_byte_stream_plugin_factory; extern IClassFactory wav_byte_stream_plugin_factory; diff --git a/include/wine/mfinternal.idl b/include/wine/mfinternal.idl index e2a33c9cf2f..0106c2b50d5 100644 --- a/include/wine/mfinternal.idl +++ b/include/wine/mfinternal.idl @@ -53,6 +53,7 @@ cpp_quote("DEFINE_GUID(CLSID_MFMP3SinkClassFactory, 0x11275a82, 0x5e5a, 0x47fd, cpp_quote("DEFINE_GUID(CLSID_MFMPEG4SinkClassFactory, 0xa22c4fc7, 0x6e91, 0x4e1d, 0x89, 0xe9, 0x53, 0xb2, 0x66, 0x7b, 0x72, 0xba);") cpp_quote("DEFINE_GUID(CLSID_MFWAVESinkClassFactory, 0x36f99745, 0x23c9, 0x4c9c, 0x8d, 0xd5, 0xcc, 0x31, 0xce, 0x96, 0x43, 0x90);")
+cpp_quote("DEFINE_GUID(CLSID_AsfByteStreamPlugin, 0x41457294, 0x644c, 0x4298, 0xa2, 0x8a, 0xbd, 0x69, 0xf2, 0xc0, 0xcf, 0x3b);") cpp_quote("DEFINE_GUID(CLSID_AVIByteStreamPlugin, 0x7afa253e, 0xf823, 0x42f6, 0xa5, 0xd9, 0x71, 0x4b, 0xde, 0x46, 0x74, 0x12);") cpp_quote("DEFINE_GUID(CLSID_MPEG4ByteStreamHandlerPlugin, 0x271c3902, 0x6095, 0x4c45, 0xa2, 0x2f, 0x20, 0x09, 0x18, 0x16, 0xee, 0x9e);") cpp_quote("DEFINE_GUID(CLSID_WAVByteStreamPlugin, 0x42c9b9f5, 0x16fc, 0x47ef, 0xaf, 0x22, 0xda, 0x05, 0xf7, 0xc8, 0x42, 0xe3);") diff --git a/loader/wine.inf.in b/loader/wine.inf.in index b7a11f86b53..f300700b0f8 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -2106,6 +2106,7 @@ HKLM,%CurrentVersion%\Telephony\Country List\998,"SameAreaRule",,"G" 11,,cryptdlg.dll,1 11,,cryptnet.dll,1 11,,devenum.dll,1 +11,,mfasfsrcsnk.dll,1 11,,mfmp4srcsnk.dll,1 11,,mp3dmod.dll,1 11,,mscoree.dll,1
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/mfmp4srcsnk/Makefile.in | 1 + dlls/mfmp4srcsnk/mfmp4srcsnk.c | 5 + dlls/mfmp4srcsnk/mfmp4srcsnk.idl | 12 +++ dlls/mfsrcsnk/Makefile.in | 1 + dlls/mfsrcsnk/media_sink.c | 99 ++++++++++++++++++++ dlls/mfsrcsnk/mfsrcsnk_private.h | 24 +++++ dlls/mfsrcsnk/wave.c | 21 ----- dlls/winegstreamer/main.c | 6 +- dlls/winegstreamer/winegstreamer_classes.idl | 9 +- 9 files changed, 150 insertions(+), 28 deletions(-) create mode 100644 dlls/mfsrcsnk/media_sink.c
diff --git a/dlls/mfmp4srcsnk/Makefile.in b/dlls/mfmp4srcsnk/Makefile.in index d32a1744bc0..cc91ab58df9 100644 --- a/dlls/mfmp4srcsnk/Makefile.in +++ b/dlls/mfmp4srcsnk/Makefile.in @@ -5,6 +5,7 @@ PARENTSRC = ../mfsrcsnk EXTRADLLFLAGS = -Wb,--prefer-native
SOURCES = \ + media_sink.c \ media_source.c \ mfmp4srcsnk.c \ mfmp4srcsnk.idl \ diff --git a/dlls/mfmp4srcsnk/mfmp4srcsnk.c b/dlls/mfmp4srcsnk/mfmp4srcsnk.c index c6a99334ca7..488d3b9ebd9 100644 --- a/dlls/mfmp4srcsnk/mfmp4srcsnk.c +++ b/dlls/mfmp4srcsnk/mfmp4srcsnk.c @@ -32,6 +32,11 @@ HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void **out) if (IsEqualGUID(clsid, &CLSID_MPEG4ByteStreamHandlerPlugin)) return IClassFactory_QueryInterface(&mpeg4_byte_stream_plugin_factory, riid, out);
+ if (IsEqualGUID(clsid, &CLSID_MFMP3SinkClassFactory)) + return IClassFactory_QueryInterface(mp3_sink_class_factory, riid, out); + if (IsEqualGUID(clsid, &CLSID_MFMPEG4SinkClassFactory)) + return IClassFactory_QueryInterface(mpeg4_sink_class_factory, riid, out); + FIXME("Unknown clsid %s.\n", debugstr_guid(clsid)); return CLASS_E_CLASSNOTAVAILABLE; } diff --git a/dlls/mfmp4srcsnk/mfmp4srcsnk.idl b/dlls/mfmp4srcsnk/mfmp4srcsnk.idl index 67c6ca58724..e9045b59b93 100644 --- a/dlls/mfmp4srcsnk/mfmp4srcsnk.idl +++ b/dlls/mfmp4srcsnk/mfmp4srcsnk.idl @@ -25,3 +25,15 @@ ] coclass MPEG4ByteStreamHandlerPlugin {}
+[ + threading(both), + uuid(11275a82-5e5a-47fd-a01c-3683c12fb196) +] +coclass MFMP3SinkClassFactory {} + +[ + helpstring("MF MPEG4 Sink Class Factory"), + threading(both), + uuid(a22c4fc7-6e91-4e1d-89e9-53b2667b72ba) +] +coclass MFMPEG4SinkClassFactory {} diff --git a/dlls/mfsrcsnk/Makefile.in b/dlls/mfsrcsnk/Makefile.in index 4b4d209e8c2..d238b43424d 100644 --- a/dlls/mfsrcsnk/Makefile.in +++ b/dlls/mfsrcsnk/Makefile.in @@ -6,6 +6,7 @@ EXTRADLLFLAGS = -Wb,--prefer-native
SOURCES = \ factory.c \ + media_sink.c \ media_source.c \ mfsrcsnk.idl \ mfsrcsnk.rc \ diff --git a/dlls/mfsrcsnk/media_sink.c b/dlls/mfsrcsnk/media_sink.c new file mode 100644 index 00000000000..2927859d937 --- /dev/null +++ b/dlls/mfsrcsnk/media_sink.c @@ -0,0 +1,99 @@ +/* + * Copyright 2023 Ziqing Hui 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 "mfsrcsnk_private.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(mfplat); + +static HRESULT WINAPI mp3_sink_factory_CreateMediaSink(IMFSinkClassFactory *iface, IMFByteStream *bytestream, + IMFMediaType *video_type, IMFMediaType *audio_type, IMFMediaSink **out) +{ + FIXME("stub!\n"); + return E_NOTIMPL; +} + +static const IMFSinkClassFactoryVtbl mp3_sink_factory_vtbl = +{ + sink_class_factory_QueryInterface, + sink_class_factory_AddRef, + sink_class_factory_Release, + mp3_sink_factory_CreateMediaSink, +}; + +static HRESULT WINAPI mp3_sink_class_factory_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **out) +{ + static const GUID CLSID_wg_mp3_sink_factory = {0x1f302877,0xaaab,0x40a3,{0xb9,0xe0,0x9f,0x48,0xda,0xf3,0x5b,0xc8}}; + return CoCreateInstance(&CLSID_wg_mp3_sink_factory, outer, CLSCTX_INPROC_SERVER, riid, out); +} + +static const IClassFactoryVtbl mp3_sink_class_factory_vtbl = +{ + class_factory_QueryInterface, + class_factory_AddRef, + class_factory_Release, + mp3_sink_class_factory_CreateInstance, + class_factory_LockServer, +}; + +struct sink_class_factory mp3_sink_factory = +{ + {&mp3_sink_class_factory_vtbl}, + {&mp3_sink_factory_vtbl}, +}; + +IClassFactory *mp3_sink_class_factory = &mp3_sink_factory.IClassFactory_iface; + +static HRESULT WINAPI mpeg4_sink_factory_CreateMediaSink(IMFSinkClassFactory *iface, IMFByteStream *bytestream, + IMFMediaType *video_type, IMFMediaType *audio_type, IMFMediaSink **out) +{ + FIXME("stub!\n"); + return E_NOTIMPL; +} + +static const IMFSinkClassFactoryVtbl mpeg4_sink_factory_vtbl = +{ + sink_class_factory_QueryInterface, + sink_class_factory_AddRef, + sink_class_factory_Release, + mpeg4_sink_factory_CreateMediaSink, +}; + +static HRESULT WINAPI mpeg4_sink_class_factory_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **out) +{ + static const GUID CLSID_wg_mpeg4_sink_factory = {0x5d5407d9,0xc6ca,0x4770,{0xa7,0xcc,0x27,0xc0,0xcb,0x8a,0x76,0x27}}; + return CoCreateInstance(&CLSID_wg_mpeg4_sink_factory, outer, CLSCTX_INPROC_SERVER, riid, out); +} + +static const IClassFactoryVtbl mpeg4_sink_class_factory_vtbl = +{ + class_factory_QueryInterface, + class_factory_AddRef, + class_factory_Release, + mpeg4_sink_class_factory_CreateInstance, + class_factory_LockServer, +}; + +struct sink_class_factory mpeg4_sink_factory = +{ + {&mpeg4_sink_class_factory_vtbl}, + {&mpeg4_sink_factory_vtbl}, +}; + +IClassFactory *mpeg4_sink_class_factory = &mpeg4_sink_factory.IClassFactory_iface; diff --git a/dlls/mfsrcsnk/mfsrcsnk_private.h b/dlls/mfsrcsnk/mfsrcsnk_private.h index 28caea2a1d2..6d4ef560d5b 100644 --- a/dlls/mfsrcsnk/mfsrcsnk_private.h +++ b/dlls/mfsrcsnk/mfsrcsnk_private.h @@ -23,8 +23,11 @@ #include "mferror.h"
#include "wine/mfinternal.h" +#include "wine/debug.h"
extern IClassFactory *wave_sink_class_factory; +extern IClassFactory *mp3_sink_class_factory; +extern IClassFactory *mpeg4_sink_class_factory;
static inline HRESULT WINAPI class_factory_QueryInterface(IClassFactory *iface, REFIID riid, void **out) { @@ -67,3 +70,24 @@ static inline ULONG WINAPI sink_class_factory_Release(IMFSinkClassFactory *iface { return 1; } + +static inline const char *debugstr_time(LONGLONG time) +{ + ULONGLONG abstime = time >= 0 ? time : -time; + unsigned int i = 0, j = 0; + char buffer[23], rev[23]; + + while (abstime || i <= 8) + { + buffer[i++] = '0' + (abstime % 10); + abstime /= 10; + if (i == 7) buffer[i++] = '.'; + } + if (time < 0) buffer[i++] = '-'; + + while (i--) rev[j++] = buffer[i]; + while (rev[j-1] == '0' && rev[j-2] != '.') --j; + rev[j] = 0; + + return wine_dbg_sprintf("%s", rev); +} diff --git a/dlls/mfsrcsnk/wave.c b/dlls/mfsrcsnk/wave.c index bae70960a72..cc5351ae2a9 100644 --- a/dlls/mfsrcsnk/wave.c +++ b/dlls/mfsrcsnk/wave.c @@ -22,27 +22,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
-static inline const char *debugstr_time(LONGLONG time) -{ - ULONGLONG abstime = time >= 0 ? time : -time; - unsigned int i = 0, j = 0; - char buffer[23], rev[23]; - - while (abstime || i <= 8) - { - buffer[i++] = '0' + (abstime % 10); - abstime /= 10; - if (i == 7) buffer[i++] = '.'; - } - if (time < 0) buffer[i++] = '-'; - - while (i--) rev[j++] = buffer[i]; - while (rev[j-1] == '0' && rev[j-2] != '.') --j; - rev[j] = 0; - - return wine_dbg_sprintf("%s", rev); -} - enum wave_sink_flags { SINK_SHUT_DOWN = 0x1, diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c index 2d144a6f71f..54058f57ba5 100644 --- a/dlls/winegstreamer/main.c +++ b/dlls/winegstreamer/main.c @@ -991,6 +991,8 @@ static struct class_factory mpeg4_sink_class_factory_cf = {{&class_factory_vtbl}
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}}; struct class_factory *factory; HRESULT hr;
@@ -1024,9 +1026,9 @@ HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **out) factory = &resampler_cf; else if (IsEqualGUID(clsid, &CLSID_CColorConvertDMO)) factory = &color_convert_cf; - else if (IsEqualGUID(clsid, &CLSID_MFMP3SinkClassFactory)) + else if (IsEqualGUID(clsid, &CLSID_wg_mp3_sink_factory)) factory = &mp3_sink_class_factory_cf; - else if (IsEqualGUID(clsid, &CLSID_MFMPEG4SinkClassFactory)) + else if (IsEqualGUID(clsid, &CLSID_wg_mpeg4_sink_factory)) factory = &mpeg4_sink_class_factory_cf; else { diff --git a/dlls/winegstreamer/winegstreamer_classes.idl b/dlls/winegstreamer/winegstreamer_classes.idl index 41ec2d26123..c960051428d 100644 --- a/dlls/winegstreamer/winegstreamer_classes.idl +++ b/dlls/winegstreamer/winegstreamer_classes.idl @@ -127,13 +127,12 @@ coclass CColorConvertDMO {}
[ threading(both), - uuid(11275a82-5e5a-47fd-a01c-3683c12fb196) + uuid(1f302877-aaab-40a3-b9e0-9f48daf35bc8) ] -coclass MFMP3SinkClassFactory {} +coclass wg_mp3_sink_factory {}
[ - helpstring("MF MPEG4 Sink Class Factory"), threading(both), - uuid(a22c4fc7-6e91-4e1d-89e9-53b2667b72ba) + uuid(5d5407d9-c6ca-4770-a7cc-27c0cb8a7627) ] -coclass MFMPEG4SinkClassFactory {} +coclass wg_mpeg4_sink_factory {}