videoflip: Also flip the pixel-aspect-ratio if width/height are exchanged
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Mon, 19 Apr 2010 12:37:54 +0000 (14:37 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Thu, 29 Apr 2010 17:28:21 +0000 (19:28 +0200)
gst/videofilter/gstvideoflip.c

index 015a29f..9b52a3b 100644 (file)
@@ -133,6 +133,7 @@ gst_video_flip_transform_caps (GstBaseTransform * trans,
 
   for (i = 0; i < gst_caps_get_size (ret); i++) {
     GstStructure *structure = gst_caps_get_structure (ret, i);
+    gint par_n, par_d;
 
     if (gst_structure_get_int (structure, "width", &width) &&
         gst_structure_get_int (structure, "height", &height)) {
@@ -144,6 +145,17 @@ gst_video_flip_transform_caps (GstBaseTransform * trans,
         case GST_VIDEO_FLIP_METHOD_OTHER:
           gst_structure_set (structure, "width", G_TYPE_INT, height,
               "height", G_TYPE_INT, width, NULL);
+          if (gst_structure_get_fraction (structure, "pixel-aspect-ratio",
+                  &par_n, &par_d)) {
+            if (par_n != 1 || par_d != 1) {
+              GValue val = { 0, };
+
+              g_value_init (&val, GST_TYPE_FRACTION);
+              gst_value_set_fraction (&val, par_d, par_n);
+              gst_structure_set_value (structure, "pixel-aspect-ratio", &val);
+              g_value_unset (&val);
+            }
+          }
           break;
         case GST_VIDEO_FLIP_METHOD_IDENTITY:
         case GST_VIDEO_FLIP_METHOD_180: