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

winegstreamer: Implement GetOutputType for WMV decoder.

parent df26eae9
......@@ -1178,9 +1178,11 @@ static void check_video_info_header_(int line, VIDEOINFOHEADER *info, const VIDE
ok_(__FILE__, line)(info->bmiHeader.biYPelsPerMeter == expected->bmiHeader.biYPelsPerMeter,
"Got unexpected bmiHeader.xxxxxx %ld, expected %ld.\n",
info->bmiHeader.biYPelsPerMeter, expected->bmiHeader.biYPelsPerMeter);
todo_wine_if(expected->bmiHeader.biClrUsed != 0)
ok_(__FILE__, line)(info->bmiHeader.biClrUsed == expected->bmiHeader.biClrUsed,
"Got unexpected bmiHeader.biClrUsed %lu, expected %lu.\n",
info->bmiHeader.biClrUsed, expected->bmiHeader.biClrUsed);
todo_wine_if(expected->bmiHeader.biClrImportant != 0)
ok_(__FILE__, line)(info->bmiHeader.biClrImportant == expected->bmiHeader.biClrImportant,
"Got unexpected bmiHeader.biClrImportant %lu, expected %lu.\n",
info->bmiHeader.biClrImportant, expected->bmiHeader.biClrImportant);
......@@ -1208,6 +1210,7 @@ static void check_dmo_media_type_(int line, DMO_MEDIA_TYPE *media_type, const DM
"Got unexpected formattype %s.\n",
debugstr_guid(&media_type->formattype));
ok_(__FILE__, line)(media_type->pUnk == NULL, "Got unexpected pUnk %p.\n", media_type->pUnk);
todo_wine_if(expected->cbFormat && expected->cbFormat != sizeof(VIDEOINFOHEADER))
ok_(__FILE__, line)(media_type->cbFormat == expected->cbFormat,
"Got unexpected cbFormat %lu, expected %lu.\n",
media_type->cbFormat, expected->cbFormat);
......@@ -5062,14 +5065,12 @@ static void test_wmv_decoder_media_object(void)
hr = IMediaObject_SetInputType(media_object, 0, NULL, DMO_SET_TYPEF_CLEAR);
ok(hr == S_OK, "SetInputType returned %#lx.\n", hr);
hr = IMediaObject_GetOutputType(media_object, 0, 0, &media_type);
todo_wine
ok(hr == DMO_E_TYPE_NOT_SET, "GetOutputType returned %#lx.\n", hr);
/* Test GetOutputType after setting input type. */
init_dmo_media_type_video(input_type, &expected_input_types[0].subtype, 16, 16);
hr = IMediaObject_SetInputType(media_object, 0, input_type, 0);
ok(hr == S_OK, "SetInputType returned %#lx.\n", hr);
todo_wine
check_dmo_get_output_type(media_object, expected_output_types, ARRAY_SIZE(expected_output_types));
/* Test SetOutputType without setting input type. */
......
......@@ -29,21 +29,45 @@
WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
extern const GUID MFVideoFormat_VC1S;
extern const GUID MEDIASUBTYPE_VC1S;
DEFINE_GUID(MFVideoFormat_WMV_Unknown, 0x7ce12ca9,0xbfbf,0x43d9,0x9d,0x00,0x82,0xb8,0xed,0x54,0x31,0x6b);
DEFINE_GUID(MEDIASUBTYPE_WMV_Unknown, 0x7ce12ca9,0xbfbf,0x43d9,0x9d,0x00,0x82,0xb8,0xed,0x54,0x31,0x6b);
struct decoder_type
{
const GUID *subtype;
WORD bpp;
DWORD compression;
};
static const GUID *const wmv_decoder_input_types[] =
{
&MFVideoFormat_WMV1,
&MFVideoFormat_WMV2,
&MEDIASUBTYPE_WMV1,
&MEDIASUBTYPE_WMV2,
&MEDIASUBTYPE_WMVA,
&MEDIASUBTYPE_WMVP,
&MEDIASUBTYPE_WVP2,
&MFVideoFormat_WMV_Unknown,
&MFVideoFormat_WVC1,
&MFVideoFormat_WMV3,
&MFVideoFormat_VC1S,
&MEDIASUBTYPE_WMV_Unknown,
&MEDIASUBTYPE_WVC1,
&MEDIASUBTYPE_WMV3,
&MEDIASUBTYPE_VC1S,
};
static const struct decoder_type wmv_decoder_output_types[] =
{
{ &MEDIASUBTYPE_NV12, 12, MAKEFOURCC('N', 'V', '1', '2') },
{ &MEDIASUBTYPE_YV12, 12, MAKEFOURCC('Y', 'V', '1', '2') },
{ &MEDIASUBTYPE_IYUV, 12, MAKEFOURCC('I', 'Y', 'U', 'V') },
{ &MEDIASUBTYPE_I420, 12, MAKEFOURCC('I', '4', '2', '0') },
{ &MEDIASUBTYPE_YUY2, 16, MAKEFOURCC('Y', 'U', 'Y', '2') },
{ &MEDIASUBTYPE_UYVY, 16, MAKEFOURCC('U', 'Y', 'V', 'Y') },
{ &MEDIASUBTYPE_YVYU, 16, MAKEFOURCC('Y', 'V', 'Y', 'U') },
{ &MEDIASUBTYPE_NV11, 12, MAKEFOURCC('N', 'V', '1', '1') },
{ &MEDIASUBTYPE_RGB32, 32, BI_RGB },
{ &MEDIASUBTYPE_RGB24, 24, BI_RGB },
{ &MEDIASUBTYPE_RGB565, 16, BI_BITFIELDS },
{ &MEDIASUBTYPE_RGB555, 16, BI_RGB },
{ &MEDIASUBTYPE_RGB8, 8, BI_RGB },
};
struct wmv_decoder
......@@ -59,6 +83,11 @@ struct wmv_decoder
struct wg_format input_format;
};
static bool wg_format_is_set(struct wg_format *format)
{
return format->major_type != WG_MAJOR_TYPE_UNKNOWN;
}
static inline struct wmv_decoder *impl_from_IUnknown(IUnknown *iface)
{
return CONTAINING_RECORD(iface, struct wmv_decoder, IUnknown_inner);
......@@ -387,8 +416,58 @@ static HRESULT WINAPI media_object_GetInputType(IMediaObject *iface, DWORD index
static HRESULT WINAPI media_object_GetOutputType(IMediaObject *iface, DWORD index, DWORD type_index,
DMO_MEDIA_TYPE *type)
{
FIXME("iface %p, index %lu, type_index %lu, type %p stub!\n", iface, index, type_index, type);
return E_NOTIMPL;
struct wmv_decoder *decoder = impl_from_IMediaObject(iface);
VIDEOINFOHEADER *info;
const GUID *subtype;
LONG width, height;
UINT32 image_size;
HRESULT hr;
TRACE("iface %p, index %lu, type_index %lu, type %p.\n", iface, index, type_index, type);
if (index > 0)
return DMO_E_INVALIDSTREAMINDEX;
if (type_index >= ARRAY_SIZE(wmv_decoder_output_types))
return DMO_E_NO_MORE_ITEMS;
if (!type)
return S_OK;
if (!wg_format_is_set(&decoder->input_format))
return DMO_E_TYPE_NOT_SET;
width = decoder->input_format.u.video_wmv.width;
height = decoder->input_format.u.video_wmv.height;
subtype = wmv_decoder_output_types[type_index].subtype;
if (FAILED(hr = MFCalculateImageSize(subtype, width, height, &image_size)))
{
FIXME("Failed to get image size of subtype %s.\n", debugstr_guid(subtype));
return hr;
}
memset(type, 0, sizeof(*type));
type->majortype = MFMediaType_Video;
type->subtype = *subtype;
type->bFixedSizeSamples = TRUE;
type->bTemporalCompression = FALSE;
type->lSampleSize = image_size;
type->formattype = FORMAT_VideoInfo;
type->cbFormat = sizeof(VIDEOINFOHEADER);
type->pbFormat = CoTaskMemAlloc(type->cbFormat);
memset(type->pbFormat, 0, type->cbFormat);
info = (VIDEOINFOHEADER *)type->pbFormat;
info->rcSource.right = width;
info->rcSource.bottom = height;
info->rcTarget.right = width;
info->rcTarget.bottom = height;
info->bmiHeader.biSize = sizeof(info->bmiHeader);
info->bmiHeader.biWidth = width;
info->bmiHeader.biHeight = height;
info->bmiHeader.biPlanes = 1;
info->bmiHeader.biBitCount = wmv_decoder_output_types[type_index].bpp;
info->bmiHeader.biCompression = wmv_decoder_output_types[type_index].compression;
info->bmiHeader.biSizeImage = image_size;
return S_OK;
}
static HRESULT WINAPI media_object_SetInputType(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