From: Rémi Bernon <rbernon@codeweavers.com> --- dlls/resampledmo/Makefile.in | 6 +- dlls/resampledmo/resampledmo.c | 36 +---------- .../resampler.c | 63 ++++++++++++------- dlls/winegstreamer/Makefile.in | 4 +- dlls/winegstreamer/gst_private.h | 1 - dlls/winegstreamer/main.c | 4 -- dlls/winegstreamer/winegstreamer_classes.idl | 6 -- 7 files changed, 47 insertions(+), 73 deletions(-) rename dlls/{winegstreamer => resampledmo}/resampler.c (97%) diff --git a/dlls/resampledmo/Makefile.in b/dlls/resampledmo/Makefile.in index 73c59999c02..2483d3b83e0 100644 --- a/dlls/resampledmo/Makefile.in +++ b/dlls/resampledmo/Makefile.in @@ -1,6 +1,8 @@ MODULE = resampledmo.dll -IMPORTS = combase mfplat msdmo mfuuid dmoguids strmiids wmcodecdspuuid uuid +IMPORTS = $(FFMPEG_PE_LIBS) combase mfplat msdmo mfuuid dmoguids strmiids wmcodecdspuuid uuid +EXTRAINCL = $(FFMPEG_PE_CFLAGS) SOURCES = \ resampledmo.c \ - resampledmo.idl + resampledmo.idl \ + resampler.c diff --git a/dlls/resampledmo/resampledmo.c b/dlls/resampledmo/resampledmo.c index 486a379b7de..30d2b8f5410 100644 --- a/dlls/resampledmo/resampledmo.c +++ b/dlls/resampledmo/resampledmo.c @@ -33,41 +33,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dmo); -static HRESULT WINAPI resampler_factory_CreateInstance(IClassFactory *iface, IUnknown *outer, - REFIID riid, void **out) -{ - static const GUID CLSID_wg_resampler = {0x92f35e78,0x15a5,0x486b,{0x88,0x8e,0x57,0x5f,0x99,0x65,0x1c,0xe2}}; - return CoCreateInstance(&CLSID_wg_resampler, 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 resampler_factory_vtbl = -{ - class_factory_QueryInterface, - class_factory_AddRef, - class_factory_Release, - resampler_factory_CreateInstance, - class_factory_LockServer, -}; - -static IClassFactory resampler_factory = {&resampler_factory_vtbl}; +extern IClassFactory resampler_factory; /*********************************************************************** * DllGetClassObject (resampledmo.@) diff --git a/dlls/winegstreamer/resampler.c b/dlls/resampledmo/resampler.c similarity index 97% rename from dlls/winegstreamer/resampler.c rename to dlls/resampledmo/resampler.c index ce7120b695f..5452e2d8c55 100644 --- a/dlls/winegstreamer/resampler.c +++ b/dlls/resampledmo/resampler.c @@ -18,11 +18,10 @@ #include <stdarg.h> #include <stddef.h> +#define COBJMACROS #include "windef.h" #include "winbase.h" -#include "gst_private.h" - #include "dmoreg.h" #include "dmort.h" #include "dshow.h" @@ -39,8 +38,7 @@ #include "wine/debug.h" -WINE_DEFAULT_DEBUG_CHANNEL(mfplat); -WINE_DECLARE_DEBUG_CHANNEL(winediag); +WINE_DEFAULT_DEBUG_CHANNEL(dmo); static const AVRational USER_TIME_BASE_Q = {1, 10000000}; @@ -1293,30 +1291,20 @@ static const char *debugstr_version(UINT version) AV_VERSION_MICRO(version)); } -HRESULT resampler_create(IUnknown *outer, IUnknown **out) +static HRESULT WINAPI resampler_factory_CreateInstance(IClassFactory *iface, IUnknown *outer, + REFIID riid, void **out) { - static const WAVEFORMATEX output_format = - { - .wFormatTag = WAVE_FORMAT_IEEE_FLOAT, .wBitsPerSample = 32, .nSamplesPerSec = 44100, .nChannels = 1, - }; - static const WAVEFORMATEX input_format = - { - .wFormatTag = WAVE_FORMAT_PCM, .wBitsPerSample = 16, .nSamplesPerSec = 44100, .nChannels = 1, - }; struct resampler *impl; HRESULT hr; - TRACE("outer %p, out %p.\n", outer, out); + TRACE("outer %p, riid %s, out %p.\n", outer, debugstr_guid(riid), out); + + if (outer && !IsEqualGUID(riid, &IID_IUnknown)) + return E_NOINTERFACE; TRACE("avutil version %s\n", debugstr_version(avutil_version())); TRACE("swresample version %s\n", debugstr_version(swresample_version())); - if (FAILED(hr = check_audio_transform_support(&input_format, &output_format))) - { - ERR_(winediag)("GStreamer doesn't support audio resampling, please install appropriate plugins.\n"); - return hr; - } - if (!(impl = calloc(1, sizeof(*impl)))) return E_OUTOFMEMORY; impl->IUnknown_inner.lpVtbl = &unknown_vtbl; @@ -1331,7 +1319,38 @@ HRESULT resampler_create(IUnknown *outer, IUnknown **out) impl->input_info.cbAlignment = 1; impl->output_info.cbAlignment = 1; - *out = &impl->IUnknown_inner; - TRACE("Created resampler %p\n", *out); + TRACE("Created resampler %p\n", impl); + + hr = IUnknown_QueryInterface(&impl->IUnknown_inner, riid, out); + IUnknown_Release(&impl->IUnknown_inner); + return hr; +} + +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 resampler_factory_vtbl = +{ + class_factory_QueryInterface, + class_factory_AddRef, + class_factory_Release, + resampler_factory_CreateInstance, + class_factory_LockServer, +}; + +IClassFactory resampler_factory = {&resampler_factory_vtbl}; diff --git a/dlls/winegstreamer/Makefile.in b/dlls/winegstreamer/Makefile.in index ec762f9bdc5..1cc69e4a443 100644 --- a/dlls/winegstreamer/Makefile.in +++ b/dlls/winegstreamer/Makefile.in @@ -1,8 +1,7 @@ MODULE = winegstreamer.dll UNIXLIB = winegstreamer.so IMPORTLIB = winegstreamer -IMPORTS = $(FFMPEG_PE_LIBS) strmbase ole32 oleaut32 msdmo user32 -EXTRAINCL = $(FFMPEG_PE_CFLAGS) +IMPORTS = strmbase ole32 oleaut32 msdmo user32 DELAYIMPORTS = mfplat mf UNIX_CFLAGS = $(GSTREAMER_CFLAGS) UNIX_LIBS = $(GSTREAMER_LIBS) $(PTHREAD_LIBS) @@ -19,7 +18,6 @@ SOURCES = \ mfplat.c \ quartz_parser.c \ quartz_transform.c \ - resampler.c \ rsrc.rc \ unixlib.c \ video_decoder.c \ diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index 431e7930208..5770e2a5c8d 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -138,7 +138,6 @@ HRESULT mpeg_splitter_create(IUnknown *outer, IUnknown **out); HRESULT wave_parser_create(IUnknown *outer, IUnknown **out); HRESULT wma_decoder_create(IUnknown *outer, IUnknown **out); HRESULT wmv_decoder_create(IUnknown *outer, IUnknown **out); -HRESULT resampler_create(IUnknown *outer, IUnknown **out); HRESULT color_convert_create(IUnknown *outer, IUnknown **out); HRESULT mp3_sink_class_factory_create(IUnknown *outer, IUnknown **out); HRESULT mpeg4_sink_class_factory_create(IUnknown *outer, IUnknown **out); diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c index c7893f71026..0bf35669c98 100644 --- a/dlls/winegstreamer/main.c +++ b/dlls/winegstreamer/main.c @@ -979,7 +979,6 @@ static struct class_factory mpeg_splitter_cf = {{&class_factory_vtbl}, mpeg_spli static struct class_factory wave_parser_cf = {{&class_factory_vtbl}, wave_parser_create}; static struct class_factory wma_decoder_cf = {{&class_factory_vtbl}, wma_decoder_create}; static struct class_factory wmv_decoder_cf = {{&class_factory_vtbl}, wmv_decoder_create}; -static struct class_factory resampler_cf = {{&class_factory_vtbl}, resampler_create}; static struct class_factory color_convert_cf = {{&class_factory_vtbl}, color_convert_create}; static struct class_factory mp3_sink_class_factory_cf = {{&class_factory_vtbl}, mp3_sink_class_factory_create}; static struct class_factory mpeg4_sink_class_factory_cf = {{&class_factory_vtbl}, mpeg4_sink_class_factory_create}; @@ -992,7 +991,6 @@ HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **out) 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_mpeg_video_decoder = {0x5ed2e5f6,0xbf3e,0x4180,{0x83,0xa4,0x48,0x47,0xcc,0x5b,0x4e,0xa3}}; - 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}}; @@ -1027,8 +1025,6 @@ HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **out) factory = &wma_decoder_cf; else if (IsEqualGUID(clsid, &CLSID_wg_wmv_decoder)) factory = &wmv_decoder_cf; - else if (IsEqualGUID(clsid, &CLSID_wg_resampler)) - factory = &resampler_cf; else if (IsEqualGUID(clsid, &CLSID_wg_color_converter)) factory = &color_convert_cf; else if (IsEqualGUID(clsid, &CLSID_wg_mp3_sink_factory)) diff --git a/dlls/winegstreamer/winegstreamer_classes.idl b/dlls/winegstreamer/winegstreamer_classes.idl index bb9f81c2341..15c0c13260d 100644 --- a/dlls/winegstreamer/winegstreamer_classes.idl +++ b/dlls/winegstreamer/winegstreamer_classes.idl @@ -107,12 +107,6 @@ coclass wg_h264_decoder {} ] coclass wg_h264_encoder {} -[ - threading(both), - uuid(92f35e78-15a5-486b-888e-575f99651ce2) -] -coclass wg_resampler {} - [ threading(both), uuid(f47e2da5-e370-47b7-903a-078ddd45a5cc) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11111