Commit a9c38568 authored by Olivier Crête's avatar Olivier Crête

Rename GstDeviceMonitor to GstDeviceProvider

parent e4f0133c
......@@ -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
......@@ -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");
......
/* 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);
......
/* 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"
......@@ -34,20 +34,20 @@
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__ */
......@@ -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 \
......
......@@ -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;
......
/* 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