From dae49907e274e2bd37d7e86aa7110cef8dea8372 Mon Sep 17 00:00:00 2001 From: Vivia Nikolaidou Date: Wed, 30 Nov 2016 17:30:33 +0200 Subject: [PATCH] x264enc: Correctly pass interlacing/TFF information 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 | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/ext/x264/gstx264enc.c b/ext/x264/gstx264enc.c index 5f91b242..0c84b41b 100644 --- a/ext/x264/gstx264enc.c +++ b/ext/x264/gstx264enc.c @@ -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; -- 2.34.1