cheese/0007-cheese-Move-camera_setup-to-cheese-preferences.patch
Hans de Goede 9b94ca029c In F-19 we had a long list of bugfix patches, most of these have been merged
into gnome-3.10 but not all have been merged yet, re-add the non merged ones
- Fix video recording not working
- Allow changing effects while recording
- Disallow changing camera settings while recording
- Fix cheese misbehavior when going from 0 -> 1 or 1 -> 0 camera devices
2013-09-12 10:36:15 +02:00

132 lines
4.4 KiB
Diff

From de2a756fd016ecf41963d46bb6c9389ee931611d Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 18 Jun 2013 11:40:41 +0200
Subject: [PATCH 07/13] cheese: Move camera_setup to cheese-preferences
cheese-preferences already keeps track of which cameras there are and is in
control of selecting camera resolution and the source-device. This patch also
makes it control of start / stop, thereby logical grouping all camera-control
code in a single place.
Having all camera control code in a single place makes dealing with various
hotplug issues a lot easier.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
src/cheese-application.vala | 20 ++++----------------
src/cheese-preferences.vala | 24 ++++++++++++++++++++++--
src/vapi/cheese-common.vapi | 2 +-
3 files changed, 27 insertions(+), 19 deletions(-)
diff --git a/src/cheese-application.vala b/src/cheese-application.vala
index 9cb5ac5..b0d0dbe 100644
--- a/src/cheese-application.vala
+++ b/src/cheese-application.vala
@@ -158,8 +158,10 @@ public class Cheese.Application : Gtk.Application
main_window.key_press_event.connect (on_webcam_key_pressed);
main_window.show ();
- setup_camera ();
+ create_camera ();
preferences_dialog = new PreferencesDialog (camera);
+ preferences_dialog.camera_error.connect (main_window.show_error);
+ preferences_dialog.camera_play ();
main_window.mode_change_changed.connect (preferences_dialog.enable_camera_controls);
this.add_window (main_window);
}
@@ -266,7 +268,7 @@ public class Cheese.Application : Gtk.Application
/**
* Setup the camera listed in GSettings.
*/
- public void setup_camera ()
+ public void create_camera ()
{
var effects = this.lookup_action ("effects") as SimpleAction;
var mode = this.lookup_action ("mode") as SimpleAction;
@@ -280,19 +282,6 @@ public class Cheese.Application : Gtk.Application
settings.get_int ("photo-x-resolution"),
settings.get_int ("photo-y-resolution"));
- try
- {
- camera.setup (device);
- }
- catch (Error err)
- {
- video_preview.hide ();
- message ("Error during camera setup: %s\n", err.message);
- main_window.show_error (err.message);
-
- return;
- }
-
double value;
value = settings.get_double ("brightness");
@@ -321,7 +310,6 @@ public class Cheese.Application : Gtk.Application
camera.state_flags_changed.connect (on_camera_state_flags_changed);
main_window.set_camera (camera);
- camera.play ();
}
/**
diff --git a/src/cheese-preferences.vala b/src/cheese-preferences.vala
index 2f2d679..5bd2ced 100644
--- a/src/cheese-preferences.vala
+++ b/src/cheese-preferences.vala
@@ -113,6 +113,28 @@ public class Cheese.PreferencesDialog : GLib.Object
}
/**
+ * Signal raised when there is an error with the camera device
+ */
+ public signal void camera_error (string? error);
+
+ /**
+ * Start playing video from the camera
+ */
+ public void camera_play ()
+ {
+ try
+ {
+ camera.setup (null);
+ camera.play ();
+ camera_changed ();
+ }
+ catch (Error err)
+ {
+ camera_error (err.message);
+ }
+ }
+
+ /**
* Set up combo box cell renderers.
*/
private void setup_combo_box_models ()
@@ -163,8 +185,6 @@ public class Cheese.PreferencesDialog : GLib.Object
source_combo.sensitive = false;
devices.foreach(add_camera_device);
-
- camera_changed ();
}
/**
diff --git a/src/vapi/cheese-common.vapi b/src/vapi/cheese-common.vapi
index 26e12a2..cd8a71c 100644
--- a/src/vapi/cheese-common.vapi
+++ b/src/vapi/cheese-common.vapi
@@ -49,7 +49,7 @@ namespace Cheese
public void toggle_effects_pipeline (bool active);
public void connect_effect_texture (Cheese.Effect effect, Clutter.Texture texture);
public void set_video_format (Cheese.VideoFormat format);
- public void setup (string udi) throws GLib.Error;
+ public void setup (string? udi) throws GLib.Error;
public void start_video_recording (string filename);
public void stop ();
public void stop_video_recording ();
--
1.8.3.1