[cheese] In F-19 we had a long list of bugfix patches, most of these have been merged
Hans de Goede
jwrdegoede at fedoraproject.org
Thu Sep 12 08:36:40 UTC 2013
commit 9b94ca029c4625c7ab4936f27840fb7ba6d4dba2
Author: Hans de Goede <hdegoede at redhat.com>
Date: Thu Sep 12 10:36:15 2013 +0200
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
...t-allow-changing-the-camera-and-or-its-re.patch | 108 ++++++++++++++++
...b-view-Don-t-set-columns-to-5000-in-horiz.patch | 126 -------------------
...e-window-Add-cancel_running_action-method.patch | 89 +++++++++++++
...camera_device_update_format_table-going-i.patch | 45 -------
...ow-Allow-changing-effects-while-shooting-.patch | 87 +++++++++++++
...h-is-a-multiple-of-8-and-height-a-multipl.patch | 73 -----------
...ra-Fix-video-recording-with-gstreamer-1.1.patch | 55 ++++++++
...ese-preferences-Add-camera_changed-method.patch | 90 ++++++++++++++
...ra_get_camera_devices-Allow-calling-befor.patch | 44 +++++++
...e-Move-camera_setup-to-cheese-preferences.patch | 131 ++++++++++++++++++++
...Properly-deal-with-going-from-0-1-devices.patch | 108 ++++++++++++++++
...d-unnecessary-calls-to-switch_camera_devi.patch | 56 +++++++++
...pdate_num_camera_devices-Remove-unnecessa.patch | 30 +++++
...preferences-Simplify-remove_camera_device.patch | 72 +++++++++++
...erences-Cleanly-handle-going-from-1-0-dev.patch | 66 ++++++++++
...ow-Disable-effect-switching-buttons-on-we.patch | 48 +++++++
cheese.spec | 46 ++++++-
17 files changed, 1026 insertions(+), 248 deletions(-)
---
diff --git a/0001-cheese-Don-t-allow-changing-the-camera-and-or-its-re.patch b/0001-cheese-Don-t-allow-changing-the-camera-and-or-its-re.patch
new file mode 100644
index 0000000..0492bfe
--- /dev/null
+++ b/0001-cheese-Don-t-allow-changing-the-camera-and-or-its-re.patch
@@ -0,0 +1,108 @@
+From d4288cd182064bca3bc3cd3d62c794737c9db426 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede at redhat.com>
+Date: Wed, 7 Aug 2013 15:13:57 +0200
+Subject: [PATCH 01/13] cheese: Don't allow changing the camera and/or its
+ resolution while recording
+
+Signed-off-by: Hans de Goede <hdegoede at redhat.com>
+---
+ src/cheese-application.vala | 1 +
+ src/cheese-preferences.vala | 16 +++++++++++++++-
+ src/cheese-window.vala | 7 +++++++
+ 3 files changed, 23 insertions(+), 1 deletion(-)
+
+diff --git a/src/cheese-application.vala b/src/cheese-application.vala
+index 4cbfa49..0f9f33d 100644
+--- a/src/cheese-application.vala
++++ b/src/cheese-application.vala
+@@ -160,6 +160,7 @@ public class Cheese.Application : Gtk.Application
+ main_window.show ();
+ setup_camera ();
+ preferences_dialog = new PreferencesDialog (camera);
++ main_window.mode_change_changed.connect (preferences_dialog.enable_camera_controls);
+ this.add_window (main_window);
+ }
+ }
+diff --git a/src/cheese-preferences.vala b/src/cheese-preferences.vala
+index e078cbb..bad3c71 100644
+--- a/src/cheese-preferences.vala
++++ b/src/cheese-preferences.vala
+@@ -24,6 +24,7 @@ using Gtk;
+ public class Cheese.PreferencesDialog : GLib.Object
+ {
+ private Cheese.Camera camera;
++ private bool camera_controls_sensitive;
+
+ private GLib.Settings settings;
+
+@@ -56,6 +57,7 @@ public class Cheese.PreferencesDialog : GLib.Object
+ public PreferencesDialog (Cheese.Camera camera)
+ {
+ this.camera = camera;
++ this.camera_controls_sensitive = true;
+
+ settings = new GLib.Settings ("org.gnome.Cheese");
+
+@@ -499,7 +501,7 @@ public class Cheese.PreferencesDialog : GLib.Object
+ if (camera.get_selected_device ().get_device_node () == dev.get_device_node ())
+ source_combo.set_active_iter (iter);
+
+- if (camera_model.iter_n_children (null) > 1)
++ if (camera_model.iter_n_children (null) > 1 && camera_controls_sensitive)
+ source_combo.sensitive = true;
+ }
+
+@@ -548,6 +550,18 @@ public class Cheese.PreferencesDialog : GLib.Object
+ }
+
+ /**
++ * Set camera controls sensitivity
++ */
++ public void enable_camera_controls (bool sensitive)
++ {
++ camera_controls_sensitive = sensitive;
++ photo_resolution_combo.sensitive = sensitive;
++ video_resolution_combo.sensitive = sensitive;
++ if (camera_model.iter_n_children (null) > 1)
++ source_combo.sensitive = sensitive;
++ }
++
++ /**
+ * Show the dialog.
+ */
+ public void show ()
+diff --git a/src/cheese-window.vala b/src/cheese-window.vala
+index a406288..bc53b4e 100644
+--- a/src/cheese-window.vala
++++ b/src/cheese-window.vala
+@@ -373,6 +373,11 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
+ }
+
+ /**
++ * Signal raised when mode_change changes
++ */
++ public signal void mode_change_changed (bool enabled);
++
++ /**
+ * Make the media capture mode actions sensitive.
+ */
+ private void enable_mode_change ()
+@@ -381,6 +386,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
+ mode.set_enabled (true);
+ var effects = this.application.lookup_action ("effects") as SimpleAction;
+ effects.set_enabled (true);
++ mode_change_changed (true);
+ }
+
+ /**
+@@ -392,6 +398,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
+ mode.set_enabled (false);
+ var effects = this.application.lookup_action ("effects") as SimpleAction;
+ effects.set_enabled (false);
++ mode_change_changed (false);
+ }
+
+ /**
+--
+1.8.3.1
+
diff --git a/0002-cheese-window-Add-cancel_running_action-method.patch b/0002-cheese-window-Add-cancel_running_action-method.patch
new file mode 100644
index 0000000..b0d9612
--- /dev/null
+++ b/0002-cheese-window-Add-cancel_running_action-method.patch
@@ -0,0 +1,89 @@
+From 8c401d7fe5c85e60e84d08f1562fd721bef01be0 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede at redhat.com>
+Date: Tue, 18 Jun 2013 09:05:19 +0200
+Subject: [PATCH 02/13] cheese-window: Add cancel_running_action () method
+
+And use it to stop recording / the photo countdown when we get an error
+while either one is active.
+
+Signed-off-by: Hans de Goede <hdegoede at redhat.com>
+---
+ src/cheese-window.vala | 47 +++++++++++++++++++++++++++++++----------------
+ 1 file changed, 31 insertions(+), 16 deletions(-)
+
+diff --git a/src/cheese-window.vala b/src/cheese-window.vala
+index bc53b4e..675a92e 100644
+--- a/src/cheese-window.vala
++++ b/src/cheese-window.vala
+@@ -724,6 +724,34 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
+ }
+
+ /**
++ * Cancel the current action (if any)
++ */
++ private bool cancel_running_action ()
++ {
++ if ((current_countdown != null && current_countdown.running) ||
++ is_bursting || is_recording)
++ {
++ action_cancelled = true;
++ switch (current_mode)
++ {
++ case MediaMode.PHOTO:
++ current_countdown.stop ();
++ finish_countdown_callback ();
++ break;
++ case MediaMode.BURST:
++ toggle_photo_bursting (false);
++ break;
++ case MediaMode.VIDEO:
++ toggle_video_recording (false);
++ break;
++ }
++ action_cancelled = false;
++ return true;
++ }
++ return false;
++ }
++
++ /**
+ * Cancel the current activity if the escape key is pressed.
+ *
+ * @param event the key event, to check which key was pressed
+@@ -736,23 +764,9 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
+ key = Gdk.keyval_name (event.keyval);
+ if (strcmp (key, "Escape") == 0)
+ {
+- if ((current_countdown != null && current_countdown.running) || is_bursting || is_recording)
++ if (cancel_running_action())
+ {
+- action_cancelled = true;
+- switch (current_mode)
+- {
+- case MediaMode.PHOTO:
+- current_countdown.stop ();
+- finish_countdown_callback ();
+- break;
+- case MediaMode.BURST:
+- toggle_photo_bursting (false);
+- break;
+- case MediaMode.VIDEO:
+- toggle_video_recording (false);
+- break;
+- }
+- action_cancelled = false;
++ return false;
+ }
+ else if (is_effects_selector_active)
+ {
+@@ -1154,6 +1168,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
+ */
+ public void camera_state_change_null ()
+ {
++ cancel_running_action();
+ if (!error_layer.visible)
+ {
+ show_error (_("There was an error playing video from the webcam"));
+--
+1.8.3.1
+
diff --git a/0003-cheese-window-Allow-changing-effects-while-shooting-.patch b/0003-cheese-window-Allow-changing-effects-while-shooting-.patch
new file mode 100644
index 0000000..9fc57eb
--- /dev/null
+++ b/0003-cheese-window-Allow-changing-effects-while-shooting-.patch
@@ -0,0 +1,87 @@
+From 1537ad2673843e033035edfe144ffc78bdab5a43 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede at redhat.com>
+Date: Tue, 6 Aug 2013 14:50:00 +0200
+Subject: [PATCH 03/13] cheese-window: Allow changing effects while shooting /
+ recording a video
+
+There is no technical reason to disable the effect selector while shooting
+a video. Likewise there is no technical reason to disallow start / stop
+recording / shooting, or changing mode when the effect selector is change.
+
+Removing these unnecessary limitations simplifies the code, and allows users
+to change effects while recording a video.
+
+Signed-off-by: Hans de Goede <hdegoede at redhat.com>
+---
+ src/cheese-application.vala | 25 +++----------------------
+ src/cheese-window.vala | 4 ----
+ 2 files changed, 3 insertions(+), 26 deletions(-)
+
+diff --git a/src/cheese-application.vala b/src/cheese-application.vala
+index 0f9f33d..9cb5ac5 100644
+--- a/src/cheese-application.vala
++++ b/src/cheese-application.vala
+@@ -368,17 +368,8 @@ public class Cheese.Application : Gtk.Application
+ switch (new_state)
+ {
+ case Gst.State.PLAYING:
+- if (effects.state.get_boolean ())
+- {
+- mode.set_enabled (false);
+- shoot.set_enabled (false);
+- }
+- else
+- {
+- mode.set_enabled (true);
+- shoot.set_enabled (true);
+- }
+-
++ mode.set_enabled (true);
++ shoot.set_enabled (true);
+ effects.set_enabled (true);
+
+ main_window.camera_state_change_playing ();
+@@ -491,17 +482,7 @@ public class Cheese.Application : Gtk.Application
+ {
+ return_if_fail (value != null);
+
+- var state = value.get_boolean ();
+-
+- var shoot = this.lookup_action ("shoot") as SimpleAction;
+- var mode = this.lookup_action ("mode") as SimpleAction;
+-
+- // Effects selection and shooting/mode changes are mutually exclusive.
+- shoot.set_enabled (!state);
+- mode.set_enabled (!state);
+-
+- main_window.set_effects (state);
+-
++ main_window.set_effects (value.get_boolean ());
+ action.set_state (value);
+ }
+
+diff --git a/src/cheese-window.vala b/src/cheese-window.vala
+index 675a92e..07cf0f4 100644
+--- a/src/cheese-window.vala
++++ b/src/cheese-window.vala
+@@ -384,8 +384,6 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
+ {
+ var mode = this.application.lookup_action ("mode") as SimpleAction;
+ mode.set_enabled (true);
+- var effects = this.application.lookup_action ("effects") as SimpleAction;
+- effects.set_enabled (true);
+ mode_change_changed (true);
+ }
+
+@@ -396,8 +394,6 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
+ {
+ var mode = this.application.lookup_action ("mode") as SimpleAction;
+ mode.set_enabled (false);
+- var effects = this.application.lookup_action ("effects") as SimpleAction;
+- effects.set_enabled (false);
+ mode_change_changed (false);
+ }
+
+--
+1.8.3.1
+
diff --git a/0004-cheese-camera-Fix-video-recording-with-gstreamer-1.1.patch b/0004-cheese-camera-Fix-video-recording-with-gstreamer-1.1.patch
new file mode 100644
index 0000000..87dd313
--- /dev/null
+++ b/0004-cheese-camera-Fix-video-recording-with-gstreamer-1.1.patch
@@ -0,0 +1,55 @@
+From dcccb73f44970d7f8ed8e7d70986f9ffecfc6491 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede at redhat.com>
+Date: Tue, 3 Sep 2013 15:56:25 +0200
+Subject: [PATCH 04/13] cheese-camera: Fix video recording with gstreamer >=
+ 1.1.4
+
+gstreamer >= 1.1.4 requires us to fully specify the video-capture-source caps,
+otherwise cheese prints this:
+
+(cheese:22606): cheese-WARNING **: Filter caps do not completely specify the output format: gstcapsfilter.c(348): gst_capsfilter_prepare_buf (): /GstCameraBin:camerabin/GstCapsFilter:videobin-capsfilter:
+Output caps are unfixed: video/x-raw, framerate=(fraction)30/1, width=(int)640, height=(int)480, format=(string){ YUY2, YV12, BGR, RGB, I420 }, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
+
+And video-recording is broken.
+
+Signed-off-by: Hans de Goede <hdegoede at redhat.com>
+---
+ libcheese/cheese-camera.c | 15 ++++++++++++---
+ 1 file changed, 12 insertions(+), 3 deletions(-)
+
+diff --git a/libcheese/cheese-camera.c b/libcheese/cheese-camera.c
+index a625359..fdeb973 100644
+--- a/libcheese/cheese-camera.c
++++ b/libcheese/cheese-camera.c
+@@ -743,7 +743,7 @@ cheese_camera_set_new_caps (CheeseCamera *camera)
+ {
+ CheeseCameraPrivate *priv;
+ CheeseCameraDevice *device;
+- GstCaps *caps;
++ GstCaps *caps, *i420_caps, *video_caps;
+ gchar *caps_desc;
+ int width, height;
+
+@@ -768,8 +768,17 @@ cheese_camera_set_new_caps (CheeseCamera *camera)
+ g_object_set (gst_bin_get_by_name (GST_BIN (priv->video_source),
+ "video_source_filter"), "caps", caps, NULL);
+ g_object_set (priv->camerabin, "viewfinder-caps", caps,
+- "image-capture-caps", caps, "video-capture-caps", caps,
+- NULL);
++ "image-capture-caps", caps, NULL);
++
++ /* We must pick a format for the video-source, otherwise gstreamer
++ becomes unhappy */
++ i420_caps = gst_caps_new_simple ("video/x-raw",
++ "format", G_TYPE_STRING, "I420", NULL);
++ video_caps = gst_caps_intersect (caps, i420_caps);
++ g_object_set (priv->camerabin, "video-capture-caps", video_caps, NULL);
++
++ gst_caps_unref (i420_caps);
++ gst_caps_unref (video_caps);
+ gst_caps_unref (caps);
+
+ width = priv->current_format->width;
+--
+1.8.3.1
+
diff --git a/0005-cheese-preferences-Add-camera_changed-method.patch b/0005-cheese-preferences-Add-camera_changed-method.patch
new file mode 100644
index 0000000..5f81bdb
--- /dev/null
+++ b/0005-cheese-preferences-Add-camera_changed-method.patch
@@ -0,0 +1,90 @@
+From ce2689370cc4cfd8e2fb3f2fba154a979792d934 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede at redhat.com>
+Date: Tue, 18 Jun 2013 11:14:16 +0200
+Subject: [PATCH 05/13] cheese-preferences: Add camera_changed () method
+
+This centralizes camera-change handling, and adds a check for their being
+no camera removing a whole bunch of glib Critical messages being printed
+when cheese is started without a camera.
+
+Signed-off-by: Hans de Goede <hdegoede at redhat.com>
+---
+ src/cheese-preferences.vala | 34 +++++++++++++++++++++++++---------
+ 1 file changed, 25 insertions(+), 9 deletions(-)
+
+diff --git a/src/cheese-preferences.vala b/src/cheese-preferences.vala
+index bad3c71..2f2d679 100644
+--- a/src/cheese-preferences.vala
++++ b/src/cheese-preferences.vala
+@@ -130,6 +130,28 @@ public class Cheese.PreferencesDialog : GLib.Object
+ }
+
+ /**
++ * Update resolution list and save the current camera to settings.
++ */
++ private void camera_changed ()
++ {
++ Cheese.CameraDevice device, iter_device;
++ TreeIter iter;
++
++ device = camera.get_selected_device ();
++ if (device == null)
++ return;
++ settings.set_string ("camera", device.get_device_node ());
++ setup_resolutions_for_device (device);
++
++ for (bool next = camera_model.get_iter_first (out iter); next;
++ next = camera_model.iter_next (ref iter)) {
++ camera_model.get (iter, 1, out iter_device, -1);
++ if (iter_device == device)
++ source_combo.set_active_iter (iter);
++ }
++ }
++
++ /**
+ * Initialize and populate the camera device combo box model.
+ */
+ private void initialize_camera_devices ()
+@@ -142,8 +164,7 @@ public class Cheese.PreferencesDialog : GLib.Object
+
+ devices.foreach(add_camera_device);
+
+- settings.set_string ("camera", camera.get_selected_device ().get_device_node ());
+- setup_resolutions_for_device (camera.get_selected_device ());
++ camera_changed ();
+ }
+
+ /**
+@@ -229,8 +250,7 @@ public class Cheese.PreferencesDialog : GLib.Object
+ combo.model.get (iter, 1, out dev);
+ camera.set_device_by_device_node (dev.get_device_node ());
+ camera.switch_camera_device ();
+- setup_resolutions_for_device (camera.get_selected_device ());
+- settings.set_string ("camera", dev.get_device_node ());
++ camera_changed ();
+ }
+
+ /**
+@@ -476,8 +496,7 @@ public class Cheese.PreferencesDialog : GLib.Object
+ }
+ }
+
+- settings.set_string ("camera", camera.get_selected_device ().get_device_node ());
+- setup_resolutions_for_device (camera.get_selected_device ());
++ camera_changed ();
+ }
+
+ /**
+@@ -498,9 +517,6 @@ public class Cheese.PreferencesDialog : GLib.Object
+ 0, dev.get_name () + " (" + dev.get_device_node () + ")",
+ 1, dev);
+
+- if (camera.get_selected_device ().get_device_node () == dev.get_device_node ())
+- source_combo.set_active_iter (iter);
+-
+ if (camera_model.iter_n_children (null) > 1 && camera_controls_sensitive)
+ source_combo.sensitive = true;
+ }
+--
+1.8.3.1
+
diff --git a/0006-cheese_camera_get_camera_devices-Allow-calling-befor.patch b/0006-cheese_camera_get_camera_devices-Allow-calling-befor.patch
new file mode 100644
index 0000000..1fa34a1
--- /dev/null
+++ b/0006-cheese_camera_get_camera_devices-Allow-calling-befor.patch
@@ -0,0 +1,44 @@
+From 0d94fa92ab66b43f08b2b9d906fe0f4c963424af Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede at redhat.com>
+Date: Tue, 18 Jun 2013 11:38:05 +0200
+Subject: [PATCH 06/13] cheese_camera_get_camera_devices: Allow calling before
+ cheese_camera_setup()
+
+Signed-off-by: Hans de Goede <hdegoede at redhat.com>
+---
+ libcheese/cheese-camera.c | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/libcheese/cheese-camera.c b/libcheese/cheese-camera.c
+index fdeb973..332780a 100644
+--- a/libcheese/cheese-camera.c
++++ b/libcheese/cheese-camera.c
+@@ -363,6 +363,9 @@ cheese_camera_detect_camera_devices (CheeseCamera *camera)
+ {
+ CheeseCameraPrivate *priv = camera->priv;
+
++ if (priv->monitor)
++ return; /* Camera devices already detected */
++
+ priv->num_camera_devices = 0;
+ priv->camera_devices = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
+
+@@ -1650,13 +1653,11 @@ cheese_camera_setup (CheeseCamera *camera, const gchar *uuid, GError **error)
+ GPtrArray *
+ cheese_camera_get_camera_devices (CheeseCamera *camera)
+ {
+- CheeseCameraPrivate *priv;
+-
+ g_return_val_if_fail (CHEESE_IS_CAMERA (camera), NULL);
+
+- priv = camera->priv;
++ cheese_camera_detect_camera_devices (camera);
+
+- return g_ptr_array_ref (priv->camera_devices);
++ return g_ptr_array_ref (camera->priv->camera_devices);
+ }
+
+ /**
+--
+1.8.3.1
+
diff --git a/0007-cheese-Move-camera_setup-to-cheese-preferences.patch b/0007-cheese-Move-camera_setup-to-cheese-preferences.patch
new file mode 100644
index 0000000..2b0cb51
--- /dev/null
+++ b/0007-cheese-Move-camera_setup-to-cheese-preferences.patch
@@ -0,0 +1,131 @@
+From de2a756fd016ecf41963d46bb6c9389ee931611d Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede at 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 at 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
+
diff --git a/0008-cheese-Properly-deal-with-going-from-0-1-devices.patch b/0008-cheese-Properly-deal-with-going-from-0-1-devices.patch
new file mode 100644
index 0000000..d4d327d
--- /dev/null
+++ b/0008-cheese-Properly-deal-with-going-from-0-1-devices.patch
@@ -0,0 +1,108 @@
+From 55491c023d2d08795c156beb0a43ae8292d74a49 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede at redhat.com>
+Date: Tue, 18 Jun 2013 11:59:55 +0200
+Subject: [PATCH 08/13] cheese: Properly deal with going from 0 -> 1 devices
+
+Before this patch cheese showed a "No device found" message when started
+without any devices connected, and would keep showing this after the user
+plugged in a webcam. The new cam also could not be selected from the
+preferences dialog.
+
+After this patch cheese will automatically switch to showing video from a
+newly plugged in webcam (when it had no devices before).
+
+Signed-off-by: Hans de Goede <hdegoede at redhat.com>
+---
+ src/cheese-application.vala | 1 +
+ src/cheese-preferences.vala | 28 +++++++++++++++++++++++++---
+ 2 files changed, 26 insertions(+), 3 deletions(-)
+
+diff --git a/src/cheese-application.vala b/src/cheese-application.vala
+index b0d0dbe..be4837e 100644
+--- a/src/cheese-application.vala
++++ b/src/cheese-application.vala
+@@ -367,6 +367,7 @@ public class Cheese.Application : Gtk.Application
+ mode.set_enabled (false);
+ shoot.set_enabled (false);
+
++ preferences_dialog.camera_stop ();
+ main_window.camera_state_change_null ();
+ break;
+ default:
+diff --git a/src/cheese-preferences.vala b/src/cheese-preferences.vala
+index 5bd2ced..04a77ac 100644
+--- a/src/cheese-preferences.vala
++++ b/src/cheese-preferences.vala
+@@ -25,6 +25,8 @@ public class Cheese.PreferencesDialog : GLib.Object
+ {
+ private Cheese.Camera camera;
+ private bool camera_controls_sensitive;
++ private bool camera_is_setup;
++ private bool camera_is_playing;
+
+ private GLib.Settings settings;
+
+@@ -124,8 +126,16 @@ public class Cheese.PreferencesDialog : GLib.Object
+ {
+ try
+ {
+- camera.setup (null);
+- camera.play ();
++ if (!camera_is_setup)
++ {
++ camera.setup (null);
++ camera_is_setup = true;
++ }
++ if (!camera_is_playing)
++ {
++ camera.play ();
++ camera_is_playing = true;
++ }
+ camera_changed ();
+ }
+ catch (Error err)
+@@ -135,6 +145,14 @@ public class Cheese.PreferencesDialog : GLib.Object
+ }
+
+ /**
++ * Call this when the gstreamer pipe transitions to NULL
++ */
++ public void camera_stop ()
++ {
++ camera_is_playing = false;
++ }
++
++ /**
+ * Set up combo box cell renderers.
+ */
+ private void setup_combo_box_models ()
+@@ -270,7 +288,7 @@ public class Cheese.PreferencesDialog : GLib.Object
+ combo.model.get (iter, 1, out dev);
+ camera.set_device_by_device_node (dev.get_device_node ());
+ camera.switch_camera_device ();
+- camera_changed ();
++ camera_play ();
+ }
+
+ /**
+@@ -531,6 +549,7 @@ public class Cheese.PreferencesDialog : GLib.Object
+ {
+ TreeIter iter;
+ Cheese.CameraDevice dev = (Cheese.CameraDevice) device;
++ bool was_empty = camera_model.iter_n_children (null) == 0;
+
+ camera_model.append (out iter);
+ camera_model.set (iter,
+@@ -539,6 +558,9 @@ public class Cheese.PreferencesDialog : GLib.Object
+
+ if (camera_model.iter_n_children (null) > 1 && camera_controls_sensitive)
+ source_combo.sensitive = true;
++
++ if (was_empty)
++ source_combo.set_active_iter (iter);
+ }
+
+ /**
+--
+1.8.3.1
+
diff --git a/0009-cheese-Avoid-unnecessary-calls-to-switch_camera_devi.patch b/0009-cheese-Avoid-unnecessary-calls-to-switch_camera_devi.patch
new file mode 100644
index 0000000..0728f9b
--- /dev/null
+++ b/0009-cheese-Avoid-unnecessary-calls-to-switch_camera_devi.patch
@@ -0,0 +1,56 @@
+From 632e0253bf899a40c5f90a0584fad936189be821 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede at redhat.com>
+Date: Tue, 18 Jun 2013 13:45:38 +0200
+Subject: [PATCH 09/13] cheese: Avoid unnecessary calls to
+ switch_camera_device()
+
+And thus avoid stopping and restarting the stream for no reason.
+
+Signed-off-by: Hans de Goede <hdegoede at redhat.com>
+---
+ src/cheese-preferences.vala | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/src/cheese-preferences.vala b/src/cheese-preferences.vala
+index 04a77ac..e962062 100644
+--- a/src/cheese-preferences.vala
++++ b/src/cheese-preferences.vala
+@@ -27,6 +27,7 @@ public class Cheese.PreferencesDialog : GLib.Object
+ private bool camera_controls_sensitive;
+ private bool camera_is_setup;
+ private bool camera_is_playing;
++ private string camera_device_node;
+
+ private GLib.Settings settings;
+
+@@ -180,7 +181,8 @@ public class Cheese.PreferencesDialog : GLib.Object
+ device = camera.get_selected_device ();
+ if (device == null)
+ return;
+- settings.set_string ("camera", device.get_device_node ());
++ camera_device_node = device.get_device_node ();
++ settings.set_string ("camera", camera_device_node);
+ setup_resolutions_for_device (device);
+
+ for (bool next = camera_model.get_iter_first (out iter); next;
+@@ -283,10 +285,16 @@ public class Cheese.PreferencesDialog : GLib.Object
+
+ TreeIter iter;
+ Cheese.CameraDevice dev;
++ string dev_node;
+
+ combo.get_active_iter (out iter);
+ combo.model.get (iter, 1, out dev);
+- camera.set_device_by_device_node (dev.get_device_node ());
++ dev_node = dev.get_device_node ();
++
++ if (dev_node == camera_device_node)
++ return;
++
++ camera.set_device_by_device_node (dev_node);
+ camera.switch_camera_device ();
+ camera_play ();
+ }
+--
+1.8.3.1
+
diff --git a/0010-on_camera_update_num_camera_devices-Remove-unnecessa.patch b/0010-on_camera_update_num_camera_devices-Remove-unnecessa.patch
new file mode 100644
index 0000000..2881e8f
--- /dev/null
+++ b/0010-on_camera_update_num_camera_devices-Remove-unnecessa.patch
@@ -0,0 +1,30 @@
+From ec54a4dcbe7b814ab7b8ee60a44faefc091a3f96 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede at redhat.com>
+Date: Tue, 18 Jun 2013 14:01:45 +0200
+Subject: [PATCH 10/13] on_camera_update_num_camera_devices: Remove unnecessary
+ camera_changed() call
+
+If the camera is actually changed then camera_changed already gets called
+from either camera_play() or on_source_change().
+
+Signed-off-by: Hans de Goede <hdegoede at redhat.com>
+---
+ src/cheese-preferences.vala | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/src/cheese-preferences.vala b/src/cheese-preferences.vala
+index e962062..2120432 100644
+--- a/src/cheese-preferences.vala
++++ b/src/cheese-preferences.vala
+@@ -541,8 +541,6 @@ public class Cheese.PreferencesDialog : GLib.Object
+ remove_camera_device (iter, old_device, active_device);
+ }
+ }
+-
+- camera_changed ();
+ }
+
+ /**
+--
+1.8.3.1
+
diff --git a/0011-cheese-preferences-Simplify-remove_camera_device.patch b/0011-cheese-preferences-Simplify-remove_camera_device.patch
new file mode 100644
index 0000000..9354868
--- /dev/null
+++ b/0011-cheese-preferences-Simplify-remove_camera_device.patch
@@ -0,0 +1,72 @@
+From 7be2bcd05f80ffa8ee5ec7847a527ac07b6f8b87 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede at redhat.com>
+Date: Wed, 19 Jun 2013 16:47:41 +0200
+Subject: [PATCH 11/13] cheese-preferences: Simplify remove_camera_device
+
+Now that we cache the device-node for the active camera, remove_camera_device
+and its callers can be simplified.
+
+Signed-off-by: Hans de Goede <hdegoede at redhat.com>
+---
+ src/cheese-preferences.vala | 19 ++++++-------------
+ 1 file changed, 6 insertions(+), 13 deletions(-)
+
+diff --git a/src/cheese-preferences.vala b/src/cheese-preferences.vala
+index 2120432..faf6877 100644
+--- a/src/cheese-preferences.vala
++++ b/src/cheese-preferences.vala
+@@ -508,12 +508,6 @@ public class Cheese.PreferencesDialog : GLib.Object
+ TreeIter iter;
+ camera_model.get_iter_first (out iter);
+
+- // Combobox active element.
+- TreeIter active_iter;
+- Cheese.CameraDevice active_device;
+- source_combo.get_active_iter (out active_iter);
+- camera_model.get (active_iter, 1, out active_device, -1);
+-
+ // Find which device was removed.
+ bool device_removed = false;
+ devices.foreach ((device) =>
+@@ -525,7 +519,7 @@ public class Cheese.PreferencesDialog : GLib.Object
+ // Found the device that was removed.
+ if (strcmp (old_device.device_node, new_device.device_node) != 0)
+ {
+- remove_camera_device (iter, new_device, active_device);
++ remove_camera_device (iter, new_device);
+ device_removed = true;
+ // Remember, this is from the anonymous function!
+ return;
+@@ -538,7 +532,7 @@ public class Cheese.PreferencesDialog : GLib.Object
+ {
+ Cheese.CameraDevice old_device;
+ camera_model.get (iter, 1, out old_device, -1);
+- remove_camera_device (iter, old_device, active_device);
++ remove_camera_device (iter, old_device);
+ }
+ }
+ }
+@@ -573,16 +567,15 @@ public class Cheese.PreferencesDialog : GLib.Object
+ * Remove the supplied camera device from the device combo box model.
+ *
+ * @param iter the iterator of the device to remove
+- * @param device_node the device to remove from the combo box model
+- * @param active_device_node the currently-active camera device
++ * @param device the device to remove from the combo box model
+ */
+- private void remove_camera_device (TreeIter iter, Cheese.CameraDevice device_node,
+- Cheese.CameraDevice active_device_node)
++ private void remove_camera_device (TreeIter iter,
++ Cheese.CameraDevice device)
+ {
+ unowned GLib.PtrArray devices = camera.get_camera_devices ();
+
+ // Check if the camera that we want to remove, is the active one
+- if (strcmp (device_node.device_node, active_device_node.device_node) == 0)
++ if (device.device_node == camera_device_node)
+ {
+ if (devices.len > 0)
+ set_new_available_camera_device (iter);
+--
+1.8.3.1
+
diff --git a/0012-cheese-preferences-Cleanly-handle-going-from-1-0-dev.patch b/0012-cheese-preferences-Cleanly-handle-going-from-1-0-dev.patch
new file mode 100644
index 0000000..33f3402
--- /dev/null
+++ b/0012-cheese-preferences-Cleanly-handle-going-from-1-0-dev.patch
@@ -0,0 +1,66 @@
+From 51ff0d863bc0e160094ec684018ee0068b7b612a Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede at redhat.com>
+Date: Wed, 19 Jun 2013 17:29:28 +0200
+Subject: [PATCH 12/13] cheese-preferences: Cleanly handle going from 1 -> 0
+ devices
+
+Cleanly handle going from 1 -> 0 devices and going from 1 -> 0 -> 1 devices.
+
+Signed-off-by: Hans de Goede <hdegoede at redhat.com>
+---
+ src/cheese-preferences.vala | 26 +++++++++++++++-----------
+ 1 file changed, 15 insertions(+), 11 deletions(-)
+
+diff --git a/src/cheese-preferences.vala b/src/cheese-preferences.vala
+index faf6877..cad7eba 100644
+--- a/src/cheese-preferences.vala
++++ b/src/cheese-preferences.vala
+@@ -280,13 +280,13 @@ public class Cheese.PreferencesDialog : GLib.Object
+ [CCode (instance_pos = -1)]
+ public void on_source_change (Gtk.ComboBox combo)
+ {
+- // TODO: Handle going from 1 to 0 devices, cleanly!
+- return_if_fail (camera.num_camera_devices > 0);
+-
+ TreeIter iter;
+ Cheese.CameraDevice dev;
+ string dev_node;
+
++ if (combo.get_active () == -1)
++ return;
++
+ combo.get_active_iter (out iter);
+ combo.model.get (iter, 1, out dev);
+ dev_node = dev.get_device_node ();
+@@ -572,16 +572,20 @@ public class Cheese.PreferencesDialog : GLib.Object
+ private void remove_camera_device (TreeIter iter,
+ Cheese.CameraDevice device)
+ {
+- unowned GLib.PtrArray devices = camera.get_camera_devices ();
+-
+- // Check if the camera that we want to remove, is the active one
+- if (device.device_node == camera_device_node)
++ if (camera.num_camera_devices == 0) /* Last camera gone? */
+ {
+- if (devices.len > 0)
+- set_new_available_camera_device (iter);
+- else
+- this.dialog.hide();
++ ListStore resolution_model = new ListStore (2, typeof (string),
++ typeof (Cheese.VideoFormat));
++ photo_resolution_combo.model = resolution_model;
++ video_resolution_combo.model = resolution_model;
++ camera_device_node = "";
++ camera_error(_("No device found"));
+ }
++ else if (device.device_node == camera_device_node)
++ {
++ set_new_available_camera_device (iter);
++ }
++
+ camera_model.remove (iter);
+
+ if (camera_model.iter_n_children (null) <= 1)
+--
+1.8.3.1
+
diff --git a/0013-cheese-window-Disable-effect-switching-buttons-on-we.patch b/0013-cheese-window-Disable-effect-switching-buttons-on-we.patch
new file mode 100644
index 0000000..fb2fbb3
--- /dev/null
+++ b/0013-cheese-window-Disable-effect-switching-buttons-on-we.patch
@@ -0,0 +1,48 @@
+From 462287f28f87c5dd9f30f734132b5c6193a1daa1 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede at redhat.com>
+Date: Tue, 3 Sep 2013 15:39:49 +0200
+Subject: [PATCH 13/13] cheese-window: Disable effect switching buttons on
+ webcam error
+
+Signed-off-by: Hans de Goede <hdegoede at redhat.com>
+---
+ src/cheese-window.vala | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/src/cheese-window.vala b/src/cheese-window.vala
+index 07cf0f4..bc2d3b7 100644
+--- a/src/cheese-window.vala
++++ b/src/cheese-window.vala
+@@ -1030,9 +1030,11 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
+ var effects_next = this.lookup_action ("effects-next") as SimpleAction;
+ var effects_previous = this.lookup_action ("effects-previous") as SimpleAction;
+
+- effects_next.set_enabled (is_effects_selector_active
++ effects_next.set_enabled (!error_layer.visible
++ && is_effects_selector_active
+ && current_effects_page != effects_manager.effects.length () / EFFECTS_PER_PAGE);
+- effects_previous.set_enabled (is_effects_selector_active
++ effects_previous.set_enabled (!error_layer.visible
++ && is_effects_selector_active
+ && current_effects_page != 0);
+ }
+
+@@ -1151,6 +1153,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
+ public void camera_state_change_playing ()
+ {
+ show_error (null);
++ setup_effects_page_switch_sensitivity ();
+
+ Effect effect = effects_manager.get_effect (settings.get_string ("selected-effect"));
+ if (effect != null)
+@@ -1169,6 +1172,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
+ {
+ show_error (_("There was an error playing video from the webcam"));
+ }
++ setup_effects_page_switch_sensitivity ();
+ }
+
+ /**
+--
+1.8.3.1
+
diff --git a/cheese.spec b/cheese.spec
index 51f23b7..51a4567 100644
--- a/cheese.spec
+++ b/cheese.spec
@@ -1,7 +1,7 @@
Name: cheese
Epoch: 2
Version: 3.9.91
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: Application for taking pictures and movies from a webcam
Group: Amusements/Graphics
@@ -12,6 +12,24 @@ Source0: http://download.gnome.org/sources/cheese/3.9/%{name}-%{version}.
# https://bugzilla.gnome.org/show_bug.cgi?id=678447
# Patch2: 0002-Setup-vp8enc-in-a-way-suitable-for-realtime-encoding.patch
+# https://bugzilla.gnome.org/show_bug.cgi?id=707386
+Patch1: 0001-cheese-Don-t-allow-changing-the-camera-and-or-its-re.patch
+Patch2: 0002-cheese-window-Add-cancel_running_action-method.patch
+# https://bugzilla.gnome.org/show_bug.cgi?id=707387
+Patch3: 0003-cheese-window-Allow-changing-effects-while-shooting-.patch
+# https://bugzilla.gnome.org/show_bug.cgi?id=707391
+Patch4: 0004-cheese-camera-Fix-video-recording-with-gstreamer-1.1.patch
+# https://bugzilla.gnome.org/show_bug.cgi?id=603612
+Patch5: 0005-cheese-preferences-Add-camera_changed-method.patch
+Patch6: 0006-cheese_camera_get_camera_devices-Allow-calling-befor.patch
+Patch7: 0007-cheese-Move-camera_setup-to-cheese-preferences.patch
+Patch8: 0008-cheese-Properly-deal-with-going-from-0-1-devices.patch
+Patch9: 0009-cheese-Avoid-unnecessary-calls-to-switch_camera_devi.patch
+Patch10: 0010-on_camera_update_num_camera_devices-Remove-unnecessa.patch
+Patch11: 0011-cheese-preferences-Simplify-remove_camera_device.patch
+Patch12: 0012-cheese-preferences-Cleanly-handle-going-from-1-0-dev.patch
+Patch13: 0013-cheese-window-Disable-effect-switching-buttons-on-we.patch
+
BuildRequires: gtk3-devel >= 3.0.0
BuildRequires: gstreamer1-devel
BuildRequires: gstreamer1-plugins-bad-free-devel
@@ -67,7 +85,19 @@ for writing applications that require a webcam display widget.
%prep
%setup -q
-# %patch2 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
+%patch5 -p1
+%patch6 -p1
+%patch7 -p1
+%patch8 -p1
+%patch9 -p1
+%patch10 -p1
+%patch11 -p1
+%patch12 -p1
+%patch13 -p1
%build
@@ -141,6 +171,14 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
%{_datadir}/gir-1.0/Cheese-3.0.gir
%changelog
+* Thu Sep 12 2013 Hans de Goede <hdegoede at redhat.com> - 2:3.9.91-3
+- 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
+
* Tue Sep 03 2013 Kalev Lember <kalevlember at gmail.com> - 2:3.9.91-2
- Rebuilt for libgnome-desktop soname bump
@@ -373,7 +411,7 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
* Thu Aug 19 2010 Matthias Clasen <mclasen at redhat.com> 1:2.31.90-1
- Update to 2.31.90
-* Fri Aug 11 2010 Matthias Clasen <mclasen at redhat.com> 1:2.31.1-2
+* Wed Aug 11 2010 Matthias Clasen <mclasen at redhat.com> 1:2.31.1-2
- Add an epoch to stay ahead of F14
* Fri Aug 6 2010 Matthias Clasen <mclasen at redhat.com> 2.31.1-1
@@ -473,7 +511,7 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
* Wed Dec 3 2008 Matthias Clasen <mclasen at redhat.com> 2.25.2-1
- Update to 2.25.2
-* Thu Nov 21 2008 Matthias Clasen <mclasen at redhat.com> 2.25.1-4
+* Fri Nov 21 2008 Matthias Clasen <mclasen at redhat.com> 2.25.1-4
- Better URL
* Thu Nov 13 2008 Matthias Clasen <mclasen at redhat.com> 2.25.1-3
More information about the scm-commits
mailing list