winegstreamer: Implement IWMSyncReader::GetOutputFormatCount().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
b3655b5be5
commit
bc52edc19d
|
@ -155,6 +155,7 @@ void wm_reader_cleanup(struct wm_reader *reader);
|
|||
HRESULT wm_reader_close(struct wm_reader *reader);
|
||||
HRESULT wm_reader_get_output_format(struct wm_reader *reader, DWORD output,
|
||||
DWORD index, IWMOutputMediaProps **props);
|
||||
HRESULT wm_reader_get_output_format_count(struct wm_reader *reader, DWORD output, DWORD *count);
|
||||
HRESULT wm_reader_get_output_props(struct wm_reader *reader, DWORD output,
|
||||
IWMOutputMediaProps **props);
|
||||
void wm_reader_init(struct wm_reader *reader, const struct wm_reader_ops *ops);
|
||||
|
|
|
@ -1306,6 +1306,36 @@ static const enum wg_video_format video_formats[] =
|
|||
WG_VIDEO_FORMAT_RGB15,
|
||||
};
|
||||
|
||||
HRESULT wm_reader_get_output_format_count(struct wm_reader *reader, DWORD output, DWORD *count)
|
||||
{
|
||||
struct wm_stream *stream;
|
||||
struct wg_format format;
|
||||
|
||||
EnterCriticalSection(&reader->cs);
|
||||
|
||||
if (!(stream = get_stream_by_output_number(reader, output)))
|
||||
{
|
||||
LeaveCriticalSection(&reader->cs);
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
wg_parser_stream_get_preferred_format(stream->wg_stream, &format);
|
||||
switch (format.major_type)
|
||||
{
|
||||
case WG_MAJOR_TYPE_VIDEO:
|
||||
*count = ARRAY_SIZE(video_formats);
|
||||
break;
|
||||
|
||||
case WG_MAJOR_TYPE_AUDIO:
|
||||
case WG_MAJOR_TYPE_UNKNOWN:
|
||||
*count = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
LeaveCriticalSection(&reader->cs);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT wm_reader_get_output_format(struct wm_reader *reader, DWORD output,
|
||||
DWORD index, IWMOutputMediaProps **props)
|
||||
{
|
||||
|
|
|
@ -107,11 +107,13 @@ static HRESULT WINAPI WMSyncReader_GetOutputFormat(IWMSyncReader2 *iface,
|
|||
return wm_reader_get_output_format(&reader->reader, output, index, props);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI WMSyncReader_GetOutputFormatCount(IWMSyncReader2 *iface, DWORD output_num, DWORD *formats)
|
||||
static HRESULT WINAPI WMSyncReader_GetOutputFormatCount(IWMSyncReader2 *iface, DWORD output, DWORD *count)
|
||||
{
|
||||
struct sync_reader *This = impl_from_IWMSyncReader2(iface);
|
||||
FIXME("(%p)->(%u %p): stub!\n", This, output_num, formats);
|
||||
return E_NOTIMPL;
|
||||
struct sync_reader *reader = impl_from_IWMSyncReader2(iface);
|
||||
|
||||
TRACE("reader %p, output %u, count %p.\n", reader, output, count);
|
||||
|
||||
return wm_reader_get_output_format_count(&reader->reader, output, count);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI WMSyncReader_GetOutputNumberForStream(IWMSyncReader2 *iface,
|
||||
|
|
|
@ -747,8 +747,8 @@ static void test_sync_reader_types(void)
|
|||
|
||||
count = 0;
|
||||
hr = IWMSyncReader_GetOutputFormatCount(reader, output_number, &count);
|
||||
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
todo_wine ok(count > 0, "Got count %u.\n", count);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
ok(count > 0, "Got count %u.\n", count);
|
||||
|
||||
for (j = 0; j < count; ++j)
|
||||
{
|
||||
|
@ -824,7 +824,7 @@ static void test_sync_reader_types(void)
|
|||
}
|
||||
|
||||
hr = IWMSyncReader_GetOutputFormat(reader, output_number, count, &output_props);
|
||||
todo_wine ok(hr == NS_E_INVALID_OUTPUT_FORMAT, "Got hr %#x.\n", hr);
|
||||
ok(hr == NS_E_INVALID_OUTPUT_FORMAT, "Got hr %#x.\n", hr);
|
||||
|
||||
hr = IWMSyncReader_GetOutputProps(reader, output_number, &output_props);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
@ -846,7 +846,7 @@ static void test_sync_reader_types(void)
|
|||
|
||||
count = 0xdeadbeef;
|
||||
hr = IWMSyncReader_GetOutputFormatCount(reader, 2, &count);
|
||||
todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
|
||||
ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
|
||||
ok(count == 0xdeadbeef, "Got count %#x.\n", count);
|
||||
|
||||
output_props = (void *)0xdeadbeef;
|
||||
|
|
Loading…
Reference in New Issue