winegstreamer: Implement H264 decoder SetInputType.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45988 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47084 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49715 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52183 Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2d7c37da49
commit
dfce20f343
|
@ -6737,7 +6737,6 @@ static void test_h264_decoder(void)
|
||||||
hr = MFCreateMediaType(&media_type);
|
hr = MFCreateMediaType(&media_type);
|
||||||
ok(hr == S_OK, "MFCreateMediaType returned %#lx\n", hr);
|
ok(hr == S_OK, "MFCreateMediaType returned %#lx\n", hr);
|
||||||
hr = IMFTransform_SetInputType(transform, 0, media_type, 0);
|
hr = IMFTransform_SetInputType(transform, 0, media_type, 0);
|
||||||
todo_wine
|
|
||||||
ok(hr == E_INVALIDARG, "SetInputType returned %#lx.\n", hr);
|
ok(hr == E_INVALIDARG, "SetInputType returned %#lx.\n", hr);
|
||||||
init_media_type(media_type, input_type_desc, 1);
|
init_media_type(media_type, input_type_desc, 1);
|
||||||
hr = IMFTransform_SetInputType(transform, 0, media_type, 0);
|
hr = IMFTransform_SetInputType(transform, 0, media_type, 0);
|
||||||
|
@ -6745,10 +6744,8 @@ static void test_h264_decoder(void)
|
||||||
ok(hr == MF_E_INVALIDMEDIATYPE, "SetInputType returned %#lx.\n", hr);
|
ok(hr == MF_E_INVALIDMEDIATYPE, "SetInputType returned %#lx.\n", hr);
|
||||||
init_media_type(media_type, input_type_desc, 2);
|
init_media_type(media_type, input_type_desc, 2);
|
||||||
hr = IMFTransform_SetInputType(transform, 0, media_type, 0);
|
hr = IMFTransform_SetInputType(transform, 0, media_type, 0);
|
||||||
todo_wine
|
|
||||||
ok(hr == S_OK, "SetInputType returned %#lx.\n", hr);
|
ok(hr == S_OK, "SetInputType returned %#lx.\n", hr);
|
||||||
ret = IMFMediaType_Release(media_type);
|
ret = IMFMediaType_Release(media_type);
|
||||||
todo_wine
|
|
||||||
ok(ret == 1, "Release returned %lu\n", ret);
|
ok(ret == 1, "Release returned %lu\n", ret);
|
||||||
|
|
||||||
flags = MFT_OUTPUT_STREAM_WHOLE_SAMPLES | MFT_OUTPUT_STREAM_SINGLE_SAMPLE_PER_BUFFER | MFT_OUTPUT_STREAM_FIXED_SAMPLE_SIZE;
|
flags = MFT_OUTPUT_STREAM_WHOLE_SAMPLES | MFT_OUTPUT_STREAM_SINGLE_SAMPLE_PER_BUFFER | MFT_OUTPUT_STREAM_FIXED_SAMPLE_SIZE;
|
||||||
|
|
|
@ -28,10 +28,17 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
|
WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
|
||||||
|
|
||||||
|
static const GUID *const h264_decoder_input_types[] =
|
||||||
|
{
|
||||||
|
&MFVideoFormat_H264,
|
||||||
|
&MFVideoFormat_H264_ES,
|
||||||
|
};
|
||||||
|
|
||||||
struct h264_decoder
|
struct h264_decoder
|
||||||
{
|
{
|
||||||
IMFTransform IMFTransform_iface;
|
IMFTransform IMFTransform_iface;
|
||||||
LONG refcount;
|
LONG refcount;
|
||||||
|
IMFMediaType *input_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct h264_decoder *impl_from_IMFTransform(IMFTransform *iface)
|
static struct h264_decoder *impl_from_IMFTransform(IMFTransform *iface)
|
||||||
|
@ -77,7 +84,11 @@ static ULONG WINAPI transform_Release(IMFTransform *iface)
|
||||||
TRACE("iface %p decreasing refcount to %lu.\n", decoder, refcount);
|
TRACE("iface %p decreasing refcount to %lu.\n", decoder, refcount);
|
||||||
|
|
||||||
if (!refcount)
|
if (!refcount)
|
||||||
|
{
|
||||||
|
if (decoder->input_type)
|
||||||
|
IMFMediaType_Release(decoder->input_type);
|
||||||
free(decoder);
|
free(decoder);
|
||||||
|
}
|
||||||
|
|
||||||
return refcount;
|
return refcount;
|
||||||
}
|
}
|
||||||
|
@ -163,8 +174,31 @@ static HRESULT WINAPI transform_GetOutputAvailableType(IMFTransform *iface, DWOR
|
||||||
|
|
||||||
static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFMediaType *type, DWORD flags)
|
static HRESULT WINAPI transform_SetInputType(IMFTransform *iface, DWORD id, IMFMediaType *type, DWORD flags)
|
||||||
{
|
{
|
||||||
FIXME("iface %p, id %#lx, type %p, flags %#lx stub!\n", iface, id, type, flags);
|
struct h264_decoder *decoder = impl_from_IMFTransform(iface);
|
||||||
return E_NOTIMPL;
|
GUID major, subtype;
|
||||||
|
HRESULT hr;
|
||||||
|
ULONG i;
|
||||||
|
|
||||||
|
TRACE("iface %p, id %#lx, type %p, flags %#lx.\n", iface, id, type, flags);
|
||||||
|
|
||||||
|
if (FAILED(hr = IMFMediaType_GetGUID(type, &MF_MT_MAJOR_TYPE, &major)) ||
|
||||||
|
FAILED(hr = IMFMediaType_GetGUID(type, &MF_MT_SUBTYPE, &subtype)))
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
|
if (!IsEqualGUID(&major, &MFMediaType_Video))
|
||||||
|
return MF_E_INVALIDMEDIATYPE;
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_SIZE(h264_decoder_input_types); ++i)
|
||||||
|
if (IsEqualGUID(&subtype, h264_decoder_input_types[i]))
|
||||||
|
break;
|
||||||
|
if (i == ARRAY_SIZE(h264_decoder_input_types))
|
||||||
|
return MF_E_INVALIDMEDIATYPE;
|
||||||
|
|
||||||
|
if (decoder->input_type)
|
||||||
|
IMFMediaType_Release(decoder->input_type);
|
||||||
|
IMFMediaType_AddRef((decoder->input_type = type));
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI transform_SetOutputType(IMFTransform *iface, DWORD id, IMFMediaType *type, DWORD flags)
|
static HRESULT WINAPI transform_SetOutputType(IMFTransform *iface, DWORD id, IMFMediaType *type, DWORD flags)
|
||||||
|
|
Loading…
Reference in New Issue