mirror of
https://github.com/mpv-player/mpv
synced 2025-03-11 08:37:59 +00:00
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:
parent
079f67268f
commit
4853eca8c6
@ -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_setfmt(dst, pixfmt2imgfmt(src->format));
|
||||||
mp_image_set_size(dst, src->width, src->height);
|
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++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
dst->planes[i] = src->data[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->width = src->w;
|
||||||
dst->height = src->h;
|
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++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
dst->data[i] = src->planes[i];
|
dst->data[i] = src->planes[i];
|
||||||
dst->linesize[i] = src->stride[i];
|
dst->linesize[i] = src->stride[i];
|
||||||
|
Loading…
Reference in New Issue
Block a user