Rémi Bernon : winegstreamer: Send stream-start, caps, and segment events on creation.

Alexandre Julliard julliard at winehq.org
Fri Feb 25 14:17:23 CST 2022


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

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Fri Feb 25 11:43:01 2022 -0600

winegstreamer: Send stream-start, caps, and segment events on creation.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51931
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52391
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winegstreamer/wg_transform.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/dlls/winegstreamer/wg_transform.c b/dlls/winegstreamer/wg_transform.c
index c5aa4acb2cc..45f8588b9f1 100644
--- a/dlls/winegstreamer/wg_transform.c
+++ b/dlls/winegstreamer/wg_transform.c
@@ -47,6 +47,7 @@ struct wg_transform
     GstElement *container;
     GstPad *my_src, *my_sink;
     GstPad *their_sink, *their_src;
+    GstSegment segment;
 };
 
 static GstFlowReturn transform_sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *buffer)
@@ -154,6 +155,7 @@ NTSTATUS wg_transform_create(void *args)
     GstPadTemplate *template = NULL;
     struct wg_transform *transform;
     const gchar *media_type;
+    GstEvent *event;
 
     if (!init_gstreamer())
         return STATUS_UNSUCCESSFUL;
@@ -257,6 +259,22 @@ NTSTATUS wg_transform_create(void *args)
     if (!gst_element_get_state(transform->container, NULL, NULL, -1))
         goto out;
 
+    if (!(event = gst_event_new_stream_start("stream"))
+            || !gst_pad_push_event(transform->my_src, event))
+        goto out;
+    if (!(event = gst_event_new_caps(src_caps))
+            || !gst_pad_push_event(transform->my_src, event))
+        goto out;
+
+    /* We need to use GST_FORMAT_TIME here because it's the only format
+     * some elements such avdec_wmav2 correctly support. */
+    gst_segment_init(&transform->segment, GST_FORMAT_TIME);
+    transform->segment.start = 0;
+    transform->segment.stop = -1;
+    if (!(event = gst_event_new_segment(&transform->segment))
+            || !gst_pad_push_event(transform->my_src, event))
+        goto out;
+
     gst_caps_unref(sink_caps);
     gst_caps_unref(src_caps);
 
@@ -278,7 +296,10 @@ out:
     if (src_caps)
         gst_caps_unref(src_caps);
     if (transform->container)
+    {
+        gst_element_set_state(transform->container, GST_STATE_NULL);
         gst_object_unref(transform->container);
+    }
     free(transform);
     GST_ERROR("Failed to create winegstreamer transform.");
     return status;




More information about the wine-cvs mailing list