summaryrefslogtreecommitdiffstats
path: root/video/mp_image.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-05-29 17:33:50 +0200
committerwm4 <wm4@nowhere>2016-05-29 19:00:55 +0200
commit240ba92bed4e1bf083d8bae49c04a211ae848a91 (patch)
tree84f1111d6a0d5dec48d305acd80918ab0c5a858e /video/mp_image.c
parent0348cd080f7f2236f0e79b9b84fb04ca0d3dec55 (diff)
downloadmpv-240ba92bed4e1bf083d8bae49c04a211ae848a91.tar.bz2
mpv-240ba92bed4e1bf083d8bae49c04a211ae848a91.tar.xz
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.
Diffstat (limited to 'video/mp_image.c')
-rw-r--r--video/mp_image.c4
1 files changed, 3 insertions, 1 deletions
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)