Commit 9e57659b authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mfreadwrite: Keep async callback reference for the reader.

parent a35ddb13
......@@ -81,6 +81,7 @@ typedef struct source_reader
IMFPresentationDescriptor *descriptor;
DWORD first_audio_stream_index;
DWORD first_video_stream_index;
IMFSourceReaderCallback *async_callback;
} srcreader;
struct sink_writer
......@@ -217,6 +218,8 @@ static ULONG WINAPI src_reader_Release(IMFSourceReader *iface)
if (!refcount)
{
if (reader->async_callback)
IMFSourceReaderCallback_Release(reader->async_callback);
IMFMediaSource_Shutdown(reader->source);
if (reader->descriptor)
IMFPresentationDescriptor_Release(reader->descriptor);
......@@ -535,6 +538,10 @@ static HRESULT create_source_reader_from_source(IMFMediaSource *source, IMFAttri
goto failed;
}
if (attributes)
IMFAttributes_GetUnknown(attributes, &MF_SOURCE_READER_ASYNC_CALLBACK, &IID_IMFSourceReaderCallback,
(void **)&object->async_callback);
hr = IMFSourceReader_QueryInterface(&object->IMFSourceReader_iface, riid, out);
failed:
......
......@@ -90,6 +90,27 @@ cpp_quote("EXTERN_GUID(MF_SOURCE_READER_ENABLE_VIDEO_PROCESSING, 0xfb
cpp_quote("EXTERN_GUID(MF_SOURCE_READER_MEDIASOURCE_CHARACTERISTICS, 0x6d23f5c8, 0xc5d7, 0x4a9b, 0x99, 0x71, 0x5d, 0x11, 0xf8, 0xbc, 0xa8, 0x80);")
cpp_quote("EXTERN_GUID(MF_SOURCE_READER_MEDIASOURCE_CONFIG, 0x9085abeb, 0x0354, 0x48f9, 0xab, 0xb5, 0x20, 0x0d, 0xf8, 0x38, 0xc6, 0x8e);")
[
object,
uuid(deec8d99-fa1d-4d82-84c2-2c8969944867),
local
]
interface IMFSourceReaderCallback : IUnknown
{
HRESULT OnReadSample(
[in] HRESULT hr,
[in] DWORD stream_index,
[in] DWORD stream_flags,
[in] LONGLONG timestamp,
[in] IMFSample *sample);
HRESULT OnFlush([in] DWORD stream_index);
HRESULT OnEvent(
[in] DWORD stream_index,
[in] IMFMediaEvent *event);
}
interface IMFMediaSource;
[
......
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