Nikolay Sivov : mfreadwrite: Keep async callback reference for the reader.

Alexandre Julliard julliard at winehq.org
Wed Mar 20 17:09:11 CDT 2019


Module: wine
Branch: master
Commit: 9e57659b7b9aa2f97c876eef435345725825b5d8
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=9e57659b7b9aa2f97c876eef435345725825b5d8

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Wed Mar 20 08:35:39 2019 +0300

mfreadwrite: Keep async callback reference for the reader.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 a6e0c10..15c5dbf 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 86e6eea..0eea43b 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;
 
 [




More information about the wine-cvs mailing list