diff options
author | wm4 <wm4@nowhere> | 2020-05-20 18:31:16 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2020-05-20 18:38:19 +0200 |
commit | d291673d40833f2249cd62f0ec690bf3aef38a73 (patch) | |
tree | 4250d4a436e0734e42b220a6f002ed7b327676d1 /video/out/vo_x11.c | |
parent | 086953a9da6c96bdd514127adc3ad5fc8a771da5 (diff) | |
download | mpv-d291673d40833f2249cd62f0ec690bf3aef38a73.tar.bz2 mpv-d291673d40833f2249cd62f0ec690bf3aef38a73.tar.xz |
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.
Diffstat (limited to 'video/out/vo_x11.c')
-rw-r--r-- | video/out/vo_x11.c | 10 |
1 files 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]) && |