From: Rémi Bernon <rbernon(a)codeweavers.com> --- configure.ac | 1 + dlls/vidreszr/Makefile.in | 6 ++ dlls/vidreszr/vidreszr.c | 181 ++++++++++++++++++++++++++++++++++++ dlls/vidreszr/vidreszr.idl | 25 +++++ dlls/vidreszr/vidreszr.spec | 4 + loader/wine.inf.in | 1 + 6 files changed, 218 insertions(+) create mode 100644 dlls/vidreszr/Makefile.in create mode 100644 dlls/vidreszr/vidreszr.c create mode 100644 dlls/vidreszr/vidreszr.idl create mode 100644 dlls/vidreszr/vidreszr.spec diff --git a/configure.ac b/configure.ac index f3354395fb5..f3c5089e22c 100644 --- a/configure.ac +++ b/configure.ac @@ -3256,6 +3256,7 @@ WINE_CONFIG_MAKEFILE(dlls/ver.dll16) WINE_CONFIG_MAKEFILE(dlls/version) WINE_CONFIG_MAKEFILE(dlls/version/tests) WINE_CONFIG_MAKEFILE(dlls/vga) +WINE_CONFIG_MAKEFILE(dlls/vidreszr) WINE_CONFIG_MAKEFILE(dlls/virtdisk) WINE_CONFIG_MAKEFILE(dlls/virtdisk/tests) WINE_CONFIG_MAKEFILE(dlls/vmm.vxd) diff --git a/dlls/vidreszr/Makefile.in b/dlls/vidreszr/Makefile.in new file mode 100644 index 00000000000..2427d28ab08 --- /dev/null +++ b/dlls/vidreszr/Makefile.in @@ -0,0 +1,6 @@ +MODULE = vidreszr.dll +IMPORTS = combase mfplat msdmo mfuuid dmoguids strmiids wmcodecdspuuid uuid + +SOURCES = \ + vidreszr.c \ + vidreszr.idl diff --git a/dlls/vidreszr/vidreszr.c b/dlls/vidreszr/vidreszr.c new file mode 100644 index 00000000000..92e4d2c3771 --- /dev/null +++ b/dlls/vidreszr/vidreszr.c @@ -0,0 +1,181 @@ +/* + * 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 <stddef.h> +#include <stdarg.h> + +#define COBJMACROS +#include "windef.h" +#include "winbase.h" + +#include "d3d9.h" +#include "dmoreg.h" +#include "dshow.h" +#include "mfapi.h" +#include "rpcproxy.h" +#include "wmcodecdsp.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dmo); + +#include "initguid.h" + +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); + +/*********************************************************************** + * DllGetClassObject (msvproc.@) + */ +HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void **out) +{ + *out = NULL; + FIXME("Unknown clsid %s.\n", debugstr_guid(clsid)); + return CLASS_E_CLASSNOTAVAILABLE; +} + +/*********************************************************************** + * DllRegisterServer (colorcnv.@) + */ +HRESULT WINAPI DllRegisterServer(void) +{ + MFT_REGISTER_TYPE_INFO color_converter_mft_inputs[] = + { + {MFMediaType_Video, MFVideoFormat_YV12}, + {MFMediaType_Video, MFVideoFormat_YUY2}, + {MFMediaType_Video, MFVideoFormat_UYVY}, + {MFMediaType_Video, MFVideoFormat_AYUV}, + {MFMediaType_Video, MFVideoFormat_NV12}, + {MFMediaType_Video, DMOVideoFormat_RGB32}, + {MFMediaType_Video, DMOVideoFormat_RGB565}, + {MFMediaType_Video, MFVideoFormat_I420}, + {MFMediaType_Video, MFVideoFormat_IYUV}, + {MFMediaType_Video, MFVideoFormat_YVYU}, + {MFMediaType_Video, DMOVideoFormat_RGB24}, + {MFMediaType_Video, DMOVideoFormat_RGB555}, + {MFMediaType_Video, DMOVideoFormat_RGB8}, + {MFMediaType_Video, MEDIASUBTYPE_V216}, + {MFMediaType_Video, MEDIASUBTYPE_V410}, + {MFMediaType_Video, MFVideoFormat_NV11}, + {MFMediaType_Video, MFVideoFormat_Y41P}, + {MFMediaType_Video, MFVideoFormat_Y41T}, + {MFMediaType_Video, MFVideoFormat_Y42T}, + {MFMediaType_Video, MFVideoFormat_YVU9}, + }; + MFT_REGISTER_TYPE_INFO color_converter_mft_outputs[] = + { + {MFMediaType_Video, MFVideoFormat_YV12}, + {MFMediaType_Video, MFVideoFormat_YUY2}, + {MFMediaType_Video, MFVideoFormat_UYVY}, + {MFMediaType_Video, MFVideoFormat_AYUV}, + {MFMediaType_Video, MFVideoFormat_NV12}, + {MFMediaType_Video, DMOVideoFormat_RGB32}, + {MFMediaType_Video, DMOVideoFormat_RGB565}, + {MFMediaType_Video, MFVideoFormat_I420}, + {MFMediaType_Video, MFVideoFormat_IYUV}, + {MFMediaType_Video, MFVideoFormat_YVYU}, + {MFMediaType_Video, DMOVideoFormat_RGB24}, + {MFMediaType_Video, DMOVideoFormat_RGB555}, + {MFMediaType_Video, DMOVideoFormat_RGB8}, + {MFMediaType_Video, MEDIASUBTYPE_V216}, + {MFMediaType_Video, MEDIASUBTYPE_V410}, + {MFMediaType_Video, MFVideoFormat_NV11}, + }; + DMO_PARTIAL_MEDIATYPE color_converter_dmo_inputs[] = + { + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_YV12}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_YUY2}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_UYVY}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_AYUV}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_NV12}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB32}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB565}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_I420}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_IYUV}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_YVYU}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB24}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB555}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB8}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_V216}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_V410}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_NV11}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_Y41P}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_Y41T}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_Y42T}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_YVU9}, + }; + DMO_PARTIAL_MEDIATYPE color_converter_dmo_outputs[] = + { + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_YV12}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_YUY2}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_UYVY}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_AYUV}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_NV12}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB32}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB565}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_I420}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_IYUV}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_YVYU}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB24}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB555}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_RGB8}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_V216}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_V410}, + {.type = MEDIATYPE_Video, .subtype = MEDIASUBTYPE_NV11}, + }; + HRESULT hr; + + TRACE("\n"); + + if (FAILED(hr = __wine_register_resources())) + return hr; + if (FAILED(hr = MFTRegister(CLSID_CResizerDMO, MFT_CATEGORY_VIDEO_EFFECT, + (WCHAR *)L"Resizer MFT", MFT_ENUM_FLAG_SYNCMFT, + ARRAY_SIZE(color_converter_mft_inputs), color_converter_mft_inputs, + ARRAY_SIZE(color_converter_mft_outputs), color_converter_mft_outputs, NULL))) + return hr; + if (FAILED(hr = DMORegister(L"Resizer DMO", &CLSID_CResizerDMO, &DMOCATEGORY_VIDEO_EFFECT, 0, + ARRAY_SIZE(color_converter_dmo_inputs), color_converter_dmo_inputs, + ARRAY_SIZE(color_converter_dmo_outputs), color_converter_dmo_outputs))) + return hr; + + return S_OK; +} + +/*********************************************************************** + * DllUnregisterServer (colorcnv.@) + */ +HRESULT WINAPI DllUnregisterServer(void) +{ + HRESULT hr; + + TRACE("\n"); + + if (FAILED(hr = __wine_unregister_resources())) + return hr; + if (FAILED(hr = MFTUnregister(CLSID_CResizerDMO))) + return hr; + if (FAILED(hr = DMOUnregister(&CLSID_CResizerDMO, &DMOCATEGORY_VIDEO_EFFECT))) + return hr; + + return S_OK; +} diff --git a/dlls/vidreszr/vidreszr.idl b/dlls/vidreszr/vidreszr.idl new file mode 100644 index 00000000000..8838f188587 --- /dev/null +++ b/dlls/vidreszr/vidreszr.idl @@ -0,0 +1,25 @@ +/* + * 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 + +[ + threading(both), + uuid(1ea1ea14-48f4-4054-ad1a-e8aee10ac805) +] +coclass CResizerDMO {} diff --git a/dlls/vidreszr/vidreszr.spec b/dlls/vidreszr/vidreszr.spec new file mode 100644 index 00000000000..b16365d0c9f --- /dev/null +++ b/dlls/vidreszr/vidreszr.spec @@ -0,0 +1,4 @@ +@ stdcall -private DllCanUnloadNow() +@ stdcall -private DllGetClassObject(ptr ptr ptr) +@ stdcall -private DllRegisterServer() +@ stdcall -private DllUnregisterServer() diff --git a/loader/wine.inf.in b/loader/wine.inf.in index ca31af717cf..80a4a062351 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -702,6 +702,7 @@ HKLM,SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x86,"Version",2,"14.42.344 11,,qedit.dll,1 11,,resampledmo.dll,1 11,,urlmon.dll,1 +11,,vidreszr.dll,1 11,,windowscodecs.dll,1 11,,winegstreamer.dll,1 55,,wineps.drv,1 -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9565