mirror of
https://gitlab.winehq.org/wine/wine.git
synced 2025-08-28 18:23:54 +02:00
129 lines
3.9 KiB
C
129 lines
3.9 KiB
C
/*
|
|
* 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;
|
|
}
|