[PATCH 3/7] mfreadwrite: Keep async callback reference for the reader.
Nikolay Sivov
nsivov at codeweavers.com
Wed Mar 20 00:35:39 CDT 2019
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
dlls/mfreadwrite/main.c | 7 +++++++
include/mfreadwrite.idl | 21 +++++++++++++++++++++
2 files changed, 28 insertions(+)
diff --git a/dlls/mfreadwrite/main.c b/dlls/mfreadwrite/main.c
index a6e0c10b5d..15c5dbf6c6 100644
--- a/dlls/mfreadwrite/main.c
+++ b/dlls/mfreadwrite/main.c
@@ -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:
diff --git a/include/mfreadwrite.idl b/include/mfreadwrite.idl
index 86e6eeaca5..0eea43b08b 100644
--- a/include/mfreadwrite.idl
+++ b/include/mfreadwrite.idl
@@ -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;
[
--
2.20.1
More information about the wine-devel
mailing list