Rename GstDeviceMonitor to GstDeviceProvider
authorOlivier Crête <olivier.crete@collabora.com>
Thu, 26 Jun 2014 18:52:57 +0000 (14:52 -0400)
committerOlivier Crête <olivier.crete@collabora.com>
Thu, 26 Jun 2014 18:57:36 +0000 (14:57 -0400)
ext/pulse/Makefile.am
ext/pulse/plugin.c
ext/pulse/pulsedeviceprovider.c [moved from ext/pulse/pulsedevicemonitor.c with 85% similarity]
ext/pulse/pulsedeviceprovider.h [moved from ext/pulse/pulsedevicemonitor.h with 61% similarity]
sys/v4l2/Makefile.am
sys/v4l2/gstv4l2.c
sys/v4l2/gstv4l2deviceprovider.c [moved from sys/v4l2/gstv4l2devicemonitor.c with 74% similarity]
sys/v4l2/gstv4l2deviceprovider.h [moved from sys/v4l2/gstv4l2devicemonitor.h with 62% similarity]

index e9e564f..a813cb6 100644 (file)
@@ -4,7 +4,7 @@ libgstpulse_la_SOURCES = \
        plugin.c \
        pulsesink.c \
        pulsesrc.c \
-       pulsedevicemonitor.c \
+       pulsedeviceprovider.c \
        pulseutil.c
 
 libgstpulse_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(PULSE_CFLAGS)
@@ -17,6 +17,6 @@ libgstpulse_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
 noinst_HEADERS = \
        pulsesink.h \
        pulsesrc.h \
-       pulsedevicemonitor.h \
+       pulsedeviceprovider.h \
        pulseutil.h
 
index ec9c89f..a2c8fe5 100644 (file)
@@ -27,7 +27,7 @@
 
 #include "pulsesink.h"
 #include "pulsesrc.h"
-#include "pulsedevicemonitor.h"
+#include "pulsedeviceprovider.h"
 
 GST_DEBUG_CATEGORY (pulse_debug);
 
@@ -49,8 +49,8 @@ plugin_init (GstPlugin * plugin)
           GST_TYPE_PULSESRC))
     return FALSE;
 
-  if (!gst_device_monitor_register (plugin, "pulsemonitor",
-          GST_RANK_PRIMARY, GST_TYPE_PULSE_DEVICE_MONITOR))
+  if (!gst_device_provider_register (plugin, "pulsedeviceprovider",
+          GST_RANK_PRIMARY, GST_TYPE_PULSE_DEVICE_PROVIDER))
     return FALSE;
 
   GST_DEBUG_CATEGORY_INIT (pulse_debug, "pulse", 0, "PulseAudio elements");
