mfreadwrite: Query presentation descriptor on reader creation.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2019-03-18 13:01:01 +03:00 committed by Alexandre Julliard
parent 1fb58907c0
commit fcae0bc755
1 changed files with 8 additions and 0 deletions

View File

@ -76,6 +76,7 @@ typedef struct source_reader
IMFSourceReader IMFSourceReader_iface; IMFSourceReader IMFSourceReader_iface;
LONG refcount; LONG refcount;
IMFMediaSource *source; IMFMediaSource *source;
IMFPresentationDescriptor *descriptor;
} srcreader; } srcreader;
struct sink_writer struct sink_writer
@ -135,6 +136,8 @@ static ULONG WINAPI src_reader_Release(IMFSourceReader *iface)
if (!refcount) if (!refcount)
{ {
if (reader->descriptor)
IMFPresentationDescriptor_Release(reader->descriptor);
IMFMediaSource_Release(reader->source); IMFMediaSource_Release(reader->source);
heap_free(reader); heap_free(reader);
} }
@ -279,7 +282,12 @@ static HRESULT create_source_reader_from_source(IMFMediaSource *source, IMFAttri
object->source = source; object->source = source;
IMFMediaSource_AddRef(object->source); IMFMediaSource_AddRef(object->source);
if (FAILED(hr = IMFMediaSource_CreatePresentationDescriptor(object->source, &object->descriptor)))
goto failed;
hr = IMFSourceReader_QueryInterface(&object->IMFSourceReader_iface, riid, out); hr = IMFSourceReader_QueryInterface(&object->IMFSourceReader_iface, riid, out);
failed:
IMFSourceReader_Release(&object->IMFSourceReader_iface); IMFSourceReader_Release(&object->IMFSourceReader_iface);
return hr; return hr;
} }