mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
lavd/xv: take aspect ratio into account.
This commit is contained in:
parent
ea6825fd09
commit
c37bbe54f4
@ -130,8 +130,15 @@ static int xv_write_header(AVFormatContext *s)
|
|||||||
xv->image_width = encctx->width;
|
xv->image_width = encctx->width;
|
||||||
xv->image_height = encctx->height;
|
xv->image_height = encctx->height;
|
||||||
if (!xv->window_width && !xv->window_height) {
|
if (!xv->window_width && !xv->window_height) {
|
||||||
|
AVRational sar = encctx->sample_aspect_ratio;
|
||||||
xv->window_width = encctx->width;
|
xv->window_width = encctx->width;
|
||||||
xv->window_height = encctx->height;
|
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 = XCreateSimpleWindow(xv->display, DefaultRootWindow(xv->display),
|
||||||
xv->window_x, xv->window_y,
|
xv->window_x, xv->window_y,
|
||||||
|
Loading…
Reference in New Issue
Block a user