winegstreamer: Better implement H264 MFT GetAttributes and GetOutputStreamAttributes.

This commit is contained in:
Rémi Bernon 2022-09-06 07:51:15 +02:00 committed by Alexandre Julliard
parent 5db7218620
commit 6178392862
2 changed files with 43 additions and 11 deletions

View file

@ -2326,7 +2326,6 @@ static void test_h264_decoder(void)
hr = IMFAttributes_SetUINT32(attributes, &MF_LOW_LATENCY, 1);
ok(hr == S_OK, "SetUINT32 returned %#lx\n", hr);
ret = IMFAttributes_Release(attributes);
todo_wine
ok(ret == 1, "Release returned %ld\n", ret);
/* no output type is available before an input type is set */

View file

@ -47,6 +47,9 @@ struct h264_decoder
{
IMFTransform IMFTransform_iface;
LONG refcount;
IMFAttributes *attributes;
IMFAttributes *output_attributes;
IMFMediaType *input_type;
IMFMediaType *output_type;
@ -238,6 +241,10 @@ static ULONG WINAPI transform_Release(IMFTransform *iface)
IMFMediaType_Release(decoder->input_type);
if (decoder->output_type)
IMFMediaType_Release(decoder->output_type);
if (decoder->output_attributes)
IMFAttributes_Release(decoder->output_attributes);
if (decoder->attributes)
IMFAttributes_Release(decoder->attributes);
wg_sample_queue_destroy(decoder->wg_sample_queue);
free(decoder);
@ -305,8 +312,15 @@ static HRESULT WINAPI transform_GetOutputStreamInfo(IMFTransform *iface, DWORD i
static HRESULT WINAPI transform_GetAttributes(IMFTransform *iface, IMFAttributes **attributes)
{
FIXME("iface %p, attributes %p stub!\n", iface, attributes);
return MFCreateAttributes(attributes, 0);
struct h264_decoder *decoder = impl_from_IMFTransform(iface);
FIXME("iface %p, attributes %p semi-stub!\n", iface, attributes);
if (!attributes)
return E_POINTER;
IMFAttributes_AddRef((*attributes = decoder->attributes));
return S_OK;
}
static HRESULT WINAPI transform_GetInputStreamAttributes(IMFTransform *iface, DWORD id, IMFAttributes **attributes)
@ -315,11 +329,19 @@ static HRESULT WINAPI transform_GetInputStreamAttributes(IMFTransform *iface, DW
return E_NOTIMPL;
}
static HRESULT WINAPI transform_GetOutputStreamAttributes(IMFTransform *iface, DWORD id,
IMFAttributes **attributes)
static HRESULT WINAPI transform_GetOutputStreamAttributes(IMFTransform *iface, DWORD id, IMFAttributes **attributes)
{
FIXME("iface %p, id %#lx, attributes %p stub!\n", iface, id, attributes);
return E_NOTIMPL;
struct h264_decoder *decoder = impl_from_IMFTransform(iface);
FIXME("iface %p, id %#lx, attributes %p semi-stub!\n", iface, id, attributes);
if (!attributes)
return E_POINTER;
if (id)
return MF_E_INVALIDSTREAMNUMBER;
IMFAttributes_AddRef((*attributes = decoder->output_attributes));
return S_OK;
}
static HRESULT WINAPI transform_DeleteInputStream(IMFTransform *iface, DWORD id)
@ -708,13 +730,24 @@ HRESULT h264_decoder_create(REFIID riid, void **ret)
decoder->wg_format.u.video.fps_n = 30000;
decoder->wg_format.u.video.fps_d = 1001;
if (FAILED(hr = MFCreateAttributes(&decoder->attributes, 16)))
goto failed;
if (FAILED(hr = IMFAttributes_SetUINT32(decoder->attributes, &MF_LOW_LATENCY, 0)))
goto failed;
if (FAILED(hr = MFCreateAttributes(&decoder->output_attributes, 0)))
goto failed;
if (FAILED(hr = wg_sample_queue_create(&decoder->wg_sample_queue)))
{
free(decoder);
return hr;
}
goto failed;
*ret = &decoder->IMFTransform_iface;
TRACE("Created decoder %p\n", *ret);
return S_OK;
failed:
if (decoder->output_attributes)
IMFAttributes_Release(decoder->output_attributes);
if (decoder->attributes)
IMFAttributes_Release(decoder->attributes);
free(decoder);
return hr;
}