x264enc: Correctly pass interlacing/TFF information
authorVivia Nikolaidou <vivia@ahiru.eu>
Wed, 30 Nov 2016 15:30:33 +0000 (17:30 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Wed, 30 Nov 2016 16:54:20 +0000 (18:54 +0200)
Give the interlacing information correctly to the encoder. Also parse
TFF/BFF information from the caps and pass it too.

https://bugzilla.gnome.org/show_bug.cgi?id=775411

ext/x264/gstx264enc.c

index 5f91b24..0c84b41 100644 (file)
@@ -1822,6 +1822,18 @@ gst_x264_enc_init_encoder (GstX264Enc * encoder)
     }
   }
 
+  if (GST_VIDEO_INFO_IS_INTERLACED (info)) {
+    encoder->x264param.b_interlaced = TRUE;
+    if (GST_VIDEO_INFO_FIELD_ORDER (info) ==
+        GST_VIDEO_FIELD_ORDER_TOP_FIELD_FIRST) {
+      encoder->x264param.b_tff = TRUE;
+    } else {
+      encoder->x264param.b_tff = FALSE;
+    }
+  } else {
+    encoder->x264param.b_interlaced = FALSE;
+  }
+
   /* Set 3D frame packing */
   if (encoder->frame_packing != GST_VIDEO_MULTIVIEW_MODE_NONE)
     encoder->x264param.i_frame_packing = encoder->frame_packing;
@@ -2264,12 +2276,6 @@ gst_x264_enc_set_format (GstVideoEncoder * video_enc,
 
   gst_caps_unref (template_caps);
 
-  if (GST_VIDEO_INFO_IS_INTERLACED (&state->info))
-    g_string_append_printf (encoder->option_string, ":interlaced=%d", TRUE);
-  else
-    g_string_append_printf (encoder->option_string, ":interlaced=%d",
-        encoder->interlaced);
-
   if (!gst_x264_enc_init_encoder (encoder))
     return FALSE;