[cheese/wip/hadess/remove-clutter: 1/5] Return gboolean from cheese_camera_setup() call
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cheese/wip/hadess/remove-clutter: 1/5] Return gboolean from cheese_camera_setup() call
- Date: Mon, 7 Feb 2022 10:49:02 +0000 (UTC)
commit 3994c20396521e3a481cc03a21b9cf7575856cbf
Author: Bastien Nocera <hadess hadess net>
Date: Mon Feb 7 11:47:07 2022 +0100
Return gboolean from cheese_camera_setup() call
Rather than needing to inspect the error to see whether we failed.
libcheese/cheese-camera.c | 12 +++++++-----
libcheese/cheese-camera.h | 2 +-
2 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/libcheese/cheese-camera.c b/libcheese/cheese-camera.c
index e123ff34..ab2cf166 100644
--- a/libcheese/cheese-camera.c
+++ b/libcheese/cheese-camera.c
@@ -1562,15 +1562,15 @@ cheese_camera_size_change_cb (ClutterGstContent *content, gint width, gint heigh
*
* Setup a video capture device.
*/
-void
+gboolean
cheese_camera_setup (CheeseCamera *camera, CheeseCameraDevice *device, GError **error)
{
CheeseCameraPrivate *priv;
GError *tmp_error = NULL;
GstElement *video_sink;
- g_return_if_fail (error == NULL || *error == NULL);
- g_return_if_fail (CHEESE_IS_CAMERA (camera));
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+ g_return_val_if_fail (CHEESE_IS_CAMERA (camera), FALSE);
priv = cheese_camera_get_instance_private (camera);
@@ -1579,7 +1579,7 @@ cheese_camera_setup (CheeseCamera *camera, CheeseCameraDevice *device, GError **
if (priv->num_camera_devices < 1)
{
g_set_error (error, CHEESE_CAMERA_ERROR, CHEESE_CAMERA_ERROR_NO_DEVICE, _("No device found"));
- return;
+ return FALSE;
}
if (device != NULL)
@@ -1638,7 +1638,7 @@ cheese_camera_setup (CheeseCamera *camera, CheeseCameraDevice *device, GError **
g_propagate_prefixed_error (error, tmp_error,
_("One or more needed GStreamer elements are missing: "));
GST_WARNING ("%s", (*error)->message);
- return;
+ return FALSE;
}
g_object_set (G_OBJECT (priv->camera_source), "video-source-filter", priv->video_filter_bin, NULL);
@@ -1648,6 +1648,8 @@ cheese_camera_setup (CheeseCamera *camera, CheeseCameraDevice *device, GError **
g_signal_connect (G_OBJECT (priv->bus), "message",
G_CALLBACK (cheese_camera_bus_message_cb), camera);
+
+ return TRUE;
}
/**
diff --git a/libcheese/cheese-camera.h b/libcheese/cheese-camera.h
index 6756dff7..f8b874dc 100644
--- a/libcheese/cheese-camera.h
+++ b/libcheese/cheese-camera.h
@@ -101,7 +101,7 @@ CheeseCamera *cheese_camera_new (ClutterActor *video_texture,
gint y_resolution);
const CheeseVideoFormat *cheese_camera_get_current_video_format (CheeseCamera *camera);
-void cheese_camera_setup (CheeseCamera *camera, CheeseCameraDevice *device, GError
**error);
+gboolean cheese_camera_setup (CheeseCamera *camera, CheeseCameraDevice *device, GError
**error);
void cheese_camera_play (CheeseCamera *camera);
void cheese_camera_stop (CheeseCamera *camera);
void cheese_camera_set_effect (CheeseCamera *camera, CheeseEffect *effect);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]