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) ...@@ -4669,10 +4669,8 @@ static void test_wmv_decoder_media_object(void)
/* Test setting the type. */ /* Test setting the type. */
init_dmo_media_type_video(input_type, subtype, 96, 96); init_dmo_media_type_video(input_type, subtype, 96, 96);
hr = IMediaObject_SetInputType(media_object, 0, input_type, DMO_SET_TYPEF_TEST_ONLY); 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); ok(hr == S_OK, "SetInputType returned unexpected hr %#lx.\n", hr);
hr = IMediaObject_SetInputType(media_object, 0, input_type, 0); hr = IMediaObject_SetInputType(media_object, 0, input_type, 0);
todo_wine
ok(hr == S_OK, "SetInputType returned unexpected hr %#lx.\n", hr); ok(hr == S_OK, "SetInputType returned unexpected hr %#lx.\n", hr);
header->dwBitRate = 0xdeadbeef; header->dwBitRate = 0xdeadbeef;
header->dwBitErrorRate = 0xdeadbeef; header->dwBitErrorRate = 0xdeadbeef;
...@@ -4683,41 +4681,35 @@ static void test_wmv_decoder_media_object(void) ...@@ -4683,41 +4681,35 @@ static void test_wmv_decoder_media_object(void)
header->bmiHeader.biXPelsPerMeter = 0xdead; header->bmiHeader.biXPelsPerMeter = 0xdead;
header->bmiHeader.biYPelsPerMeter = 0xdead; header->bmiHeader.biYPelsPerMeter = 0xdead;
hr = IMediaObject_SetInputType(media_object, 0, input_type, 0); hr = IMediaObject_SetInputType(media_object, 0, input_type, 0);
todo_wine
ok(hr == S_OK, "SetInputType returned unexpected hr %#lx.\n", hr); ok(hr == S_OK, "SetInputType returned unexpected hr %#lx.\n", hr);
/* Test invalid major type. */ /* Test invalid major type. */
init_dmo_media_type_video(input_type, subtype, 96, 96); init_dmo_media_type_video(input_type, subtype, 96, 96);
input_type->majortype = MFMediaType_Default; input_type->majortype = MFMediaType_Default;
hr = IMediaObject_SetInputType(media_object, 0, input_type, DMO_SET_TYPEF_TEST_ONLY); 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); ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "SetInputType returned unexpected hr %#lx.\n", hr);
/* Test invalid subtype. */ /* Test invalid subtype. */
init_dmo_media_type_video(input_type, &MEDIASUBTYPE_None, 96, 96); init_dmo_media_type_video(input_type, &MEDIASUBTYPE_None, 96, 96);
hr = IMediaObject_SetInputType(media_object, 0, input_type, DMO_SET_TYPEF_TEST_ONLY); 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); ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "SetInputType returned unexpected hr %#lx.\n", hr);
/* Test invalid format type. */ /* Test invalid format type. */
init_dmo_media_type_video(input_type, subtype, 96, 96); init_dmo_media_type_video(input_type, subtype, 96, 96);
input_type->formattype = FORMAT_None; input_type->formattype = FORMAT_None;
hr = IMediaObject_SetInputType(media_object, 0, input_type, DMO_SET_TYPEF_TEST_ONLY); 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); ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "SetInputType returned unexpected hr %#lx.\n", hr);
/* Test invalid format size. */ /* Test invalid format size. */
init_dmo_media_type_video(input_type, subtype, 96, 96); init_dmo_media_type_video(input_type, subtype, 96, 96);
input_type->cbFormat = 1; input_type->cbFormat = 1;
hr = IMediaObject_SetInputType(media_object, 0, input_type, DMO_SET_TYPEF_TEST_ONLY); 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); ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "SetInputType returned unexpected hr %#lx.\n", hr);
/* Test NULL format pointer. */ /* Test NULL format pointer. */
init_dmo_media_type_video(input_type, subtype, 96, 96); init_dmo_media_type_video(input_type, subtype, 96, 96);
input_type->pbFormat = NULL; input_type->pbFormat = NULL;
hr = IMediaObject_SetInputType(media_object, 0, input_type, DMO_SET_TYPEF_TEST_ONLY); 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); ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "SetInputType returned unexpected hr %#lx.\n", hr);
/* Test video header struct size. */ /* Test video header struct size. */
...@@ -4751,7 +4743,6 @@ static void test_wmv_decoder_media_object(void) ...@@ -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); ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "SetInputType returned unexpected hr %#lx.\n", hr);
header->bmiHeader.biWidth = 4096; header->bmiHeader.biWidth = 4096;
hr = IMediaObject_SetInputType(media_object, 0, input_type, DMO_SET_TYPEF_TEST_ONLY); 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); ok(hr == S_OK, "SetInputType returned unexpected hr %#lx.\n", hr);
/* Test height. */ /* Test height. */
...@@ -4766,11 +4757,9 @@ static void test_wmv_decoder_media_object(void) ...@@ -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); ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "SetInputType returned unexpected hr %#lx.\n", hr);
header->bmiHeader.biHeight = 4096; header->bmiHeader.biHeight = 4096;
hr = IMediaObject_SetInputType(media_object, 0, input_type, DMO_SET_TYPEF_TEST_ONLY); 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); ok(hr == S_OK, "SetInputType returned unexpected hr %#lx.\n", hr);
header->bmiHeader.biHeight = -4096; header->bmiHeader.biHeight = -4096;
hr = IMediaObject_SetInputType(media_object, 0, input_type, DMO_SET_TYPEF_TEST_ONLY); 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); ok(hr == S_OK, "SetInputType returned unexpected hr %#lx.\n", hr);
/* Test compression. */ /* Test compression. */
...@@ -4781,15 +4770,12 @@ static void test_wmv_decoder_media_object(void) ...@@ -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); ok(hr == DMO_E_TYPE_NOT_ACCEPTED, "SetInputType returned unexpected hr %#lx.\n", hr);
header->bmiHeader.biCompression = 1; header->bmiHeader.biCompression = 1;
hr = IMediaObject_SetInputType(media_object, 0, input_type, DMO_SET_TYPEF_TEST_ONLY); 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); ok(hr == S_OK, "SetInputType returned unexpected hr %#lx.\n", hr);
header->bmiHeader.biCompression = 2; header->bmiHeader.biCompression = 2;
hr = IMediaObject_SetInputType(media_object, 0, input_type, DMO_SET_TYPEF_TEST_ONLY); 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); ok(hr == S_OK, "SetInputType returned unexpected hr %#lx.\n", hr);
header->bmiHeader.biCompression = 0xdeadbeef; header->bmiHeader.biCompression = 0xdeadbeef;
hr = IMediaObject_SetInputType(media_object, 0, input_type, DMO_SET_TYPEF_TEST_ONLY); 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); ok(hr == S_OK, "SetInputType returned unexpected hr %#lx.\n", hr);
winetest_pop_context(); winetest_pop_context();
...@@ -4813,7 +4799,6 @@ static void test_wmv_decoder_media_object(void) ...@@ -4813,7 +4799,6 @@ static void test_wmv_decoder_media_object(void)
type = NULL; type = NULL;
hr = IMediaObject_SetInputType(media_object, test->stream_index, type, test->flags); 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); ok(hr == test->hr, "SetInputType returned unexpected hr %#lx, expected %#lx.\n", hr, test->hr);
winetest_pop_context(); winetest_pop_context();
......
...@@ -55,6 +55,8 @@ struct wmv_decoder ...@@ -55,6 +55,8 @@ struct wmv_decoder
IPropertyStore IPropertyStore_iface; IPropertyStore IPropertyStore_iface;
IUnknown *outer; IUnknown *outer;
LONG refcount; LONG refcount;
struct wg_format input_format;
}; };
static inline struct wmv_decoder *impl_from_IUnknown(IUnknown *iface) static inline struct wmv_decoder *impl_from_IUnknown(IUnknown *iface)
...@@ -392,8 +394,41 @@ static HRESULT WINAPI media_object_GetOutputType(IMediaObject *iface, DWORD inde ...@@ -392,8 +394,41 @@ static HRESULT WINAPI media_object_GetOutputType(IMediaObject *iface, DWORD inde
static HRESULT WINAPI media_object_SetInputType(IMediaObject *iface, DWORD index, static HRESULT WINAPI media_object_SetInputType(IMediaObject *iface, DWORD index,
const DMO_MEDIA_TYPE *type, DWORD flags) const DMO_MEDIA_TYPE *type, DWORD flags)
{ {
FIXME("iface %p, index %lu, type %p, flags %#lx stub!\n", iface, index, type, flags); struct wmv_decoder *decoder = impl_from_IMediaObject(iface);
return E_NOTIMPL; 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, 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