]> git.0d.be Git - empathy.git/commitdiff
renamespace CheeseCameraDeviceMonitor
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Thu, 1 Dec 2011 10:28:04 +0000 (11:28 +0100)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 2 Dec 2011 08:20:46 +0000 (09:20 +0100)
This ensures empathy will always use our version, even when linking on
libcheese, and so avoid incompatibliy when libcheese breaks its ABI.

https://bugzilla.gnome.org/show_bug.cgi?id=665244

libempathy/cheese-camera-device-monitor.c
libempathy/cheese-camera-device-monitor.h
libempathy/empathy-camera-monitor.c

index 78b40fb70275d7bd0e496c5aa825b6f3f8f38de6..57c0087636c09f920751860565e00df5b6600bd3 100644 (file)
@@ -1,3 +1,5 @@
+/* This file is a copy of cheese-camera-device-monitor.c from Empathy. We
+ * just renamespaced it to avoid conflicts when linking on libcheese. */
 /*
  * Copyright © 2007,2008 Jaap Haitsma <jaap@haitsma.org>
  * Copyright © 2007-2009 daniel g. siegel <dgsiegel@gnome.org>
  * @short_description: Simple object to enumerate v4l devices
  * @include: cheese/cheese-camera-device-monitor.h
  *
- * #CheeseCameraDeviceMonitor provides a basic interface for
+ * #EmpathyCameraDeviceMonitor provides a basic interface for
  * video4linux device enumeration and hotplugging.
  *
  * It uses either GUdev or some platform specific code to list video
  * devices.  It is also capable (right now in linux only, with the
  * udev backend) to monitor device plugging and emit a
- * CheeseCameraDeviceMonitor::added or
- * CheeseCameraDeviceMonitor::removed signal when an event happens.
+ * EmpathyCameraDeviceMonitor::added or
+ * EmpathyCameraDeviceMonitor::removed signal when an event happens.
  */
 
-G_DEFINE_TYPE (CheeseCameraDeviceMonitor, cheese_camera_device_monitor, G_TYPE_OBJECT)
+G_DEFINE_TYPE (EmpathyCameraDeviceMonitor, empathy_camera_device_monitor, G_TYPE_OBJECT)
 
-#define CHEESE_CAMERA_DEVICE_MONITOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o),                               \
-                                                                                  CHEESE_TYPE_CAMERA_DEVICE_MONITOR, \
-                                                                                  CheeseCameraDeviceMonitorPrivate))
+#define EMPATHY_CAMERA_DEVICE_MONITOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o),                               \
+                                                                                  EMPATHY_TYPE_CAMERA_DEVICE_MONITOR, \
+                                                                                  EmpathyCameraDeviceMonitorPrivate))
 
-#define CHEESE_CAMERA_DEVICE_MONITOR_ERROR cheese_camera_device_monitor_error_quark ()
+#define EMPATHY_CAMERA_DEVICE_MONITOR_ERROR empathy_camera_device_monitor_error_quark ()
 
-GST_DEBUG_CATEGORY (cheese_device_monitor_cat);
-#define GST_CAT_DEFAULT cheese_device_monitor_cat
+GST_DEBUG_CATEGORY (empathy_device_monitor_cat);
+#define GST_CAT_DEFAULT empathy_device_monitor_cat
 
-enum CheeseCameraDeviceMonitorError
+enum EmpathyCameraDeviceMonitorError
 {
-  CHEESE_CAMERA_DEVICE_MONITOR_ERROR_UNKNOWN,
-  CHEESE_CAMERA_DEVICE_MONITOR_ERROR_ELEMENT_NOT_FOUND
+  EMPATHY_CAMERA_DEVICE_MONITOR_ERROR_UNKNOWN,
+  EMPATHY_CAMERA_DEVICE_MONITOR_ERROR_ELEMENT_NOT_FOUND
 };
 
 typedef struct
@@ -83,7 +85,7 @@ typedef struct
 #else
   guint filler;
 #endif /* HAVE_UDEV */
