1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-27 01:22:30 +00:00

mp_image: don't lose pixel aspect ratio when setting format

This is quite unexpected. It's caused by mp_image_set_size(), which is
used to update certain fields which can be format-dependent, but which
is actually also supposed to reset the pixel aspect ratio.
This commit is contained in:
wm4 2016-05-29 17:33:50 +02:00
parent 0348cd080f
commit 240ba92bed

View File

@ -81,12 +81,14 @@ static bool mp_image_alloc_planes(struct mp_image *mpi)
void mp_image_setfmt(struct mp_image *mpi, int out_fmt)
{
struct mp_image_params params = mpi->params;
struct mp_imgfmt_desc fmt = mp_imgfmt_get_desc(out_fmt);
mpi->params.imgfmt = fmt.id;
params.imgfmt = fmt.id;
mpi->fmt = fmt;
mpi->imgfmt = fmt.id;
mpi->num_planes = fmt.num_planes;
mp_image_set_size(mpi, mpi->w, mpi->h);
mpi->params = params;
}
static void mp_image_destructor(void *ptr)