From: Rémi Bernon <rbernon@codeweavers.com> --- dlls/msvproc/Makefile.in | 6 +- dlls/msvproc/msvproc.c | 36 +------ .../video_processor.c | 100 +++++++++++++----- dlls/winegstreamer/Makefile.in | 4 +- dlls/winegstreamer/gst_private.h | 2 - dlls/winegstreamer/mfplat.c | 2 - dlls/winegstreamer/winegstreamer_classes.idl | 6 -- 7 files changed, 79 insertions(+), 77 deletions(-) rename dlls/{winegstreamer => msvproc}/video_processor.c (94%) diff --git a/dlls/msvproc/Makefile.in b/dlls/msvproc/Makefile.in index f98b4d6d44b..cf19d1dfd17 100644 --- a/dlls/msvproc/Makefile.in +++ b/dlls/msvproc/Makefile.in @@ -1,6 +1,8 @@ MODULE = msvproc.dll -IMPORTS = combase mfplat mfuuid dmoguids dxguid strmiids wmcodecdspuuid uuid +IMPORTS = $(FFMPEG_PE_LIBS) bcrypt combase mfplat mfuuid dmoguids dxguid strmiids wmcodecdspuuid uuid +EXTRAINCL = $(FFMPEG_PE_CFLAGS) SOURCES = \ msvproc.c \ - msvproc.idl + msvproc.idl \ + video_processor.c diff --git a/dlls/msvproc/msvproc.c b/dlls/msvproc/msvproc.c index fdf6a1cddb1..17c3b8def93 100644 --- a/dlls/msvproc/msvproc.c +++ b/dlls/msvproc/msvproc.c @@ -37,41 +37,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dmo); DEFINE_MEDIATYPE_GUID(MFVideoFormat_ABGR32, D3DFMT_A8B8G8R8); DEFINE_MEDIATYPE_GUID(MFVideoFormat_P208,MAKEFOURCC('P','2','0','8')); -static HRESULT WINAPI video_processor_factory_CreateInstance(IClassFactory *iface, IUnknown *outer, - REFIID riid, void **out) -{ - static const GUID CLSID_wg_video_processor = {0xd527607f,0x89cb,0x4e94,{0x95,0x71,0xbc,0xfe,0x62,0x17,0x56,0x13}}; - return CoCreateInstance(&CLSID_wg_video_processor, 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 video_processor_factory_vtbl = -{ - class_factory_QueryInterface, - class_factory_AddRef, - class_factory_Release, - video_processor_factory_CreateInstance, - class_factory_LockServer, -}; - -static IClassFactory video_processor_factory = {&video_processor_factory_vtbl}; +extern IClassFactory video_processor_factory; /*********************************************************************** * DllGetClassObject (msvproc.@) diff --git a/dlls/winegstreamer/video_processor.c b/dlls/msvproc/video_processor.c similarity index 94% rename from dlls/winegstreamer/video_processor.c rename to dlls/msvproc/video_processor.c index 9208106e10e..f2ad3e0fe78 100644 --- a/dlls/winegstreamer/video_processor.c +++ b/dlls/msvproc/video_processor.c @@ -15,15 +15,21 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "gst_private.h" +#include <stddef.h> +#include <stdarg.h> + +#define COBJMACROS +#include "windef.h" +#include "winbase.h" #include "d3d9types.h" -#include "mediaerr.h" +#include "dshow.h" +#include "dvdmedia.h" #include "mfapi.h" +#include "mfidl.h" #include "mferror.h" #include "mfobjects.h" #include "mftransform.h" -#include "wmcodecdsp.h" #include <libavutil/avutil.h> #include <libavutil/imgutils.h> @@ -33,9 +39,9 @@ #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(dmo); -WINE_DECLARE_DEBUG_CHANNEL(winediag); -extern GUID MFVideoFormat_ABGR32; +DEFINE_MEDIATYPE_GUID(MFVideoFormat_ABGR32, D3DFMT_A8B8G8R8); +DEFINE_MEDIATYPE_GUID(MFVideoFormat_P208,MAKEFOURCC('P','2','0','8')); static const GUID MF_XVP_PLAYBACK_MODE = { 0x3c5d293f, 0xad67, 0x4e29, { 0xaf, 0x12, 0xcf, 0x3e, 0x23, 0x8a, 0xcc, 0xe9 } }; @@ -464,6 +470,29 @@ static void video_processor_cleanup(struct video_processor *impl) sws_free_context(&impl->context); } +static BOOL is_mf_video_area_empty(const MFVideoArea *area) +{ + return !area->OffsetX.value && !area->OffsetY.value && !area->Area.cx && !area->Area.cy; +} + +static void get_mf_video_content_rect(const MFVideoInfo *info, RECT *rect) +{ + if (!is_mf_video_area_empty(&info->MinimumDisplayAperture)) + { + rect->left = info->MinimumDisplayAperture.OffsetX.value; + rect->top = info->MinimumDisplayAperture.OffsetY.value; + rect->right = rect->left + info->MinimumDisplayAperture.Area.cx; + rect->bottom = rect->top + info->MinimumDisplayAperture.Area.cy; + } + else + { + rect->left = 0; + rect->top = 0; + rect->right = info->dwWidth; + rect->bottom = info->dwHeight; + } +} + static void update_video_aperture(MFVideoInfo *input_info, MFVideoInfo *output_info) { RECT input_rect, output_rect; @@ -1158,34 +1187,22 @@ static const char *debugstr_version(UINT version) AV_VERSION_MICRO(version)); } -HRESULT video_processor_create(REFIID riid, void **ret) +static HRESULT WINAPI video_processor_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 video_processor *impl; HRESULT hr; - TRACE("riid %s, ret %p.\n", debugstr_guid(riid), ret); + TRACE("outer %p, riid %s, out %p.\n", outer, debugstr_guid(riid), out); + + *out = NULL; + + if (outer) + return CLASS_E_NOAGGREGATION; 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; @@ -1201,9 +1218,9 @@ HRESULT video_processor_create(REFIID riid, void **ret) impl->IMFTransform_iface.lpVtbl = &video_processor_vtbl; impl->refcount = 1; + TRACE("Created video processor %p\n", impl); - *ret = &impl->IMFTransform_iface; - TRACE("Created %p\n", *ret); + *out = &impl->IMFTransform_iface; return S_OK; failed: @@ -1215,3 +1232,32 @@ failed: free(impl); 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 video_processor_factory_vtbl = +{ + class_factory_QueryInterface, + class_factory_AddRef, + class_factory_Release, + video_processor_factory_CreateInstance, + class_factory_LockServer, +}; + +IClassFactory video_processor_factory = {&video_processor_factory_vtbl}; diff --git a/dlls/winegstreamer/Makefile.in b/dlls/winegstreamer/Makefile.in index 1df91596e30..12907f90b2f 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) @@ -22,7 +21,6 @@ SOURCES = \ unixlib.c \ video_decoder.c \ video_encoder.c \ - video_processor.c \ wg_allocator.c \ wg_format.c \ wg_media_type.c \ diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index 0301db6e627..7a5c2f3f4b0 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -181,8 +181,6 @@ bool wg_video_format_is_rgb(enum wg_video_format format); HRESULT aac_decoder_create(REFIID riid, void **ret); HRESULT h264_decoder_create(REFIID riid, void **ret); -HRESULT video_processor_create(REFIID riid, void **ret); - HRESULT h264_encoder_create(REFIID riid, void **ret); extern const GUID MFAudioFormat_RAW_AAC; diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index 4088a935625..65a1079155e 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -121,7 +121,6 @@ static const IClassFactoryVtbl class_factory_vtbl = }; static const GUID CLSID_GStreamerByteStreamHandler = {0x317df618, 0x5e5a, 0x468a, {0x9f, 0x15, 0xd8, 0x27, 0xa9, 0xa0, 0x81, 0x62}}; -static const GUID CLSID_wg_video_processor = {0xd527607f,0x89cb,0x4e94,{0x95,0x71,0xbc,0xfe,0x62,0x17,0x56,0x13}}; static const GUID CLSID_wg_aac_decoder = {0xe7889a8a,0x2083,0x4844,{0x83,0x70,0x5e,0xe3,0x49,0xb1,0x45,0x03}}; static const GUID CLSID_wg_h264_decoder = {0x1f1e273d,0x12c0,0x4b3a,{0x8e,0x9b,0x19,0x33,0xc2,0x49,0x8a,0xea}}; static const GUID CLSID_wg_h264_encoder = {0x6c34de69,0x4670,0x46cd,{0x8c,0xb4,0x1f,0x2f,0xa1,0xdf,0xfb,0x65}}; @@ -133,7 +132,6 @@ static const struct class_object } class_objects[] = { - { &CLSID_wg_video_processor, &video_processor_create }, { &CLSID_GStreamerByteStreamHandler, &gstreamer_byte_stream_handler_create }, { &CLSID_wg_aac_decoder, &aac_decoder_create }, { &CLSID_wg_h264_decoder, &h264_decoder_create }, diff --git a/dlls/winegstreamer/winegstreamer_classes.idl b/dlls/winegstreamer/winegstreamer_classes.idl index 8afa08df5f7..fd46ba3e687 100644 --- a/dlls/winegstreamer/winegstreamer_classes.idl +++ b/dlls/winegstreamer/winegstreamer_classes.idl @@ -64,12 +64,6 @@ coclass wg_wave_parser {} ] coclass decodebin_parser {} -[ - threading(both), - uuid(d527607f-89cb-4e94-9571-bcfe62175613) -] -coclass wg_video_processor {} - [ helpstring("Generic Decodebin Byte Stream Handler"), threading(both), -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11194