diff options
author | David King <amigadave@amigadave.com> | 2013-06-26 22:01:12 +0100 |
---|---|---|
committer | David King <amigadave@amigadave.com> | 2013-06-26 22:01:12 +0100 |
commit | 202e73abf80ad737658a9e7a20f5502a406eb64b (patch) | |
tree | 68dd9fad81b012936eaa4d6aa0ac2736605734d0 | |
parent | 62f1a1165977672811a8474c4009a0754dda966e (diff) | |
download | cheese-202e73abf80ad737658a9e7a20f5502a406eb64b.tar.gz |
Show an error message if the camera state is NULL
If there is a GST_MESSAGE_ERROR, stop the stream and emit
::state-flags-changed on the CheeseCamera. Handle the state change in
CheeseWindow by showing a generic error message. This message can easily
occur if the video device is busy, such as when another application is
using the webcam.
Fixes bug 703123.
-rw-r--r-- | libcheese/cheese-camera.c | 7 | ||||
-rw-r--r-- | src/cheese-main.vala | 7 | ||||
-rw-r--r-- | src/cheese-window.vala | 9 |
3 files changed, 18 insertions, 5 deletions
diff --git a/libcheese/cheese-camera.c b/libcheese/cheese-camera.c index dbad2410..a625359a 100644 --- a/libcheese/cheese-camera.c +++ b/libcheese/cheese-camera.c @@ -184,7 +184,7 @@ cheese_camera_photo_data (CheeseCamera *camera, GstSample *sample) * @camera: the #CheeseCamera * * Process messages create by the @camera on the @bus. Emit - * ::state-flags-changes if the state of the camera has changed. + * ::state-flags-changed if the state of the camera has changed. */ static void cheese_camera_bus_message_cb (GstBus *bus, GstMessage *message, CheeseCamera *camera) @@ -216,12 +216,15 @@ cheese_camera_bus_message_cb (GstBus *bus, GstMessage *message, CheeseCamera *ca gst_message_parse_error (message, &err, &debug); if (err && err->message) { - g_warning ("%s\n", err->message); + g_warning ("%s: %s\n", err->message, debug); g_error_free (err); } else { g_warning ("Unparsable GST_MESSAGE_ERROR message.\n"); } + cheese_camera_stop (camera); + g_signal_emit (camera, camera_signals[STATE_FLAGS_CHANGED], 0, + GST_STATE_NULL); g_free (debug); break; } diff --git a/src/cheese-main.vala b/src/cheese-main.vala index 16ea5915..51fba55a 100644 --- a/src/cheese-main.vala +++ b/src/cheese-main.vala @@ -254,10 +254,8 @@ public class Cheese.Main : Gtk.Application { video_preview.hide (); warning ("Error: %s\n", err.message); - //error_layer.text = err.message; - //error_layer.show (); + main_window.show_error (err.message); - //toggle_camera_actions_sensitivities (false); return; } @@ -332,6 +330,9 @@ public class Cheese.Main : Gtk.Application case Gst.State.PLAYING: main_window.camera_state_change_playing (); break; + case Gst.State.NULL: + main_window.camera_state_change_null (); + break; default: break; } diff --git a/src/cheese-window.vala b/src/cheese-window.vala index 584eb6dd..ce4596f6 100644 --- a/src/cheese-window.vala +++ b/src/cheese-window.vala @@ -1282,6 +1282,15 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow } } + /** + * Report an error as the camerabin switched to the NULL state. + */ + public void camera_state_change_null () + { + show_error (_("There was an error playing video from the webcam")); + toggle_camera_actions_sensitivities (false); + } + /** * Set wide mode active when started from the command line (and do not change * the GSetting). |