libx264: support aspect Ratio Switch
authorJULIAN GARDNER <joolzg@btinternet.com>
Thu, 26 May 2011 13:32:14 +0000 (15:32 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 26 May 2011 19:38:10 +0000 (21:38 +0200)
libavcodec/libx264.c

index d9bac17..28683a9 100644 (file)
@@ -119,6 +119,12 @@ static int X264_frame(AVCodecContext *ctx, uint8_t *buf,
             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 {