From: Rémi Bernon <rbernon@codeweavers.com> --- dlls/colorcnv/Makefile.in | 4 +- .../color_converter.c} | 86 ++++++++++--------- dlls/colorcnv/colorcnv.c | 47 +++------- dlls/iyuv_32/Makefile.in | 5 +- dlls/iyuv_32/iyuv.c | 8 +- dlls/iyuv_32/iyuv_private.h | 2 - dlls/winegstreamer/Makefile.in | 4 +- dlls/winegstreamer/gst_private.h | 1 - dlls/winegstreamer/main.c | 4 - dlls/winegstreamer/winegstreamer.spec | 1 - dlls/winegstreamer/winegstreamer_classes.idl | 6 -- 11 files changed, 73 insertions(+), 95 deletions(-) rename dlls/{winegstreamer/color_convert.c => colorcnv/color_converter.c} (96%) diff --git a/dlls/colorcnv/Makefile.in b/dlls/colorcnv/Makefile.in index 1798af91c9b..cfff9e88d10 100644 --- a/dlls/colorcnv/Makefile.in +++ b/dlls/colorcnv/Makefile.in @@ -1,6 +1,8 @@ MODULE = colorcnv.dll -IMPORTS = combase mfplat msdmo mfuuid dmoguids strmiids wmcodecdspuuid uuid +IMPORTS = $(FFMPEG_PE_LIBS) bcrypt combase mfplat msdmo mfuuid dmoguids strmiids wmcodecdspuuid uuid +EXTRAINCL = $(FFMPEG_PE_CFLAGS) SOURCES = \ + color_converter.c \ colorcnv.c \ colorcnv.idl diff --git a/dlls/winegstreamer/color_convert.c b/dlls/colorcnv/color_converter.c similarity index 96% rename from dlls/winegstreamer/color_convert.c rename to dlls/colorcnv/color_converter.c index 20f7d15b419..1d5f48e615e 100644 --- a/dlls/winegstreamer/color_convert.c +++ b/dlls/colorcnv/color_converter.c @@ -18,12 +18,15 @@ #include <stdarg.h> #include <stddef.h> +#define COBJMACROS #include "windef.h" #include "winbase.h" -#include "gst_private.h" - +#include "d3d9types.h" +#include "dmoreg.h" #include "dmort.h" +#include "dshow.h" +#include "dvdmedia.h" #include "mediaerr.h" #include "mfapi.h" #include "mferror.h" @@ -38,10 +41,14 @@ #include "wine/debug.h" -WINE_DEFAULT_DEBUG_CHANNEL(mfplat); -WINE_DECLARE_DEBUG_CHANNEL(winediag); +WINE_DEFAULT_DEBUG_CHANNEL(dmo); DEFINE_MEDIATYPE_GUID(MFVideoFormat_ABGR32, D3DFMT_A8B8G8R8); +DEFINE_GUID(DMOVideoFormat_RGB32,D3DFMT_X8R8G8B8,0x524f,0x11ce,0x9f,0x53,0x00,0x20,0xaf,0x0b,0xa7,0x70); +DEFINE_GUID(DMOVideoFormat_RGB24,D3DFMT_R8G8B8,0x524f,0x11ce,0x9f,0x53,0x00,0x20,0xaf,0x0b,0xa7,0x70); +DEFINE_GUID(DMOVideoFormat_RGB565,D3DFMT_R5G6B5,0x524f,0x11ce,0x9f,0x53,0x00,0x20,0xaf,0x0b,0xa7,0x70); +DEFINE_GUID(DMOVideoFormat_RGB555,D3DFMT_X1R5G5B5,0x524f,0x11ce,0x9f,0x53,0x00,0x20,0xaf,0x0b,0xa7,0x70); +DEFINE_GUID(DMOVideoFormat_RGB8,D3DFMT_P8,0x524f,0x11ce,0x9f,0x53,0x00,0x20,0xaf,0x0b,0xa7,0x70); static const AVRational USER_TIME_BASE_Q = {1, 10000000}; @@ -1434,34 +1441,20 @@ static const char *debugstr_version(UINT version) AV_VERSION_MICRO(version)); } -HRESULT color_convert_create(IUnknown *outer, IUnknown **out) +static HRESULT WINAPI color_converter_factory_CreateInstance(IClassFactory *iface, IUnknown *outer, + REFIID riid, void **out) { - const MFVIDEOFORMAT input_format = - { - .dwSize = sizeof(MFVIDEOFORMAT), - .videoInfo = {.dwWidth = 1920, .dwHeight = 1080}, - .guidFormat = MFVideoFormat_I420, - }; - const MFVIDEOFORMAT output_format = - { - .dwSize = sizeof(MFVIDEOFORMAT), - .videoInfo = {.dwWidth = 1920, .dwHeight = 1080}, - .guidFormat = MFVideoFormat_NV12, - }; struct color_convert *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("swscale version %s\n", debugstr_version(swscale_version())); - if (FAILED(hr = check_video_transform_support(&input_format, &output_format))) - { - ERR_(winediag)("GStreamer doesn't support video conversion, please install appropriate plugins.\n"); - return hr; - } - if (!(impl = calloc(1, sizeof(*impl)))) return E_OUTOFMEMORY; impl->IUnknown_inner.lpVtbl = &unknown_vtbl; @@ -1475,23 +1468,38 @@ HRESULT color_convert_create(IUnknown *outer, IUnknown **out) impl->input_info.cbAlignment = 1; impl->output_info.cbAlignment = 1; - *out = &impl->IUnknown_inner; - TRACE("Created %p\n", *out); - return S_OK; + TRACE("Created converter %p\n", impl); + + hr = IUnknown_QueryInterface(&impl->IUnknown_inner, riid, out); + IUnknown_Release(&impl->IUnknown_inner); + return hr; } -HRESULT WINAPI winegstreamer_create_color_converter(IMFTransform **out) +static HRESULT WINAPI class_factory_QueryInterface(IClassFactory *iface, REFIID riid, void **out) { - IUnknown *unknown; - HRESULT hr; - - TRACE("out %p.\n", out); - - if (!init_gstreamer()) - return E_FAIL; + *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; +} - if (FAILED(hr = color_convert_create(NULL, &unknown))) - return hr; +static const IClassFactoryVtbl color_converter_factory_vtbl = +{ + class_factory_QueryInterface, + class_factory_AddRef, + class_factory_Release, + color_converter_factory_CreateInstance, + class_factory_LockServer, +}; - return IUnknown_QueryInterface(unknown, &IID_IMFTransform, (void**)out); -} +IClassFactory color_converter_factory = {&color_converter_factory_vtbl}; diff --git a/dlls/colorcnv/colorcnv.c b/dlls/colorcnv/colorcnv.c index e9bf90932bc..467a0df8c82 100644 --- a/dlls/colorcnv/colorcnv.c +++ b/dlls/colorcnv/colorcnv.c @@ -25,11 +25,22 @@ #include "d3d9.h" #include "dmoreg.h" +#include "dmort.h" #include "dshow.h" +#include "dvdmedia.h" +#include "mediaerr.h" #include "mfapi.h" +#include "mferror.h" +#include "mfobjects.h" +#include "mftransform.h" #include "rpcproxy.h" #include "wmcodecdsp.h" +#include <libavutil/avutil.h> +#include <libavutil/opt.h> +#include <libavutil/imgutils.h> +#include <libswscale/swscale.h> + #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(dmo); @@ -43,41 +54,7 @@ DEFINE_GUID(DMOVideoFormat_RGB565,D3DFMT_R5G6B5,0x524f,0x11ce,0x9f,0x53,0x00,0x2 DEFINE_GUID(DMOVideoFormat_RGB555,D3DFMT_X1R5G5B5,0x524f,0x11ce,0x9f,0x53,0x00,0x20,0xaf,0x0b,0xa7,0x70); DEFINE_GUID(DMOVideoFormat_RGB8,D3DFMT_P8,0x524f,0x11ce,0x9f,0x53,0x00,0x20,0xaf,0x0b,0xa7,0x70); -static HRESULT WINAPI color_converter_factory_CreateInstance(IClassFactory *iface, IUnknown *outer, - REFIID riid, void **out) -{ - static const GUID CLSID_wg_color_converter = {0xf47e2da5,0xe370,0x47b7,{0x90,0x3a,0x07,0x8d,0xdd,0x45,0xa5,0xcc}}; - return CoCreateInstance(&CLSID_wg_color_converter, 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 color_converter_factory_vtbl = -{ - class_factory_QueryInterface, - class_factory_AddRef, - class_factory_Release, - color_converter_factory_CreateInstance, - class_factory_LockServer, -}; - -static IClassFactory color_converter_factory = {&color_converter_factory_vtbl}; +extern IClassFactory color_converter_factory; /*********************************************************************** * DllGetClassObject (colorcnv.@) diff --git a/dlls/iyuv_32/Makefile.in b/dlls/iyuv_32/Makefile.in index e5a261b973f..7830169ed28 100644 --- a/dlls/iyuv_32/Makefile.in +++ b/dlls/iyuv_32/Makefile.in @@ -1,6 +1,9 @@ MODULE = iyuv_32.dll -IMPORTS = user32 mfplat ole32 winegstreamer +IMPORTS = $(FFMPEG_PE_LIBS) bcrypt user32 combase mfplat msdmo mfuuid dmoguids strmiids wmcodecdspuuid uuid +EXTRAINCL = $(FFMPEG_PE_CFLAGS) +PARENTSRC = ../colorcnv SOURCES = \ + color_converter.c \ iyuv.c \ iyuv_32.rc diff --git a/dlls/iyuv_32/iyuv.c b/dlls/iyuv_32/iyuv.c index f990a5bd6a1..6c9a8b43a51 100644 --- a/dlls/iyuv_32/iyuv.c +++ b/dlls/iyuv_32/iyuv.c @@ -26,9 +26,10 @@ #include "wingdi.h" #include "winuser.h" +#define COBJMACROS #include "commdlg.h" -#include "initguid.h" #include "vfw.h" +#include "unknwn.h" #include "wmcodecdsp.h" #include "iyuv_private.h" @@ -45,6 +46,9 @@ static HINSTANCE IYUV_32_module; #define compare_fourcc(fcc1, fcc2) (((fcc1) ^ (fcc2)) & ~0x20202020) +/* in dlls/colorcnv/color_converter.c */ +extern IClassFactory color_converter_factory; + static inline UINT64 make_uint64(UINT32 high, UINT32 low) { return ((UINT64)high << 32) | low; @@ -59,7 +63,7 @@ static LRESULT IYUV_Open(const ICINFO *icinfo) if (icinfo && compare_fourcc(icinfo->fccType, ICTYPE_VIDEO)) return 0; - if (FAILED(winegstreamer_create_color_converter(&transform))) + if (FAILED(IClassFactory_CreateInstance(&color_converter_factory, NULL, &IID_IMFTransform, (void **)&transform))) transform = NULL; return (LRESULT)transform; diff --git a/dlls/iyuv_32/iyuv_private.h b/dlls/iyuv_32/iyuv_private.h index 694f89799d5..a58482f7a0d 100644 --- a/dlls/iyuv_32/iyuv_private.h +++ b/dlls/iyuv_32/iyuv_private.h @@ -25,8 +25,6 @@ #include "mfapi.h" #include "mftransform.h" -HRESULT WINAPI winegstreamer_create_color_converter(IMFTransform **out); - #define IDS_NAME 100 #define IDS_DESCRIPTION 101 diff --git a/dlls/winegstreamer/Makefile.in b/dlls/winegstreamer/Makefile.in index 98c9b16dcce..81700f12ea9 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) bcrypt 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) @@ -12,7 +11,6 @@ VER_OLESELFREGISTER = 1 SOURCES = \ aac_decoder.c \ - color_convert.c \ main.c \ media_sink.c \ media_source.c \ diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index 5770e2a5c8d..0301db6e627 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 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 0bf35669c98..6a8bd4b6413 100644 --- a/dlls/winegstreamer/main.c +++ b/dlls/winegstreamer/main.c @@ -979,14 +979,12 @@ 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 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}; HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, void **out) { static const GUID CLSID_wg_avi_splitter = {0x272bfbfb,0x50d0,0x4078,{0xb6,0x00,0x1e,0x95,0x9c,0x30,0x13,0x37}}; - 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}}; @@ -1025,8 +1023,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_color_converter)) - factory = &color_convert_cf; else if (IsEqualGUID(clsid, &CLSID_wg_mp3_sink_factory)) factory = &mp3_sink_class_factory_cf; else if (IsEqualGUID(clsid, &CLSID_wg_mpeg4_sink_factory)) diff --git a/dlls/winegstreamer/winegstreamer.spec b/dlls/winegstreamer/winegstreamer.spec index 69eed004b78..095f75a0865 100644 --- a/dlls/winegstreamer/winegstreamer.spec +++ b/dlls/winegstreamer/winegstreamer.spec @@ -4,4 +4,3 @@ @ stdcall -private DllUnregisterServer() @ stdcall winegstreamer_create_wm_sync_reader(ptr ptr) @ stdcall winegstreamer_create_video_decoder(ptr) -@ stdcall winegstreamer_create_color_converter(ptr) diff --git a/dlls/winegstreamer/winegstreamer_classes.idl b/dlls/winegstreamer/winegstreamer_classes.idl index 15c0c13260d..8afa08df5f7 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(f47e2da5-e370-47b7-903a-078ddd45a5cc) -] -coclass wg_color_converter {} - [ threading(both), uuid(1f302877-aaab-40a3-b9e0-9f48daf35bc8) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11194