Package:   gstreamer1.0-plugins-good

Version:     1.22.0-5+deb12u1


A regression inadvertently introduced in GStreamer-1.22.0 breaks user setting of  the "videoflip" feature.

It was initially fixed in 1.22.3, with three more fix attempts until the fix stabilized in 1.22.6.

I have prepared a patch to backport the fix to Debian Bookworm, the patch and more details are

available at https://github.com/FDH2/UxPlay/wiki/patch-for-broken--videoflip-method-in-GStreamer-1.22.0


Since Bookworm will last a long time, it would be good to include this backport of the fix in some future updates.

The patch (also attached) includes GStreamer commits

b17fbb23

2dc0e1ac

4c77bc21

bbca6cc8

diff -uNr a/docs/gst_plugins_cache.json b/docs/gst_plugins_cache.json
--- a/docs/gst_plugins_cache.json       2024-03-10 12:28:07.349086078 -0400
+++ b/docs/gst_plugins_cache.json       2024-03-10 12:40:14.858128390 -0400
@@ -26293,7 +26293,7 @@
                     "method": {
                         "blurb": "method (deprecated, use video-direction 
instead)",
                         "conditionally-available": false,
-                        "construct": true,
+                        "construct": false,
                         "construct-only": false,
                         "controllable": true,
                         "default": "none (0)",
diff -uNr a/gst/videofilter/gstvideoflip.c b/gst/videofilter/gstvideoflip.c
--- a/gst/videofilter/gstvideoflip.c    2024-03-10 12:28:07.397087203 -0400
+++ b/gst/videofilter/gstvideoflip.c    2024-03-10 14:12:15.331126852 -0400
@@ -1788,6 +1788,18 @@
 
       if (gst_video_orientation_from_tag (taglist, &method)) {
         gst_video_flip_set_method (vf, method, TRUE);
+
+        if (vf->method == GST_VIDEO_ORIENTATION_AUTO) {
+          /* Update the orientation tag as we rotate the video accordingly.
+           * The event (and so the tag list) can be shared so always copy 
both. */
+          taglist = gst_tag_list_copy (taglist);
+
+          gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE,
+              "image-orientation", "rotate-0", NULL);
+
+          gst_event_unref (event);
+          event = gst_event_new_tag (taglist);
+        }
       }
       break;
     default:
@@ -1834,6 +1846,17 @@
 }
 
 static void
+gst_video_flip_constructed (GObject * object)
+{
+  GstVideoFlip *self = GST_VIDEO_FLIP (object);
+
+  if (self->method == (GstVideoOrientationMethod) PROP_METHOD_DEFAULT) {
+    gst_video_flip_set_method (self,
+        (GstVideoOrientationMethod) PROP_METHOD_DEFAULT, FALSE);
+  }
+}
+
+static void
 gst_video_flip_class_init (GstVideoFlipClass * klass)
 {
   GObjectClass *gobject_class = (GObjectClass *) klass;
@@ -1846,13 +1869,14 @@
 
   gobject_class->set_property = gst_video_flip_set_property;
   gobject_class->get_property = gst_video_flip_get_property;
+  gobject_class->constructed = gst_video_flip_constructed;
 
   g_object_class_install_property (gobject_class, PROP_METHOD,
       g_param_spec_enum ("method", "method",
           "method (deprecated, use video-direction instead)",
           GST_TYPE_VIDEO_FLIP_METHOD, PROP_METHOD_DEFAULT,
           GST_PARAM_CONTROLLABLE | GST_PARAM_MUTABLE_PLAYING |
-          G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS));
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   g_object_class_override_property (gobject_class, PROP_VIDEO_DIRECTION,
       "video-direction");
   /* override the overriden property's flags to include the mutable in playing
@@ -1886,6 +1910,12 @@
 static void
 gst_video_flip_init (GstVideoFlip * videoflip)
 {
+  /* We initialize to the default and call set_method() from constructed
+   * if the value hasn't changed, this ensures set_method() does get called
+   * even if the non-construct method / direction properties aren't set
+   */
+  videoflip->method = (GstVideoOrientationMethod) PROP_METHOD_DEFAULT;
+
   /* AUTO is not valid for active method, this is just to ensure we setup the
    * method in gst_video_flip_set_method() */
   videoflip->active_method = GST_VIDEO_ORIENTATION_AUTO;

Reply via email to