mirror of
https://gitlab.winehq.org/wine/wine.git
synced 2024-11-19 17:06:04 -07:00
mfh264enc: Register the H264 Encoder MFT class.
This commit is contained in:
parent
23d303e8ee
commit
0d75a1ba21
Notes:
Alexandre Julliard
2024-09-03 23:30:11 +02:00
Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/wine/merge_requests/6430
11 changed files with 173 additions and 62 deletions
2
configure
vendored
2
configure
vendored
|
@ -1229,6 +1229,7 @@ enable_mf
|
|||
enable_mf3216
|
||||
enable_mfasfsrcsnk
|
||||
enable_mferror
|
||||
enable_mfh264enc
|
||||
enable_mfmediaengine
|
||||
enable_mfmp4srcsnk
|
||||
enable_mfplat
|
||||
|
@ -22333,6 +22334,7 @@ wine_fn_config_makefile dlls/mf/tests enable_tests
|
|||
wine_fn_config_makefile dlls/mf3216 enable_mf3216
|
||||
wine_fn_config_makefile dlls/mfasfsrcsnk enable_mfasfsrcsnk
|
||||
wine_fn_config_makefile dlls/mferror enable_mferror
|
||||
wine_fn_config_makefile dlls/mfh264enc enable_mfh264enc
|
||||
wine_fn_config_makefile dlls/mfmediaengine enable_mfmediaengine
|
||||
wine_fn_config_makefile dlls/mfmediaengine/tests enable_tests
|
||||
wine_fn_config_makefile dlls/mfmp4srcsnk enable_mfmp4srcsnk
|
||||
|
|
|
@ -2808,6 +2808,7 @@ WINE_CONFIG_MAKEFILE(dlls/mf/tests)
|
|||
WINE_CONFIG_MAKEFILE(dlls/mf3216)
|
||||
WINE_CONFIG_MAKEFILE(dlls/mfasfsrcsnk)
|
||||
WINE_CONFIG_MAKEFILE(dlls/mferror)
|
||||
WINE_CONFIG_MAKEFILE(dlls/mfh264enc)
|
||||
WINE_CONFIG_MAKEFILE(dlls/mfmediaengine)
|
||||
WINE_CONFIG_MAKEFILE(dlls/mfmediaengine/tests)
|
||||
WINE_CONFIG_MAKEFILE(dlls/mfmp4srcsnk)
|
||||
|
|
6
dlls/mfh264enc/Makefile.in
Normal file
6
dlls/mfh264enc/Makefile.in
Normal file
|
@ -0,0 +1,6 @@
|
|||
MODULE = mfh264enc.dll
|
||||
IMPORTS = combase mfplat mfuuid dmoguids strmiids wmcodecdspuuid uuid
|
||||
|
||||
SOURCES = \
|
||||
mfh264enc.c \
|
||||
mfh264enc.idl
|
129
dlls/mfh264enc/mfh264enc.c
Normal file
129
dlls/mfh264enc/mfh264enc.c
Normal file
|
@ -0,0 +1,129 @@
|
|||
/*
|
||||
* 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 "mfapi.h"
|
||||
#include "mfidl.h"
|
||||
#include "rpcproxy.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(dmo);
|
||||
|
||||
static HRESULT WINAPI h264_encoder_factory_CreateInstance(IClassFactory *iface, IUnknown *outer,
|
||||
REFIID riid, void **out)
|
||||
{
|
||||
static const GUID CLSID_wg_h264_encoder = {0x6c34de69,0x4670,0x46cd,{0x8c,0xb4,0x1f,0x2f,0xa1,0xdf,0xfb,0x65}};
|
||||
return CoCreateInstance(&CLSID_wg_h264_encoder, 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 h264_encoder_factory_vtbl =
|
||||
{
|
||||
class_factory_QueryInterface,
|
||||
class_factory_AddRef,
|
||||
class_factory_Release,
|
||||
h264_encoder_factory_CreateInstance,
|
||||
class_factory_LockServer,
|
||||
};
|
||||
|
||||
static IClassFactory h264_encoder_factory = {&h264_encoder_factory_vtbl};
|
||||
|
||||
/***********************************************************************
|
||||
* DllGetClassObject (mfh264enc.@)
|
||||
*/
|
||||
HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void **out)
|
||||
{
|
||||
if (IsEqualGUID(clsid, &CLSID_MSH264EncoderMFT))
|
||||
return IClassFactory_QueryInterface(&h264_encoder_factory, riid, out);
|
||||
|
||||
*out = NULL;
|
||||
FIXME("Unknown clsid %s.\n", debugstr_guid(clsid));
|
||||
return CLASS_E_CLASSNOTAVAILABLE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* DllRegisterServer (mfh264enc.@)
|
||||
*/
|
||||
HRESULT WINAPI DllRegisterServer(void)
|
||||
{
|
||||
MFT_REGISTER_TYPE_INFO h264_encoder_mft_inputs[] =
|
||||
{
|
||||
{MFMediaType_Video, MFVideoFormat_IYUV},
|
||||
{MFMediaType_Video, MFVideoFormat_YV12},
|
||||
{MFMediaType_Video, MFVideoFormat_NV12},
|
||||
{MFMediaType_Video, MFVideoFormat_YUY2},
|
||||
};
|
||||
MFT_REGISTER_TYPE_INFO h264_encoder_mft_outputs[] =
|
||||
{
|
||||
{MFMediaType_Video, MFVideoFormat_H264},
|
||||
};
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if (FAILED(hr = __wine_register_resources()))
|
||||
return hr;
|
||||
if (FAILED(hr = MFTRegister(CLSID_MSH264EncoderMFT, MFT_CATEGORY_VIDEO_ENCODER,
|
||||
(WCHAR *)L"H264 Encoder MFT", MFT_ENUM_FLAG_SYNCMFT,
|
||||
ARRAY_SIZE(h264_encoder_mft_inputs), h264_encoder_mft_inputs,
|
||||
ARRAY_SIZE(h264_encoder_mft_outputs), h264_encoder_mft_outputs, NULL)))
|
||||
return hr;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* DllUnregisterServer (mfh264enc.@)
|
||||
*/
|
||||
HRESULT WINAPI DllUnregisterServer(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
if (FAILED(hr = __wine_unregister_resources()))
|
||||
return hr;
|
||||
if (FAILED(hr = MFTUnregister(CLSID_MSH264EncoderMFT)))
|
||||
return hr;
|
||||
|
||||
return S_OK;
|
||||
}
|
25
dlls/mfh264enc/mfh264enc.idl
Normal file
25
dlls/mfh264enc/mfh264enc.idl
Normal file
|
@ -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(6ca50344-051a-4ded-9779-a43305165e35)
|
||||
]
|
||||
coclass CMSH264EncoderMFT {}
|
4
dlls/mfh264enc/mfh264enc.spec
Normal file
4
dlls/mfh264enc/mfh264enc.spec
Normal file
|
@ -0,0 +1,4 @@
|
|||
@ stdcall -private DllCanUnloadNow()
|
||||
@ stdcall -private DllGetClassObject(ptr ptr ptr)
|
||||
@ stdcall -private DllRegisterServer()
|
||||
@ stdcall -private DllUnregisterServer()
|
|
@ -151,7 +151,6 @@ bool amt_to_wg_format(const AM_MEDIA_TYPE *mt, struct wg_format *format);
|
|||
BOOL init_gstreamer(void);
|
||||
|
||||
extern HRESULT mfplat_get_class_object(REFCLSID rclsid, REFIID riid, void **obj);
|
||||
extern HRESULT mfplat_DllRegisterServer(void);
|
||||
|
||||
IMFMediaType *mf_media_type_from_wg_format(const struct wg_format *format);
|
||||
void mf_media_type_to_wg_format(IMFMediaType *type, struct wg_format *format);
|
||||
|
|
|
@ -1327,7 +1327,7 @@ HRESULT WINAPI DllRegisterServer(void)
|
|||
|
||||
IFilterMapper2_Release(mapper);
|
||||
|
||||
return mfplat_DllRegisterServer();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI DllUnregisterServer(void)
|
||||
|
|
|
@ -124,6 +124,7 @@ static const GUID CLSID_GStreamerByteStreamHandler = {0x317df618, 0x5e5a, 0x468a
|
|||
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}};
|
||||
|
||||
static const struct class_object
|
||||
{
|
||||
|
@ -136,7 +137,7 @@ class_objects[] =
|
|||
{ &CLSID_GStreamerByteStreamHandler, &gstreamer_byte_stream_handler_create },
|
||||
{ &CLSID_wg_aac_decoder, &aac_decoder_create },
|
||||
{ &CLSID_wg_h264_decoder, &h264_decoder_create },
|
||||
{ &CLSID_MSH264EncoderMFT, &h264_encoder_create },
|
||||
{ &CLSID_wg_h264_encoder, &h264_encoder_create },
|
||||
};
|
||||
|
||||
HRESULT mfplat_get_class_object(REFCLSID rclsid, REFIID riid, void **obj)
|
||||
|
@ -165,63 +166,6 @@ HRESULT mfplat_get_class_object(REFCLSID rclsid, REFIID riid, void **obj)
|
|||
return CLASS_E_CLASSNOTAVAILABLE;
|
||||
}
|
||||
|
||||
HRESULT mfplat_DllRegisterServer(void)
|
||||
{
|
||||
MFT_REGISTER_TYPE_INFO h264_encoder_input_types[] =
|
||||
{
|
||||
{MFMediaType_Video, MFVideoFormat_IYUV},
|
||||
{MFMediaType_Video, MFVideoFormat_YV12},
|
||||
{MFMediaType_Video, MFVideoFormat_NV12},
|
||||
{MFMediaType_Video, MFVideoFormat_YUY2},
|
||||
};
|
||||
MFT_REGISTER_TYPE_INFO h264_encoder_output_types[] =
|
||||
{
|
||||
{MFMediaType_Video, MFVideoFormat_H264},
|
||||
};
|
||||
|
||||
struct mft
|
||||
{
|
||||
GUID clsid;
|
||||
GUID category;
|
||||
WCHAR name[MAX_PATH];
|
||||
UINT32 flags;
|
||||
UINT32 input_types_count;
|
||||
MFT_REGISTER_TYPE_INFO *input_types;
|
||||
UINT32 output_types_count;
|
||||
MFT_REGISTER_TYPE_INFO *output_types;
|
||||
}
|
||||
mfts[] =
|
||||
{
|
||||
{
|
||||
CLSID_MSH264EncoderMFT,
|
||||
MFT_CATEGORY_VIDEO_ENCODER,
|
||||
L"H264 Encoder MFT",
|
||||
MFT_ENUM_FLAG_SYNCMFT,
|
||||
ARRAY_SIZE(h264_encoder_input_types),
|
||||
h264_encoder_input_types,
|
||||
ARRAY_SIZE(h264_encoder_output_types),
|
||||
h264_encoder_output_types,
|
||||
},
|
||||
};
|
||||
|
||||
unsigned int i;
|
||||
HRESULT hr;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(mfts); i++)
|
||||
{
|
||||
hr = MFTRegister(mfts[i].clsid, mfts[i].category, mfts[i].name, mfts[i].flags, mfts[i].input_types_count,
|
||||
mfts[i].input_types, mfts[i].output_types_count, mfts[i].output_types, NULL);
|
||||
|
||||
if (FAILED(hr))
|
||||
{
|
||||
FIXME("Failed to register MFT, hr %#lx.\n", hr);
|
||||
return hr;
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const struct
|
||||
{
|
||||
const GUID *subtype;
|
||||
|
|
|
@ -109,9 +109,9 @@ coclass wg_h264_decoder {}
|
|||
|
||||
[
|
||||
threading(both),
|
||||
uuid(6ca50344-051a-4ded-9779-a43305165e35)
|
||||
uuid(6c34de69-4670-46cd-8cb4-1f2fa1dffb65)
|
||||
]
|
||||
coclass CMSH264EncoderMFT {}
|
||||
coclass wg_h264_encoder {}
|
||||
|
||||
[
|
||||
threading(both),
|
||||
|
|
|
@ -2108,6 +2108,7 @@ HKLM,%CurrentVersion%\Telephony\Country List\998,"SameAreaRule",,"G"
|
|||
11,,cryptnet.dll,1
|
||||
11,,devenum.dll,1
|
||||
11,,mfasfsrcsnk.dll,1
|
||||
11,,mfh264enc.dll,1
|
||||
11,,mfmp4srcsnk.dll,1
|
||||
11,,mp3dmod.dll,1
|
||||
11,,msauddecmft.dll,1
|
||||
|
|
Loading…
Reference in a new issue