[FFmpeg-cvslog] r12936 - trunk/libavcodec/libxvidff.c

benoit subversion
Thu Apr 24 14:39:26 CEST 2008


Author: benoit
Date: Thu Apr 24 14:39:25 2008
New Revision: 12936

Log:
Set pixel aspect ratio for libxvid wrapper.
Patch by Thorsten Jordan tjordanATmacrosystem de


Modified:
   trunk/libavcodec/libxvidff.c

Modified: trunk/libavcodec/libxvidff.c
==============================================================================
--- trunk/libavcodec/libxvidff.c	(original)
+++ trunk/libavcodec/libxvidff.c	Thu Apr 24 14:39:25 2008
@@ -406,6 +406,17 @@ int ff_xvid_encode_frame(AVCodecContext 
     xvid_enc_frame.motion = x->me_flags;
     xvid_enc_frame.type = XVID_TYPE_AUTO;
 
+    /* Pixel aspect ratio setting */
+    if (avctx->sample_aspect_ratio.num < 1 || avctx->sample_aspect_ratio.num > 255 ||
+        avctx->sample_aspect_ratio.den < 1 || avctx->sample_aspect_ratio.den > 255) {
+        av_log(avctx, AV_LOG_ERROR, "Invalid pixel aspect ratio %i/%i\n",
+               avctx->sample_aspect_ratio.num, avctx->sample_aspect_ratio.den);
+        return -1;
+    }
+    xvid_enc_frame.par = XVID_PAR_EXT;
+    xvid_enc_frame.par_width  = avctx->sample_aspect_ratio.num;
+    xvid_enc_frame.par_height = avctx->sample_aspect_ratio.den;
+
     /* Quant Setting */
     if( x->qscale ) xvid_enc_frame.quant = picture->quality / FF_QP2LAMBDA;
     else xvid_enc_frame.quant = 0;




More information about the ffmpeg-cvslog mailing list