From 8d6a66892ec8fbca28fa5f494ff6ee6994f2fe13 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 26 Dec 2012 21:30:33 +0100 Subject: vf_swapuv: support more image formats --- video/filter/vf_swapuv.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'video/filter') diff --git a/video/filter/vf_swapuv.c b/video/filter/vf_swapuv.c index a9083ccaa8..10dc1da858 100644 --- a/video/filter/vf_swapuv.c +++ b/video/filter/vf_swapuv.c @@ -39,18 +39,14 @@ static struct mp_image *filter(struct vf_instance *vf, struct mp_image *mpi) return mpi; } -static int query_format(struct vf_instance *vf, unsigned int fmt){ - switch(fmt) - { - case IMGFMT_444P: - case IMGFMT_422P: - case IMGFMT_440P: - case IMGFMT_420P: - case IMGFMT_411P: - case IMGFMT_410P: - return vf_next_query_format(vf, fmt); - } - return 0; +static int query_format(struct vf_instance *vf, unsigned int fmt) +{ + struct mp_imgfmt_desc desc = mp_imgfmt_get_desc(fmt); + if (!(desc.flags & MP_IMGFLAG_BYTE_ALIGNED)) + return 0; + if (!(desc.num_planes >= 3 && desc.bytes[1] == desc.bytes[2])) + return 0; + return vf_next_query_format(vf, fmt); } static int vf_open(vf_instance_t *vf, char *args){ -- cgit v1.2.3