cheese/0004-cheese_camera_get_camera_devices-Allow-calling-befor.patch
2013-09-18 10:48:12 +02:00

45 lines
1.3 KiB
Diff

From e3480dd3e55665e9e48a39a74fd7ee4e56bc0736 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 18 Jun 2013 11:38:05 +0200
Subject: [PATCH 04/11] cheese_camera_get_camera_devices: Allow calling before
cheese_camera_setup()
Signed-off-by: Hans de Goede <hdegoede@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 ab5490d..de066af 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);
@@ -1649,13 +1652,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