similarity index 85%
rename from ext/pulse/pulsedevicemonitor.c
rename to ext/pulse/pulsedeviceprovider.c
index f697d10..8e91700 100644 (file)
@@ -1,7 +1,7 @@
 /* GStreamer
  * Copyright (C) 2012 Olivier Crete <olivier.crete@collabora.com>
  *
- * gstv4l2devicemonitor.c: V4l2 device probing and monitoring
+ * gstv4l2deviceprovider.c: V4l2 device probing and monitoring
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -23,7 +23,7 @@
 #include "config.h"
 #endif
 
-#include "pulsedevicemonitor.h"
+#include "pulsedeviceprovider.h"
 
 #include <string.h>
 
@@ -42,19 +42,19 @@ static GstDevice *gst_pulse_device_new (guint id,
     const gchar * device_name, GstCaps * caps, const gchar * internal_name,
     GstPulseDeviceType type);
 
-G_DEFINE_TYPE (GstPulseDeviceMonitor, gst_pulse_device_monitor,
-    GST_TYPE_DEVICE_MONITOR);
+G_DEFINE_TYPE (GstPulseDeviceProvider, gst_pulse_device_provider,
+    GST_TYPE_DEVICE_PROVIDER);
 
-static void gst_pulse_device_monitor_finalize (GObject * object);
-static void gst_pulse_device_monitor_set_property (GObject * object,
+static void gst_pulse_device_provider_finalize (GObject * object);
+static void gst_pulse_device_provider_set_property (GObject * object,
     guint prop_id, const GValue * value, GParamSpec * pspec);
-static void gst_pulse_device_monitor_get_property (GObject * object,
+static void gst_pulse_device_provider_get_property (GObject * object,
     guint prop_id, GValue * value, GParamSpec * pspec);
 
 
-static GList *gst_pulse_device_monitor_probe (GstDeviceMonitor * monitor);
-static gboolean gst_pulse_device_monitor_start (GstDeviceMonitor * monitor);
-static void gst_pulse_device_monitor_stop (GstDeviceMonitor * monitor);
+static GList *gst_pulse_device_provider_probe (GstDeviceProvider * provider);
+static gboolean gst_pulse_device_provider_start (GstDeviceProvider * provider);
+static void gst_pulse_device_provider_stop (GstDeviceProvider * provider);
 
 enum
 {
@@ -66,19 +66,19 @@ enum
 
 
 static void
-gst_pulse_device_monitor_class_init (GstPulseDeviceMonitorClass * klass)
+gst_pulse_device_provider_class_init (GstPulseDeviceProviderClass * klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-  GstDeviceMonitorClass *dm_class = GST_DEVICE_MONITOR_CLASS (klass);
+  GstDeviceProviderClass *dm_class = GST_DEVICE_PROVIDER_CLASS (klass);
   gchar *client_name;
 
-  gobject_class->set_property = gst_pulse_device_monitor_set_property;
-  gobject_class->get_property = gst_pulse_device_monitor_get_property;
-  gobject_class->finalize = gst_pulse_device_monitor_finalize;
+  gobject_class->set_property = gst_pulse_device_provider_set_property;
+  gobject_class->get_property = gst_pulse_device_provider_get_property;
+  gobject_class->finalize = gst_pulse_device_provider_finalize;
 
-  dm_class->probe = gst_pulse_device_monitor_probe;
-  dm_class->start = gst_pulse_device_monitor_start;
-  dm_class->stop = gst_pulse_device_monitor_stop;
+  dm_class->probe = gst_pulse_device_provider_probe;
+  dm_class->start = gst_pulse_device_provider_start;
+  dm_class->stop = gst_pulse_device_provider_stop;
 
   g_object_class_install_property (gobject_class,
       PROP_SERVER,
@@ -95,35 +95,35 @@ gst_pulse_device_monitor_class_init (GstPulseDeviceMonitorClass * klass)
           GST_PARAM_MUTABLE_READY));
   g_free (client_name);
 
-  gst_device_monitor_class_set_static_metadata (dm_class,
-      "PulseAudio Device Monitor", "Sink/Source/Audio",
-      "List and monitor PulseAudio source and sink devices",
+  gst_device_provider_class_set_static_metadata (dm_class,
+      "PulseAudio Device Provider", "Sink/Source/Audio",
+      "List and provider PulseAudio source and sink devices",
       "Olivier Crete <olivier.crete@collabora.com>");
 }
 
 static void
-gst_pulse_device_monitor_init (GstPulseDeviceMonitor * self)
+gst_pulse_device_provider_init (GstPulseDeviceProvider * self)
 {
   self->client_name = gst_pulse_client_name ();
 }
 
 static void
-gst_pulse_device_monitor_finalize (GObject * object)
+gst_pulse_device_provider_finalize (GObject * object)
 {
-  GstPulseDeviceMonitor *self = GST_PULSE_DEVICE_MONITOR (object);
+  GstPulseDeviceProvider *self = GST_PULSE_DEVICE_PROVIDER (object);
 
   g_free (self->client_name);
   g_free (self->server);
 
-  G_OBJECT_CLASS (gst_pulse_device_monitor_parent_class)->finalize (object);
+  G_OBJECT_CLASS (gst_pulse_device_provider_parent_class)->finalize (object);
 }
 
 
 static void
-gst_pulse_device_monitor_set_property (GObject * object,
+gst_pulse_device_provider_set_property (GObject * object,
     guint prop_id, const GValue * value, GParamSpec * pspec)
 {
-  GstPulseDeviceMonitor *self = GST_PULSE_DEVICE_MONITOR (object);
+  GstPulseDeviceProvider *self = GST_PULSE_DEVICE_PROVIDER (object);
 
   switch (prop_id) {
     case PROP_SERVER:
@@ -147,10 +147,10 @@ gst_pulse_device_monitor_set_property (GObject * object,
 }
 
 static void
-gst_pulse_device_monitor_get_property (GObject * object,
+gst_pulse_device_provider_get_property (GObject * object,
     guint prop_id, GValue * value, GParamSpec * pspec)
 {
-  GstPulseDeviceMonitor *self = GST_PULSE_DEVICE_MONITOR (object);
+  GstPulseDeviceProvider *self = GST_PULSE_DEVICE_PROVIDER (object);
 
   switch (prop_id) {
     case PROP_SERVER:
@@ -168,7 +168,7 @@ gst_pulse_device_monitor_get_property (GObject * object,
 static void
 context_state_cb (pa_context * c, void *userdata)
 {
-  GstPulseDeviceMonitor *self = userdata;
+  GstPulseDeviceProvider *self = userdata;
 
   switch (pa_context_get_state (c)) {
     case PA_CONTEXT_READY:
@@ -219,7 +219,7 @@ static void
 get_source_info_cb (pa_context * context,
     const pa_source_info * info, int eol, void *userdata)
 {
-  GstPulseDeviceMonitor *self = userdata;
+  GstPulseDeviceProvider *self = userdata;
   GstDevice *dev;
 
   if (eol) {
@@ -230,14 +230,14 @@ get_source_info_cb (pa_context * context,
   dev = new_source (info);
 
   if (dev)
-    gst_device_monitor_device_add (GST_DEVICE_MONITOR (self), dev);
+    gst_device_provider_device_add (GST_DEVICE_PROVIDER (self), dev);
 }
 
 static void
 get_sink_info_cb (pa_context * context,
     const pa_sink_info * info, int eol, void *userdata)
 {
-  GstPulseDeviceMonitor *self = userdata;
+  GstPulseDeviceProvider *self = userdata;
   GstDevice *dev;
 
   if (eol) {
@@ -248,15 +248,15 @@ get_sink_info_cb (pa_context * context,
   dev = new_sink (info);
 
   if (dev)
-    gst_device_monitor_device_add (GST_DEVICE_MONITOR (self), dev);
+    gst_device_provider_device_add (GST_DEVICE_PROVIDER (self), dev);
 }
 
 static void
 context_subscribe_cb (pa_context * context, pa_subscription_event_type_t type,
     uint32_t idx, void *userdata)
 {
-  GstPulseDeviceMonitor *self = userdata;
-  GstDeviceMonitor *monitor = userdata;
+  GstPulseDeviceProvider *self = userdata;
+  GstDeviceProvider *provider = userdata;
   pa_subscription_event_type_t facility =
       type & PA_SUBSCRIPTION_EVENT_FACILITY_MASK;
   pa_subscription_event_type_t event_type =
@@ -279,7 +279,7 @@ context_subscribe_cb (pa_context * context, pa_subscription_event_type_t type,
     GList *item;
 
     GST_OBJECT_LOCK (self);
-    for (item = monitor->devices; item; item = item->next) {
+    for (item = provider->devices; item; item = item->next) {
       dev = item->data;
 
       if (((facility == PA_SUBSCRIPTION_EVENT_SOURCE &&
@@ -295,7 +295,7 @@ context_subscribe_cb (pa_context * context, pa_subscription_event_type_t type,
     GST_OBJECT_UNLOCK (self);
 
     if (dev) {
-      gst_device_monitor_device_remove (GST_DEVICE_MONITOR (self),
+      gst_device_provider_device_remove (GST_DEVICE_PROVIDER (self),
           GST_DEVICE (dev));
       gst_object_unref (dev);
     }
@@ -327,9 +327,9 @@ get_sink_info_list_cb (pa_context * context, const pa_sink_info * info,
 }
 
 static GList *
-gst_pulse_device_monitor_probe (GstDeviceMonitor * monitor)
+gst_pulse_device_provider_probe (GstDeviceProvider * provider)
 {
-  GstPulseDeviceMonitor *self = GST_PULSE_DEVICE_MONITOR (monitor);
+  GstPulseDeviceProvider *self = GST_PULSE_DEVICE_PROVIDER (provider);
   GList *devices = NULL;
   pa_mainloop *m = NULL;
   pa_context *c = NULL;
@@ -397,9 +397,9 @@ failed:
 }
 
 static gboolean
-gst_pulse_device_monitor_start (GstDeviceMonitor * monitor)
+gst_pulse_device_provider_start (GstDeviceProvider * provider)
 {
-  GstPulseDeviceMonitor *self = GST_PULSE_DEVICE_MONITOR (monitor);
+  GstPulseDeviceProvider *self = GST_PULSE_DEVICE_PROVIDER (provider);
   pa_operation *initial_operation;
 
   if (!(self->mainloop = pa_threaded_mainloop_new ())) {
@@ -484,7 +484,7 @@ gst_pulse_device_monitor_start (GstDeviceMonitor * monitor)
 
 unlock_and_fail:
   pa_threaded_mainloop_unlock (self->mainloop);
-  gst_pulse_device_monitor_stop (monitor);
+  gst_pulse_device_provider_stop (provider);
   return FALSE;
 
 mainloop_failed:
@@ -497,9 +497,9 @@ cancel_and_fail:
 }
 
 static void
-gst_pulse_device_monitor_stop (GstDeviceMonitor * monitor)
+gst_pulse_device_provider_stop (GstDeviceProvider * provider)
 {
-  GstPulseDeviceMonitor *self = GST_PULSE_DEVICE_MONITOR (monitor);
+  GstPulseDeviceProvider *self = GST_PULSE_DEVICE_PROVIDER (provider);
 
   pa_threaded_mainloop_stop (self->mainloop);
 
similarity index 61%
rename from ext/pulse/pulsedevicemonitor.h
rename to ext/pulse/pulsedeviceprovider.h
index 100ba9b..8828721 100644 (file)
@@ -1,7 +1,7 @@
 /* GStreamer
  * Copyright (C) 2012 Olivier Crete <olivier.crete@collabora.com>
  *
- * pulsedevicemonitor.h: Device probing and monitoring
+ * pulsedeviceprovider.h: Device probing and monitoring
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -20,8 +20,8 @@
  */
 
 
