[PATCH v3 1/5] winegstreamer: Use a custom flag instead of sample info for caps change.

Rémi Bernon wine at gitlab.winehq.org
Thu Jun 2 01:31:31 CDT 2022


From: Rémi Bernon <rbernon at codeweavers.com>

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45988
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47084
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49715
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52183
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/winegstreamer/wg_transform.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/dlls/winegstreamer/wg_transform.c b/dlls/winegstreamer/wg_transform.c
index 946268ee353..93fe0039a63 100644
--- a/dlls/winegstreamer/wg_transform.c
+++ b/dlls/winegstreamer/wg_transform.c
@@ -42,6 +42,8 @@
 GST_DEBUG_CATEGORY_EXTERN(wine);
 #define GST_CAT_DEFAULT wine
 
+#define GST_SAMPLE_FLAG_WG_CAPS_CHANGED (GST_MINI_OBJECT_FLAG_LAST << 0)
+
 struct wg_transform
 {
     GstElement *container;
@@ -59,26 +61,21 @@ struct wg_transform
 static GstFlowReturn transform_sink_chain_cb(GstPad *pad, GstObject *parent, GstBuffer *buffer)
 {
     struct wg_transform *transform = gst_pad_get_element_private(pad);
-    GstStructure *info = NULL;
     GstSample *sample;
 
     GST_LOG("transform %p, buffer %p.", transform, buffer);
 
-    if (transform->output_caps_changed && !(info = gst_structure_new_empty("format-changed")))
-    {
-        GST_ERROR("Failed to allocate transform %p output sample info.", transform);
-        gst_buffer_unref(buffer);
-        return GST_FLOW_ERROR;
-    }
-    transform->output_caps_changed = false;
-
-    if (!(sample = gst_sample_new(buffer, transform->output_caps, NULL, info)))
+    if (!(sample = gst_sample_new(buffer, transform->output_caps, NULL, NULL)))
     {
         GST_ERROR("Failed to allocate transform %p output sample.", transform);
         gst_buffer_unref(buffer);
         return GST_FLOW_ERROR;
     }
 
+    if (transform->output_caps_changed)
+        GST_MINI_OBJECT_FLAG_SET(sample, GST_SAMPLE_FLAG_WG_CAPS_CHANGED);
+    transform->output_caps_changed = false;
+
     gst_atomic_queue_push(transform->output_queue, sample);
     gst_buffer_unref(buffer);
     return GST_FLOW_OK;
@@ -521,9 +518,9 @@ NTSTATUS wg_transform_read_data(void *args)
     output_buffer = gst_sample_get_buffer(transform->output_sample);
     output_caps = gst_sample_get_caps(transform->output_sample);
 
-    if (gst_sample_get_info(transform->output_sample))
+    if (GST_MINI_OBJECT_FLAG_IS_SET(transform->output_sample, GST_SAMPLE_FLAG_WG_CAPS_CHANGED))
     {
-        gst_sample_set_info(transform->output_sample, NULL);
+        GST_MINI_OBJECT_FLAG_UNSET(transform->output_sample, GST_SAMPLE_FLAG_WG_CAPS_CHANGED);
 
         if (format)
             wg_format_from_caps(format, output_caps);
-- 
GitLab


https://gitlab.winehq.org/wine/wine/-/merge_requests/139



More information about the wine-devel mailing list