Zebediah Figura : winegstreamer: Use request_buffer_src() in push_data().

Alexandre Julliard julliard at winehq.org
Thu Jan 28 15:41:40 CST 2021


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

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Wed Jan 27 16:18:45 2021 -0600

winegstreamer: Use request_buffer_src() in push_data().

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winegstreamer/gstdemux.c | 35 +++++++++--------------------------
 1 file changed, 9 insertions(+), 26 deletions(-)

diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c
index 9b47bf4f88c..1701bf58194 100644
--- a/dlls/winegstreamer/gstdemux.c
+++ b/dlls/winegstreamer/gstdemux.c
@@ -821,13 +821,13 @@ static gboolean event_sink(GstPad *pad, GstObject *parent, GstEvent *event)
     return TRUE;
 }
 
+static GstFlowReturn request_buffer_src(GstPad *pad, GstObject *parent, guint64 offset, guint size, GstBuffer **buffer);
+
 static DWORD CALLBACK push_data(LPVOID iface)
 {
     struct parser *This = iface;
-    GstMapInfo mapping;
     GstBuffer *buffer;
     LONGLONG maxlen;
-    HRESULT hr;
 
     if (!(buffer = gst_buffer_new_allocate(NULL, 16384, NULL)))
     {
@@ -835,8 +835,6 @@ static DWORD CALLBACK push_data(LPVOID iface)
         return 0;
     }
 
-    IBaseFilter_AddRef(&This->filter.IBaseFilter_iface);
-
     maxlen = This->stop ? This->stop : This->filesize;
 
     TRACE("Starting..\n");
@@ -848,42 +846,27 @@ static DWORD CALLBACK push_data(LPVOID iface)
             break;
         len = min(16384, maxlen - This->nextofs);
 
-        if (!gst_buffer_map_range(buffer, -1, len, &mapping, GST_MAP_WRITE))
-        {
-            ERR("Failed to map buffer.\n");
-            break;
-        }
-        hr = IAsyncReader_SyncRead(This->reader, This->nextofs, len, mapping.data);
-        gst_buffer_unmap(buffer, &mapping);
-        if (hr != S_OK)
+        if ((ret = request_buffer_src(This->my_src, NULL, This->nextofs, len, &buffer)) < 0)
         {
-            ERR("Failed to read data, hr %#x.\n", hr);
+            ERR("Failed to read data, ret %s.\n", gst_flow_get_name(ret));
             break;
         }
 
         This->nextofs += len;
 
         buffer->duration = buffer->pts = -1;
-        ret = gst_pad_push(This->my_src, buffer);
-        if (ret >= 0)
-            hr = S_OK;
-        else
-            ERR("Sending returned: %i\n", ret);
-        if (ret == GST_FLOW_ERROR)
-            hr = E_FAIL;
-        else if (ret == GST_FLOW_FLUSHING)
-            hr = VFW_E_WRONG_STATE;
-        if (hr != S_OK)
+        if ((ret = gst_pad_push(This->my_src, buffer)) < 0)
+        {
+            ERR("Failed to push data, ret %s.\n", gst_flow_get_name(ret));
             break;
+        }
     }
 
     gst_buffer_unref(buffer);
 
     gst_pad_push_event(This->my_src, gst_event_new_eos());
 
-    TRACE("Stopping.. %08x\n", hr);
-
-    IBaseFilter_Release(&This->filter.IBaseFilter_iface);
+    TRACE("Stopping.\n");
 
     return 0;
 }




More information about the wine-cvs mailing list