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.
This commit is contained in:
wm4 2016-05-30 19:12:41 +02:00
parent 079f67268f
commit 4853eca8c6
1 changed files with 6 additions and 1 deletions

View File

@ -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];