Commit 0dfeadd7 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

winegstreamer: Use IWMSyncReader2_GetOutputFormat in the async reader.

parent efb6aca8
......@@ -189,8 +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(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_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);
......
......@@ -536,7 +536,7 @@ static HRESULT WINAPI WMReader_GetOutputFormat(IWMReader *iface, DWORD output,
TRACE("reader %p, output %lu, index %lu, props %p.\n", reader, output, index, props);
return wm_reader_get_output_format(reader->wm_reader, output, index, props);
return IWMSyncReader2_GetOutputFormat(reader->reader, output, index, props);
}
static HRESULT WINAPI WMReader_Start(IWMReader *iface,
......
......@@ -1538,57 +1538,6 @@ HRESULT wm_reader_get_output_format_count(struct wm_reader *reader, DWORD output
return S_OK;
}
HRESULT wm_reader_get_output_format(struct wm_reader *reader, DWORD output,
DWORD index, IWMOutputMediaProps **props)
{
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:
if (index >= ARRAY_SIZE(video_formats))
{
LeaveCriticalSection(&reader->cs);
return NS_E_INVALID_OUTPUT_FORMAT;
}
format.u.video.format = video_formats[index];
break;
case WG_MAJOR_TYPE_AUDIO:
if (index)
{
LeaveCriticalSection(&reader->cs);
return NS_E_INVALID_OUTPUT_FORMAT;
}
format.u.audio.format = WG_AUDIO_FORMAT_S16LE;
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);
break;
case WG_MAJOR_TYPE_UNKNOWN:
break;
}
LeaveCriticalSection(&reader->cs);
*props = output_props_create(&format);
return *props ? S_OK : E_OUTOFMEMORY;
}
static const char *get_major_type_string(enum wg_major_type type)
{
switch (type)
......@@ -2086,10 +2035,54 @@ static HRESULT WINAPI reader_GetOutputFormat(IWMSyncReader2 *iface,
DWORD output, DWORD index, IWMOutputMediaProps **props)
{
struct wm_reader *reader = impl_from_IWMSyncReader2(iface);
struct wm_stream *stream;
struct wg_format format;
TRACE("reader %p, output %lu, index %lu, props %p.\n", reader, output, index, props);
return wm_reader_get_output_format(reader, output, index, props);
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:
if (index >= ARRAY_SIZE(video_formats))
{
LeaveCriticalSection(&reader->cs);
return NS_E_INVALID_OUTPUT_FORMAT;
}
format.u.video.format = video_formats[index];
break;
case WG_MAJOR_TYPE_AUDIO:
if (index)
{
LeaveCriticalSection(&reader->cs);
return NS_E_INVALID_OUTPUT_FORMAT;
}
format.u.audio.format = WG_AUDIO_FORMAT_S16LE;
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);
break;
case WG_MAJOR_TYPE_UNKNOWN:
break;
}
LeaveCriticalSection(&reader->cs);
*props = output_props_create(&format);
return *props ? S_OK : E_OUTOFMEMORY;
}
static HRESULT WINAPI reader_GetOutputFormatCount(IWMSyncReader2 *iface, DWORD output, DWORD *count)
......
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