[cheese] Avoid crash when creating the default CheeseWidget



commit b89ed15b156cdef303b8fd7593751160d1dfd4fc
Author: David King <amigadave amigadave com>
Date:   Thu Sep 3 22:49:07 2015 +0100

    Avoid crash when creating the default CheeseWidget
    
    Update the device argument to cheese_camera_new() to reflect the new use
    of GstDeviceMonitor, by renaming the device_node argument to name. Emit
    a critical warning if passing a name, as creating a device by name is
    not yet supported.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=754506

 libcheese/cheese-camera.c |   14 ++++++++++----
 libcheese/cheese-camera.h |    2 +-
 2 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/libcheese/cheese-camera.c b/libcheese/cheese-camera.c
index d5285d7..5873567 100644
--- a/libcheese/cheese-camera.c
+++ b/libcheese/cheese-camera.c
@@ -1474,7 +1474,7 @@ cheese_camera_init (CheeseCamera *camera)
 /**
  * cheese_camera_new:
  * @video_texture: a #ClutterTexture
- * @camera_device_node: (allow-none): the device node path
+ * @name: (allow-none): the name of the device
  * @x_resolution: the resolution width
  * @y_resolution: the resolution height
  *
@@ -1483,19 +1483,25 @@ cheese_camera_init (CheeseCamera *camera)
  * Returns: a new #CheeseCamera
  */
 CheeseCamera *
-cheese_camera_new (ClutterActor *video_texture, const gchar *camera_device_node,
+cheese_camera_new (ClutterActor *video_texture, const gchar *name,
                    gint x_resolution, gint y_resolution)
 {
   CheeseCamera      *camera;
   CheeseVideoFormat format = { x_resolution, y_resolution };
 
-  if (camera_device_node)
+  if (name)
   {
+    /* FIXME: Implement device creation from a name. */
+    g_critical ("%s",
+                "Creating a camera from a device name is not implemented!");
+  }
+#if 0
     camera = g_object_new (CHEESE_TYPE_CAMERA, "video-texture", video_texture,
-                           "device-node", camera_device_node,
+                           "device", device,
                            "format", &format, NULL);
   }
   else
+#endif
   {
     camera = g_object_new (CHEESE_TYPE_CAMERA, "video-texture", video_texture,
                            "format", &format, NULL);
diff --git a/libcheese/cheese-camera.h b/libcheese/cheese-camera.h
index 3413b91..6756dff 100644
--- a/libcheese/cheese-camera.h
+++ b/libcheese/cheese-camera.h
@@ -96,7 +96,7 @@ typedef enum
 
 GType         cheese_camera_get_type (void);
 CheeseCamera *cheese_camera_new (ClutterActor *video_texture,
-                                 const gchar  *camera_device_node,
+                                 const gchar  *name,
                                  gint          x_resolution,
                                  gint          y_resolution);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]