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

winegstreamer: Use IWMSyncReader2_OpenStream in the async reader.

parent 1b527e8c
...@@ -199,7 +199,6 @@ HRESULT wm_reader_get_stream_sample(struct wm_reader *reader, IWMReaderCallbackA ...@@ -199,7 +199,6 @@ HRESULT wm_reader_get_stream_sample(struct wm_reader *reader, IWMReaderCallbackA
INSSBuffer **ret_sample, QWORD *pts, QWORD *duration, DWORD *flags, WORD *ret_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, HRESULT wm_reader_get_stream_selection(struct wm_reader *reader,
WORD stream_number, WMT_STREAM_SELECTION *selection); WORD stream_number, WMT_STREAM_SELECTION *selection);
HRESULT wm_reader_open_stream(struct wm_reader *reader, IStream *stream);
void wm_reader_seek(struct wm_reader *reader, QWORD start, LONGLONG duration); void wm_reader_seek(struct wm_reader *reader, QWORD start, LONGLONG duration);
HRESULT wm_reader_set_allocate_for_output(struct wm_reader *reader, DWORD output, BOOL allocate); HRESULT wm_reader_set_allocate_for_output(struct wm_reader *reader, DWORD output, BOOL allocate);
HRESULT wm_reader_set_allocate_for_stream(struct wm_reader *reader, WORD stream_number, BOOL allocate); HRESULT wm_reader_set_allocate_for_stream(struct wm_reader *reader, WORD stream_number, BOOL allocate);
......
...@@ -933,7 +933,7 @@ static HRESULT WINAPI WMReaderAdvanced2_OpenStream(IWMReaderAdvanced6 *iface, ...@@ -933,7 +933,7 @@ static HRESULT WINAPI WMReaderAdvanced2_OpenStream(IWMReaderAdvanced6 *iface,
EnterCriticalSection(&reader->cs); EnterCriticalSection(&reader->cs);
if (SUCCEEDED(hr = wm_reader_open_stream(reader->wm_reader, stream)) if (SUCCEEDED(hr = IWMSyncReader2_OpenStream(reader->reader, stream))
&& FAILED(hr = async_reader_open(reader, callback, context))) && FAILED(hr = async_reader_open(reader, callback, context)))
IWMSyncReader2_Close(reader->reader); IWMSyncReader2_Close(reader->reader);
......
...@@ -1479,37 +1479,6 @@ out_destroy_parser: ...@@ -1479,37 +1479,6 @@ out_destroy_parser:
return hr; return hr;
} }
HRESULT wm_reader_open_stream(struct wm_reader *reader, IStream *stream)
{
STATSTG stat;
HRESULT hr;
if (FAILED(hr = IStream_Stat(stream, &stat, STATFLAG_NONAME)))
{
ERR("Failed to stat stream, hr %#lx.\n", hr);
return hr;
}
EnterCriticalSection(&reader->cs);
if (reader->wg_parser)
{
LeaveCriticalSection(&reader->cs);
WARN("Stream is already open; returning E_UNEXPECTED.\n");
return E_UNEXPECTED;
}
IStream_AddRef(reader->source_stream = stream);
if (FAILED(hr = init_stream(reader, stat.cbSize.QuadPart)))
{
IStream_Release(stream);
reader->source_stream = NULL;
}
LeaveCriticalSection(&reader->cs);
return hr;
}
static struct wm_stream *wm_reader_get_stream_by_stream_number(struct wm_reader *reader, WORD stream_number) static struct wm_stream *wm_reader_get_stream_by_stream_number(struct wm_reader *reader, WORD stream_number)
{ {
if (stream_number && stream_number <= reader->stream_count) if (stream_number && stream_number <= reader->stream_count)
...@@ -2373,10 +2342,35 @@ static HRESULT WINAPI reader_Open(IWMSyncReader2 *iface, const WCHAR *filename) ...@@ -2373,10 +2342,35 @@ static HRESULT WINAPI reader_Open(IWMSyncReader2 *iface, const WCHAR *filename)
static HRESULT WINAPI reader_OpenStream(IWMSyncReader2 *iface, IStream *stream) static HRESULT WINAPI reader_OpenStream(IWMSyncReader2 *iface, IStream *stream)
{ {
struct wm_reader *reader = impl_from_IWMSyncReader2(iface); struct wm_reader *reader = impl_from_IWMSyncReader2(iface);
STATSTG stat;
HRESULT hr;
TRACE("reader %p, stream %p.\n", reader, stream); TRACE("reader %p, stream %p.\n", reader, stream);
return wm_reader_open_stream(reader, stream); if (FAILED(hr = IStream_Stat(stream, &stat, STATFLAG_NONAME)))
{
ERR("Failed to stat stream, hr %#lx.\n", hr);
return hr;
}
EnterCriticalSection(&reader->cs);
if (reader->wg_parser)
{
LeaveCriticalSection(&reader->cs);
WARN("Stream is already open; returning E_UNEXPECTED.\n");
return E_UNEXPECTED;
}
IStream_AddRef(reader->source_stream = stream);
if (FAILED(hr = init_stream(reader, stat.cbSize.QuadPart)))
{
IStream_Release(stream);
reader->source_stream = NULL;
}
LeaveCriticalSection(&reader->cs);
return hr;
} }
static HRESULT WINAPI reader_SetOutputProps(IWMSyncReader2 *iface, DWORD output, IWMOutputMediaProps *props) static HRESULT WINAPI reader_SetOutputProps(IWMSyncReader2 *iface, DWORD output, IWMOutputMediaProps *props)
......
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