From 240ba92bed4e1bf083d8bae49c04a211ae848a91 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 29 May 2016 17:33:50 +0200 Subject: [PATCH] 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. --- video/mp_image.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/video/mp_image.c b/video/mp_image.c index 5adce213e5..52087fdf83 100644 --- a/video/mp_image.c +++ b/video/mp_image.c @@ -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)