Commit 08effb90 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

winegstreamer: Use IWMSyncReader2_GetOutputFormatCount in the async reader.

parent 0dfeadd7
......@@ -189,7 +189,6 @@ struct wm_reader
HRESULT WINAPI winegstreamer_create_wm_sync_reader(IUnknown *outer, void **out);
struct wm_reader *wm_reader_from_sync_reader_inner(IUnknown *inner);
HRESULT wm_reader_get_output_format_count(struct wm_reader *reader, DWORD output, DWORD *count);
HRESULT wm_reader_get_stream_sample(struct wm_reader *reader, IWMReaderCallbackAdvanced *callback_advanced, WORD stream_number,
INSSBuffer **ret_sample, QWORD *pts, QWORD *duration, DWORD *flags, WORD *ret_stream_number);
HRESULT wm_reader_get_stream_selection(struct wm_reader *reader,
......
......@@ -526,7 +526,7 @@ static HRESULT WINAPI WMReader_GetOutputFormatCount(IWMReader *iface, DWORD outp
TRACE("reader %p, output %lu, count %p.\n", reader, output, count);
return wm_reader_get_output_format_count(reader->wm_reader, output, count);
return IWMSyncReader2_GetOutputFormatCount(reader->reader, output, count);
}
static HRESULT WINAPI WMReader_GetOutputFormat(IWMReader *iface, DWORD output,
......
......@@ -1503,41 +1503,6 @@ 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_MPEG1_AUDIO:
case WG_MAJOR_TYPE_WMA:
case WG_MAJOR_TYPE_H264:
FIXME("Format %u not implemented!\n", format.major_type);
/* fallthrough */
case WG_MAJOR_TYPE_AUDIO:
case WG_MAJOR_TYPE_UNKNOWN:
*count = 1;
break;
}
LeaveCriticalSection(&reader->cs);
return S_OK;
}
static const char *get_major_type_string(enum wg_major_type type)
{
switch (type)
......@@ -2088,10 +2053,39 @@ static HRESULT WINAPI reader_GetOutputFormat(IWMSyncReader2 *iface,
static HRESULT WINAPI reader_GetOutputFormatCount(IWMSyncReader2 *iface, DWORD output, DWORD *count)
{
struct wm_reader *reader = impl_from_IWMSyncReader2(iface);
struct wm_stream *stream;
struct wg_format format;
TRACE("reader %p, output %lu, count %p.\n", reader, output, count);
return wm_reader_get_output_format_count(reader, output, count);
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_MPEG1_AUDIO:
case WG_MAJOR_TYPE_WMA:
case WG_MAJOR_TYPE_H264:
FIXME("Format %u not implemented!\n", format.major_type);
/* fallthrough */
case WG_MAJOR_TYPE_AUDIO:
case WG_MAJOR_TYPE_UNKNOWN:
*count = 1;
break;
}
LeaveCriticalSection(&reader->cs);
return S_OK;
}
static HRESULT WINAPI reader_GetOutputNumberForStream(IWMSyncReader2 *iface,
......
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