-} CheeseCameraDeviceMonitorPrivate;
+} EmpathyCameraDeviceMonitorPrivate;
 
 enum
 {
@@ -96,15 +98,15 @@ static guint monitor_signals[LAST_SIGNAL];
 
 #if 0
 GQuark
-cheese_camera_device_monitor_error_quark (void)
+empathy_camera_device_monitor_error_quark (void)
 {
-  return g_quark_from_static_string ("cheese-camera-error-quark");
+  return g_quark_from_static_string ("empathy-camera-error-quark");
 }
 #endif
 
 #ifdef HAVE_UDEV
 static void
-cheese_camera_device_monitor_added (CheeseCameraDeviceMonitor *monitor,
+empathy_camera_device_monitor_added (EmpathyCameraDeviceMonitor *monitor,
                                     GUdevDevice               *udevice)
 {
   const char *device_file;
@@ -190,7 +192,7 @@ cheese_camera_device_monitor_added (CheeseCameraDeviceMonitor *monitor,
 }
 
 static void
-cheese_camera_device_monitor_removed (CheeseCameraDeviceMonitor *monitor,
+empathy_camera_device_monitor_removed (EmpathyCameraDeviceMonitor *monitor,
                                       GUdevDevice               *udevice)
 {
   g_signal_emit (monitor, monitor_signals[REMOVED], 0,
@@ -198,20 +200,20 @@ cheese_camera_device_monitor_removed (CheeseCameraDeviceMonitor *monitor,
 }
 
 static void
-cheese_camera_device_monitor_uevent_cb (GUdevClient               *client,
+empathy_camera_device_monitor_uevent_cb (GUdevClient               *client,
                                         const gchar               *action,
                                         GUdevDevice               *udevice,
-                                        CheeseCameraDeviceMonitor *monitor)
+                                        EmpathyCameraDeviceMonitor *monitor)
 {
   if (g_str_equal (action, "remove"))
-    cheese_camera_device_monitor_removed (monitor, udevice);
+    empathy_camera_device_monitor_removed (monitor, udevice);
   else if (g_str_equal (action, "add"))
-    cheese_camera_device_monitor_added (monitor, udevice);
+    empathy_camera_device_monitor_added (monitor, udevice);
 }
 
 /**
- * cheese_camera_device_monitor_coldplug:
- * @monitor: a #CheeseCameraDeviceMonitor object.
+ * empathy_camera_device_monitor_coldplug:
+ * @monitor: a #EmpathyCameraDeviceMonitor object.
  *
  * Will actively look for plugged in cameras and emit
  * ::added for those new cameras.
@@ -219,9 +221,9 @@ cheese_camera_device_monitor_uevent_cb (GUdevClient               *client,
  * to those signals before they are emitted.
  */
 void
-cheese_camera_device_monitor_coldplug (CheeseCameraDeviceMonitor *monitor)
+empathy_camera_device_monitor_coldplug (EmpathyCameraDeviceMonitor *monitor)
 {
-  CheeseCameraDeviceMonitorPrivate *priv = CHEESE_CAMERA_DEVICE_MONITOR_GET_PRIVATE (monitor);
+  EmpathyCameraDeviceMonitorPrivate *priv = EMPATHY_CAMERA_DEVICE_MONITOR_GET_PRIVATE (monitor);
   GList                            *devices, *l;
   gint                              i = 0;
 
@@ -235,7 +237,7 @@ cheese_camera_device_monitor_coldplug (CheeseCameraDeviceMonitor *monitor)
   /* Initialize camera structures */
   for (l = devices; l != NULL; l = l->next)
   {
-    cheese_camera_device_monitor_added (monitor, l->data);
+    empathy_camera_device_monitor_added (monitor, l->data);
     g_object_unref (l->data);
     i++;
   }
@@ -246,10 +248,10 @@ cheese_camera_device_monitor_coldplug (CheeseCameraDeviceMonitor *monitor)
 
 #else /* HAVE_UDEV */
 void
-cheese_camera_device_monitor_coldplug (CheeseCameraDeviceMonitor *monitor)
+empathy_camera_device_monitor_coldplug (EmpathyCameraDeviceMonitor *monitor)
 {
   #if 0
-  CheeseCameraDeviceMonitorPrivate *priv = CHEESE_CAMERA_DEVICE_MONITOR_GET_PRIVATE (monitor);
+  EmpathyCameraDeviceMonitorPrivate *priv = EMPATHY_CAMERA_DEVICE_MONITOR_GET_PRIVATE (monitor);
   struct v4l2_capability            v2cap;
   struct video_capability           v1cap;
   int                               fd, ok;
@@ -307,7 +309,7 @@ cheese_camera_device_monitor_coldplug (CheeseCameraDeviceMonitor *monitor)
   /* Initialize camera structures */
   for (l = devices; l != NULL; l = l->next)
   {
-    cheese_camera_device_monitor_added (monitor, l->data);
+    empathy_camera_device_monitor_added (monitor, l->data);
     g_object_unref (l->data);
   }
   g_list_free (devices);
@@ -317,11 +319,11 @@ cheese_camera_device_monitor_coldplug (CheeseCameraDeviceMonitor *monitor)
 #endif /* HAVE_UDEV */
 
 static void
-cheese_camera_device_monitor_finalize (GObject *object)
+empathy_camera_device_monitor_finalize (GObject *object)
 {
 #ifdef HAVE_UDEV
-  CheeseCameraDeviceMonitor *monitor = CHEESE_CAMERA_DEVICE_MONITOR (object);
-  CheeseCameraDeviceMonitorPrivate *priv = CHEESE_CAMERA_DEVICE_MONITOR_GET_PRIVATE (monitor);
+  EmpathyCameraDeviceMonitor *monitor = EMPATHY_CAMERA_DEVICE_MONITOR (object);
+  EmpathyCameraDeviceMonitorPrivate *priv = EMPATHY_CAMERA_DEVICE_MONITOR_GET_PRIVATE (monitor);
 
   if (priv->client != NULL)
   {
@@ -329,23 +331,23 @@ cheese_camera_device_monitor_finalize (GObject *object)
     priv->client = NULL;
   }
 #endif /* HAVE_UDEV */
-  G_OBJECT_CLASS (cheese_camera_device_monitor_parent_class)->finalize (object);
+  G_OBJECT_CLASS (empathy_camera_device_monitor_parent_class)->finalize (object);
 }
 
 static void
-cheese_camera_device_monitor_class_init (CheeseCameraDeviceMonitorClass *klass)
+empathy_camera_device_monitor_class_init (EmpathyCameraDeviceMonitorClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-  if (cheese_device_monitor_cat == NULL)
-    GST_DEBUG_CATEGORY_INIT (cheese_device_monitor_cat,
-                             "cheese-device-monitor",
-                             0, "Cheese Camera Device Monitor");
+  if (empathy_device_monitor_cat == NULL)
+    GST_DEBUG_CATEGORY_INIT (empathy_device_monitor_cat,
+                             "empathy-device-monitor",
+                             0, "Empathy Camera Device Monitor");
 
-  object_class->finalize = cheese_camera_device_monitor_finalize;
+  object_class->finalize = empathy_camera_device_monitor_finalize;
 
   /**
-   * CheeseCameraDeviceMonitor::added:
+   * EmpathyCameraDeviceMonitor::added:
    * @device: A private object representing the newly added camera.
    * @id: Device unique identifier.
    * @device: Device file name  (e.g. /dev/video2).
@@ -353,17 +355,17 @@ cheese_camera_device_monitor_class_init (CheeseCameraDeviceMonitorClass *klass)
    * @api_version: Supported video4linux API: 1 for v4l, 2 for v4l2.
    *
    * The ::added signal is emitted when a camera is added, or on start-up
-   * after #cheese_camera_device_monitor_colplug is called.
+   * after #empathy_camera_device_monitor_colplug is called.
    **/
   monitor_signals[ADDED] = g_signal_new ("added", G_OBJECT_CLASS_TYPE (klass),
                                          G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-                                         G_STRUCT_OFFSET (CheeseCameraDeviceMonitorClass, added),
+                                         G_STRUCT_OFFSET (EmpathyCameraDeviceMonitorClass, added),
                                          NULL, NULL,
                                          g_cclosure_marshal_generic,
                                          G_TYPE_NONE, 4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT);
 
   /**
-   * CheeseCameraDeviceMonitor::removed:
+   * EmpathyCameraDeviceMonitor::removed:
    * @device: A private object representing the newly added camera
    * @id: Device unique identifier.
    *
@@ -372,38 +374,38 @@ cheese_camera_device_monitor_class_init (CheeseCameraDeviceMonitorClass *klass)
    **/
   monitor_signals[REMOVED] = g_signal_new ("removed", G_OBJECT_CLASS_TYPE (klass),
                                            G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-                                           G_STRUCT_OFFSET (CheeseCameraDeviceMonitorClass, removed),
+                                           G_STRUCT_OFFSET (EmpathyCameraDeviceMonitorClass, removed),
                                            NULL, NULL,
                                            g_cclosure_marshal_generic,
                                            G_TYPE_NONE, 1, G_TYPE_STRING);
 
-  g_type_class_add_private (klass, sizeof (CheeseCameraDeviceMonitorPrivate));
+  g_type_class_add_private (klass, sizeof (EmpathyCameraDeviceMonitorPrivate));
 }
 
 static void
-cheese_camera_device_monitor_init (CheeseCameraDeviceMonitor *monitor)
+empathy_camera_device_monitor_init (EmpathyCameraDeviceMonitor *monitor)
 {
 #ifdef HAVE_UDEV
-  CheeseCameraDeviceMonitorPrivate *priv         = CHEESE_CAMERA_DEVICE_MONITOR_GET_PRIVATE (monitor);
+  EmpathyCameraDeviceMonitorPrivate *priv         = EMPATHY_CAMERA_DEVICE_MONITOR_GET_PRIVATE (monitor);
   const gchar *const                subsystems[] = {"video4linux", NULL};
 
   priv->client = g_udev_client_new (subsystems);
   g_signal_connect (G_OBJECT (priv->client), "uevent",
-                    G_CALLBACK (cheese_camera_device_monitor_uevent_cb), monitor);
+                    G_CALLBACK (empathy_camera_device_monitor_uevent_cb), monitor);
 #endif /* HAVE_UDEV */
 }
 
 /**
- * cheese_camera_device_monitor_new:
+ * empathy_camera_device_monitor_new:
  *
- * Returns a new #CheeseCameraDeviceMonitor object.
+ * Returns a new #EmpathyCameraDeviceMonitor object.
  *
- * Return value: a new #CheeseCameraDeviceMonitor object.
+ * Return value: a new #EmpathyCameraDeviceMonitor object.
  **/
-CheeseCameraDeviceMonitor *
-cheese_camera_device_monitor_new (void)
+EmpathyCameraDeviceMonitor *
+empathy_camera_device_monitor_new (void)
 {
-  return g_object_new (CHEESE_TYPE_CAMERA_DEVICE_MONITOR, NULL);
+  return g_object_new (EMPATHY_TYPE_CAMERA_DEVICE_MONITOR, NULL);
 }
 
 /*
index d0d98a45f164fca01dec16f8cdc4b145df8fe567..ff0bfa7677b91089ddc196cec713f243370b9a92 100644 (file)
@@ -1,3 +1,5 @@
+/* This file is a copy of cheese-camera-device-monitor.h from Empathy. We
+ * just renamespaced it to avoid conflicts when linking on libcheese. */
 /*
  * Copyright © 2007,2008 Jaap Haitsma <jaap@haitsma.org>
  * Copyright © 2007-2009 daniel g. siegel <dgsiegel@gnome.org>
  */
 
 
-#ifndef __CHEESE_CAMERA_DEVICE_MONITOR_H__
-#define __CHEESE_CAMERA_DEVICE_MONITOR_H__
+#ifndef __EMPATHY_CAMERA_DEVICE_MONITOR_H__
+#define __EMPATHY_CAMERA_DEVICE_MONITOR_H__
 
 #include <glib-object.h>
 #include <gst/interfaces/xoverlay.h>
 
 G_BEGIN_DECLS
 
-#define CHEESE_TYPE_CAMERA_DEVICE_MONITOR (cheese_camera_device_monitor_get_type ())
-#define CHEESE_CAMERA_DEVICE_MONITOR(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), CHEESE_TYPE_CAMERA_DEVICE_MONITOR, \
-                                                                               CheeseCameraDeviceMonitor))
-#define CHEESE_CAMERA_DEVICE_MONITOR_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), CHEESE_TYPE_CAMERA_DEVICE_MONITOR, \
-                                                                            CheeseCameraDeviceMonitorClass))
-#define CHEESE_IS_CAMERA_DEVICE_MONITOR(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), CHEESE_TYPE_CAMERA_DEVICE_MONITOR))
-#define CHEESE_IS_CAMERA_DEVICE_MONITOR_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), CHEESE_TYPE_CAMERA_DEVICE_MONITOR))
-#define CHEESE_CAMERA_DEVICE_MONITOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CHEESE_TYPE_CAMERA_DEVICE_MONITOR, \
-                                                                              CheeseCameraDeviceMonitorClass))
+#define EMPATHY_TYPE_CAMERA_DEVICE_MONITOR (empathy_camera_device_monitor_get_type ())
+#define EMPATHY_CAMERA_DEVICE_MONITOR(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), EMPATHY_TYPE_CAMERA_DEVICE_MONITOR, \
+                                                                               EmpathyCameraDeviceMonitor))
+#define EMPATHY_CAMERA_DEVICE_MONITOR_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), EMPATHY_TYPE_CAMERA_DEVICE_MONITOR, \
+                                                                            EmpathyCameraDeviceMonitorClass))
+#define EMPATHY_IS_CAMERA_DEVICE_MONITOR(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_CAMERA_DEVICE_MONITOR))
+#define EMPATHY_IS_CAMERA_DEVICE_MONITOR_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_CAMERA_DEVICE_MONITOR))
+#define EMPATHY_CAMERA_DEVICE_MONITOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_CAMERA_DEVICE_MONITOR, \
+                                                                              EmpathyCameraDeviceMonitorClass))
 
