libx264: support aspect ratio switching
authorJULIAN GARDNER <joolzg@btinternet.com>
Sun, 8 Jul 2012 14:33:47 +0000 (17:33 +0300)
committerAnton Khirnov <anton@khirnov.net>
Mon, 9 Jul 2012 06:15:59 +0000 (08:15 +0200)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
libavcodec/libx264.c

index 35c0030..adda881 100644 (file)
@@ -148,6 +148,12 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame,
             x4->params.b_tff = frame->top_field_first;
             x264_encoder_reconfig(x4->enc, &x4->params);
         }
             x4->params.b_tff = frame->top_field_first;
             x264_encoder_reconfig(x4->enc, &x4->params);
         }
+        if (x4->params.vui.i_sar_height != ctx->sample_aspect_ratio.den ||
+            x4->params.vui.i_sar_width  != ctx->sample_aspect_ratio.num) {
+            x4->params.vui.i_sar_height = ctx->sample_aspect_ratio.den;
+            x4->params.vui.i_sar_width  = ctx->sample_aspect_ratio.num;
+            x264_encoder_reconfig(x4->enc, &x4->params);
+        }
     }
 
     do {
     }
 
     do {