cheese r728 - in trunk: . src
- From: jhaitsma svn gnome org
- To: svn-commits-list gnome org
- Subject: cheese r728 - in trunk: . src
- Date: Sun, 25 May 2008 08:35:12 +0000 (UTC)
Author: jhaitsma
Date: Sun May 25 08:35:12 2008
New Revision: 728
URL: http://svn.gnome.org/viewvc/cheese?rev=728&view=rev
Log:
2008-05-25 Jaap Haitsma <jaap haitsma org>
* configure.ac,
src/cheese-flash.c,
src/cheese-flash.h,
src/cheese-webcam.c,
src/cheese-window.c,
src/Makefile.am:
Add new flash and remove changing gamma for simulating flash. The
new flash works best if you run a composited desktop. Patch by
Alex "weej" Jones. Fixes #526214
Modified:
trunk/ChangeLog
trunk/configure.ac
trunk/src/Makefile.am
trunk/src/cheese-webcam.c
trunk/src/cheese-window.c
Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Sun May 25 08:35:12 2008
@@ -86,9 +86,7 @@
hal >= $HAL_REQUIRED \
dbus-glib-1 >= $DBUS_GLIB_REQUIRED \
pangocairo >= $PANGOCAIRO_REQUIRED \
- librsvg-2.0 >= $LIBRSVG_REQUIRED \
- xxf86vm)
-
+ librsvg-2.0 >= $LIBRSVG_REQUIRED)
AC_SUBST(CHEESE_CFLAGS)
CHEESE_LIBS="$CHEESE_LIBS -lgstinterfaces-0.10"
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Sun May 25 08:35:12 2008
@@ -44,8 +44,10 @@
cheese-prefs-resolution-combo.h \
cheese-prefs-resolution-combo.c \
cheese-prefs-dialog.c \
- cheese-prefs-dialog.h
-
+ cheese-prefs-dialog.h \
+ cheese-flash.h \
+ cheese-flash.c
+
cheese_LDADD = \
$(CHEESE_LIBS)
Modified: trunk/src/cheese-webcam.c
==============================================================================
--- trunk/src/cheese-webcam.c (original)
+++ trunk/src/cheese-webcam.c Sun May 25 08:35:12 2008
@@ -34,6 +34,7 @@
#include <libhal.h>
#include "cheese-webcam.h"
+#include "cheese-flash.h"
G_DEFINE_TYPE (CheeseWebcam, cheese_webcam, G_TYPE_OBJECT)
@@ -77,9 +78,6 @@
gboolean is_recording;
gboolean pipeline_is_playing;
char *photo_filename;
-
- XF86VidModeGamma normal_gamma;
- float flash_intensity;
int num_webcam_devices;
char *device_name;
@@ -89,6 +87,8 @@
int selected_device;
CheeseVideoFormat *current_format;
GHashTable *supported_resolutions;
+
+ CheeseFlash *flash;
} CheeseWebcamPrivate;
enum
@@ -207,6 +207,8 @@
g_signal_handler_disconnect (G_OBJECT(priv->photo_sink),
priv->photo_handler_signal_id);
+
+ g_signal_emit (webcam, webcam_signals[PHOTO_SAVED], 0);
}
static void
@@ -865,47 +867,6 @@
return TRUE;
}
-static void
-cheese_webcam_flash_set_intensity (CheeseWebcam *webcam, float intensity)
-{
- const float MAX_GAMMA = 10.0;
- XF86VidModeGamma gamma;
- CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
-
- g_return_if_fail ((intensity >= 0.0) || (intensity <= 1.0));
-
- gamma.red = MAX_GAMMA * intensity + priv->normal_gamma.red * (1.0 - intensity);
- gamma.green = MAX_GAMMA * intensity + priv->normal_gamma.green * (1.0 - intensity);
- gamma.blue = MAX_GAMMA * intensity + priv->normal_gamma.blue * (1.0 - intensity);
-
- XF86VidModeSetGamma (GDK_DISPLAY (), 0, &gamma);
-
- priv->flash_intensity = intensity;
-}
-
-static gboolean
-cheese_webcam_flash_dim_cb (CheeseWebcam *webcam)
-{
- CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
-
- priv->flash_intensity -= 0.1;
- cheese_webcam_flash_set_intensity (webcam, priv->flash_intensity);
-
- if (priv->flash_intensity <= 0.0)
- {
- g_signal_emit (webcam, webcam_signals [PHOTO_SAVED], 0);
- return FALSE;
- }
- return TRUE;
-}
-
-static void
-cheese_webcam_flash (CheeseWebcam *webcam)
-{
- cheese_webcam_flash_set_intensity (webcam, 1.0);
- g_timeout_add (50, (GSourceFunc) cheese_webcam_flash_dim_cb, webcam);
-}
-
int
cheese_webcam_get_num_webcam_devices (CheeseWebcam *webcam)
{
@@ -1036,10 +997,9 @@
"handoff",
G_CALLBACK (cheese_webcam_photo_data_cb),
webcam);
- cheese_webcam_flash (webcam);
+ cheese_flash_fire (priv->flash);
}
-
static void
cheese_webcam_finalize (GObject *object)
{
@@ -1210,6 +1170,8 @@
priv->supported_resolutions = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free, NULL);
+
+ priv->flash = cheese_flash_new ();
}
CheeseWebcam*
@@ -1262,9 +1224,6 @@
if (!ok)
g_error ("Unable link pipeline for photo");
- gdk_threads_enter();
- XF86VidModeGetGamma (GDK_DISPLAY (), 0, &(priv->normal_gamma));
- gdk_threads_leave();
}
GArray *
Modified: trunk/src/cheese-window.c
==============================================================================
--- trunk/src/cheese-window.c (original)
+++ trunk/src/cheese-window.c Sun May 25 08:35:12 2008
@@ -1378,9 +1378,12 @@
g_object_get (cheese_window->gconf, "gconf_prop_x_resolution", &x_resolution,
"gconf_prop_y_resolution", &y_resolution, NULL);
+ gdk_threads_enter ();
cheese_window->webcam = cheese_webcam_new (cheese_window->screen,
webcam_device, x_resolution,
y_resolution);
+ gdk_threads_leave ();
+
g_free (webcam_device);
cheese_webcam_setup (cheese_window->webcam);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]