ivtc: Use input framerate when possible
authorEdward Hervey <edward@collabora.com>
Tue, 20 Aug 2013 14:01:47 +0000 (16:01 +0200)
committerEdward Hervey <edward@collabora.com>
Tue, 20 Aug 2013 14:02:59 +0000 (16:02 +0200)
if input is 30000/1001 ... use 24000/1001 as the output fixated framerate

gst/ivtc/gstivtc.c

index 13f3c622f1e82e68da58072afc7cadbcf5e4c801..02f382bd56cc23886c5a3e2106f517d423885a96 100644 (file)
@@ -201,7 +201,20 @@ gst_ivtc_fixate_caps (GstBaseTransform * trans, GstPadDirection direction,
 
   result = gst_caps_make_writable (othercaps);
   if (direction == GST_PAD_SINK) {
-    gst_caps_set_simple (result, "framerate", GST_TYPE_FRACTION, 24, 1, NULL);
+    GstVideoInfo info;
+    if (gst_video_info_from_caps (&info, caps)) {
+      /* Smarter decision */
+      GST_DEBUG_OBJECT (trans, "Input framerate is %d/%d", info.fps_n,
+          info.fps_d);
+      if (info.fps_n == 30000 && info.fps_d == 1001)
+        gst_caps_set_simple (result, "framerate", GST_TYPE_FRACTION, 24000,
+            1001, NULL);
+      else
+        gst_caps_set_simple (result, "framerate", GST_TYPE_FRACTION, 24, 1,
+            NULL);
+    } else {
+      gst_caps_set_simple (result, "framerate", GST_TYPE_FRACTION, 24, 1, NULL);
+    }
   }
 
   result = gst_caps_fixate (result);