Commit c5700a63 authored by Ziqing Hui's avatar Ziqing Hui Committed by Alexandre Julliard

winegstreamer: Implement media_object_SetInputType for WMV decoder.

parent 3e5d683c
......@@ -4669,10 +4669,8 @@ static void test_wmv_decoder_media_object(void)
/* Test setting the type. */
init_dmo_media_type_video(input_type, subtype, 96, 96);
hr = IMediaObject_SetInputType(media_object, 0, input_type, DMO_SET_TYPEF_TEST_ONLY);
todo_wine
ok(hr == S_OK, "SetInputType returned unexpected hr %#lx.\n", hr);
hr = IMediaObject_SetInputType(media_object, 0, input_type, 0);
todo_wine
ok(hr == S_OK, "SetInputType returned unexpected hr %#lx.\n", hr);
header->dwBitRate = 0xdeadbeef;
header->dwBitErrorRate = 0xdeadbeef;
......@@ -4683,41 +4681,35 @@ static void test_wmv_decoder_media_object(void)
header->bmiHeader.biXPelsPerMeter = 0xdead;
header->bmiHeader.biYPelsPerMeter = 0xdead;
hr = IMediaObject_SetInputType(media_object, 0, input_type, 0);
todo_wine
ok(hr == S_OK, "SetInputType returned unexpected hr %#lx.\n", hr);
/* Test invalid major type. */
init_dmo_media_type_video(input_type, subtype, 96, 96);
input_type->majortype = MFMediaType_Default;
hr = IMediaObject_SetInputType(media_object, 0, input_type, DMO_SET_TYPEF_TEST_ONLY);
todo_wine
ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "SetInputType returned unexpected hr %#lx.\n", hr);
/* Test invalid subtype. */
init_dmo_media_type_video(input_type, &MEDIASUBTYPE_None, 96, 96);
hr = IMediaObject_SetInputType(media_object, 0, input_type, DMO_SET_TYPEF_TEST_ONLY);
todo_wine
ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "SetInputType returned unexpected hr %#lx.\n", hr);
/* Test invalid format type. */
init_dmo_media_type_video(input_type, subtype, 96, 96);
input_type->formattype = FORMAT_None;
hr = IMediaObject_SetInputType(media_object, 0, input_type, DMO_SET_TYPEF_TEST_ONLY);
todo_wine
ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "SetInputType returned unexpected hr %#lx.\n", hr);
/* Test invalid format size. */
init_dmo_media_type_video(input_type, subtype, 96, 96);
input_type->cbFormat = 1;
hr = IMediaObject_SetInputType(media_object, 0, input_type, DMO_SET_TYPEF_TEST_ONLY);
todo_wine
ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "SetInputType returned unexpected hr %#lx.\n", hr);
/* Test NULL format pointer. */
init_dmo_media_type_video(input_type, subtype, 96, 96);
input_type->pbFormat = NULL;
hr = IMediaObject_SetInputType(media_object, 0, input_type, DMO_SET_TYPEF_TEST_ONLY);
todo_wine
ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "SetInputType returned unexpected hr %#lx.\n", hr);
/* Test video header struct size. */
......@@ -4751,7 +4743,6 @@ static void test_wmv_decoder_media_object(void)
ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "SetInputType returned unexpected hr %#lx.\n", hr);
header->bmiHeader.biWidth = 4096;
hr = IMediaObject_SetInputType(media_object, 0, input_type, DMO_SET_TYPEF_TEST_ONLY);
todo_wine
ok(hr == S_OK, "SetInputType returned unexpected hr %#lx.\n", hr);
/* Test height. */
......@@ -4766,11 +4757,9 @@ static void test_wmv_decoder_media_object(void)
ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "SetInputType returned unexpected hr %#lx.\n", hr);
header->bmiHeader.biHeight = 4096;
hr = IMediaObject_SetInputType(media_object, 0, input_type, DMO_SET_TYPEF_TEST_ONLY);
todo_wine
ok(hr == S_OK, "SetInputType returned unexpected hr %#lx.\n", hr);
header->bmiHeader.biHeight = -4096;
hr = IMediaObject_SetInputType(media_object, 0, input_type, DMO_SET_TYPEF_TEST_ONLY);
todo_wine
ok(hr == S_OK, "SetInputType returned unexpected hr %#lx.\n", hr);
/* Test compression. */
......@@ -4781,15 +4770,12 @@ static void test_wmv_decoder_media_object(void)
ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "SetInputType returned unexpected hr %#lx.\n", hr);
header->bmiHeader.biCompression = 1;
hr = IMediaObject_SetInputType(media_object, 0, input_type, DMO_SET_TYPEF_TEST_ONLY);
todo_wine
ok(hr == S_OK, "SetInputType returned unexpected hr %#lx.\n", hr);
header->bmiHeader.biCompression = 2;
hr = IMediaObject_SetInputType(media_object, 0, input_type, DMO_SET_TYPEF_TEST_ONLY);
todo_wine
ok(hr == S_OK, "SetInputType returned unexpected hr %#lx.\n", hr);
header->bmiHeader.biCompression = 0xdeadbeef;
hr = IMediaObject_SetInputType(media_object, 0, input_type, DMO_SET_TYPEF_TEST_ONLY);
todo_wine
ok(hr == S_OK, "SetInputType returned unexpected hr %#lx.\n", hr);
winetest_pop_context();
......@@ -4813,7 +4799,6 @@ static void test_wmv_decoder_media_object(void)
type = NULL;
hr = IMediaObject_SetInputType(media_object, test->stream_index, type, test->flags);
todo_wine
ok(hr == test->hr, "SetInputType returned unexpected hr %#lx, expected %#lx.\n", hr, test->hr);
winetest_pop_context();
......
......@@ -55,6 +55,8 @@ struct wmv_decoder
IPropertyStore IPropertyStore_iface;
IUnknown *outer;
LONG refcount;
struct wg_format input_format;
};
static inline struct wmv_decoder *impl_from_IUnknown(IUnknown *iface)
......@@ -392,8 +394,41 @@ static HRESULT WINAPI media_object_GetOutputType(IMediaObject *iface, DWORD inde
static HRESULT WINAPI media_object_SetInputType(IMediaObject *iface, DWORD index,
const DMO_MEDIA_TYPE *type, DWORD flags)
{
FIXME("iface %p, index %lu, type %p, flags %#lx stub!\n", iface, index, type, flags);
return E_NOTIMPL;
struct wmv_decoder *decoder = impl_from_IMediaObject(iface);
struct wg_format wg_format;
unsigned int i;
TRACE("iface %p, index %lu, type %p, flags %#lx.\n", iface, index, type, flags);
if (index > 0)
return DMO_E_INVALIDSTREAMINDEX;
if (!type)
{
if (flags & DMO_SET_TYPEF_CLEAR)
{
memset(&decoder->input_format, 0, sizeof(decoder->input_format));
return S_OK;
}
return DMO_E_TYPE_NOT_ACCEPTED;
}
if (!IsEqualGUID(&type->majortype, &MEDIATYPE_Video))
return DMO_E_TYPE_NOT_ACCEPTED;
for (i = 0; i < ARRAY_SIZE(wmv_decoder_input_types); ++i)
if (IsEqualGUID(&type->subtype, wmv_decoder_input_types[i]))
break;
if (i == ARRAY_SIZE(wmv_decoder_input_types))
return DMO_E_TYPE_NOT_ACCEPTED;
if (!amt_to_wg_format((const AM_MEDIA_TYPE *)type, &wg_format))
return DMO_E_TYPE_NOT_ACCEPTED;
if (!(flags & DMO_SET_TYPEF_TEST_ONLY))
decoder->input_format = wg_format;
return S_OK;
}
static HRESULT WINAPI media_object_SetOutputType(IMediaObject *iface, DWORD index,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment