[cheese] webcam: set as default resolution the highest one with more than 15fps
- From: Filippo Argiolas <fargiolas src gnome org>
- To: svn-commits-list gnome org
- Subject: [cheese] webcam: set as default resolution the highest one with more than 15fps
- Date: Mon, 15 Jun 2009 16:14:02 -0400 (EDT)
commit c2675d63df006d6dffc0b3e7cdc64b3fefda6df3
Author: Filippo Argiolas <filippo argiolas gmail com>
Date: Mon Jun 15 21:58:12 2009 +0200
webcam: set as default resolution the highest one with more than 15fps
Webcam devices often support high resolutions but at a very slow rate.
We used to pick the highest one as default often ending up with a jerky
preview and complaining users. Set default resolution to the best one
with a framerate higher than 15Hz. Fixes bug #585857
src/cheese-webcam.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/cheese-webcam.c b/src/cheese-webcam.c
index c9b2f74..9e77d48 100644
--- a/src/cheese-webcam.c
+++ b/src/cheese-webcam.c
@@ -47,6 +47,8 @@ G_DEFINE_TYPE (CheeseWebcam, cheese_webcam, G_TYPE_OBJECT)
#define CHEESE_WEBCAM_ERROR cheese_webcam_error_quark ()
+#define MIN_DEFAULT_RATE 15.0
+
static void find_highest_framerate (CheeseVideoFormat *format);
enum CheeseWebcamError
@@ -835,11 +837,14 @@ cheese_webcam_create_webcam_source_bin (CheeseWebcam *webcam)
CheeseVideoFormat, 0));
for (i = 1; i < selected_webcam->num_video_formats; i++)
{
- if (g_array_index (selected_webcam->video_formats,
- CheeseVideoFormat, i).width > format->width)
+ CheeseVideoFormat *new = &g_array_index (selected_webcam->video_formats,
+ CheeseVideoFormat, i);
+ gfloat newrate = new->highest_framerate.numerator /
+ new->highest_framerate.denominator;
+ if ((new->width+new->height) > (format->width+format->height) &&
+ (newrate >= MIN_DEFAULT_RATE))
{
- format = &(g_array_index (selected_webcam->video_formats,
- CheeseVideoFormat, i));
+ format = new;
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]