Commit 7992174a authored by Olivier Crête's avatar Olivier Crête 👻

DeviceProvider: Rename from DeviceMonitor

parent 4720e6d0
......@@ -117,10 +117,10 @@ Windows. It is released under the GNU Library General Public License
<chapter id="gstreamer-device-probing">
<title>GStreamer Device Discovery and Device Probing</title>
<xi:include href="xml/gstdevice.xml" />
<xi:include href="xml/gstdevicemonitor.xml" />
<xi:include href="xml/gstdevicemonitorfactory.xml" />
<xi:include href="xml/gstglobaldevicemonitor.xml" />
<xi:include href="xml/gstdevice.xml" />
<xi:include href="xml/gstdeviceprovider.xml" />
<xi:include href="xml/gstdeviceproviderfactory.xml" />
</chapter>
<chapter id="gstreamer-support">
......
......@@ -3353,61 +3353,61 @@ gst_device_get_type
</SECTION>
<SECTION>
<FILE>gstdevicemonitor</FILE>
<TITLE>GstDeviceMonitor</TITLE>
GstDeviceMonitor
GstDeviceMonitorClass
gst_device_monitor_can_monitor
gst_device_monitor_class_add_metadata
gst_device_monitor_class_add_static_metadata
gst_device_monitor_class_get_metadata
gst_device_monitor_class_set_metadata
gst_device_monitor_class_set_static_metadata
gst_device_monitor_device_add
gst_device_monitor_device_remove
gst_device_monitor_get_bus
gst_device_monitor_get_devices
gst_device_monitor_get_factory
gst_device_monitor_register
gst_device_monitor_start
gst_device_monitor_stop
<FILE>gstdeviceprovider</FILE>
<TITLE>GstDeviceProvider</TITLE>
GstDeviceProvider
GstDeviceProviderClass
gst_device_provider_can_monitor
gst_device_provider_class_add_metadata
gst_device_provider_class_add_static_metadata
gst_device_provider_class_get_metadata
gst_device_provider_class_set_metadata
gst_device_provider_class_set_static_metadata
gst_device_provider_device_add
gst_device_provider_device_remove
gst_device_provider_get_bus
gst_device_provider_get_devices
gst_device_provider_get_factory
gst_device_provider_register
gst_device_provider_start
gst_device_provider_stop
<SUBSECTION Standard>
GstDevicePrivate
GST_DEVICE_MONITOR
GST_DEVICE_MONITOR_CAST
GST_DEVICE_MONITOR_CLASS
GST_DEVICE_MONITOR_GET_CLASS
GST_IS_DEVICE_MONITOR
GST_IS_DEVICE_MONITOR_CLASS
GST_TYPE_DEVICE_MONITOR
gst_device_monitor_get_type
GST_DEVICE_PROVIDER
GST_DEVICE_PROVIDER_CAST
GST_DEVICE_PROVIDER_CLASS
GST_DEVICE_PROVIDER_GET_CLASS
GST_IS_DEVICE_PROVIDER
GST_IS_DEVICE_PROVIDER_CLASS
GST_TYPE_DEVICE_PROVIDER
gst_device_provider_get_type
</SECTION>
<SECTION>
<FILE>gstdevicemonitorfactory</FILE>
<TITLE>GstDeviceMonitorFactory</TITLE>
GstDeviceMonitorFactory
GstDeviceMonitorFactoryClass
gst_device_monitor_factory_find
gst_device_monitor_factory_get
gst_device_monitor_factory_get_by_name
gst_device_monitor_factory_get_device_monitor_type
gst_device_monitor_factory_get_metadata
gst_device_monitor_factory_get_metadata_keys
gst_device_monitor_factory_has_classes
gst_device_monitor_factory_has_classesv
gst_device_monitor_factory_list_get_device_monitors
<FILE>gstdeviceproviderfactory</FILE>
<TITLE>GstDeviceProviderFactory</TITLE>
GstDeviceProviderFactory
GstDeviceProviderFactoryClass
gst_device_provider_factory_find
gst_device_provider_factory_get
gst_device_provider_factory_get_by_name
gst_device_provider_factory_get_device_provider_type
gst_device_provider_factory_get_metadata
gst_device_provider_factory_get_metadata_keys
gst_device_provider_factory_has_classes
gst_device_provider_factory_has_classesv
gst_device_provider_factory_list_get_device_providers
<SUBSECTION Standard>
GstDeviceMonitorPrivate
GST_DEVICE_MONITOR_FACTORY
GST_DEVICE_MONITOR_FACTORY_CAST
GST_DEVICE_MONITOR_FACTORY_CLASS
GST_TYPE_DEVICE_MONITOR_FACTORY
GST_IS_DEVICE_MONITOR_FACTORY
GST_IS_DEVICE_MONITOR_FACTORY_CLASS
gst_device_monitor_factory_get_type
GstDeviceProviderPrivate
GST_DEVICE_PROVIDER_FACTORY
GST_DEVICE_PROVIDER_FACTORY_CAST
GST_DEVICE_PROVIDER_FACTORY_CLASS
GST_TYPE_DEVICE_PROVIDER_FACTORY
GST_IS_DEVICE_PROVIDER_FACTORY
GST_IS_DEVICE_PROVIDER_FACTORY_CLASS
gst_device_provider_factory_get_type
</SECTION>
<SECTION>
......
......@@ -36,7 +36,7 @@ GObject
GstPadTemplate
GstPlugin
GstPluginFeature
GstDeviceMonitorFactory
GstDeviceProviderFactory
GstElementFactory
GstTypeFindFactory
GstRegistry
......
......@@ -72,8 +72,8 @@ libgstreamer_@GST_API_VERSION@_la_SOURCES = \
gstdatetime.c \
gstdebugutils.c \
gstdevice.c \
gstdevicemonitor.c \
gstdevicemonitorfactory.c \
gstdeviceprovider.c \
gstdeviceproviderfactory.c \
gstelement.c \
gstelementfactory.c \
gsterror.c \
......@@ -177,8 +177,8 @@ gst_headers = \
gstelement.h \
gstelementmetadata.h \
gstdevice.h \
gstdevicemonitor.h \
gstdevicemonitorfactory.h \
gstdeviceprovider.h \
gstdeviceproviderfactory.h \
gstelementfactory.h \
gsterror.h \
gstevent.h \
......
......@@ -43,7 +43,7 @@
#include <gst/gstdatetime.h>
#include <gst/gstdebugutils.h>
#include <gst/gstdevice.h>
#include <gst/gstdevicemonitor.h>
#include <gst/gstdeviceprovider.h>
#include <gst/gstelement.h>
#include <gst/gstelementmetadata.h>
#include <gst/gsterror.h>
......
......@@ -54,8 +54,8 @@ extern const char g_log_domain_gstreamer[];
/* for GstElement */
#include "gstelement.h"
/* for GstDeviceMonitor */
#include "gstdevicemonitor.h"
/* for GstDeviceProvider */
#include "gstdeviceprovider.h"
/* for GstToc */
#include "gsttoc.h"
......@@ -399,19 +399,19 @@ struct _GstElementFactoryClass {
gpointer _gst_reserved[GST_PADDING];
};
struct _GstDeviceMonitorFactory {
struct _GstDeviceProviderFactory {
GstPluginFeature feature;
/* <private> */
GType type; /* unique GType the device factory or 0 if not loaded */
volatile GstDeviceMonitor *monitor;
volatile GstDeviceProvider *provider;
gpointer metadata;
gpointer _gst_reserved[GST_PADDING];
};
struct _GstDeviceMonitorFactoryClass {
struct _GstDeviceProviderFactoryClass {
GstPluginFeatureClass parent;
/* <private> */
......
......@@ -22,13 +22,13 @@
/**
* SECTION:gstdevice
* @short_description: Object representing a device
* @see_also: #GstDeviceMonitor
* @see_also: #GstDeviceProvider
*
* #GstDevice are objects representing a device, they contain
* relevant metadata about the device, such as its class and the #GstCaps
* representing the media types it can produce or handle.
*
* #GstDevice are created by #GstDeviceMonitor objects which can be
* #GstDevice are created by #GstDeviceProvider objects which can be
* aggregated by #GstGlobalDeviceMonitor objects.
*
* Since: 1.4
......@@ -239,7 +239,7 @@ gst_device_get_display_name (GstDevice * device)
*
* Gets the "class" of a device. This is a "/" separated list of
* classes that represent this device. They are a subset of the
* classes of the #GstDeviceMonitor that produced this device.
* classes of the #GstDeviceProvider that produced this device.
*
* Returns: The device class. Free with g_free() after use.
*
......
/* GStreamer
* Copyright (C) 2012 Olivier Crete <olivier.crete@collabora.com>
*
* gstdevicemonitor.h: Device probing and monitoring
* gstdeviceprovider.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
......@@ -19,39 +19,39 @@
* Boston, MA 02111-1307, USA.
*/
#include <gst/gstdevicemonitorfactory.h>
#include <gst/gstdeviceproviderfactory.h>
#ifndef __GST_DEVICE_MONITOR_H__
#define __GST_DEVICE_MONITOR_H__
#ifndef __GST_DEVICE_PROVIDER_H__
#define __GST_DEVICE_PROVIDER_H__
#include <gst/gstelement.h>
G_BEGIN_DECLS
typedef struct _GstDeviceMonitor GstDeviceMonitor;
typedef struct _GstDeviceMonitorClass GstDeviceMonitorClass;
typedef struct _GstDeviceMonitorPrivate GstDeviceMonitorPrivate;
typedef struct _GstDeviceProvider GstDeviceProvider;
typedef struct _GstDeviceProviderClass GstDeviceProviderClass;
typedef struct _GstDeviceProviderPrivate GstDeviceProviderPrivate;
#define GST_TYPE_DEVICE_MONITOR (gst_device_monitor_get_type())
#define GST_IS_DEVICE_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DEVICE_MONITOR))
#define GST_IS_DEVICE_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_DEVICE_MONITOR))
#define GST_DEVICE_MONITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_DEVICE_MONITOR, GstDeviceMonitorClass))
#define GST_DEVICE_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DEVICE_MONITOR, GstDeviceMonitor))
#define GST_DEVICE_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DEVICE_MONITOR, GstDeviceMonitorClass))
#define GST_DEVICE_MONITOR_CAST(obj) ((GstDeviceMonitor *)(obj))
#define GST_TYPE_DEVICE_PROVIDER (gst_device_provider_get_type())
#define GST_IS_DEVICE_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DEVICE_PROVIDER))
#define GST_IS_DEVICE_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_DEVICE_PROVIDER))
#define GST_DEVICE_PROVIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_DEVICE_PROVIDER, GstDeviceProviderClass))
#define GST_DEVICE_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DEVICE_PROVIDER, GstDeviceProvider))
#define GST_DEVICE_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DEVICE_PROVIDER, GstDeviceProviderClass))
#define GST_DEVICE_PROVIDER_CAST(obj) ((GstDeviceProvider *)(obj))
/**
* GstDeviceMonitor:
* GstDeviceProvider:
* @parent: The parent #GstObject
* @devices: a #GList of the #GstDevice objects
*
* The structure of the base #GstDeviceMonitor
* The structure of the base #GstDeviceProvider
*
* Since: 1.4
*/
struct _GstDeviceMonitor {
struct _GstDeviceProvider {
GstObject parent;
/* Protected by the Object lock */
......@@ -59,16 +59,16 @@ struct _GstDeviceMonitor {
/*< private >*/
GstDeviceMonitorPrivate *priv;
GstDeviceProviderPrivate *priv;
gpointer _gst_reserved[GST_PADDING];
};
/**
* GstDeviceMonitorClass:
* GstDeviceProviderClass:
* @parent_class: the parent #GstObjectClass structure
* @factory: a pointer to the #GstDeviceMonitorFactory that creates this
* monitor
* @factory: a pointer to the #GstDeviceProviderFactory that creates this
* provider
* @probe: Returns a list of devices that are currently available.
* This should never block.
* @start: Starts monitoring for new devices. Only subclasses that can know
......@@ -76,20 +76,20 @@ struct _GstDeviceMonitor {
* @stop: Stops monitoring for new devices. Only subclasses that implement
* the start() method need to implement this method.
*
* The structure of the base #GstDeviceMonitorClass
* The structure of the base #GstDeviceProviderClass
*
* Since: 1.4
*/
struct _GstDeviceMonitorClass {
struct _GstDeviceProviderClass {
GstObjectClass parent_class;
GstDeviceMonitorFactory *factory;
GstDeviceProviderFactory *factory;
GList* (*probe) (GstDeviceMonitor * monitor);
GList* (*probe) (GstDeviceProvider * provider);
gboolean (*start) (GstDeviceMonitor * monitor);
void (*stop) (GstDeviceMonitor * monitor);
gboolean (*start) (GstDeviceProvider * provider);
void (*stop) (GstDeviceProvider * provider);
/*< private >*/
gpointer metadata;
......@@ -98,45 +98,45 @@ struct _GstDeviceMonitorClass {
gpointer _gst_reserved[GST_PADDING];
};
GType gst_device_monitor_get_type (void);
GType gst_device_provider_get_type (void);
GList * gst_device_monitor_get_devices (GstDeviceMonitor * monitor);
GList * gst_device_provider_get_devices (GstDeviceProvider * provider);
gboolean gst_device_monitor_start (GstDeviceMonitor * monitor);
void gst_device_monitor_stop (GstDeviceMonitor * monitor);
gboolean gst_device_provider_start (GstDeviceProvider * provider);
void gst_device_provider_stop (GstDeviceProvider * provider);
gboolean gst_device_monitor_can_monitor (GstDeviceMonitor * monitor);
gboolean gst_device_provider_can_monitor (GstDeviceProvider * provider);
GstBus * gst_device_monitor_get_bus (GstDeviceMonitor * monitor);
GstBus * gst_device_provider_get_bus (GstDeviceProvider * provider);
void gst_device_monitor_device_add (GstDeviceMonitor * monitor,
void gst_device_provider_device_add (GstDeviceProvider * provider,
GstDevice * device);
void gst_device_monitor_device_remove (GstDeviceMonitor * monitor,
void gst_device_provider_device_remove (GstDeviceProvider * provider,
GstDevice * device);
/* device monitor class meta data */
void gst_device_monitor_class_set_metadata (GstDeviceMonitorClass *klass,
/* device provider class meta data */
void gst_device_provider_class_set_metadata (GstDeviceProviderClass *klass,
const gchar *longname,
const gchar *classification,
const gchar *description,
const gchar *author);
void gst_device_monitor_class_set_static_metadata (GstDeviceMonitorClass *klass,
void gst_device_provider_class_set_static_metadata (GstDeviceProviderClass *klass,
const gchar *longname,
const gchar *classification,
const gchar *description,
const gchar *author);
void gst_device_monitor_class_add_metadata (GstDeviceMonitorClass * klass,
void gst_device_provider_class_add_metadata (GstDeviceProviderClass * klass,
const gchar * key, const gchar * value);
void gst_device_monitor_class_add_static_metadata (GstDeviceMonitorClass * klass,
void gst_device_provider_class_add_static_metadata (GstDeviceProviderClass * klass,
const gchar * key, const gchar * value);
const gchar * gst_device_monitor_class_get_metadata (GstDeviceMonitorClass * klass,
const gchar * gst_device_provider_class_get_metadata (GstDeviceProviderClass * klass,
const gchar * key);
/* factory management */
GstDeviceMonitorFactory * gst_device_monitor_get_factory (GstDeviceMonitor * monitor);
GstDeviceProviderFactory * gst_device_provider_get_factory (GstDeviceProvider * provider);
G_END_DECLS
#endif /* __GST_DEVICE_MONITOR_H__ */
#endif /* __GST_DEVICE_PROVIDER_H__ */
......@@ -3,7 +3,7 @@
* 2000,2004 Wim Taymans <wim@fluendo.com>
* 2012 Olivier Crete <olivier.crete@collabora.com>
*
* gstdevicemonitorfactory.h: Header for GstDeviceMonitorFactory
* gstdeviceproviderfactory.h: Header for GstDeviceProviderFactory
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -23,68 +23,68 @@
#ifndef __GST_DEVICE_MONITOR_FACTORY_H__
#define __GST_DEVICE_MONITOR_FACTORY_H__
#ifndef __GST_DEVICE_PROVIDER_FACTORY_H__
#define __GST_DEVICE_PROVIDER_FACTORY_H__
/**
* GstDeviceMonitorFactory:
* GstDeviceProviderFactory:
*
* The opaque #GstDeviceMonitorFactory data structure.
* The opaque #GstDeviceProviderFactory data structure.
*
* Since: 1.4
*/
/**
* GstDeviceMonitorFactoryClass:
* GstDeviceProviderFactoryClass:
*
* The opaque #GstDeviceMonitorFactoryClass data structure.
* The opaque #GstDeviceProviderFactoryClass data structure.
*
* Since: 1.4
*/
typedef struct _GstDeviceMonitorFactory GstDeviceMonitorFactory;
typedef struct _GstDeviceMonitorFactoryClass GstDeviceMonitorFactoryClass;
typedef struct _GstDeviceProviderFactory GstDeviceProviderFactory;
typedef struct _GstDeviceProviderFactoryClass GstDeviceProviderFactoryClass;
#include <gst/gstconfig.h>
#include <gst/gstplugin.h>
#include <gst/gstpluginfeature.h>
#include <gst/gstdevicemonitor.h>
#include <gst/gstdeviceprovider.h>
G_BEGIN_DECLS
#define GST_TYPE_DEVICE_MONITOR_FACTORY (gst_device_monitor_factory_get_type())
#define GST_DEVICE_MONITOR_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DEVICE_MONITOR_FACTORY,\
GstDeviceMonitorFactory))
#define GST_DEVICE_MONITOR_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DEVICE_MONITOR_FACTORY,\
GstDeviceMonitorFactoryClass))
#define GST_IS_DEVICE_MONITOR_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DEVICE_MONITOR_FACTORY))
#define GST_IS_DEVICE_MONITOR_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DEVICE_MONITOR_FACTORY))
#define GST_DEVICE_MONITOR_FACTORY_CAST(obj) ((GstDeviceMonitorFactory *)(obj))
#define GST_TYPE_DEVICE_PROVIDER_FACTORY (gst_device_provider_factory_get_type())
#define GST_DEVICE_PROVIDER_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DEVICE_PROVIDER_FACTORY,\
GstDeviceProviderFactory))
#define GST_DEVICE_PROVIDER_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DEVICE_PROVIDER_FACTORY,\
GstDeviceProviderFactoryClass))
#define GST_IS_DEVICE_PROVIDER_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DEVICE_PROVIDER_FACTORY))
#define GST_IS_DEVICE_PROVIDER_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DEVICE_PROVIDER_FACTORY))
#define GST_DEVICE_PROVIDER_FACTORY_CAST(obj) ((GstDeviceProviderFactory *)(obj))
GType gst_device_monitor_factory_get_type (void);
GType gst_device_provider_factory_get_type (void);
GstDeviceMonitorFactory * gst_device_monitor_factory_find (const gchar *name);
GstDeviceProviderFactory * gst_device_provider_factory_find (const gchar *name);
GType gst_device_monitor_factory_get_device_monitor_type (GstDeviceMonitorFactory *factory);
GType gst_device_provider_factory_get_device_provider_type (GstDeviceProviderFactory *factory);
const gchar * gst_device_monitor_factory_get_metadata (GstDeviceMonitorFactory *factory, const gchar *key);
gchar ** gst_device_monitor_factory_get_metadata_keys (GstDeviceMonitorFactory *factory);
const gchar * gst_device_provider_factory_get_metadata (GstDeviceProviderFactory *factory, const gchar *key);
gchar ** gst_device_provider_factory_get_metadata_keys (GstDeviceProviderFactory *factory);
GstDeviceMonitor* gst_device_monitor_factory_get (GstDeviceMonitorFactory *factory) G_GNUC_MALLOC;
GstDeviceMonitor* gst_device_monitor_factory_get_by_name (const gchar *factoryname) G_GNUC_MALLOC;
GstDeviceProvider* gst_device_provider_factory_get (GstDeviceProviderFactory *factory) G_GNUC_MALLOC;
GstDeviceProvider* gst_device_provider_factory_get_by_name (const gchar *factoryname) G_GNUC_MALLOC;
gboolean gst_device_monitor_register (GstPlugin *plugin, const gchar *name,
gboolean gst_device_provider_register (GstPlugin *plugin, const gchar *name,
guint rank,
GType type);
gboolean gst_device_monitor_factory_has_classesv (GstDeviceMonitorFactory * factory,
gboolean gst_device_provider_factory_has_classesv (GstDeviceProviderFactory * factory,
gchar ** classes);
gboolean gst_device_monitor_factory_has_classes (GstDeviceMonitorFactory *factory,
gboolean gst_device_provider_factory_has_classes (GstDeviceProviderFactory *factory,
const gchar * classes);
GList * gst_device_monitor_factory_list_get_device_monitors (const gchar *classes,
GList * gst_device_provider_factory_list_get_device_providers (const gchar *classes,
GstRank minrank) G_GNUC_MALLOC;
G_END_DECLS
#endif /* __GST_DEVICE_MONITOR_FACTORY_H__ */
#endif /* __GST_DEVICE_PROVIDER_FACTORY_H__ */
......@@ -22,12 +22,12 @@
/**
* SECTION:gstglobaldevicemonitor
* @short_description: A global device monitor and prober
* @see_also: #GstDevice, #GstDeviceMonitor
* @see_also: #GstDevice, #GstDeviceProvider
*
* Applications should create a #GstGlobalDeviceMonitor when they want
* to probe, list and monitor devices of a specific type. The
* #GstGlobalDeviceMonitor will create the appropriate
* #GstDeviceMonitor objects and manage them. It will then post
* #GstDeviceProvider objects and manage them. It will then post
* messages on its #GstBus for devices that have been added and
* removed.
*
......@@ -48,7 +48,7 @@ struct _GstGlobalDeviceMonitorPrivate
GstBus *bus;
GPtrArray *monitors;
GPtrArray *providers;
guint cookie;
GstCaps *caps;
......@@ -111,28 +111,28 @@ gst_global_device_monitor_init (GstGlobalDeviceMonitor * self)
self->priv->bus = gst_bus_new ();
gst_bus_set_flushing (self->priv->bus, TRUE);
self->priv->monitors = g_ptr_array_new ();
self->priv->providers = g_ptr_array_new ();
self->priv->caps = gst_caps_new_any ();
self->priv->classes = g_strdup ("");
factories =
gst_device_monitor_factory_list_get_device_monitors (self->priv->classes,
1);
gst_device_provider_factory_list_get_device_providers (self->priv->
classes, 1);
while (factories) {
GstDeviceMonitorFactory *factory = factories->data;
GstDeviceMonitor *monitor;
GstDeviceProviderFactory *factory = factories->data;
GstDeviceProvider *provider;
factories = g_list_remove (factories, factory);
monitor = gst_device_monitor_factory_get (factory);
if (monitor) {
GstBus *bus = gst_device_monitor_get_bus (monitor);
provider = gst_device_provider_factory_get (factory);
if (provider) {
GstBus *bus = gst_device_provider_get_bus (provider);
gst_bus_enable_sync_message_emission (bus);
g_signal_connect (bus, "sync-message",
G_CALLBACK (bus_sync_message), self);
g_ptr_array_add (self->priv->monitors, monitor);
g_ptr_array_add (self->priv->providers, provider);
}
gst_object_unref (factory);
......@@ -143,16 +143,16 @@ gst_global_device_monitor_init (GstGlobalDeviceMonitor * self)
static void
gst_global_device_monitor_remove (GstGlobalDeviceMonitor * self, guint i)
{
GstDeviceMonitor *monitor = g_ptr_array_index (self->priv->monitors, i);
GstDeviceProvider *provider = g_ptr_array_index (self->priv->providers, i);
GstBus *bus;
g_ptr_array_remove_index_fast (self->priv->monitors, i);
g_ptr_array_remove_index_fast (self->priv->providers, i);
bus = gst_device_monitor_get_bus (monitor);
bus = gst_device_provider_get_bus (provider);
g_signal_handlers_disconnect_by_func (bus, bus_sync_message, self);
gst_object_unref (bus);
gst_object_unref (monitor);
gst_object_unref (provider);
}
static void
......@@ -162,11 +162,11 @@ gst_global_device_monitor_dispose (GObject * object)
g_return_if_fail (self->priv->started == FALSE);
if (self->priv->monitors) {
while (self->priv->monitors->len)
gst_global_device_monitor_remove (self, self->priv->monitors->len - 1);
g_ptr_array_unref (self->priv->monitors);
self->priv->monitors = NULL;
if (self->priv->providers) {
while (self->priv->providers->len)
gst_global_device_monitor_remove (self, self->priv->providers->len - 1);
g_ptr_array_unref (self->priv->providers);
self->priv->providers = NULL;
}
gst_caps_replace (&self->priv->caps, NULL);
......@@ -178,7 +178,7 @@ gst_global_device_monitor_dispose (GObject * object)
/**
* gst_global_device_monitor_get_devices:
* @monitor: A #GstDeviceMonitor
* @monitor: A #GstDeviceProvider
*
* Gets a list of devices from all of the relevant monitors. This may actually
* probe the hardware if the global monitor is not currently started.
......@@ -207,15 +207,15 @@ again:
cookie = monitor->priv->cookie;