aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/libxvidff.c
diff options
context:
space:
mode:
authorThorsten Jordan <tjordan@ macrosystem.de>2008-04-24 12:39:25 +0000
committerBenoit Fouet <benoit.fouet@free.fr>2008-04-24 12:39:25 +0000
commit3fd6b3368ad0cd12741ff327c5af6f3086a5de42 (patch)
tree3cb6efc2467c5670733311c7c78b5ffe2ce24924 /libavcodec/libxvidff.c
parent95a6a015e367258da3411b51104de02dc939ea6e (diff)
downloadffmpeg-3fd6b3368ad0cd12741ff327c5af6f3086a5de42.tar.gz
Set pixel aspect ratio for libxvid wrapper.
Patch by Thorsten Jordan tjordanATmacrosystem de Originally committed as revision 12936 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/libxvidff.c')
-rw-r--r--libavcodec/libxvidff.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libavcodec/libxvidff.c b/libavcodec/libxvidff.c
index 492f0a8412..acac29b7dd 100644
--- a/libavcodec/libxvidff.c
+++ b/libavcodec/libxvidff.c
@@ -406,6 +406,17 @@ int ff_xvid_encode_frame(AVCodecContext *avctx,
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;