From d291673d40833f2249cd62f0ec690bf3aef38a73 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 20 May 2020 18:31:16 +0200 Subject: vo_x11: minor improvement in format matching Make sure to accept only native endian mpv formats. Previously, it didn't check, and simply matched LE, because these are usually defined before the BE formats. red_mask etc. are defined as unsigned long, so use that instead of hardcoding a 32 bit limit. --- video/out/vo_x11.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/video/out/vo_x11.c b/video/out/vo_x11.c index 12ce4f4d1e..1cd8bdbe96 100644 --- a/video/out/vo_x11.c +++ b/video/out/vo_x11.c @@ -159,7 +159,7 @@ static void freeMyXImage(struct priv *p, int foo) p->myximage[foo] = NULL; } -#define MAKE_MASK(comp) (((1u << (comp).size) - 1) << (comp).offset) +#define MAKE_MASK(comp) (((1ul << (comp).size) - 1) << (comp).offset) static int reconfig(struct vo *vo, struct mp_image_params *fmt) { @@ -215,10 +215,10 @@ static bool resize(struct vo *vo) for (int fmt = IMGFMT_START; fmt < IMGFMT_END; fmt++) { struct mp_imgfmt_desc desc = mp_imgfmt_get_desc(fmt); if ((desc.flags & MP_IMGFLAG_HAS_COMPS) && desc.num_planes == 1 && - mp_imgfmt_get_component_type(fmt) == MP_COMPONENT_TYPE_UINT && - mp_imgfmt_get_forced_csp(fmt) == MP_CSP_RGB && - !(desc.flags & MP_IMGFLAG_ALPHA) && - desc.bpp[0] <= 32 && + (desc.flags & MP_IMGFLAG_COLOR_MASK) == MP_IMGFLAG_COLOR_RGB && + (desc.flags & MP_IMGFLAG_TYPE_MASK) == MP_IMGFLAG_TYPE_UINT && + (desc.flags & MP_IMGFLAG_NE) && !(desc.flags & MP_IMGFLAG_ALPHA) && + desc.bpp[0] <= 8 * sizeof(unsigned long) && p->myximage[0]->bits_per_pixel == desc.bpp[0] && p->myximage[0]->byte_order == LSBFirst && p->myximage[0]->red_mask == MAKE_MASK(desc.comps[0]) && -- cgit v1.2.3