-typedef struct _CheeseCameraDeviceMonitorClass CheeseCameraDeviceMonitorClass;
-typedef struct _CheeseCameraDeviceMonitor CheeseCameraDeviceMonitor;
+typedef struct _EmpathyCameraDeviceMonitorClass EmpathyCameraDeviceMonitorClass;
+typedef struct _EmpathyCameraDeviceMonitor EmpathyCameraDeviceMonitor;
 
-struct _CheeseCameraDeviceMonitor
+struct _EmpathyCameraDeviceMonitor
 {
   GObject parent;
 };
 
-struct _CheeseCameraDeviceMonitorClass
+struct _EmpathyCameraDeviceMonitorClass
 {
   GObjectClass parent_class;
 
-  void (*added)(CheeseCameraDeviceMonitor *camera,
+  void (*added)(EmpathyCameraDeviceMonitor *camera,
                 const char                *id,
                 const char                *device_file,
                 const char                *product_name,
                 int                        api_version);
-  void (*removed)(CheeseCameraDeviceMonitor *camera, const char *id);
+  void (*removed)(EmpathyCameraDeviceMonitor *camera, const char *id);
 };
 
-GType                      cheese_camera_device_monitor_get_type (void) G_GNUC_CONST;
-CheeseCameraDeviceMonitor *cheese_camera_device_monitor_new (void);
-void                       cheese_camera_device_monitor_coldplug (CheeseCameraDeviceMonitor *monitor);
+GType                      empathy_camera_device_monitor_get_type (void) G_GNUC_CONST;
+EmpathyCameraDeviceMonitor *empathy_camera_device_monitor_new (void);
+void                       empathy_camera_device_monitor_coldplug (EmpathyCameraDeviceMonitor *monitor);
 
 G_END_DECLS
 
-#endif /* __CHEESE_CAMERA_DEVICE_MONITOR_H__ */
+#endif /* __EMPATHY_CAMERA_DEVICE_MONITOR_H__ */
index a92349c92de0d54b22232b04d343d91dde44e0ae..977b1f2c6fda614e5327b73798625d0c7c3a6fa0 100644 (file)
@@ -33,7 +33,7 @@
 
 struct _EmpathyCameraMonitorPrivate
 {
-  CheeseCameraDeviceMonitor *cheese_monitor;
+  EmpathyCameraDeviceMonitor *empathy_monitor;
   GQueue *cameras;
   gint num_cameras;
 };
@@ -108,7 +108,7 @@ empathy_camera_monitor_free_camera_foreach (gpointer data,
 }
 
 static void
-on_camera_added (CheeseCameraDeviceMonitor *device,
+on_camera_added (EmpathyCameraDeviceMonitor *device,
     gchar *id,
     gchar *filename,
     gchar *product_name,
@@ -133,7 +133,7 @@ on_camera_added (CheeseCameraDeviceMonitor *device,
 }
 
 static void
-on_camera_removed (CheeseCameraDeviceMonitor *device,
+on_camera_removed (EmpathyCameraDeviceMonitor *device,
     gchar *id,
     EmpathyCameraMonitor *self)
 {
@@ -194,7 +194,7 @@ empathy_camera_monitor_dispose (GObject *object)
 {
   EmpathyCameraMonitor *self = EMPATHY_CAMERA_MONITOR (object);
 
-  tp_clear_object (&self->priv->cheese_monitor);
+  tp_clear_object (&self->priv->empathy_monitor);
 
   g_queue_foreach (self->priv->cameras,
       empathy_camera_monitor_free_camera_foreach, NULL);
@@ -210,7 +210,7 @@ empathy_camera_monitor_constructed (GObject *object)
 
   G_OBJECT_CLASS (empathy_camera_monitor_parent_class)->constructed (object);
 
-  cheese_camera_device_monitor_coldplug (self->priv->cheese_monitor);
+  empathy_camera_device_monitor_coldplug (self->priv->empathy_monitor);
 }
 
 static void
@@ -252,11 +252,11 @@ empathy_camera_monitor_init (EmpathyCameraMonitor *self)
 
   self->priv->cameras = g_queue_new ();
 
-  self->priv->cheese_monitor = cheese_camera_device_monitor_new ();
+  self->priv->empathy_monitor = empathy_camera_device_monitor_new ();
 
-  g_signal_connect (self->priv->cheese_monitor, "added",
+  g_signal_connect (self->priv->empathy_monitor, "added",
       G_CALLBACK (on_camera_added), self);
-  g_signal_connect (self->priv->cheese_monitor, "removed",
+  g_signal_connect (self->priv->empathy_monitor, "removed",
       G_CALLBACK (on_camera_removed), self);
 
 #ifndef HAVE_UDEV