-#ifndef __GST_PULSE_DEVICE_MONITOR_H__
-#define __GST_PULSE_DEVICE_MONITOR_H__
+#ifndef __GST_PULSE_DEVICE_PROVIDER_H__
+#define __GST_PULSE_DEVICE_PROVIDER_H__
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 
 G_BEGIN_DECLS
 
-typedef struct _GstPulseDeviceMonitor GstPulseDeviceMonitor;
-typedef struct _GstPulseDeviceMonitorPrivate GstPulseDeviceMonitorPrivate;
-typedef struct _GstPulseDeviceMonitorClass GstPulseDeviceMonitorClass;
+typedef struct _GstPulseDeviceProvider GstPulseDeviceProvider;
+typedef struct _GstPulseDeviceProviderPrivate GstPulseDeviceProviderPrivate;
+typedef struct _GstPulseDeviceProviderClass GstPulseDeviceProviderClass;
 
-#define GST_TYPE_PULSE_DEVICE_MONITOR                 (gst_pulse_device_monitor_get_type())
-#define GST_IS_PULSE_DEVICE_MONITOR(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PULSE_DEVICE_MONITOR))
-#define GST_IS_PULSE_DEVICE_MONITOR_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PULSE_DEVICE_MONITOR))
-#define GST_PULSE_DEVICE_MONITOR_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_PULSE_DEVICE_MONITOR, GstPulseDeviceMonitorClass))
-#define GST_PULSE_DEVICE_MONITOR(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PULSE_DEVICE_MONITOR, GstPulseDeviceMonitor))
-#define GST_PULSE_DEVICE_MONITOR_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DEVICE_MONITOR, GstPulseDeviceMonitorClass))
-#define GST_PULSE_DEVICE_MONITOR_CAST(obj)            ((GstPulseDeviceMonitor *)(obj))
+#define GST_TYPE_PULSE_DEVICE_PROVIDER                 (gst_pulse_device_provider_get_type())
+#define GST_IS_PULSE_DEVICE_PROVIDER(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PULSE_DEVICE_PROVIDER))
+#define GST_IS_PULSE_DEVICE_PROVIDER_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PULSE_DEVICE_PROVIDER))
+#define GST_PULSE_DEVICE_PROVIDER_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_PULSE_DEVICE_PROVIDER, GstPulseDeviceProviderClass))
+#define GST_PULSE_DEVICE_PROVIDER(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PULSE_DEVICE_PROVIDER, GstPulseDeviceProvider))
+#define GST_PULSE_DEVICE_PROVIDER_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DEVICE_PROVIDER, GstPulseDeviceProviderClass))
+#define GST_PULSE_DEVICE_PROVIDER_CAST(obj)            ((GstPulseDeviceProvider *)(obj))
 
