[FFmpeg-cvslog] lavd/xv: take aspect ratio into account.
Nicolas George
git at videolan.org
Sun Mar 23 21:12:13 CET 2014
ffmpeg | branch: release/2.2 | Nicolas George <george at nsup.org> | Mon Nov 25 17:26:07 2013 +0100| [99905118a851cd18e36fac0b84cda34ca71183b2] | committer: Michael Niedermayer
lavd/xv: take aspect ratio into account.
(cherry picked from commit c37bbe54f400edc8cb0070138328048943e90b1a)
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=99905118a851cd18e36fac0b84cda34ca71183b2
---
libavdevice/xv.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/libavdevice/xv.c b/libavdevice/xv.c
index 89d6575..fbb9415 100644
--- a/libavdevice/xv.c
+++ b/libavdevice/xv.c
@@ -130,8 +130,15 @@ static int xv_write_header(AVFormatContext *s)
xv->image_width = encctx->width;
xv->image_height = encctx->height;
if (!xv->window_width && !xv->window_height) {
+ AVRational sar = encctx->sample_aspect_ratio;
xv->window_width = encctx->width;
xv->window_height = encctx->height;
+ if (sar.num) {
+ if (sar.num > sar.den)
+ xv->window_width = av_rescale(xv->window_width, sar.num, sar.den);
+ if (sar.num < sar.den)
+ xv->window_height = av_rescale(xv->window_height, sar.den, sar.num);
+ }
}
xv->window = XCreateSimpleWindow(xv->display, DefaultRootWindow(xv->display),
xv->window_x, xv->window_y,
More information about the ffmpeg-cvslog
mailing list