summaryrefslogtreecommitdiff
path: root/v4l2-apps/lib/libv4l
diff options
context:
space:
mode:
authorhans@localhost.localdomain <hans@localhost.localdomain>2008-08-03 16:53:49 +0200
committerhans@localhost.localdomain <hans@localhost.localdomain>2008-08-03 16:53:49 +0200
commitb373ec3cc6f05fec60f972d8b42ddcd0f2d1c29a (patch)
tree0fe939a9d247a0ddb79765cd732e727cca0363a5 /v4l2-apps/lib/libv4l
parentbad01ca943742b5a2938b3718abc8590a0f3929d (diff)
downloadmediapointer-dvb-s2-b373ec3cc6f05fec60f972d8b42ddcd0f2d1c29a.tar.gz
mediapointer-dvb-s2-b373ec3cc6f05fec60f972d8b42ddcd0f2d1c29a.tar.bz2
libv4l: prefer native formats
From: Hans de Goede <j.w.r.degoede@hhs.nl> When the hardware supports a format natively prefer using the native version over converting from another supported format Signed-off-by: Hans de Goede <j.w.r.degoede@hhs.nl>
Diffstat (limited to 'v4l2-apps/lib/libv4l')
-rw-r--r--v4l2-apps/lib/libv4l/ChangeLog2
-rw-r--r--v4l2-apps/lib/libv4l/libv4lconvert/libv4lconvert.c4
2 files changed, 5 insertions, 1 deletions
diff --git a/v4l2-apps/lib/libv4l/ChangeLog b/v4l2-apps/lib/libv4l/ChangeLog
index cdd29fac8..498b816de 100644
--- a/v4l2-apps/lib/libv4l/ChangeLog
+++ b/v4l2-apps/lib/libv4l/ChangeLog
@@ -7,6 +7,8 @@ libv4l-0.4.0
converting map the (real) buffers before calling the qbuf ioctl
* Add support for conversion to RGB24 (before we only supported BGR24) based
on a patch by Jean-Francois Moine
+* When the hardware supports a format natively prefer using the native
+ version over converting from another supported format
* Various Makefile and pkgconfig file improvements by Gregor Jasny (Debian)
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;
}