diff options
author | wm4 <wm4@nowhere> | 2016-05-30 19:12:41 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-05-30 19:12:41 +0200 |
commit | 4853eca8c619dfc9a942d250add5ecc22ceafa90 (patch) | |
tree | f06d7bf35234f68edf702ff1783b1578d25fda0d /video | |
parent | 079f67268f6f5a2ecfd12277b246b1937493c092 (diff) |
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.
Diffstat (limited to 'video')
-rw-r--r-- | video/mp_image.c | 7 |
1 files changed, 6 insertions, 1 deletions
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]; |