-struct _GstPulseDeviceMonitor {
-  GstDeviceMonitor         parent;
+struct _GstPulseDeviceProvider {
+  GstDeviceProvider         parent;
 
   gchar *server;
   gchar *client_name;
@@ -61,11 +61,11 @@ typedef enum {
   GST_PULSE_DEVICE_TYPE_SINK
 } GstPulseDeviceType;
 
-struct _GstPulseDeviceMonitorClass {
-  GstDeviceMonitorClass    parent_class;
+struct _GstPulseDeviceProviderClass {
+  GstDeviceProviderClass    parent_class;
 };
 
-GType        gst_pulse_device_monitor_get_type (void);
+GType        gst_pulse_device_provider_get_type (void);
 
 
 typedef struct _GstPulseDevice GstPulseDevice;
@@ -95,4 +95,4 @@ struct _GstPulseDeviceClass {
 
 GType        gst_pulse_device_get_type (void);
 
-#endif /* __GST_PULSE_DEVICE_MONITOR_H__ */
+#endif /* __GST_PULSE_DEVICE_PROVIDER_H__ */
index 061609e..5ccea1a 100644 (file)
@@ -5,7 +5,7 @@ include $(top_srcdir)/common/gst-glib-gen.mak
 libgstvideo4linux2_la_SOURCES = gstv4l2.c \
                                gstv4l2allocator.c \
                                gstv4l2colorbalance.c \
-                               gstv4l2devicemonitor.c \
+                               gstv4l2deviceprovider.c \
                                gstv4l2object.c \
                                gstv4l2bufferpool.c \
                                gstv4l2sink.c \
@@ -47,7 +47,7 @@ noinst_HEADERS = \
        gstv4l2allocator.h \
        gstv4l2bufferpool.h \
        gstv4l2colorbalance.h \
-       gstv4l2devicemonitor.h \
+       gstv4l2deviceprovider.h \
        gstv4l2object.h \
        gstv4l2sink.h \
        gstv4l2src.h \
index d4871f8..08ff3f5 100644 (file)
@@ -43,7 +43,7 @@
 #include "gstv4l2sink.h"
 #include "gstv4l2radio.h"
 #include "gstv4l2videodec.h"
-#include "gstv4l2devicemonitor.h"
+#include "gstv4l2deviceprovider.h"
 #include "gstv4l2transform.h"
 
 /* used in v4l2_calls.c and v4l2src_calls.c */
@@ -199,8 +199,8 @@ plugin_init (GstPlugin * plugin)
           GST_TYPE_V4L2SINK) ||
       !gst_element_register (plugin, "v4l2radio", GST_RANK_NONE,
           GST_TYPE_V4L2RADIO) ||
-      !gst_device_monitor_register (plugin, "v4l2monitor",
-          GST_RANK_PRIMARY, GST_TYPE_V4L2_DEVICE_MONITOR) ||
+      !gst_device_provider_register (plugin, "v4l2deviceprovider",
+          GST_RANK_PRIMARY, GST_TYPE_V4L2_DEVICE_PROVIDER) ||
       /* etc. */
       !gst_v4l2_probe_and_register (plugin))
     return FALSE;
similarity index 74%
rename from sys/v4l2/gstv4l2devicemonitor.c
rename to sys/v4l2/gstv4l2deviceprovider.c
index f3f1c0b..e49e7e5 100644 (file)
@@ -1,7 +1,7 @@
 /* GStreamer
  * Copyright (C) 2012 Olivier Crete <olivier.crete@collabora.com>
  *
- * gstv4l2devicemonitor.c: V4l2 device probing and monitoring
+ * gstv4l2deviceprovider.c: V4l2 device probing and monitoring
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -23,7 +23,7 @@
 #include "config.h"
 #endif
 
-#include "gstv4l2devicemonitor.h"
+#include "gstv4l2deviceprovider.h"
 
 #include <string.h>
 #include <sys/stat.h>
@@ -42,61 +42,61 @@ static GstV4l2Device *gst_v4l2_device_new (const gchar * device_path,
     const gchar * device_name, GstCaps * caps, GstV4l2DeviceType type);
 
 
-G_DEFINE_TYPE (GstV4l2DeviceMonitor, gst_v4l2_device_monitor,
-    GST_TYPE_DEVICE_MONITOR);
+G_DEFINE_TYPE (GstV4l2DeviceProvider, gst_v4l2_device_provider,
+    GST_TYPE_DEVICE_PROVIDER);
 
-static void gst_v4l2_device_monitor_finalize (GObject * object);
-static GList *gst_v4l2_device_monitor_probe (GstDeviceMonitor * monitor);
+static void gst_v4l2_device_provider_finalize (GObject * object);
+static GList *gst_v4l2_device_provider_probe (GstDeviceProvider * provider);
 
 #if HAVE_GUDEV
-static gboolean gst_v4l2_device_monitor_start (GstDeviceMonitor * monitor);
-static void gst_v4l2_device_monitor_stop (GstDeviceMonitor * monitor);
+static gboolean gst_v4l2_device_provider_start (GstDeviceProvider * provider);
+static void gst_v4l2_device_provider_stop (GstDeviceProvider * provider);
 #endif
 
 
 static void
-gst_v4l2_device_monitor_class_init (GstV4l2DeviceMonitorClass * klass)
+gst_v4l2_device_provider_class_init (GstV4l2DeviceProviderClass * klass)
 {
-  GstDeviceMonitorClass *dm_class = GST_DEVICE_MONITOR_CLASS (klass);
+  GstDeviceProviderClass *dm_class = GST_DEVICE_PROVIDER_CLASS (klass);
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
-  dm_class->probe = gst_v4l2_device_monitor_probe;
+  dm_class->probe = gst_v4l2_device_provider_probe;
 
 #if HAVE_GUDEV
-  dm_class->start = gst_v4l2_device_monitor_start;
-  dm_class->stop = gst_v4l2_device_monitor_stop;
+  dm_class->start = gst_v4l2_device_provider_start;
+  dm_class->stop = gst_v4l2_device_provider_stop;
 #endif
 
-  gobject_class->finalize = gst_v4l2_device_monitor_finalize;
+  gobject_class->finalize = gst_v4l2_device_provider_finalize;
 
-  gst_device_monitor_class_set_static_metadata (dm_class,
-      "Video (video4linux2) Device Monitor", "Source/Sink/Video",
+  gst_device_provider_class_set_static_metadata (dm_class,
+      "Video (video4linux2) Device Provider", "Source/Sink/Video",
       "List and monitor video4linux2 source and sink devices",
       "Olivier Crete <olivier.crete@collabora.com>");
 }
 
 static void
-gst_v4l2_device_monitor_init (GstV4l2DeviceMonitor * monitor)
+gst_v4l2_device_provider_init (GstV4l2DeviceProvider * provider)
 {
 #if HAVE_GUDEV
-  g_cond_init (&monitor->started_cond);
+  g_cond_init (&provider->started_cond);
 #endif
 }
 
 static void
-gst_v4l2_device_monitor_finalize (GObject * object)
+gst_v4l2_device_provider_finalize (GObject * object)
 {
 #if HAVE_GUDEV
-  GstV4l2DeviceMonitor *monitor = GST_V4L2_DEVICE_MONITOR (object);
+  GstV4l2DeviceProvider *provider = GST_V4L2_DEVICE_PROVIDER (object);
 
-  g_cond_clear (&monitor->started_cond);
+  g_cond_clear (&provider->started_cond);
 #endif
 
-  G_OBJECT_CLASS (gst_v4l2_device_monitor_parent_class)->finalize (object);
+  G_OBJECT_CLASS (gst_v4l2_device_provider_parent_class)->finalize (object);
 }
 
 static GstV4l2Device *
-gst_v4l2_device_monitor_probe_device (GstV4l2DeviceMonitor * monitor,
+gst_v4l2_device_provider_probe_device (GstV4l2DeviceProvider * provider,
     const gchar * device_path, const gchar * device_name)
 {
   GstV4l2Object *v4l2obj;
@@ -111,7 +111,7 @@ gst_v4l2_device_monitor_probe_device (GstV4l2DeviceMonitor * monitor,
   if (!S_ISCHR (st.st_mode))
     return NULL;
 
-  v4l2obj = gst_v4l2_object_new ((GstElement *) monitor,
+  v4l2obj = gst_v4l2_object_new ((GstElement *) provider,
       V4L2_BUF_TYPE_VIDEO_CAPTURE, device_path, NULL, NULL, NULL);
 
   if (!gst_v4l2_open (v4l2obj))
@@ -129,7 +129,7 @@ gst_v4l2_device_monitor_probe_device (GstV4l2DeviceMonitor * monitor,
       type = GST_V4L2_DEVICE_TYPE_SINK;
     else
       /* We ignore M2M devices that are both capture and output for now
-       * The monitor is not for them
+       * The provider is not for them
        */
       goto close;
   }
@@ -160,9 +160,9 @@ destroy:
 
 
 static GList *
-gst_v4l2_device_monitor_probe (GstDeviceMonitor * monitor)
+gst_v4l2_device_provider_probe (GstDeviceProvider * provider)
 {
-  GstV4l2DeviceMonitor *self = GST_V4L2_DEVICE_MONITOR (monitor);
+  GstV4l2DeviceProvider *self = GST_V4L2_DEVICE_PROVIDER (provider);
   GstV4l2Iterator *it;
   GList *devices = NULL;
 
@@ -171,7 +171,8 @@ gst_v4l2_device_monitor_probe (GstDeviceMonitor * monitor)
   while (gst_v4l2_iterator_next (it)) {
     GstV4l2Device *device;
 
-    device = gst_v4l2_device_monitor_probe_device (self, it->device_path, NULL);
+    device =
+        gst_v4l2_device_provider_probe_device (self, it->device_path, NULL);
 
     if (device) {
       gst_object_ref_sink (device);
@@ -187,7 +188,7 @@ gst_v4l2_device_monitor_probe (GstDeviceMonitor * monitor)
 #if HAVE_GUDEV
 
 static GstDevice *
-gst_v4l2_device_monitor_device_from_udev (GstV4l2DeviceMonitor * monitor,
+gst_v4l2_device_provider_device_from_udev (GstV4l2DeviceProvider * provider,
     GUdevDevice * udev_device)
 {
   GstV4l2Device *gstdev;
@@ -200,7 +201,7 @@ gst_v4l2_device_monitor_device_from_udev (GstV4l2DeviceMonitor * monitor,
   if (!device_name)
     device_name = g_udev_device_get_property (udev_device, "ID_MODEL");
 
-  gstdev = gst_v4l2_device_monitor_probe_device (monitor, device_path,
+  gstdev = gst_v4l2_device_provider_probe_device (provider, device_path,
       device_name);
 
   if (gstdev)
@@ -211,9 +212,9 @@ gst_v4l2_device_monitor_device_from_udev (GstV4l2DeviceMonitor * monitor,
 
 static void
 uevent_cb (GUdevClient * client, const gchar * action, GUdevDevice * device,
-    GstV4l2DeviceMonitor * self)
+    GstV4l2DeviceProvider * self)
 {
-  GstDeviceMonitor *monitor = GST_DEVICE_MONITOR (self);
+  GstDeviceProvider *provider = GST_DEVICE_PROVIDER (self);
 
   /* Not V4L2, ignoring */
   if (g_udev_device_get_property_as_int (device, "ID_V4L_VERSION") != 2)
@@ -222,16 +223,16 @@ uevent_cb (GUdevClient * client, const gchar * action, GUdevDevice * device,
   if (!strcmp (action, "add")) {
     GstDevice *gstdev = NULL;
 
-    gstdev = gst_v4l2_device_monitor_device_from_udev (self, device);
+    gstdev = gst_v4l2_device_provider_device_from_udev (self, device);
 
     if (gstdev)
-      gst_device_monitor_device_add (monitor, gstdev);
+      gst_device_provider_device_add (provider, gstdev);
   } else if (!strcmp (action, "remove")) {
     GstV4l2Device *gstdev = NULL;
     GList *item;
 
     GST_OBJECT_LOCK (self);
-    for (item = monitor->devices; item; item = item->next) {
+    for (item = provider->devices; item; item = item->next) {
       gstdev = item->data;
 
       if (!strcmp (gstdev->syspath, g_udev_device_get_sysfs_path (device))) {
@@ -241,10 +242,10 @@ uevent_cb (GUdevClient * client, const gchar * action, GUdevDevice * device,
 
       gstdev = NULL;
     }
-    GST_OBJECT_UNLOCK (monitor);
+    GST_OBJECT_UNLOCK (provider);
 
     if (gstdev) {
-      gst_device_monitor_device_remove (monitor, GST_DEVICE (gstdev));
+      gst_device_provider_device_remove (provider, GST_DEVICE (gstdev));
       g_object_unref (gstdev);
     }
   } else {
@@ -253,34 +254,34 @@ uevent_cb (GUdevClient * client, const gchar * action, GUdevDevice * device,
 }
 
 static gpointer
-monitor_thread (gpointer data)
+provider_thread (gpointer data)
 {
-  GstV4l2DeviceMonitor *monitor = data;
+  GstV4l2DeviceProvider *provider = data;
   GMainContext *context = NULL;
   GMainLoop *loop = NULL;
   GUdevClient *client;
   GList *devices;
   static const gchar *subsystems[] = { "video4linux", NULL };
 
-  GST_OBJECT_LOCK (monitor);
-  if (monitor->context)
-    context = g_main_context_ref (monitor->context);
-  if (monitor->loop)
-    loop = g_main_loop_ref (monitor->loop);
+  GST_OBJECT_LOCK (provider);
+  if (provider->context)
+    context = g_main_context_ref (provider->context);
+  if (provider->loop)
+    loop = g_main_loop_ref (provider->loop);
 
   if (context == NULL || loop == NULL) {
-    monitor->started = TRUE;
-    g_cond_broadcast (&monitor->started_cond);
-    GST_OBJECT_UNLOCK (monitor);
+    provider->started = TRUE;
+    g_cond_broadcast (&provider->started_cond);
+    GST_OBJECT_UNLOCK (provider);
     return NULL;
   }
-  GST_OBJECT_UNLOCK (monitor);
+  GST_OBJECT_UNLOCK (provider);
 
   g_main_context_push_thread_default (context);
 
   client = g_udev_client_new (subsystems);
 
-  g_signal_connect (client, "uevent", G_CALLBACK (uevent_cb), monitor);
+  g_signal_connect (client, "uevent", G_CALLBACK (uevent_cb), provider);
 
   devices = g_udev_client_query_by_subsystem (client, "video4linux");
 
@@ -291,18 +292,19 @@ monitor_thread (gpointer data)
     devices = g_list_remove (devices, udev_device);
 
     if (g_udev_device_get_property_as_int (udev_device, "ID_V4L_VERSION") == 2) {
-      gstdev = gst_v4l2_device_monitor_device_from_udev (monitor, udev_device);
+      gstdev =
+          gst_v4l2_device_provider_device_from_udev (provider, udev_device);
       if (gstdev)
-        gst_device_monitor_device_add (GST_DEVICE_MONITOR (monitor), gstdev);
+        gst_device_provider_device_add (GST_DEVICE_PROVIDER (provider), gstdev);
     }
 
     g_object_unref (udev_device);
   }
 
-  GST_OBJECT_LOCK (monitor);
-  monitor->started = TRUE;
-  g_cond_broadcast (&monitor->started_cond);
-  GST_OBJECT_UNLOCK (monitor);
+  GST_OBJECT_LOCK (provider);
+  provider->started = TRUE;
+  g_cond_broadcast (&provider->started_cond);
+  GST_OBJECT_UNLOCK (provider);
 
   g_main_loop_run (loop);
   g_main_loop_unref (loop);
@@ -310,15 +312,15 @@ monitor_thread (gpointer data)
   g_object_unref (client);
   g_main_context_unref (context);
 
-  gst_object_unref (monitor);
+  gst_object_unref (provider);
 
   return NULL;
 }
 
 static gboolean
-gst_v4l2_device_monitor_start (GstDeviceMonitor * monitor)
+gst_v4l2_device_provider_start (GstDeviceProvider * provider)
 {
-  GstV4l2DeviceMonitor *self = GST_V4L2_DEVICE_MONITOR (monitor);
+  GstV4l2DeviceProvider *self = GST_V4L2_DEVICE_PROVIDER (provider);
 
   GST_OBJECT_LOCK (self);
   g_assert (self->context == NULL);
@@ -326,7 +328,7 @@ gst_v4l2_device_monitor_start (GstDeviceMonitor * monitor)
   self->context = g_main_context_new ();
   self->loop = g_main_loop_new (self->context, FALSE);
 
-  self->thread = g_thread_new ("v4l2-device-monitor", monitor_thread,
+  self->thread = g_thread_new ("v4l2-device-provider", provider_thread,
       g_object_ref (self));
 
   while (self->started == FALSE)
@@ -338,9 +340,9 @@ gst_v4l2_device_monitor_start (GstDeviceMonitor * monitor)
 }
 
 static void
-gst_v4l2_device_monitor_stop (GstDeviceMonitor * monitor)
+gst_v4l2_device_provider_stop (GstDeviceProvider * provider)
 {
-  GstV4l2DeviceMonitor *self = GST_V4L2_DEVICE_MONITOR (monitor);
+  GstV4l2DeviceProvider *self = GST_V4L2_DEVICE_PROVIDER (provider);
   GMainContext *context;
   GMainLoop *loop;
   GSource *idle_stop_source;
similarity index 62%
rename from sys/v4l2/gstv4l2devicemonitor.h
rename to sys/v4l2/gstv4l2deviceprovider.h
index 4e3050e..8e979ad 100644 (file)
@@ -1,7 +1,7 @@
 /* GStreamer
  * Copyright (C) 2012 Olivier Crete <olivier.crete@collabora.com>
  *
- * gstv4l2devicemonitor.h: V4l2 device probing and monitoring
+ * gstv4l2deviceprovider.h: V4l2 device probing and monitoring
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -20,8 +20,8 @@
  */
 
 
-#ifndef __GST_V4L2_DEVICE_MONITOR_H__
-#define __GST_V4L2_DEVICE_MONITOR_H__
+#ifndef __GST_V4L2_DEVICE_PROVIDER_H__
+#define __GST_V4L2_DEVICE_PROVIDER_H__
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 
 G_BEGIN_DECLS
 
-typedef struct _GstV4l2DeviceMonitor GstV4l2DeviceMonitor;
-typedef struct _GstV4l2DeviceMonitorPrivate GstV4l2DeviceMonitorPrivate;
-typedef struct _GstV4l2DeviceMonitorClass GstV4l2DeviceMonitorClass;
+typedef struct _GstV4l2DeviceProvider GstV4l2DeviceProvider;
+typedef struct _GstV4l2DeviceProviderPrivate GstV4l2DeviceProviderPrivate;
+typedef struct _GstV4l2DeviceProviderClass GstV4l2DeviceProviderClass;
 
-#define GST_TYPE_V4L2_DEVICE_MONITOR                 (gst_v4l2_device_monitor_get_type())
-#define GST_IS_V4L2_DEVICE_MONITOR(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_V4L2_DEVICE_MONITOR))
-#define GST_IS_V4L2_DEVICE_MONITOR_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_V4L2_DEVICE_MONITOR))
-#define GST_V4L2_DEVICE_MONITOR_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_V4L2_DEVICE_MONITOR, GstV4l2DeviceMonitorClass))
-#define GST_V4L2_DEVICE_MONITOR(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_V4L2_DEVICE_MONITOR, GstV4l2DeviceMonitor))
-#define GST_V4L2_DEVICE_MONITOR_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DEVICE_MONITOR, GstV4l2DeviceMonitorClass))
-#define GST_V4L2_DEVICE_MONITOR_CAST(obj)            ((GstV4l2DeviceMonitor *)(obj))
+#define GST_TYPE_V4L2_DEVICE_PROVIDER                 (gst_v4l2_device_provider_get_type())
+#define GST_IS_V4L2_DEVICE_PROVIDER(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_V4L2_DEVICE_PROVIDER))
+#define GST_IS_V4L2_DEVICE_PROVIDER_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_V4L2_DEVICE_PROVIDER))
+#define GST_V4L2_DEVICE_PROVIDER_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_V4L2_DEVICE_PROVIDER, GstV4l2DeviceProviderClass))
+#define GST_V4L2_DEVICE_PROVIDER(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_V4L2_DEVICE_PROVIDER, GstV4l2DeviceProvider))
+#define GST_V4L2_DEVICE_PROVIDER_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DEVICE_PROVIDER, GstV4l2DeviceProviderClass))
+#define GST_V4L2_DEVICE_PROVIDER_CAST(obj)            ((GstV4l2DeviceProvider *)(obj))
 
-struct _GstV4l2DeviceMonitor {
-  GstDeviceMonitor         parent;
+struct _GstV4l2DeviceProvider {
+  GstDeviceProvider         parent;
 
 #ifdef HAVE_GUDEV
   GMainContext *context;
@@ -65,11 +65,11 @@ typedef enum {
   GST_V4L2_DEVICE_TYPE_SINK
 } GstV4l2DeviceType;
 
-struct _GstV4l2DeviceMonitorClass {
-  GstDeviceMonitorClass    parent_class;
+struct _GstV4l2DeviceProviderClass {
+  GstDeviceProviderClass    parent_class;
 };
 
-GType        gst_v4l2_device_monitor_get_type (void);
+GType        gst_v4l2_device_provider_get_type (void);
 
 
 typedef struct _GstV4l2Device GstV4l2Device;
@@ -98,4 +98,4 @@ struct _GstV4l2DeviceClass {
 
 GType        gst_v4l2_device_get_type (void);
 
-#endif /* __GST_V4L2_DEVICE_MONITOR_H__ */
+#endif /* __GST_V4L2_DEVICE_PROVIDER_H__ */