[gst-cvs] gst-plugins-good: videoflip: Also flip the pixel-aspect-ratio if width/ height are exchanged

Sebastian Dröge slomo at kemper.freedesktop.org
Thu Apr 29 10:36:24 PDT 2010


Module: gst-plugins-good
Branch: master
Commit: 45571f4bd486c16d4933999b6578dffa6cb87157
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=45571f4bd486c16d4933999b6578dffa6cb87157

Author: Sebastian Dröge <sebastian.droege at collabora.co.uk>
Date:   Mon Apr 19 14:37:54 2010 +0200

videoflip: Also flip the pixel-aspect-ratio if width/height are exchanged

---

 gst/videofilter/gstvideoflip.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/gst/videofilter/gstvideoflip.c b/gst/videofilter/gstvideoflip.c
index 015a29f..9b52a3b 100644
--- a/gst/videofilter/gstvideoflip.c
+++ b/gst/videofilter/gstvideoflip.c
@@ -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:





More information about the Gstreamer-commits mailing list