Required for dxva video playback by Chromium-based browsers and the Chromium Embedded Framework, including Adobe Photoshop's tooltip hint videos.
Signed-off-by: Mohamad Al-Jaf mohamadaljaf@gmail.com --- configure.ac | 1 + dlls/msmpeg2vdec/Makefile.in | 6 ++++++ dlls/msmpeg2vdec/main.c | 32 +++++++++++++++++++++++++++++++ dlls/msmpeg2vdec/msmpeg2vdec.spec | 8 ++++++++ 4 files changed, 47 insertions(+) create mode 100644 dlls/msmpeg2vdec/Makefile.in create mode 100644 dlls/msmpeg2vdec/main.c create mode 100644 dlls/msmpeg2vdec/msmpeg2vdec.spec
diff --git a/configure.ac b/configure.ac index 48445cc7b2f..d2e0127f262 100644 --- a/configure.ac +++ b/configure.ac @@ -2750,6 +2750,7 @@ WINE_CONFIG_MAKEFILE(dlls/msimtf) WINE_CONFIG_MAKEFILE(dlls/msisip) WINE_CONFIG_MAKEFILE(dlls/msisys.ocx) WINE_CONFIG_MAKEFILE(dlls/msls31) +WINE_CONFIG_MAKEFILE(dlls/msmpeg2vdec) WINE_CONFIG_MAKEFILE(dlls/msnet32) WINE_CONFIG_MAKEFILE(dlls/mspatcha) WINE_CONFIG_MAKEFILE(dlls/mspatcha/tests) diff --git a/dlls/msmpeg2vdec/Makefile.in b/dlls/msmpeg2vdec/Makefile.in new file mode 100644 index 00000000000..54ada2f20c4 --- /dev/null +++ b/dlls/msmpeg2vdec/Makefile.in @@ -0,0 +1,6 @@ +MODULE = msmpeg2vdec.dll + +EXTRADLLFLAGS = -Wb,--prefer-native + +C_SRCS = \ + main.c diff --git a/dlls/msmpeg2vdec/main.c b/dlls/msmpeg2vdec/main.c new file mode 100644 index 00000000000..61ada37b2f6 --- /dev/null +++ b/dlls/msmpeg2vdec/main.c @@ -0,0 +1,32 @@ +/* + * Copyright 2022 Mohamad Al-Jaf + * + * 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 <stdarg.h> + +#include "windef.h" +#include "winbase.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(msmpeg2vdec); + +HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, LPVOID *ppv) +{ + FIXME("(%s %s %p)\n", debugstr_guid(clsid), debugstr_guid(riid), ppv); + return CLASS_E_CLASSNOTAVAILABLE; +} diff --git a/dlls/msmpeg2vdec/msmpeg2vdec.spec b/dlls/msmpeg2vdec/msmpeg2vdec.spec new file mode 100644 index 00000000000..b81b77ce108 --- /dev/null +++ b/dlls/msmpeg2vdec/msmpeg2vdec.spec @@ -0,0 +1,8 @@ +@ stub GetH264DecoderFunctionTable +@ stub ?GetSurface@CVIDEOfilter@@QEAAJHPEAEJ@Z +@ stub ?GetSurfaceSize@CVIDEOfilter@@QEAAJHPEAJ@Z +@ stub ?LoadSurface@CVIDEOfilter@@QEAAJHPEAEK@Z +@ stdcall -private DllCanUnloadNow() +@ stdcall -private DllGetClassObject(ptr ptr ptr) +@ stdcall -private DllRegisterServer() +@ stdcall -private DllUnregisterServer()
Signed-off-by: Mohamad Al-Jaf mohamadaljaf@gmail.com --- dlls/winegstreamer/winegstreamer_classes.idl | 6 ++++++ include/wmcodecdsp.idl | 5 +++++ 2 files changed, 11 insertions(+)
diff --git a/dlls/winegstreamer/winegstreamer_classes.idl b/dlls/winegstreamer/winegstreamer_classes.idl index 347ee906a52..4e752e9c96e 100644 --- a/dlls/winegstreamer/winegstreamer_classes.idl +++ b/dlls/winegstreamer/winegstreamer_classes.idl @@ -79,3 +79,9 @@ coclass CWMADecMediaObject {}; uuid(62ce7e72-4c71-4d20-b15d-452831a87d9d) ] coclass CMSH264DecoderMFT {} + +[ + threading(both), + uuid(2d709e52-123f-49b5-9cbc-9af5cde28fb9) +] +coclass CMSMPEGDecoderMFT {} diff --git a/include/wmcodecdsp.idl b/include/wmcodecdsp.idl index dcf28ab682c..0846b08382c 100644 --- a/include/wmcodecdsp.idl +++ b/include/wmcodecdsp.idl @@ -44,6 +44,11 @@ coclass CResamplerMediaObject {} ] coclass CMSH264DecoderMFT {}
+[ + uuid(2d709e52-123f-49b5-9cbc-9af5cde28fb9) +] +coclass CMSMPEGDecoderMFT {} + [ uuid(2eeb4adf-4578-4d10-bca7-bb955f56320a) ]
On 4/21/22 08:29, Mohamad Al-Jaf wrote:
Signed-off-by: Mohamad Al-Jaf mohamadaljaf@gmail.com
dlls/winegstreamer/winegstreamer_classes.idl | 6 ++++++ include/wmcodecdsp.idl | 5 +++++ 2 files changed, 11 insertions(+)
diff --git a/dlls/winegstreamer/winegstreamer_classes.idl b/dlls/winegstreamer/winegstreamer_classes.idl index 347ee906a52..4e752e9c96e 100644 --- a/dlls/winegstreamer/winegstreamer_classes.idl +++ b/dlls/winegstreamer/winegstreamer_classes.idl @@ -79,3 +79,9 @@ coclass CWMADecMediaObject {}; uuid(62ce7e72-4c71-4d20-b15d-452831a87d9d) ] coclass CMSH264DecoderMFT {}
+[
- threading(both),
- uuid(2d709e52-123f-49b5-9cbc-9af5cde28fb9)
+] +coclass CMSMPEGDecoderMFT {} diff --git a/include/wmcodecdsp.idl b/include/wmcodecdsp.idl index dcf28ab682c..0846b08382c 100644 --- a/include/wmcodecdsp.idl +++ b/include/wmcodecdsp.idl @@ -44,6 +44,11 @@ coclass CResamplerMediaObject {} ] coclass CMSH264DecoderMFT {}
+[
- uuid(2d709e52-123f-49b5-9cbc-9af5cde28fb9)
+] +coclass CMSMPEGDecoderMFT {}
- [ uuid(2eeb4adf-4578-4d10-bca7-bb955f56320a) ]
Header change is fine, but I don't see why you added it to winegstreamer as well.
On Thu, Apr 21, 2022 at 2:55 AM Nikolay Sivov nsivov@codeweavers.com wrote:
Header change is fine, but I don't see why you added it to winegstreamer as well.
Isn't media playback handled by winegstreamer? Won't it not be able to play if the coclass isn't found?
-- Kind regards, Mohamad
Signed-off-by: Mohamad Al-Jaf mohamadaljaf@gmail.com --- dlls/msmpeg2vdec/Makefile.in | 3 + dlls/msmpeg2vdec/main.c | 76 +++++++++++++++++++++++- dlls/msmpeg2vdec/msmpeg2vdec_classes.idl | 21 +++++++ 3 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 dlls/msmpeg2vdec/msmpeg2vdec_classes.idl
diff --git a/dlls/msmpeg2vdec/Makefile.in b/dlls/msmpeg2vdec/Makefile.in index 54ada2f20c4..44377594b91 100644 --- a/dlls/msmpeg2vdec/Makefile.in +++ b/dlls/msmpeg2vdec/Makefile.in @@ -1,6 +1,9 @@ MODULE = msmpeg2vdec.dll +IMPORTS = mfuuid uuid
EXTRADLLFLAGS = -Wb,--prefer-native
C_SRCS = \ main.c + +IDL_SRCS = msmpeg2vdec_classes.idl diff --git a/dlls/msmpeg2vdec/main.c b/dlls/msmpeg2vdec/main.c index 61ada37b2f6..7eede3d4b38 100644 --- a/dlls/msmpeg2vdec/main.c +++ b/dlls/msmpeg2vdec/main.c @@ -18,15 +18,89 @@
#include <stdarg.h>
+#define COBJMACROS + #include "windef.h" #include "winbase.h" +#include "mfidl.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(msmpeg2vdec);
+typedef struct { + IClassFactory IClassFactory_iface; + LONG ref; + HRESULT (*pfnCreateInstance)(IUnknown *outer, REFIID riid, void **out); +} msmpeg2vdec_class_factory; + +static inline msmpeg2vdec_class_factory *impl_from_IClassFactory(IClassFactory *iface) +{ + return CONTAINING_RECORD(iface, msmpeg2vdec_class_factory, IClassFactory_iface); +} + +static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ret_iface) +{ + TRACE("(%p, %s, %p)\n", iface, debugstr_guid(riid), ret_iface); + + if (IsEqualGUID(&IID_IUnknown, riid) || + IsEqualGUID(&IID_IClassFactory, riid)) + { + IClassFactory_AddRef(iface); + *ret_iface = iface; + return S_OK; + } + + *ret_iface = NULL; + WARN("no interface for %s\n", debugstr_guid(riid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface) +{ + return 2; +} + +static ULONG WINAPI ClassFactory_Release(IClassFactory *iface) +{ + return 1; +} + +static HRESULT WINAPI MSMPEGDecoderMFTFactory_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **obj) +{ + msmpeg2vdec_class_factory *factory = impl_from_IClassFactory(iface); + + TRACE("(iface %p, outer %p, riid %s, obj %p)\n", + iface, outer, debugstr_guid(riid), obj); + + return factory->pfnCreateInstance(outer, riid, obj); +} + +static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL lock) +{ + FIXME("(%d) stub\n", lock); + return S_OK; +} + +static const IClassFactoryVtbl MSMPEGDecoderMFTFactoryVtbl = +{ + ClassFactory_QueryInterface, + ClassFactory_AddRef, + ClassFactory_Release, + MSMPEGDecoderMFTFactory_CreateInstance, + ClassFactory_LockServer, +}; + +static IClassFactory MSMPEGDecoderMFTFactory = { &MSMPEGDecoderMFTFactoryVtbl }; + HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, LPVOID *ppv) { - FIXME("(%s %s %p)\n", debugstr_guid(clsid), debugstr_guid(riid), ppv); + TRACE("(%s, %s, %p)\n", debugstr_guid(clsid), debugstr_guid(riid), ppv); + + if (IsEqualGUID(clsid, &CLSID_MSMPEGDecoderMFT)) + return ClassFactory_QueryInterface(&MSMPEGDecoderMFTFactory, riid, ppv); + + WARN("Unsupported class %s.\n", debugstr_guid(clsid)); + *ppv = NULL; return CLASS_E_CLASSNOTAVAILABLE; } diff --git a/dlls/msmpeg2vdec/msmpeg2vdec_classes.idl b/dlls/msmpeg2vdec/msmpeg2vdec_classes.idl new file mode 100644 index 00000000000..2df633a06dd --- /dev/null +++ b/dlls/msmpeg2vdec/msmpeg2vdec_classes.idl @@ -0,0 +1,21 @@ +/* + * COM Classes for msmpeg2vdec + * + * Copyright 2022 Mohamad Al-Jaf + * + * 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
On 4/21/22 08:29, Mohamad Al-Jaf wrote:
+static HRESULT WINAPI MSMPEGDecoderMFTFactory_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **obj) +{
- msmpeg2vdec_class_factory *factory = impl_from_IClassFactory(iface);
- TRACE("(iface %p, outer %p, riid %s, obj %p)\n",
iface, outer, debugstr_guid(riid), obj);
- return factory->pfnCreateInstance(outer, riid, obj);
+}
I suspect that will crash.
On 4/21/22 08:29, Mohamad Al-Jaf wrote:
Required for dxva video playback by Chromium-based browsers and the Chromium Embedded Framework, including Adobe Photoshop's tooltip hint videos.
I can't imagine a stub helping this situation.
Important problem here is to have an ability of using both software and d3d path in such decoders.
We only have "software" path going through gstreamer, and no dxva/d3d11/d3d12 video decoding capabilities. We would want d3d path too for other reasons as well, but it's a question of how to integrate that nicely.
On Thu, Apr 21, 2022 at 2:54 AM Nikolay Sivov nsivov@codeweavers.com wrote:
I can't imagine a stub helping this situation. Important problem here is to have an ability of using both software and d3d path in such decoders.
We only have "software" path going through gstreamer, and no dxva/d3d11/d3d12 video decoding capabilities. We would want d3d path too for other reasons as well, but it's a question of how to integrate that nicely.
Well at the moment it just prevents errors from happening when CEF and Chromium-based browsers, like Microsoft Edge, attempt to load a non-existent msmpeg2vdec file. For Photoshop, it can load either an mp4 or a webm. For the former, this file prevents an error which should make it fallback to webm and I believe webm plays fine in Wine.
Perhaps in the future when dxva decoding is implemented this dll will work similarly to the native version.
-- Kind regards, Mohamad