From ddf0a05516ddaefd3c473a3cc2bf5d6e170e5698 Mon Sep 17 00:00:00 2001 From: "hans@rhel5-devel.localdomain" Date: Wed, 11 Mar 2009 13:08:13 +0100 Subject: libv4l: don't use memcmp to compare pix_formats From: Hans de Goede Only check width, height and pixelformat when checking if we are doing conversion, instead of doing a memcmp, as that are the only things which the convert code checks Priority: normal Signed-off-by: Hans de Goede --- v4l2-apps/libv4l/ChangeLog | 3 +++ v4l2-apps/libv4l/libv4lconvert/libv4lconvert.c | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'v4l2-apps') diff --git a/v4l2-apps/libv4l/ChangeLog b/v4l2-apps/libv4l/ChangeLog index 04d9931b5..c68c05445 100644 --- a/v4l2-apps/libv4l/ChangeLog +++ b/v4l2-apps/libv4l/ChangeLog @@ -6,6 +6,9 @@ libv4l-0.5.2 s_fmt in their try_fmt answer * Check that s_fmt atleast gives us the width, height and pixelformat try_fmt promised us, and if not disable conversion +* Only check width, height and pixelformat when checking if we are doing + conversion, instead of doing a memcmp, as that are the only things which + the convert code checks libv4l-0.5.1 ------------ diff --git a/v4l2-apps/libv4l/libv4lconvert/libv4lconvert.c b/v4l2-apps/libv4l/libv4lconvert/libv4lconvert.c index 3e93d98cc..daced73dd 100644 --- a/v4l2-apps/libv4l/libv4lconvert/libv4lconvert.c +++ b/v4l2-apps/libv4l/libv4lconvert/libv4lconvert.c @@ -301,7 +301,9 @@ int v4lconvert_try_format(struct v4lconvert_data *data, } /* Are we converting? */ - if(memcmp(&try_src, &try_dest, sizeof(try_src))) + if(try_src.fmt.pix.width != try_dest.fmt.pix.width || + try_src.fmt.pix.height != try_dest.fmt.pix.height || + try_src.fmt.pix.pixelformat != try_dest.fmt.pix.pixelformat) v4lconvert_fixup_fmt(&try_dest); *dest_fmt = try_dest; @@ -316,7 +318,9 @@ int v4lconvert_needs_conversion(struct v4lconvert_data *data, const struct v4l2_format *src_fmt, /* in */ const struct v4l2_format *dest_fmt) /* in */ { - if(memcmp(src_fmt, dest_fmt, sizeof(*src_fmt))) + if(src_fmt->fmt.pix.width != dest_fmt->fmt.pix.width || + src_fmt->fmt.pix.height != dest_fmt->fmt.pix.height || + src_fmt->fmt.pix.pixelformat != dest_fmt->fmt.pix.pixelformat) return 1; /* Formats differ */ if (!(data->flags & (V4LCONVERT_ROTATE_90|V4LCONVERT_ROTATE_180))) -- cgit v1.2.3