From b373ec3cc6f05fec60f972d8b42ddcd0f2d1c29a Mon Sep 17 00:00:00 2001 From: "hans@localhost.localdomain" Date: Sun, 3 Aug 2008 16:53:49 +0200 Subject: libv4l: prefer native formats From: Hans de Goede When the hardware supports a format natively prefer using the native version over converting from another supported format Signed-off-by: Hans de Goede --- v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'v4l2-apps/lib/libv4l/libv4lconvert') diff --git a/v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert.c b/v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert.c index ffde7e1e8..e19b2f05b 100644 --- a/v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert.c +++ b/v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert.c @@ -171,7 +171,9 @@ int v4lconvert_try_format(struct v4lconvert_data *data, (int)dest_fmt->fmt.pix.height); unsigned int size_diff = size_x_diff * size_x_diff + size_y_diff * size_y_diff; - if (size_diff < closest_fmt_size_diff) { + if (size_diff < closest_fmt_size_diff || + (size_diff == closest_fmt_size_diff && + try_fmt.fmt.pix.pixelformat == desired_pixfmt)) { closest_fmt_size_diff = size_diff; closest_fmt = try_fmt; } -- cgit v1.2.3