[FFmpeg-devel] [PATCH] lavd/xv: take aspect ratio into account.

Stefano Sabatini stefasab at gmail.com
Tue Nov 26 10:15:43 CET 2013


On date Monday 2013-11-25 17:30:57 +0100, Nicolas George encoded:
> Signed-off-by: Nicolas George <george at nsup.org>
> ---
>  libavdevice/xv.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/libavdevice/xv.c b/libavdevice/xv.c
> index ad60482..0ccef4c 100644
> --- a/libavdevice/xv.c
> +++ b/libavdevice/xv.c
> @@ -129,8 +129,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);
> +        }

Any reason why you're using a different logic w.r.t. sdl.c?

>      }
>      xv->window = XCreateSimpleWindow(xv->display, DefaultRootWindow(xv->display),
>                                       xv->window_x, xv->window_y,

LGTM if tested, thanks.
-- 
FFmpeg = Fiendish & Fiendish Mystic Philosophical Extravagant Goblin


More information about the ffmpeg-devel mailing list