aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas George <george@nsup.org>2013-11-25 17:26:07 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-03-23 20:31:04 +0100
commit99905118a851cd18e36fac0b84cda34ca71183b2 (patch)
tree5b07e83509b1bcc420dda963d0ec429ca8c9f2b5
parentdcf560204c5abe7ee2a98566e98ecd6a3e1ebbc8 (diff)
downloadffmpeg-99905118a851cd18e36fac0b84cda34ca71183b2.tar.gz
lavd/xv: take aspect ratio into account.
(cherry picked from commit c37bbe54f400edc8cb0070138328048943e90b1a) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavdevice/xv.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavdevice/xv.c b/libavdevice/xv.c
index 89d6575f6c..fbb941579e 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,