From 4853eca8c619dfc9a942d250add5ecc22ceafa90 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 30 May 2016 19:12:41 +0200 Subject: mp_image: properly communicate aspect ratio through AVFrame No idea why this wasn't done before. In particular, this fixes playing anamorphic video through --lavfi-complex. --- video/mp_image.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/video/mp_image.c b/video/mp_image.c index 21773ef660..ac3d4ea5e1 100644 --- a/video/mp_image.c +++ b/video/mp_image.c @@ -671,7 +671,9 @@ static void mp_image_copy_fields_from_av_frame(struct mp_image *dst, { mp_image_setfmt(dst, pixfmt2imgfmt(src->format)); mp_image_set_size(dst, src->width, src->height); - dst->params.p_w = dst->params.p_h = 1; + + dst->params.p_w = src->sample_aspect_ratio.num; + dst->params.p_h = src->sample_aspect_ratio.den; for (int i = 0; i < 4; i++) { dst->planes[i] = src->data[i]; @@ -698,6 +700,9 @@ static void mp_image_copy_fields_to_av_frame(struct AVFrame *dst, dst->width = src->w; dst->height = src->h; + dst->sample_aspect_ratio.num = src->params.p_w; + dst->sample_aspect_ratio.den = src->params.p_h; + for (int i = 0; i < 4; i++) { dst->data[i] = src->planes[i]; dst->linesize[i] = src->stride[i]; -- cgit v1.2.3