mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
DeviceProvider: Rename from DeviceMonitor
This commit is contained in:
parent
4720e6d0e0
commit
7992174a1a
23 changed files with 1047 additions and 1041 deletions
|
@ -117,10 +117,10 @@ Windows. It is released under the GNU Library General Public License
|
||||||
|
|
||||||
<chapter id="gstreamer-device-probing">
|
<chapter id="gstreamer-device-probing">
|
||||||
<title>GStreamer Device Discovery and Device Probing</title>
|
<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/gstglobaldevicemonitor.xml" />
|
||||||
|
<xi:include href="xml/gstdevice.xml" />
|
||||||
|
<xi:include href="xml/gstdeviceprovider.xml" />
|
||||||
|
<xi:include href="xml/gstdeviceproviderfactory.xml" />
|
||||||
</chapter>
|
</chapter>
|
||||||
|
|
||||||
<chapter id="gstreamer-support">
|
<chapter id="gstreamer-support">
|
||||||
|
|
|
@ -3353,61 +3353,61 @@ gst_device_get_type
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
<SECTION>
|
<SECTION>
|
||||||
<FILE>gstdevicemonitor</FILE>
|
<FILE>gstdeviceprovider</FILE>
|
||||||
<TITLE>GstDeviceMonitor</TITLE>
|
<TITLE>GstDeviceProvider</TITLE>
|
||||||
GstDeviceMonitor
|
GstDeviceProvider
|
||||||
GstDeviceMonitorClass
|
GstDeviceProviderClass
|
||||||
gst_device_monitor_can_monitor
|
gst_device_provider_can_monitor
|
||||||
gst_device_monitor_class_add_metadata
|
gst_device_provider_class_add_metadata
|
||||||
gst_device_monitor_class_add_static_metadata
|
gst_device_provider_class_add_static_metadata
|
||||||
gst_device_monitor_class_get_metadata
|
gst_device_provider_class_get_metadata
|
||||||
gst_device_monitor_class_set_metadata
|
gst_device_provider_class_set_metadata
|
||||||
gst_device_monitor_class_set_static_metadata
|
gst_device_provider_class_set_static_metadata
|
||||||
gst_device_monitor_device_add
|
gst_device_provider_device_add
|
||||||
gst_device_monitor_device_remove
|
gst_device_provider_device_remove
|
||||||
gst_device_monitor_get_bus
|
gst_device_provider_get_bus
|
||||||
gst_device_monitor_get_devices
|
gst_device_provider_get_devices
|
||||||
gst_device_monitor_get_factory
|
gst_device_provider_get_factory
|
||||||
gst_device_monitor_register
|
gst_device_provider_register
|
||||||
gst_device_monitor_start
|
gst_device_provider_start
|
||||||
gst_device_monitor_stop
|
gst_device_provider_stop
|
||||||
|
|
||||||
<SUBSECTION Standard>
|
<SUBSECTION Standard>
|
||||||
GstDevicePrivate
|
GstDevicePrivate
|
||||||
GST_DEVICE_MONITOR
|
GST_DEVICE_PROVIDER
|
||||||
GST_DEVICE_MONITOR_CAST
|
GST_DEVICE_PROVIDER_CAST
|
||||||
GST_DEVICE_MONITOR_CLASS
|
GST_DEVICE_PROVIDER_CLASS
|
||||||
GST_DEVICE_MONITOR_GET_CLASS
|
GST_DEVICE_PROVIDER_GET_CLASS
|
||||||
GST_IS_DEVICE_MONITOR
|
GST_IS_DEVICE_PROVIDER
|
||||||
GST_IS_DEVICE_MONITOR_CLASS
|
GST_IS_DEVICE_PROVIDER_CLASS
|
||||||
GST_TYPE_DEVICE_MONITOR
|
GST_TYPE_DEVICE_PROVIDER
|
||||||
gst_device_monitor_get_type
|
gst_device_provider_get_type
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
<SECTION>
|
<SECTION>
|
||||||
<FILE>gstdevicemonitorfactory</FILE>
|
<FILE>gstdeviceproviderfactory</FILE>
|
||||||
<TITLE>GstDeviceMonitorFactory</TITLE>
|
<TITLE>GstDeviceProviderFactory</TITLE>
|
||||||
GstDeviceMonitorFactory
|
GstDeviceProviderFactory
|
||||||
GstDeviceMonitorFactoryClass
|
GstDeviceProviderFactoryClass
|
||||||
gst_device_monitor_factory_find
|
gst_device_provider_factory_find
|
||||||
gst_device_monitor_factory_get
|
gst_device_provider_factory_get
|
||||||
gst_device_monitor_factory_get_by_name
|
gst_device_provider_factory_get_by_name
|
||||||
gst_device_monitor_factory_get_device_monitor_type
|
gst_device_provider_factory_get_device_provider_type
|
||||||
gst_device_monitor_factory_get_metadata
|
gst_device_provider_factory_get_metadata
|
||||||
gst_device_monitor_factory_get_metadata_keys
|
gst_device_provider_factory_get_metadata_keys
|
||||||
gst_device_monitor_factory_has_classes
|
gst_device_provider_factory_has_classes
|
||||||
gst_device_monitor_factory_has_classesv
|
gst_device_provider_factory_has_classesv
|
||||||
gst_device_monitor_factory_list_get_device_monitors
|
gst_device_provider_factory_list_get_device_providers
|
||||||
|
|
||||||
<SUBSECTION Standard>
|
<SUBSECTION Standard>
|
||||||
GstDeviceMonitorPrivate
|
GstDeviceProviderPrivate
|
||||||
GST_DEVICE_MONITOR_FACTORY
|
GST_DEVICE_PROVIDER_FACTORY
|
||||||
GST_DEVICE_MONITOR_FACTORY_CAST
|
GST_DEVICE_PROVIDER_FACTORY_CAST
|
||||||
GST_DEVICE_MONITOR_FACTORY_CLASS
|
GST_DEVICE_PROVIDER_FACTORY_CLASS
|
||||||
GST_TYPE_DEVICE_MONITOR_FACTORY
|
GST_TYPE_DEVICE_PROVIDER_FACTORY
|
||||||
GST_IS_DEVICE_MONITOR_FACTORY
|
GST_IS_DEVICE_PROVIDER_FACTORY
|
||||||
GST_IS_DEVICE_MONITOR_FACTORY_CLASS
|
GST_IS_DEVICE_PROVIDER_FACTORY_CLASS
|
||||||
gst_device_monitor_factory_get_type
|
gst_device_provider_factory_get_type
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
<SECTION>
|
<SECTION>
|
||||||
|
|
|
@ -36,7 +36,7 @@ GObject
|
||||||
GstPadTemplate
|
GstPadTemplate
|
||||||
GstPlugin
|
GstPlugin
|
||||||
GstPluginFeature
|
GstPluginFeature
|
||||||
GstDeviceMonitorFactory
|
GstDeviceProviderFactory
|
||||||
GstElementFactory
|
GstElementFactory
|
||||||
GstTypeFindFactory
|
GstTypeFindFactory
|
||||||
GstRegistry
|
GstRegistry
|
||||||
|
|
|
@ -72,8 +72,8 @@ libgstreamer_@GST_API_VERSION@_la_SOURCES = \
|
||||||
gstdatetime.c \
|
gstdatetime.c \
|
||||||
gstdebugutils.c \
|
gstdebugutils.c \
|
||||||
gstdevice.c \
|
gstdevice.c \
|
||||||
gstdevicemonitor.c \
|
gstdeviceprovider.c \
|
||||||
gstdevicemonitorfactory.c \
|
gstdeviceproviderfactory.c \
|
||||||
gstelement.c \
|
gstelement.c \
|
||||||
gstelementfactory.c \
|
gstelementfactory.c \
|
||||||
gsterror.c \
|
gsterror.c \
|
||||||
|
@ -177,8 +177,8 @@ gst_headers = \
|
||||||
gstelement.h \
|
gstelement.h \
|
||||||
gstelementmetadata.h \
|
gstelementmetadata.h \
|
||||||
gstdevice.h \
|
gstdevice.h \
|
||||||
gstdevicemonitor.h \
|
gstdeviceprovider.h \
|
||||||
gstdevicemonitorfactory.h \
|
gstdeviceproviderfactory.h \
|
||||||
gstelementfactory.h \
|
gstelementfactory.h \
|
||||||
gsterror.h \
|
gsterror.h \
|
||||||
gstevent.h \
|
gstevent.h \
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
#include <gst/gstdatetime.h>
|
#include <gst/gstdatetime.h>
|
||||||
#include <gst/gstdebugutils.h>
|
#include <gst/gstdebugutils.h>
|
||||||
#include <gst/gstdevice.h>
|
#include <gst/gstdevice.h>
|
||||||
#include <gst/gstdevicemonitor.h>
|
#include <gst/gstdeviceprovider.h>
|
||||||
#include <gst/gstelement.h>
|
#include <gst/gstelement.h>
|
||||||
#include <gst/gstelementmetadata.h>
|
#include <gst/gstelementmetadata.h>
|
||||||
#include <gst/gsterror.h>
|
#include <gst/gsterror.h>
|
||||||
|
|
|
@ -54,8 +54,8 @@ extern const char g_log_domain_gstreamer[];
|
||||||
/* for GstElement */
|
/* for GstElement */
|
||||||
#include "gstelement.h"
|
#include "gstelement.h"
|
||||||
|
|
||||||
/* for GstDeviceMonitor */
|
/* for GstDeviceProvider */
|
||||||
#include "gstdevicemonitor.h"
|
#include "gstdeviceprovider.h"
|
||||||
|
|
||||||
/* for GstToc */
|
/* for GstToc */
|
||||||
#include "gsttoc.h"
|
#include "gsttoc.h"
|
||||||
|
@ -399,19 +399,19 @@ struct _GstElementFactoryClass {
|
||||||
gpointer _gst_reserved[GST_PADDING];
|
gpointer _gst_reserved[GST_PADDING];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstDeviceMonitorFactory {
|
struct _GstDeviceProviderFactory {
|
||||||
GstPluginFeature feature;
|
GstPluginFeature feature;
|
||||||
/* <private> */
|
/* <private> */
|
||||||
|
|
||||||
GType type; /* unique GType the device factory or 0 if not loaded */
|
GType type; /* unique GType the device factory or 0 if not loaded */
|
||||||
|
|
||||||
volatile GstDeviceMonitor *monitor;
|
volatile GstDeviceProvider *provider;
|
||||||
gpointer metadata;
|
gpointer metadata;
|
||||||
|
|
||||||
gpointer _gst_reserved[GST_PADDING];
|
gpointer _gst_reserved[GST_PADDING];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstDeviceMonitorFactoryClass {
|
struct _GstDeviceProviderFactoryClass {
|
||||||
GstPluginFeatureClass parent;
|
GstPluginFeatureClass parent;
|
||||||
/* <private> */
|
/* <private> */
|
||||||
|
|
||||||
|
|
|
@ -22,13 +22,13 @@
|
||||||
/**
|
/**
|
||||||
* SECTION:gstdevice
|
* SECTION:gstdevice
|
||||||
* @short_description: Object representing a device
|
* @short_description: Object representing a device
|
||||||
* @see_also: #GstDeviceMonitor
|
* @see_also: #GstDeviceProvider
|
||||||
*
|
*
|
||||||
* #GstDevice are objects representing a device, they contain
|
* #GstDevice are objects representing a device, they contain
|
||||||
* relevant metadata about the device, such as its class and the #GstCaps
|
* relevant metadata about the device, such as its class and the #GstCaps
|
||||||
* representing the media types it can produce or handle.
|
* 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.
|
* aggregated by #GstGlobalDeviceMonitor objects.
|
||||||
*
|
*
|
||||||
* Since: 1.4
|
* 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
|
* Gets the "class" of a device. This is a "/" separated list of
|
||||||
* classes that represent this device. They are a subset of the
|
* 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.
|
* Returns: The device class. Free with g_free() after use.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,587 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
* Copyright (C) 2012 Olivier Crete <olivier.crete@collabora.com>
|
|
||||||
*
|
|
||||||
* gstdevicemonitor.c: 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
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Library General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Library General Public
|
|
||||||
* License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SECTION:gstdevicemonitor
|
|
||||||
* @short_description: A device monitor and prober
|
|
||||||
* @see_also: #GstDevice, #GstGlobalDeviceMonitor
|
|
||||||
*
|
|
||||||
* A #GstDeviceMonitor subclass is provided by a plugin that handles devices
|
|
||||||
* if there is a way to programatically list connected devices. It can also
|
|
||||||
* optionally provide updates to the list of connected devices.
|
|
||||||
*
|
|
||||||
* Each #GstDeviceMonitor subclass is a singleton, a plugin should
|
|
||||||
* normally provide a single subclass for all devices.
|
|
||||||
*
|
|
||||||
* Applications would normally use a #GstGlobalDeviceMonitor to monitor devices
|
|
||||||
* from all revelant monitors.
|
|
||||||
*
|
|
||||||
* Since: 1.4
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "gst_private.h"
|
|
||||||
|
|
||||||
#include "gstdevicemonitor.h"
|
|
||||||
|
|
||||||
#include "gstelementmetadata.h"
|
|
||||||
#include "gstquark.h"
|
|
||||||
|
|
||||||
struct _GstDeviceMonitorPrivate
|
|
||||||
{
|
|
||||||
GstBus *bus;
|
|
||||||
|
|
||||||
GMutex start_lock;
|
|
||||||
|
|
||||||
gboolean started_count;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* this is used in gstelementfactory.c:gst_element_register() */
|
|
||||||
GQuark __gst_devicemonitorclass_factory = 0;
|
|
||||||
|
|
||||||
static void gst_device_monitor_class_init (GstDeviceMonitorClass * klass);
|
|
||||||
static void gst_device_monitor_init (GstDeviceMonitor * element);
|
|
||||||
static void gst_device_monitor_base_class_init (gpointer g_class);
|
|
||||||
static void gst_device_monitor_base_class_finalize (gpointer g_class);
|
|
||||||
static void gst_device_monitor_dispose (GObject * object);
|
|
||||||
static void gst_device_monitor_finalize (GObject * object);
|
|
||||||
|
|
||||||
static gpointer gst_device_monitor_parent_class = NULL;
|
|
||||||
|
|
||||||
GType
|
|
||||||
gst_device_monitor_get_type (void)
|
|
||||||
{
|
|
||||||
static volatile gsize gst_device_monitor_type = 0;
|
|
||||||
|
|
||||||
if (g_once_init_enter (&gst_device_monitor_type)) {
|
|
||||||
GType _type;
|
|
||||||
static const GTypeInfo element_info = {
|
|
||||||
sizeof (GstDeviceMonitorClass),
|
|
||||||
gst_device_monitor_base_class_init,
|
|
||||||
gst_device_monitor_base_class_finalize,
|
|
||||||
(GClassInitFunc) gst_device_monitor_class_init,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
sizeof (GstDeviceMonitor),
|
|
||||||
0,
|
|
||||||
(GInstanceInitFunc) gst_device_monitor_init,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
_type = g_type_register_static (GST_TYPE_OBJECT, "GstDeviceMonitor",
|
|
||||||
&element_info, G_TYPE_FLAG_ABSTRACT);
|
|
||||||
|
|
||||||
__gst_devicemonitorclass_factory =
|
|
||||||
g_quark_from_static_string ("GST_DEVICEMONITORCLASS_FACTORY");
|
|
||||||
g_once_init_leave (&gst_device_monitor_type, _type);
|
|
||||||
}
|
|
||||||
return gst_device_monitor_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_device_monitor_base_class_init (gpointer g_class)
|
|
||||||
{
|
|
||||||
GstDeviceMonitorClass *klass = GST_DEVICE_MONITOR_CLASS (g_class);
|
|
||||||
|
|
||||||
/* Copy the element details here so elements can inherit the
|
|
||||||
* details from their base class and classes only need to set
|
|
||||||
* the details in class_init instead of base_init */
|
|
||||||
klass->metadata =
|
|
||||||
klass->metadata ? gst_structure_copy (klass->metadata) :
|
|
||||||
gst_structure_new_empty ("metadata");
|
|
||||||
|
|
||||||
klass->factory = g_type_get_qdata (G_TYPE_FROM_CLASS (klass),
|
|
||||||
__gst_devicemonitorclass_factory);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_device_monitor_base_class_finalize (gpointer g_class)
|
|
||||||
{
|
|
||||||
GstDeviceMonitorClass *klass = GST_DEVICE_MONITOR_CLASS (g_class);
|
|
||||||
|
|
||||||
gst_structure_free (klass->metadata);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_device_monitor_class_init (GstDeviceMonitorClass * klass)
|
|
||||||
{
|
|
||||||
GObjectClass *gobject_class = (GObjectClass *) klass;
|
|
||||||
|
|
||||||
gst_device_monitor_parent_class = g_type_class_peek_parent (klass);
|
|
||||||
|
|
||||||
g_type_class_add_private (klass, sizeof (GstDeviceMonitorPrivate));
|
|
||||||
|
|
||||||
gobject_class->dispose = gst_device_monitor_dispose;
|
|
||||||
gobject_class->finalize = gst_device_monitor_finalize;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_device_monitor_init (GstDeviceMonitor * monitor)
|
|
||||||
{
|
|
||||||
monitor->priv = G_TYPE_INSTANCE_GET_PRIVATE (monitor,
|
|
||||||
GST_TYPE_DEVICE_MONITOR, GstDeviceMonitorPrivate);
|
|
||||||
|
|
||||||
g_mutex_init (&monitor->priv->start_lock);
|
|
||||||
|
|
||||||
monitor->priv->bus = gst_bus_new ();
|
|
||||||
gst_bus_set_flushing (monitor->priv->bus, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_device_monitor_dispose (GObject * object)
|
|
||||||
{
|
|
||||||
GstDeviceMonitor *monitor = GST_DEVICE_MONITOR (object);
|
|
||||||
|
|
||||||
gst_object_replace ((GstObject **) & monitor->priv->bus, NULL);
|
|
||||||
|
|
||||||
GST_OBJECT_LOCK (monitor);
|
|
||||||
g_list_free_full (monitor->devices, (GDestroyNotify) gst_object_unparent);
|
|
||||||
monitor->devices = NULL;
|
|
||||||
GST_OBJECT_UNLOCK (monitor);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (gst_device_monitor_parent_class)->dispose (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_device_monitor_finalize (GObject * object)
|
|
||||||
{
|
|
||||||
GstDeviceMonitor *monitor = GST_DEVICE_MONITOR (object);
|
|
||||||
|
|
||||||
g_mutex_clear (&monitor->priv->start_lock);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (gst_device_monitor_parent_class)->finalize (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_device_monitor_class_add_metadata:
|
|
||||||
* @klass: class to set metadata for
|
|
||||||
* @key: the key to set
|
|
||||||
* @value: the value to set
|
|
||||||
*
|
|
||||||
* Set @key with @value as metadata in @klass.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
gst_device_monitor_class_add_metadata (GstDeviceMonitorClass * klass,
|
|
||||||
const gchar * key, const gchar * value)
|
|
||||||
{
|
|
||||||
g_return_if_fail (GST_IS_DEVICE_MONITOR_CLASS (klass));
|
|
||||||
g_return_if_fail (key != NULL);
|
|
||||||
g_return_if_fail (value != NULL);
|
|
||||||
|
|
||||||
gst_structure_set ((GstStructure *) klass->metadata,
|
|
||||||
key, G_TYPE_STRING, value, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_device_monitor_class_add_static_metadata:
|
|
||||||
* @klass: class to set metadata for
|
|
||||||
* @key: the key to set
|
|
||||||
* @value: the value to set
|
|
||||||
*
|
|
||||||
* Set @key with @value as metadata in @klass.
|
|
||||||
*
|
|
||||||
* Same as gst_device_monitor_class_add_metadata(), but @value must be a static string
|
|
||||||
* or an inlined string, as it will not be copied. (GStreamer plugins will
|
|
||||||
* be made resident once loaded, so this function can be used even from
|
|
||||||
* dynamically loaded plugins.)
|
|
||||||
*
|
|
||||||
* Since: 1.4
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
gst_device_monitor_class_add_static_metadata (GstDeviceMonitorClass * klass,
|
|
||||||
const gchar * key, const gchar * value)
|
|
||||||
{
|
|
||||||
GValue val = G_VALUE_INIT;
|
|
||||||
|
|
||||||
g_return_if_fail (GST_IS_DEVICE_MONITOR_CLASS (klass));
|
|
||||||
g_return_if_fail (key != NULL);
|
|
||||||
g_return_if_fail (value != NULL);
|
|
||||||
|
|
||||||
g_value_init (&val, G_TYPE_STRING);
|
|
||||||
g_value_set_static_string (&val, value);
|
|
||||||
gst_structure_take_value ((GstStructure *) klass->metadata, key, &val);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_device_monitor_class_set_metadata:
|
|
||||||
* @klass: class to set metadata for
|
|
||||||
* @longname: The long English name of the device monitor. E.g. "File Sink"
|
|
||||||
* @classification: String describing the type of device monitor, as an unordered list
|
|
||||||
* separated with slashes ('/'). See draft-klass.txt of the design docs
|
|
||||||
* for more details and common types. E.g: "Sink/File"
|
|
||||||
* @description: Sentence describing the purpose of the device monitor.
|
|
||||||
* E.g: "Write stream to a file"
|
|
||||||
* @author: Name and contact details of the author(s). Use \n to separate
|
|
||||||
* multiple author metadata. E.g: "Joe Bloggs <joe.blogs at foo.com>"
|
|
||||||
*
|
|
||||||
* Sets the detailed information for a #GstDeviceMonitorClass.
|
|
||||||
* <note>This function is for use in _class_init functions only.</note>
|
|
||||||
*
|
|
||||||
* Since: 1.4
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
gst_device_monitor_class_set_metadata (GstDeviceMonitorClass * klass,
|
|
||||||
const gchar * longname, const gchar * classification,
|
|
||||||
const gchar * description, const gchar * author)
|
|
||||||
{
|
|
||||||
g_return_if_fail (GST_IS_DEVICE_MONITOR_CLASS (klass));
|
|
||||||
g_return_if_fail (longname != NULL && *longname != '\0');
|
|
||||||
g_return_if_fail (classification != NULL && *classification != '\0');
|
|
||||||
g_return_if_fail (description != NULL && *description != '\0');
|
|
||||||
g_return_if_fail (author != NULL && *author != '\0');
|
|
||||||
|
|
||||||
gst_structure_id_set ((GstStructure *) klass->metadata,
|
|
||||||
GST_QUARK (ELEMENT_METADATA_LONGNAME), G_TYPE_STRING, longname,
|
|
||||||
GST_QUARK (ELEMENT_METADATA_KLASS), G_TYPE_STRING, classification,
|
|
||||||
GST_QUARK (ELEMENT_METADATA_DESCRIPTION), G_TYPE_STRING, description,
|
|
||||||
GST_QUARK (ELEMENT_METADATA_AUTHOR), G_TYPE_STRING, author, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_device_monitor_class_set_static_metadata:
|
|
||||||
* @klass: class to set metadata for
|
|
||||||
* @longname: The long English name of the element. E.g. "File Sink"
|
|
||||||
* @classification: String describing the type of element, as an unordered list
|
|
||||||
* separated with slashes ('/'). See draft-klass.txt of the design docs
|
|
||||||
* for more details and common types. E.g: "Sink/File"
|
|
||||||
* @description: Sentence describing the purpose of the element.
|
|
||||||
* E.g: "Write stream to a file"
|
|
||||||
* @author: Name and contact details of the author(s). Use \n to separate
|
|
||||||
* multiple author metadata. E.g: "Joe Bloggs <joe.blogs at foo.com>"
|
|
||||||
*
|
|
||||||
* Sets the detailed information for a #GstDeviceMonitorClass.
|
|
||||||
* <note>This function is for use in _class_init functions only.</note>
|
|
||||||
*
|
|
||||||
* Same as gst_device_monitor_class_set_metadata(), but @longname, @classification,
|
|
||||||
* @description, and @author must be static strings or inlined strings, as
|
|
||||||
* they will not be copied. (GStreamer plugins will be made resident once
|
|
||||||
* loaded, so this function can be used even from dynamically loaded plugins.)
|
|
||||||
*
|
|
||||||
* Since: 1.4
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
gst_device_monitor_class_set_static_metadata (GstDeviceMonitorClass * klass,
|
|
||||||
const gchar * longname, const gchar * classification,
|
|
||||||
const gchar * description, const gchar * author)
|
|
||||||
{
|
|
||||||
GstStructure *s = (GstStructure *) klass->metadata;
|
|
||||||
GValue val = G_VALUE_INIT;
|
|
||||||
|
|
||||||
g_return_if_fail (GST_IS_DEVICE_MONITOR_CLASS (klass));
|
|
||||||
g_return_if_fail (longname != NULL && *longname != '\0');
|
|
||||||
g_return_if_fail (classification != NULL && *classification != '\0');
|
|
||||||
g_return_if_fail (description != NULL && *description != '\0');
|
|
||||||
g_return_if_fail (author != NULL && *author != '\0');
|
|
||||||
|
|
||||||
g_value_init (&val, G_TYPE_STRING);
|
|
||||||
|
|
||||||
g_value_set_static_string (&val, longname);
|
|
||||||
gst_structure_id_set_value (s, GST_QUARK (ELEMENT_METADATA_LONGNAME), &val);
|
|
||||||
|
|
||||||
g_value_set_static_string (&val, classification);
|
|
||||||
gst_structure_id_set_value (s, GST_QUARK (ELEMENT_METADATA_KLASS), &val);
|
|
||||||
|
|
||||||
g_value_set_static_string (&val, description);
|
|
||||||
gst_structure_id_set_value (s, GST_QUARK (ELEMENT_METADATA_DESCRIPTION),
|
|
||||||
&val);
|
|
||||||
|
|
||||||
g_value_set_static_string (&val, author);
|
|
||||||
gst_structure_id_take_value (s, GST_QUARK (ELEMENT_METADATA_AUTHOR), &val);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_device_monitor_class_get_metadata:
|
|
||||||
* @klass: class to get metadata for
|
|
||||||
* @key: the key to get
|
|
||||||
*
|
|
||||||
* Get metadata with @key in @klass.
|
|
||||||
*
|
|
||||||
* Returns: the metadata for @key.
|
|
||||||
*
|
|
||||||
* Since: 1.4
|
|
||||||
*/
|
|
||||||
const gchar *
|
|
||||||
gst_device_monitor_class_get_metadata (GstDeviceMonitorClass * klass,
|
|
||||||
const gchar * key)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (GST_IS_DEVICE_MONITOR_CLASS (klass), NULL);
|
|
||||||
g_return_val_if_fail (key != NULL, NULL);
|
|
||||||
|
|
||||||
return gst_structure_get_string ((GstStructure *) klass->metadata, key);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_device_monitor_get_devices:
|
|
||||||
* @monitor: A #GstDeviceMonitor
|
|
||||||
*
|
|
||||||
* Gets a list of devices that this monitor understands. This may actually
|
|
||||||
* probe the hardware if the monitor is not currently started.
|
|
||||||
*
|
|
||||||
* Returns: (transfer full) (element-type GstDevice): a #GList of
|
|
||||||
* #GstDevice
|
|
||||||
*
|
|
||||||
* Since: 1.4
|
|
||||||
*/
|
|
||||||
|
|
||||||
GList *
|
|
||||||
gst_device_monitor_get_devices (GstDeviceMonitor * monitor)
|
|
||||||
{
|
|
||||||
GstDeviceMonitorClass *klass;
|
|
||||||
GList *devices = NULL;
|
|
||||||
gboolean started;
|
|
||||||
GList *item;
|
|
||||||
|
|
||||||
g_return_val_if_fail (GST_IS_DEVICE_MONITOR (monitor), NULL);
|
|
||||||
klass = GST_DEVICE_MONITOR_GET_CLASS (monitor);
|
|
||||||
|
|
||||||
g_mutex_lock (&monitor->priv->start_lock);
|
|
||||||
started = (monitor->priv->started_count > 0);
|
|
||||||
|
|
||||||
if (started) {
|
|
||||||
GST_OBJECT_LOCK (monitor);
|
|
||||||
for (item = monitor->devices; item; item = item->next)
|
|
||||||
devices = g_list_prepend (devices, gst_object_ref (item->data));
|
|
||||||
GST_OBJECT_UNLOCK (monitor);
|
|
||||||
} else if (klass->probe)
|
|
||||||
devices = klass->probe (monitor);
|
|
||||||
|
|
||||||
g_mutex_unlock (&monitor->priv->start_lock);
|
|
||||||
|
|
||||||
return devices;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_device_monitor_start:
|
|
||||||
* @monitor: A #GstDeviceMonitor
|
|
||||||
*
|
|
||||||
* Starts monitoring the devices. This will cause #GST_MESSAGE_DEVICE messages
|
|
||||||
* to be posted on the monitor's bus when devices are added or removed from
|
|
||||||
* the system.
|
|
||||||
*
|
|
||||||
* Since the #GstDeviceMonitor is a singleton,
|
|
||||||
* gst_device_monitor_start() may already have been called by another
|
|
||||||
* user of the object, gst_device_monitor_stop() needs to be called the same
|
|
||||||
* number of times.
|
|
||||||
*
|
|
||||||
* Returns: %TRUE if the device monitoring could be started
|
|
||||||
*
|
|
||||||
* Since: 1.4
|
|
||||||
*/
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
gst_device_monitor_start (GstDeviceMonitor * monitor)
|
|
||||||
{
|
|
||||||
GstDeviceMonitorClass *klass;
|
|
||||||
gboolean ret = FALSE;
|
|
||||||
|
|
||||||
g_return_val_if_fail (GST_IS_DEVICE_MONITOR (monitor), FALSE);
|
|
||||||
klass = GST_DEVICE_MONITOR_GET_CLASS (monitor);
|
|
||||||
|
|
||||||
g_mutex_lock (&monitor->priv->start_lock);
|
|
||||||
|
|
||||||
if (monitor->priv->started_count > 0) {
|
|
||||||
ret = TRUE;
|
|
||||||
goto started;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (klass->start)
|
|
||||||
ret = klass->start (monitor);
|
|
||||||
|
|
||||||
if (ret) {
|
|
||||||
monitor->priv->started_count++;
|
|
||||||
gst_bus_set_flushing (monitor->priv->bus, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
started:
|
|
||||||
|
|
||||||
g_mutex_unlock (&monitor->priv->start_lock);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_device_monitor_stop:
|
|
||||||
* @monitor: A #GstDeviceMonitor
|
|
||||||
*
|
|
||||||
* Decreases the use-count by one. If the use count reaches zero, this
|
|
||||||
* #GstDeviceMonitor will stop monitoring the devices. This needs to be
|
|
||||||
* called the same number of times that gst_device_monitor_start() was called.
|
|
||||||
*
|
|
||||||
* Since: 1.4
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
gst_device_monitor_stop (GstDeviceMonitor * monitor)
|
|
||||||
{
|
|
||||||
GstDeviceMonitorClass *klass;
|
|
||||||
|
|
||||||
g_return_if_fail (GST_IS_DEVICE_MONITOR (monitor));
|
|
||||||
klass = GST_DEVICE_MONITOR_GET_CLASS (monitor);
|
|
||||||
|
|
||||||
g_mutex_lock (&monitor->priv->start_lock);
|
|
||||||
|
|
||||||
if (monitor->priv->started_count == 1) {
|
|
||||||
gst_bus_set_flushing (monitor->priv->bus, TRUE);
|
|
||||||
if (klass->stop)
|
|
||||||
klass->stop (monitor);
|
|
||||||
GST_OBJECT_LOCK (monitor);
|
|
||||||
g_list_free_full (monitor->devices, (GDestroyNotify) gst_object_unparent);
|
|
||||||
monitor->devices = NULL;
|
|
||||||
GST_OBJECT_UNLOCK (monitor);
|
|
||||||
} else if (monitor->priv->started_count < 1) {
|
|
||||||
g_critical ("Trying to stop a GstDeviceMonitor %s which is already stopped",
|
|
||||||
GST_OBJECT_NAME (monitor));
|
|
||||||
}
|
|
||||||
|
|
||||||
monitor->priv->started_count--;
|
|
||||||
g_mutex_unlock (&monitor->priv->start_lock);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_device_monitor_get_factory:
|
|
||||||
* @monitor: a #GstDeviceMonitor to request the device monitor factory of.
|
|
||||||
*
|
|
||||||
* Retrieves the factory that was used to create this device monitor.
|
|
||||||
*
|
|
||||||
* Returns: (transfer none): the #GstDeviceMonitorFactory used for creating this
|
|
||||||
* device monitor. no refcounting is needed.
|
|
||||||
*
|
|
||||||
* Since: 1.4
|
|
||||||
*/
|
|
||||||
GstDeviceMonitorFactory *
|
|
||||||
gst_device_monitor_get_factory (GstDeviceMonitor * monitor)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (GST_IS_DEVICE_MONITOR (monitor), NULL);
|
|
||||||
|
|
||||||
return GST_DEVICE_MONITOR_GET_CLASS (monitor)->factory;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_device_monitor_can_monitor:
|
|
||||||
* @monitor: a #GstDeviceMonitor
|
|
||||||
*
|
|
||||||
* If this function returns %TRUE, then the device monitor can monitor if
|
|
||||||
* devices are added or removed. Otherwise, it can only do static probing.
|
|
||||||
*
|
|
||||||
* Returns: %TRUE if the #GstDeviceMonitor support monitoring, %FALSE otherwise
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
gst_device_monitor_can_monitor (GstDeviceMonitor * monitor)
|
|
||||||
{
|
|
||||||
GstDeviceMonitorClass *klass;
|
|
||||||
|
|
||||||
g_return_val_if_fail (GST_IS_DEVICE_MONITOR (monitor), FALSE);
|
|
||||||
klass = GST_DEVICE_MONITOR_GET_CLASS (monitor);
|
|
||||||
|
|
||||||
if (klass->start)
|
|
||||||
return TRUE;
|
|
||||||
else
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_device_monitor_get_bus:
|
|
||||||
* @monitor: a #GstDeviceMonitor
|
|
||||||
*
|
|
||||||
* Gets the #GstBus of this #GstDeviceMonitor
|
|
||||||
*
|
|
||||||
* Returns: (transfer full): a #GstBus
|
|
||||||
*
|
|
||||||
* Since: 1.4
|
|
||||||
*/
|
|
||||||
GstBus *
|
|
||||||
gst_device_monitor_get_bus (GstDeviceMonitor * monitor)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (GST_IS_DEVICE_MONITOR (monitor), NULL);
|
|
||||||
|
|
||||||
return gst_object_ref (monitor->priv->bus);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_device_monitor_device_add:
|
|
||||||
* @monitor: a #GstDeviceMonitor
|
|
||||||
* @device: (transfer full): a #GstDevice that has been added
|
|
||||||
*
|
|
||||||
* Posts a message on the monitor's #GstBus to inform applications that
|
|
||||||
* a new device has been added.
|
|
||||||
*
|
|
||||||
* This is for use by subclasses.
|
|
||||||
*
|
|
||||||
* Since: 1.4
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
gst_device_monitor_device_add (GstDeviceMonitor * monitor, GstDevice * device)
|
|
||||||
{
|
|
||||||
GstMessage *message;
|
|
||||||
|
|
||||||
if (!gst_object_set_parent (GST_OBJECT (device), GST_OBJECT (monitor))) {
|
|
||||||
GST_WARNING_OBJECT (monitor, "Could not parent device %p to monitor,"
|
|
||||||
" it already has a parent", device);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_OBJECT_LOCK (monitor);
|
|
||||||
monitor->devices = g_list_prepend (monitor->devices, gst_object_ref (device));
|
|
||||||
GST_OBJECT_UNLOCK (monitor);
|
|
||||||
|
|
||||||
message = gst_message_new_device_added (GST_OBJECT (monitor), device);
|
|
||||||
gst_bus_post (monitor->priv->bus, message);
|
|
||||||
gst_object_unref (device);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gst_device_monitor_device_remove:
|
|
||||||
* @monitor: a #GstDeviceMonitor
|
|
||||||
* @device: a #GstDevice that has been removed
|
|
||||||
*
|
|
||||||
* Posts a message on the monitor's #GstBus to inform applications that
|
|
||||||
* a device has been removed.
|
|
||||||
*
|
|
||||||
* This is for use by subclasses.
|
|
||||||
*
|
|
||||||
* Since: 1.4
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
gst_device_monitor_device_remove (GstDeviceMonitor * monitor,
|
|
||||||
GstDevice * device)
|
|
||||||
{
|
|
||||||
GstMessage *message;
|
|
||||||
GList *item;
|
|
||||||
|
|
||||||
GST_OBJECT_LOCK (monitor);
|
|
||||||
item = g_list_find (monitor->devices, device);
|
|
||||||
if (item) {
|
|
||||||
monitor->devices = g_list_delete_link (monitor->devices, item);
|
|
||||||
}
|
|
||||||
GST_OBJECT_UNLOCK (monitor);
|
|
||||||
|
|
||||||
message = gst_message_new_device_removed (GST_OBJECT (monitor), device);
|
|
||||||
g_signal_emit_by_name (device, "removed");
|
|
||||||
gst_bus_post (monitor->priv->bus, message);
|
|
||||||
if (item)
|
|
||||||
gst_object_unparent (GST_OBJECT (device));
|
|
||||||
}
|
|
|
@ -1,90 +0,0 @@
|
||||||
/* GStreamer
|
|
||||||
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
|
||||||
* 2000,2004 Wim Taymans <wim@fluendo.com>
|
|
||||||
* 2012 Olivier Crete <olivier.crete@collabora.com>
|
|
||||||
*
|
|
||||||
* gstdevicemonitorfactory.h: Header for GstDeviceMonitorFactory
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Library General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Library General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Library General Public
|
|
||||||
* License along with this library; if not, write to the
|
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef __GST_DEVICE_MONITOR_FACTORY_H__
|
|
||||||
#define __GST_DEVICE_MONITOR_FACTORY_H__
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GstDeviceMonitorFactory:
|
|
||||||
*
|
|
||||||
* The opaque #GstDeviceMonitorFactory data structure.
|
|
||||||
*
|
|
||||||
* Since: 1.4
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GstDeviceMonitorFactoryClass:
|
|
||||||
*
|
|
||||||
* The opaque #GstDeviceMonitorFactoryClass data structure.
|
|
||||||
*
|
|
||||||
* Since: 1.4
|
|
||||||
*/
|
|
||||||
typedef struct _GstDeviceMonitorFactory GstDeviceMonitorFactory;
|
|
||||||
typedef struct _GstDeviceMonitorFactoryClass GstDeviceMonitorFactoryClass;
|
|
||||||
|
|
||||||
#include <gst/gstconfig.h>
|
|
||||||
#include <gst/gstplugin.h>
|
|
||||||
#include <gst/gstpluginfeature.h>
|
|
||||||
#include <gst/gstdevicemonitor.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))
|
|
||||||
|
|
||||||
GType gst_device_monitor_factory_get_type (void);
|
|
||||||
|
|
||||||
GstDeviceMonitorFactory * gst_device_monitor_factory_find (const gchar *name);
|
|
||||||
|
|
||||||
GType gst_device_monitor_factory_get_device_monitor_type (GstDeviceMonitorFactory *factory);
|
|
||||||
|
|
||||||
const gchar * gst_device_monitor_factory_get_metadata (GstDeviceMonitorFactory *factory, const gchar *key);
|
|
||||||
gchar ** gst_device_monitor_factory_get_metadata_keys (GstDeviceMonitorFactory *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;
|
|
||||||
|
|
||||||
gboolean gst_device_monitor_register (GstPlugin *plugin, const gchar *name,
|
|
||||||
guint rank,
|
|
||||||
GType type);
|
|
||||||
|
|
||||||
gboolean gst_device_monitor_factory_has_classesv (GstDeviceMonitorFactory * factory,
|
|
||||||
gchar ** classes);
|
|
||||||
|
|
||||||
gboolean gst_device_monitor_factory_has_classes (GstDeviceMonitorFactory *factory,
|
|
||||||
const gchar * classes);
|
|
||||||
|
|
||||||
GList * gst_device_monitor_factory_list_get_device_monitors (const gchar *classes,
|
|
||||||
GstRank minrank) G_GNUC_MALLOC;
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* __GST_DEVICE_MONITOR_FACTORY_H__ */
|
|
591
gst/gstdeviceprovider.c
Normal file
591
gst/gstdeviceprovider.c
Normal file
|
@ -0,0 +1,591 @@
|
||||||
|
/* GStreamer
|
||||||
|
* Copyright (C) 2012 Olivier Crete <olivier.crete@collabora.com>
|
||||||
|
*
|
||||||
|
* gstdeviceprovider.c: 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
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SECTION:gstdeviceprovider
|
||||||
|
* @short_description: A device provider, monitor and prober
|
||||||
|
* @see_also: #GstDevice, #GstGlobalDeviceMonitor
|
||||||
|
*
|
||||||
|
* A #GstDeviceProvider subclass is provided by a plugin that handles devices
|
||||||
|
* if there is a way to programatically list connected devices. It can also
|
||||||
|
* optionally provide updates to the list of connected devices.
|
||||||
|
*
|
||||||
|
* Each #GstDeviceProvider subclass is a singleton, a plugin should
|
||||||
|
* normally provide a single subclass for all devices.
|
||||||
|
*
|
||||||
|
* Applications would normally use a #GstGlobalDeviceMonitor to monitor devices
|
||||||
|
* from all relevant providers.
|
||||||
|
*
|
||||||
|
* Since: 1.4
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "gst_private.h"
|
||||||
|
|
||||||
|
#include "gstdeviceprovider.h"
|
||||||
|
|
||||||
|
#include "gstelementmetadata.h"
|
||||||
|
#include "gstquark.h"
|
||||||
|
|
||||||
|
struct _GstDeviceProviderPrivate
|
||||||
|
{
|
||||||
|
GstBus *bus;
|
||||||
|
|
||||||
|
GMutex start_lock;
|
||||||
|
|
||||||
|
gboolean started_count;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* this is used in gstelementfactory.c:gst_element_register() */
|
||||||
|
GQuark __gst_deviceproviderclass_factory = 0;
|
||||||
|
|
||||||
|
static void gst_device_provider_class_init (GstDeviceProviderClass * klass);
|
||||||
|
static void gst_device_provider_init (GstDeviceProvider * element);
|
||||||
|
static void gst_device_provider_base_class_init (gpointer g_class);
|
||||||
|
static void gst_device_provider_base_class_finalize (gpointer g_class);
|
||||||
|
static void gst_device_provider_dispose (GObject * object);
|
||||||
|
static void gst_device_provider_finalize (GObject * object);
|
||||||
|
|
||||||
|
static gpointer gst_device_provider_parent_class = NULL;
|
||||||
|
|
||||||
|
GType
|
||||||
|
gst_device_provider_get_type (void)
|
||||||
|
{
|
||||||
|
static volatile gsize gst_device_provider_type = 0;
|
||||||
|
|
||||||
|
if (g_once_init_enter (&gst_device_provider_type)) {
|
||||||
|
GType _type;
|
||||||
|
static const GTypeInfo element_info = {
|
||||||
|
sizeof (GstDeviceProviderClass),
|
||||||
|
gst_device_provider_base_class_init,
|
||||||
|
gst_device_provider_base_class_finalize,
|
||||||
|
(GClassInitFunc) gst_device_provider_class_init,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
sizeof (GstDeviceProvider),
|
||||||
|
0,
|
||||||
|
(GInstanceInitFunc) gst_device_provider_init,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
_type = g_type_register_static (GST_TYPE_OBJECT, "GstDeviceProvider",
|
||||||
|
&element_info, G_TYPE_FLAG_ABSTRACT);
|
||||||
|
|
||||||
|
__gst_deviceproviderclass_factory =
|
||||||
|
g_quark_from_static_string ("GST_DEVICEPROVIDERCLASS_FACTORY");
|
||||||
|
g_once_init_leave (&gst_device_provider_type, _type);
|
||||||
|
}
|
||||||
|
return gst_device_provider_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_device_provider_base_class_init (gpointer g_class)
|
||||||
|
{
|
||||||
|
GstDeviceProviderClass *klass = GST_DEVICE_PROVIDER_CLASS (g_class);
|
||||||
|
|
||||||
|
/* Copy the element details here so elements can inherit the
|
||||||
|
* details from their base class and classes only need to set
|
||||||
|
* the details in class_init instead of base_init */
|
||||||
|
klass->metadata =
|
||||||
|
klass->metadata ? gst_structure_copy (klass->metadata) :
|
||||||
|
gst_structure_new_empty ("metadata");
|
||||||
|
|
||||||
|
klass->factory = g_type_get_qdata (G_TYPE_FROM_CLASS (klass),
|
||||||
|
__gst_deviceproviderclass_factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_device_provider_base_class_finalize (gpointer g_class)
|
||||||
|
{
|
||||||
|
GstDeviceProviderClass *klass = GST_DEVICE_PROVIDER_CLASS (g_class);
|
||||||
|
|
||||||
|
gst_structure_free (klass->metadata);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_device_provider_class_init (GstDeviceProviderClass * klass)
|
||||||
|
{
|
||||||
|
GObjectClass *gobject_class = (GObjectClass *) klass;
|
||||||
|
|
||||||
|
gst_device_provider_parent_class = g_type_class_peek_parent (klass);
|
||||||
|
|
||||||
|
g_type_class_add_private (klass, sizeof (GstDeviceProviderPrivate));
|
||||||
|
|
||||||
|
gobject_class->dispose = gst_device_provider_dispose;
|
||||||
|
gobject_class->finalize = gst_device_provider_finalize;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_device_provider_init (GstDeviceProvider * provider)
|
||||||
|
{
|
||||||
|
provider->priv = G_TYPE_INSTANCE_GET_PRIVATE (provider,
|
||||||
|
GST_TYPE_DEVICE_PROVIDER, GstDeviceProviderPrivate);
|
||||||
|
|
||||||
|
g_mutex_init (&provider->priv->start_lock);
|
||||||
|
|
||||||
|
provider->priv->bus = gst_bus_new ();
|
||||||
|
gst_bus_set_flushing (provider->priv->bus, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_device_provider_dispose (GObject * object)
|
||||||
|
{
|
||||||
|
GstDeviceProvider *provider = GST_DEVICE_PROVIDER (object);
|
||||||
|
|
||||||
|
gst_object_replace ((GstObject **) & provider->priv->bus, NULL);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (provider);
|
||||||
|
g_list_free_full (provider->devices, (GDestroyNotify) gst_object_unparent);
|
||||||
|
provider->devices = NULL;
|
||||||
|
GST_OBJECT_UNLOCK (provider);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (gst_device_provider_parent_class)->dispose (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_device_provider_finalize (GObject * object)
|
||||||
|
{
|
||||||
|
GstDeviceProvider *provider = GST_DEVICE_PROVIDER (object);
|
||||||
|
|
||||||
|
g_mutex_clear (&provider->priv->start_lock);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (gst_device_provider_parent_class)->finalize (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_device_provider_class_add_metadata:
|
||||||
|
* @klass: class to set metadata for
|
||||||
|
* @key: the key to set
|
||||||
|
* @value: the value to set
|
||||||
|
*
|
||||||
|
* Set @key with @value as metadata in @klass.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gst_device_provider_class_add_metadata (GstDeviceProviderClass * klass,
|
||||||
|
const gchar * key, const gchar * value)
|
||||||
|
{
|
||||||
|
g_return_if_fail (GST_IS_DEVICE_PROVIDER_CLASS (klass));
|
||||||
|
g_return_if_fail (key != NULL);
|
||||||
|
g_return_if_fail (value != NULL);
|
||||||
|
|
||||||
|
gst_structure_set ((GstStructure *) klass->metadata,
|
||||||
|
key, G_TYPE_STRING, value, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_device_provider_class_add_static_metadata:
|
||||||
|
* @klass: class to set metadata for
|
||||||
|
* @key: the key to set
|
||||||
|
* @value: the value to set
|
||||||
|
*
|
||||||
|
* Set @key with @value as metadata in @klass.
|
||||||
|
*
|
||||||
|
* Same as gst_device_provider_class_add_metadata(), but @value must be a static string
|
||||||
|
* or an inlined string, as it will not be copied. (GStreamer plugins will
|
||||||
|
* be made resident once loaded, so this function can be used even from
|
||||||
|
* dynamically loaded plugins.)
|
||||||
|
*
|
||||||
|
* Since: 1.4
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gst_device_provider_class_add_static_metadata (GstDeviceProviderClass * klass,
|
||||||
|
const gchar * key, const gchar * value)
|
||||||
|
{
|
||||||
|
GValue val = G_VALUE_INIT;
|
||||||
|
|
||||||
|
g_return_if_fail (GST_IS_DEVICE_PROVIDER_CLASS (klass));
|
||||||
|
g_return_if_fail (key != NULL);
|
||||||
|
g_return_if_fail (value != NULL);
|
||||||
|
|
||||||
|
g_value_init (&val, G_TYPE_STRING);
|
||||||
|
g_value_set_static_string (&val, value);
|
||||||
|
gst_structure_take_value ((GstStructure *) klass->metadata, key, &val);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_device_provider_class_set_metadata:
|
||||||
|
* @klass: class to set metadata for
|
||||||
|
* @longname: The long English name of the device provider. E.g. "File Sink"
|
||||||
|
* @classification: String describing the type of device provider, as an
|
||||||
|
* unordered list separated with slashes ('/'). See draft-klass.txt of the
|
||||||
|
* design docs
|
||||||
|
* for more details and common types. E.g: "Sink/File"
|
||||||
|
* @description: Sentence describing the purpose of the device provider.
|
||||||
|
* E.g: "Write stream to a file"
|
||||||
|
* @author: Name and contact details of the author(s). Use \n to separate
|
||||||
|
* multiple author metadata. E.g: "Joe Bloggs <joe.blogs at foo.com>"
|
||||||
|
*
|
||||||
|
* Sets the detailed information for a #GstDeviceProviderClass.
|
||||||
|
* <note>This function is for use in _class_init functions only.</note>
|
||||||
|
*
|
||||||
|
* Since: 1.4
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gst_device_provider_class_set_metadata (GstDeviceProviderClass * klass,
|
||||||
|
const gchar * longname, const gchar * classification,
|
||||||
|
const gchar * description, const gchar * author)
|
||||||
|
{
|
||||||
|
g_return_if_fail (GST_IS_DEVICE_PROVIDER_CLASS (klass));
|
||||||
|
g_return_if_fail (longname != NULL && *longname != '\0');
|
||||||
|
g_return_if_fail (classification != NULL && *classification != '\0');
|
||||||
|
g_return_if_fail (description != NULL && *description != '\0');
|
||||||
|
g_return_if_fail (author != NULL && *author != '\0');
|
||||||
|
|
||||||
|
gst_structure_id_set ((GstStructure *) klass->metadata,
|
||||||
|
GST_QUARK (ELEMENT_METADATA_LONGNAME), G_TYPE_STRING, longname,
|
||||||
|
GST_QUARK (ELEMENT_METADATA_KLASS), G_TYPE_STRING, classification,
|
||||||
|
GST_QUARK (ELEMENT_METADATA_DESCRIPTION), G_TYPE_STRING, description,
|
||||||
|
GST_QUARK (ELEMENT_METADATA_AUTHOR), G_TYPE_STRING, author, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_device_provider_class_set_static_metadata:
|
||||||
|
* @klass: class to set metadata for
|
||||||
|
* @longname: The long English name of the element. E.g. "File Sink"
|
||||||
|
* @classification: String describing the type of element, as an unordered list
|
||||||
|
* separated with slashes ('/'). See draft-klass.txt of the design docs
|
||||||
|
* for more details and common types. E.g: "Sink/File"
|
||||||
|
* @description: Sentence describing the purpose of the element.
|
||||||
|
* E.g: "Write stream to a file"
|
||||||
|
* @author: Name and contact details of the author(s). Use \n to separate
|
||||||
|
* multiple author metadata. E.g: "Joe Bloggs <joe.blogs at foo.com>"
|
||||||
|
*
|
||||||
|
* Sets the detailed information for a #GstDeviceProviderClass.
|
||||||
|
* <note>This function is for use in _class_init functions only.</note>
|
||||||
|
*
|
||||||
|
* Same as gst_device_provider_class_set_metadata(), but @longname, @classification,
|
||||||
|
* @description, and @author must be static strings or inlined strings, as
|
||||||
|
* they will not be copied. (GStreamer plugins will be made resident once
|
||||||
|
* loaded, so this function can be used even from dynamically loaded plugins.)
|
||||||
|
*
|
||||||
|
* Since: 1.4
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gst_device_provider_class_set_static_metadata (GstDeviceProviderClass * klass,
|
||||||
|
const gchar * longname, const gchar * classification,
|
||||||
|
const gchar * description, const gchar * author)
|
||||||
|
{
|
||||||
|
GstStructure *s = (GstStructure *) klass->metadata;
|
||||||
|
GValue val = G_VALUE_INIT;
|
||||||
|
|
||||||
|
g_return_if_fail (GST_IS_DEVICE_PROVIDER_CLASS (klass));
|
||||||
|
g_return_if_fail (longname != NULL && *longname != '\0');
|
||||||
|
g_return_if_fail (classification != NULL && *classification != '\0');
|
||||||
|
g_return_if_fail (description != NULL && *description != '\0');
|
||||||
|
g_return_if_fail (author != NULL && *author != '\0');
|
||||||
|
|
||||||
|
g_value_init (&val, G_TYPE_STRING);
|
||||||
|
|
||||||
|
g_value_set_static_string (&val, longname);
|
||||||
|
gst_structure_id_set_value (s, GST_QUARK (ELEMENT_METADATA_LONGNAME), &val);
|
||||||
|
|
||||||
|
g_value_set_static_string (&val, classification);
|
||||||
|
gst_structure_id_set_value (s, GST_QUARK (ELEMENT_METADATA_KLASS), &val);
|
||||||
|
|
||||||
|
g_value_set_static_string (&val, description);
|
||||||
|
gst_structure_id_set_value (s, GST_QUARK (ELEMENT_METADATA_DESCRIPTION),
|
||||||
|
&val);
|
||||||
|
|
||||||
|
g_value_set_static_string (&val, author);
|
||||||
|
gst_structure_id_take_value (s, GST_QUARK (ELEMENT_METADATA_AUTHOR), &val);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_device_provider_class_get_metadata:
|
||||||
|
* @klass: class to get metadata for
|
||||||
|
* @key: the key to get
|
||||||
|
*
|
||||||
|
* Get metadata with @key in @klass.
|
||||||
|
*
|
||||||
|
* Returns: the metadata for @key.
|
||||||
|
*
|
||||||
|
* Since: 1.4
|
||||||
|
*/
|
||||||
|
const gchar *
|
||||||
|
gst_device_provider_class_get_metadata (GstDeviceProviderClass * klass,
|
||||||
|
const gchar * key)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GST_IS_DEVICE_PROVIDER_CLASS (klass), NULL);
|
||||||
|
g_return_val_if_fail (key != NULL, NULL);
|
||||||
|
|
||||||
|
return gst_structure_get_string ((GstStructure *) klass->metadata, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_device_provider_get_devices:
|
||||||
|
* @provider: A #GstDeviceProvider
|
||||||
|
*
|
||||||
|
* Gets a list of devices that this provider understands. This may actually
|
||||||
|
* probe the hardware if the provider is not currently started.
|
||||||
|
*
|
||||||
|
* Returns: (transfer full) (element-type GstDevice): a #GList of
|
||||||
|
* #GstDevice
|
||||||
|
*
|
||||||
|
* Since: 1.4
|
||||||
|
*/
|
||||||
|
|
||||||
|
GList *
|
||||||
|
gst_device_provider_get_devices (GstDeviceProvider * provider)
|
||||||
|
{
|
||||||
|
GstDeviceProviderClass *klass;
|
||||||
|
GList *devices = NULL;
|
||||||
|
gboolean started;
|
||||||
|
GList *item;
|
||||||
|
|
||||||
|
g_return_val_if_fail (GST_IS_DEVICE_PROVIDER (provider), NULL);
|
||||||
|
klass = GST_DEVICE_PROVIDER_GET_CLASS (provider);
|
||||||
|
|
||||||
|
g_mutex_lock (&provider->priv->start_lock);
|
||||||
|
started = (provider->priv->started_count > 0);
|
||||||
|
|
||||||
|
if (started) {
|
||||||
|
GST_OBJECT_LOCK (provider);
|
||||||
|
for (item = provider->devices; item; item = item->next)
|
||||||
|
devices = g_list_prepend (devices, gst_object_ref (item->data));
|
||||||
|
GST_OBJECT_UNLOCK (provider);
|
||||||
|
} else if (klass->probe)
|
||||||
|
devices = klass->probe (provider);
|
||||||
|
|
||||||
|
g_mutex_unlock (&provider->priv->start_lock);
|
||||||
|
|
||||||
|
return devices;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_device_provider_start:
|
||||||
|
* @provider: A #GstDeviceProvider
|
||||||
|
*
|
||||||
|
* Starts providering the devices. This will cause #GST_MESSAGE_DEVICE messages
|
||||||
|
* to be posted on the provider's bus when devices are added or removed from
|
||||||
|
* the system.
|
||||||
|
*
|
||||||
|
* Since the #GstDeviceProvider is a singleton,
|
||||||
|
* gst_device_provider_start() may already have been called by another
|
||||||
|
* user of the object, gst_device_provider_stop() needs to be called the same
|
||||||
|
* number of times.
|
||||||
|
*
|
||||||
|
* Returns: %TRUE if the device providering could be started
|
||||||
|
*
|
||||||
|
* Since: 1.4
|
||||||
|
*/
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
gst_device_provider_start (GstDeviceProvider * provider)
|
||||||
|
{
|
||||||
|
GstDeviceProviderClass *klass;
|
||||||
|
gboolean ret = FALSE;
|
||||||
|
|
||||||
|
g_return_val_if_fail (GST_IS_DEVICE_PROVIDER (provider), FALSE);
|
||||||
|
klass = GST_DEVICE_PROVIDER_GET_CLASS (provider);
|
||||||
|
|
||||||
|
g_mutex_lock (&provider->priv->start_lock);
|
||||||
|
|
||||||
|
if (provider->priv->started_count > 0) {
|
||||||
|
ret = TRUE;
|
||||||
|
goto started;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (klass->start)
|
||||||
|
ret = klass->start (provider);
|
||||||
|
|
||||||
|
if (ret) {
|
||||||
|
provider->priv->started_count++;
|
||||||
|
gst_bus_set_flushing (provider->priv->bus, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
started:
|
||||||
|
|
||||||
|
g_mutex_unlock (&provider->priv->start_lock);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_device_provider_stop:
|
||||||
|
* @provider: A #GstDeviceProvider
|
||||||
|
*
|
||||||
|
* Decreases the use-count by one. If the use count reaches zero, this
|
||||||
|
* #GstDeviceProvider will stop providering the devices. This needs to be
|
||||||
|
* called the same number of times that gst_device_provider_start() was called.
|
||||||
|
*
|
||||||
|
* Since: 1.4
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
gst_device_provider_stop (GstDeviceProvider * provider)
|
||||||
|
{
|
||||||
|
GstDeviceProviderClass *klass;
|
||||||
|
|
||||||
|
g_return_if_fail (GST_IS_DEVICE_PROVIDER (provider));
|
||||||
|
klass = GST_DEVICE_PROVIDER_GET_CLASS (provider);
|
||||||
|
|
||||||
|
g_mutex_lock (&provider->priv->start_lock);
|
||||||
|
|
||||||
|
if (provider->priv->started_count == 1) {
|
||||||
|
gst_bus_set_flushing (provider->priv->bus, TRUE);
|
||||||
|
if (klass->stop)
|
||||||
|
klass->stop (provider);
|
||||||
|
GST_OBJECT_LOCK (provider);
|
||||||
|
g_list_free_full (provider->devices, (GDestroyNotify) gst_object_unparent);
|
||||||
|
provider->devices = NULL;
|
||||||
|
GST_OBJECT_UNLOCK (provider);
|
||||||
|
} else if (provider->priv->started_count < 1) {
|
||||||
|
g_critical
|
||||||
|
("Trying to stop a GstDeviceProvider %s which is already stopped",
|
||||||
|
GST_OBJECT_NAME (provider));
|
||||||
|
}
|
||||||
|
|
||||||
|
provider->priv->started_count--;
|
||||||
|
g_mutex_unlock (&provider->priv->start_lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_device_provider_get_factory:
|
||||||
|
* @provider: a #GstDeviceProvider to request the device provider factory of.
|
||||||
|
*
|
||||||
|
* Retrieves the factory that was used to create this device provider.
|
||||||
|
*
|
||||||
|
* Returns: (transfer none): the #GstDeviceProviderFactory used for
|
||||||
|
* creating this device provider. no refcounting is needed.
|
||||||
|
*
|
||||||
|
* Since: 1.4
|
||||||
|
*/
|
||||||
|
GstDeviceProviderFactory *
|
||||||
|
gst_device_provider_get_factory (GstDeviceProvider * provider)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GST_IS_DEVICE_PROVIDER (provider), NULL);
|
||||||
|
|
||||||
|
return GST_DEVICE_PROVIDER_GET_CLASS (provider)->factory;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_device_provider_can_provider:
|
||||||
|
* @provider: a #GstDeviceProvider
|
||||||
|
*
|
||||||
|
* If this function returns %TRUE, then the device provider can provider if
|
||||||
|
* devices are added or removed. Otherwise, it can only do static probing.
|
||||||
|
*
|
||||||
|
* Returns: %TRUE if the #GstDeviceProvider support providering, %FALSE otherwise
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
gst_device_provider_can_monitor (GstDeviceProvider * provider)
|
||||||
|
{
|
||||||
|
GstDeviceProviderClass *klass;
|
||||||
|
|
||||||
|
g_return_val_if_fail (GST_IS_DEVICE_PROVIDER (provider), FALSE);
|
||||||
|
klass = GST_DEVICE_PROVIDER_GET_CLASS (provider);
|
||||||
|
|
||||||
|
if (klass->start)
|
||||||
|
return TRUE;
|
||||||
|
else
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_device_provider_get_bus:
|
||||||
|
* @provider: a #GstDeviceProvider
|
||||||
|
*
|
||||||
|
* Gets the #GstBus of this #GstDeviceProvider
|
||||||
|
*
|
||||||
|
* Returns: (transfer full): a #GstBus
|
||||||
|
*
|
||||||
|
* Since: 1.4
|
||||||
|
*/
|
||||||
|
GstBus *
|
||||||
|
gst_device_provider_get_bus (GstDeviceProvider * provider)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GST_IS_DEVICE_PROVIDER (provider), NULL);
|
||||||
|
|
||||||
|
return gst_object_ref (provider->priv->bus);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_device_provider_device_add:
|
||||||
|
* @provider: a #GstDeviceProvider
|
||||||
|
* @device: (transfer full): a #GstDevice that has been added
|
||||||
|
*
|
||||||
|
* Posts a message on the provider's #GstBus to inform applications that
|
||||||
|
* a new device has been added.
|
||||||
|
*
|
||||||
|
* This is for use by subclasses.
|
||||||
|
*
|
||||||
|
* Since: 1.4
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gst_device_provider_device_add (GstDeviceProvider * provider,
|
||||||
|
GstDevice * device)
|
||||||
|
{
|
||||||
|
GstMessage *message;
|
||||||
|
|
||||||
|
if (!gst_object_set_parent (GST_OBJECT (device), GST_OBJECT (provider))) {
|
||||||
|
GST_WARNING_OBJECT (provider, "Could not parent device %p to provider,"
|
||||||
|
" it already has a parent", device);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (provider);
|
||||||
|
provider->devices = g_list_prepend (provider->devices,
|
||||||
|
gst_object_ref (device));
|
||||||
|
GST_OBJECT_UNLOCK (provider);
|
||||||
|
|
||||||
|
message = gst_message_new_device_added (GST_OBJECT (provider), device);
|
||||||
|
gst_bus_post (provider->priv->bus, message);
|
||||||
|
gst_object_unref (device);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_device_provider_device_remove:
|
||||||
|
* @provider: a #GstDeviceProvider
|
||||||
|
* @device: a #GstDevice that has been removed
|
||||||
|
*
|
||||||
|
* Posts a message on the provider's #GstBus to inform applications that
|
||||||
|
* a device has been removed.
|
||||||
|
*
|
||||||
|
* This is for use by subclasses.
|
||||||
|
*
|
||||||
|
* Since: 1.4
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gst_device_provider_device_remove (GstDeviceProvider * provider,
|
||||||
|
GstDevice * device)
|
||||||
|
{
|
||||||
|
GstMessage *message;
|
||||||
|
GList *item;
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (provider);
|
||||||
|
item = g_list_find (provider->devices, device);
|
||||||
|
if (item) {
|
||||||
|
provider->devices = g_list_delete_link (provider->devices, item);
|
||||||
|
}
|
||||||
|
GST_OBJECT_UNLOCK (provider);
|
||||||
|
|
||||||
|
message = gst_message_new_device_removed (GST_OBJECT (provider), device);
|
||||||
|
g_signal_emit_by_name (device, "removed");
|
||||||
|
gst_bus_post (provider->priv->bus, message);
|
||||||
|
if (item)
|
||||||
|
gst_object_unparent (GST_OBJECT (device));
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
/* GStreamer
|
/* GStreamer
|
||||||
* Copyright (C) 2012 Olivier Crete <olivier.crete@collabora.com>
|
* 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
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
@ -19,39 +19,39 @@
|
||||||
* Boston, MA 02111-1307, USA.
|
* Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <gst/gstdevicemonitorfactory.h>
|
#include <gst/gstdeviceproviderfactory.h>
|
||||||
|
|
||||||
|
|
||||||
#ifndef __GST_DEVICE_MONITOR_H__
|
#ifndef __GST_DEVICE_PROVIDER_H__
|
||||||
#define __GST_DEVICE_MONITOR_H__
|
#define __GST_DEVICE_PROVIDER_H__
|
||||||
|
|
||||||
#include <gst/gstelement.h>
|
#include <gst/gstelement.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
typedef struct _GstDeviceMonitor GstDeviceMonitor;
|
typedef struct _GstDeviceProvider GstDeviceProvider;
|
||||||
typedef struct _GstDeviceMonitorClass GstDeviceMonitorClass;
|
typedef struct _GstDeviceProviderClass GstDeviceProviderClass;
|
||||||
typedef struct _GstDeviceMonitorPrivate GstDeviceMonitorPrivate;
|
typedef struct _GstDeviceProviderPrivate GstDeviceProviderPrivate;
|
||||||
|
|
||||||
#define GST_TYPE_DEVICE_MONITOR (gst_device_monitor_get_type())
|
#define GST_TYPE_DEVICE_PROVIDER (gst_device_provider_get_type())
|
||||||
#define GST_IS_DEVICE_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DEVICE_MONITOR))
|
#define GST_IS_DEVICE_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DEVICE_PROVIDER))
|
||||||
#define GST_IS_DEVICE_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_DEVICE_MONITOR))
|
#define GST_IS_DEVICE_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_DEVICE_PROVIDER))
|
||||||
#define GST_DEVICE_MONITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_DEVICE_MONITOR, GstDeviceMonitorClass))
|
#define GST_DEVICE_PROVIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_DEVICE_PROVIDER, GstDeviceProviderClass))
|
||||||
#define GST_DEVICE_MONITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DEVICE_MONITOR, GstDeviceMonitor))
|
#define GST_DEVICE_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DEVICE_PROVIDER, GstDeviceProvider))
|
||||||
#define GST_DEVICE_MONITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DEVICE_MONITOR, GstDeviceMonitorClass))
|
#define GST_DEVICE_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DEVICE_PROVIDER, GstDeviceProviderClass))
|
||||||
#define GST_DEVICE_MONITOR_CAST(obj) ((GstDeviceMonitor *)(obj))
|
#define GST_DEVICE_PROVIDER_CAST(obj) ((GstDeviceProvider *)(obj))
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GstDeviceMonitor:
|
* GstDeviceProvider:
|
||||||
* @parent: The parent #GstObject
|
* @parent: The parent #GstObject
|
||||||
* @devices: a #GList of the #GstDevice objects
|
* @devices: a #GList of the #GstDevice objects
|
||||||
*
|
*
|
||||||
* The structure of the base #GstDeviceMonitor
|
* The structure of the base #GstDeviceProvider
|
||||||
*
|
*
|
||||||
* Since: 1.4
|
* Since: 1.4
|
||||||
*/
|
*/
|
||||||
struct _GstDeviceMonitor {
|
struct _GstDeviceProvider {
|
||||||
GstObject parent;
|
GstObject parent;
|
||||||
|
|
||||||
/* Protected by the Object lock */
|
/* Protected by the Object lock */
|
||||||
|
@ -59,16 +59,16 @@ struct _GstDeviceMonitor {
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
|
|
||||||
GstDeviceMonitorPrivate *priv;
|
GstDeviceProviderPrivate *priv;
|
||||||
|
|
||||||
gpointer _gst_reserved[GST_PADDING];
|
gpointer _gst_reserved[GST_PADDING];
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GstDeviceMonitorClass:
|
* GstDeviceProviderClass:
|
||||||
* @parent_class: the parent #GstObjectClass structure
|
* @parent_class: the parent #GstObjectClass structure
|
||||||
* @factory: a pointer to the #GstDeviceMonitorFactory that creates this
|
* @factory: a pointer to the #GstDeviceProviderFactory that creates this
|
||||||
* monitor
|
* provider
|
||||||
* @probe: Returns a list of devices that are currently available.
|
* @probe: Returns a list of devices that are currently available.
|
||||||
* This should never block.
|
* This should never block.
|
||||||
* @start: Starts monitoring for new devices. Only subclasses that can know
|
* @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
|
* @stop: Stops monitoring for new devices. Only subclasses that implement
|
||||||
* the start() method need to implement this method.
|
* the start() method need to implement this method.
|
||||||
*
|
*
|
||||||
* The structure of the base #GstDeviceMonitorClass
|
* The structure of the base #GstDeviceProviderClass
|
||||||
*
|
*
|
||||||
* Since: 1.4
|
* Since: 1.4
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct _GstDeviceMonitorClass {
|
struct _GstDeviceProviderClass {
|
||||||
GstObjectClass parent_class;
|
GstObjectClass parent_class;
|
||||||
|
|
||||||
GstDeviceMonitorFactory *factory;
|
GstDeviceProviderFactory *factory;
|
||||||
|
|
||||||
GList* (*probe) (GstDeviceMonitor * monitor);
|
GList* (*probe) (GstDeviceProvider * provider);
|
||||||
|
|
||||||
gboolean (*start) (GstDeviceMonitor * monitor);
|
gboolean (*start) (GstDeviceProvider * provider);
|
||||||
void (*stop) (GstDeviceMonitor * monitor);
|
void (*stop) (GstDeviceProvider * provider);
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
gpointer metadata;
|
gpointer metadata;
|
||||||
|
@ -98,45 +98,45 @@ struct _GstDeviceMonitorClass {
|
||||||
gpointer _gst_reserved[GST_PADDING];
|
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);
|
gboolean gst_device_provider_start (GstDeviceProvider * provider);
|
||||||
void gst_device_monitor_stop (GstDeviceMonitor * monitor);
|
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);
|
GstDevice * device);
|
||||||
void gst_device_monitor_device_remove (GstDeviceMonitor * monitor,
|
void gst_device_provider_device_remove (GstDeviceProvider * provider,
|
||||||
GstDevice * device);
|
GstDevice * device);
|
||||||
|
|
||||||
|
|
||||||
/* device monitor class meta data */
|
/* device provider class meta data */
|
||||||
void gst_device_monitor_class_set_metadata (GstDeviceMonitorClass *klass,
|
void gst_device_provider_class_set_metadata (GstDeviceProviderClass *klass,
|
||||||
const gchar *longname,
|
const gchar *longname,
|
||||||
const gchar *classification,
|
const gchar *classification,
|
||||||
const gchar *description,
|
const gchar *description,
|
||||||
const gchar *author);
|
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 *longname,
|
||||||
const gchar *classification,
|
const gchar *classification,
|
||||||
const gchar *description,
|
const gchar *description,
|
||||||
const gchar *author);
|
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);
|
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 * 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);
|
const gchar * key);
|
||||||
|
|
||||||
/* factory management */
|
/* factory management */
|
||||||
GstDeviceMonitorFactory * gst_device_monitor_get_factory (GstDeviceMonitor * monitor);
|
GstDeviceProviderFactory * gst_device_provider_get_factory (GstDeviceProvider * provider);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GST_DEVICE_MONITOR_H__ */
|
#endif /* __GST_DEVICE_PROVIDER_H__ */
|
|
@ -3,7 +3,7 @@
|
||||||
* 2000 Wim Taymans <wtay@chello.be>
|
* 2000 Wim Taymans <wtay@chello.be>
|
||||||
* 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
|
* 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
|
||||||
*
|
*
|
||||||
* gstdevicemonitorfactory.c: GstDeviceMonitorFactory object, support routines
|
* gstdeviceproviderfactory.c: GstDeviceProviderFactory object, support routines
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
@ -22,16 +22,16 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SECTION:gstdevicemonitorfactory
|
* SECTION:gstdeviceproviderfactory
|
||||||
* @short_description: Create GstDeviceMonitors from a factory
|
* @short_description: Create GstDeviceProviders from a factory
|
||||||
* @see_also: #GstDeviceMonitor, #GstPlugin, #GstPluginFeature, #GstPadTemplate.
|
* @see_also: #GstDeviceProvider, #GstPlugin, #GstPluginFeature, #GstPadTemplate.
|
||||||
*
|
*
|
||||||
* #GstDeviceMonitorFactory is used to create instances of device monitors. A
|
* #GstDeviceProviderFactory is used to create instances of device providers. A
|
||||||
* GstDeviceMonitorfactory can be added to a #GstPlugin as it is also a
|
* GstDeviceProviderfactory can be added to a #GstPlugin as it is also a
|
||||||
* #GstPluginFeature.
|
* #GstPluginFeature.
|
||||||
*
|
*
|
||||||
* Use the gst_device_monitor_factory_find() and gst_device_monitor_factory_create()
|
* Use the gst_device_provider_factory_find() and gst_device_provider_factory_create()
|
||||||
* functions to create device monitor instances or use gst_device_monitor_factory_make() as a
|
* functions to create device provider instances or use gst_device_provider_factory_make() as a
|
||||||
* convenient shortcut.
|
* convenient shortcut.
|
||||||
*
|
*
|
||||||
* Since: 1.4
|
* Since: 1.4
|
||||||
|
@ -43,94 +43,94 @@
|
||||||
|
|
||||||
#include "gst_private.h"
|
#include "gst_private.h"
|
||||||
|
|
||||||
#include "gstdevicemonitorfactory.h"
|
#include "gstdeviceproviderfactory.h"
|
||||||
#include "gst.h"
|
#include "gst.h"
|
||||||
|
|
||||||
#include "glib-compat-private.h"
|
#include "glib-compat-private.h"
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_STATIC (device_monitor_factory_debug);
|
GST_DEBUG_CATEGORY_STATIC (device_provider_factory_debug);
|
||||||
#define GST_CAT_DEFAULT device_monitor_factory_debug
|
#define GST_CAT_DEFAULT device_provider_factory_debug
|
||||||
|
|
||||||
static void gst_device_monitor_factory_finalize (GObject * object);
|
static void gst_device_provider_factory_finalize (GObject * object);
|
||||||
static void gst_device_monitor_factory_cleanup (GstDeviceMonitorFactory *
|
static void gst_device_provider_factory_cleanup (GstDeviceProviderFactory *
|
||||||
factory);
|
factory);
|
||||||
|
|
||||||
/* static guint gst_device_monitor_factory_signals[LAST_SIGNAL] = { 0 }; */
|
/* static guint gst_device_provider_factory_signals[LAST_SIGNAL] = { 0 }; */
|
||||||
|
|
||||||
/* this is defined in gstelement.c */
|
/* this is defined in gstelement.c */
|
||||||
extern GQuark __gst_devicemonitorclass_factory;
|
extern GQuark __gst_deviceproviderclass_factory;
|
||||||
|
|
||||||
#define _do_init \
|
#define _do_init \
|
||||||
{ \
|
{ \
|
||||||
GST_DEBUG_CATEGORY_INIT (device_monitor_factory_debug, "GST_DEVICE_MONITOR_FACTORY", \
|
GST_DEBUG_CATEGORY_INIT (device_provider_factory_debug, "GST_DEVICE_PROVIDER_FACTORY", \
|
||||||
GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED, \
|
GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED, \
|
||||||
"device monitor factories keep information about installed device monitors"); \
|
"device provider factories keep information about installed device providers"); \
|
||||||
}
|
}
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (GstDeviceMonitorFactory, gst_device_monitor_factory,
|
G_DEFINE_TYPE_WITH_CODE (GstDeviceProviderFactory, gst_device_provider_factory,
|
||||||
GST_TYPE_PLUGIN_FEATURE, _do_init);
|
GST_TYPE_PLUGIN_FEATURE, _do_init);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_device_monitor_factory_class_init (GstDeviceMonitorFactoryClass * klass)
|
gst_device_provider_factory_class_init (GstDeviceProviderFactoryClass * klass)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class = (GObjectClass *) klass;
|
GObjectClass *gobject_class = (GObjectClass *) klass;
|
||||||
|
|
||||||
gobject_class->finalize = gst_device_monitor_factory_finalize;
|
gobject_class->finalize = gst_device_provider_factory_finalize;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_device_monitor_factory_init (GstDeviceMonitorFactory * factory)
|
gst_device_provider_factory_init (GstDeviceProviderFactory * factory)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_device_monitor_factory_finalize (GObject * object)
|
gst_device_provider_factory_finalize (GObject * object)
|
||||||
{
|
{
|
||||||
GstDeviceMonitorFactory *factory = GST_DEVICE_MONITOR_FACTORY (object);
|
GstDeviceProviderFactory *factory = GST_DEVICE_PROVIDER_FACTORY (object);
|
||||||
GstDeviceMonitor *monitor;
|
GstDeviceProvider *provider;
|
||||||
|
|
||||||
gst_device_monitor_factory_cleanup (factory);
|
gst_device_provider_factory_cleanup (factory);
|
||||||
|
|
||||||
monitor = g_atomic_pointer_get (&factory->monitor);
|
provider = g_atomic_pointer_get (&factory->provider);
|
||||||
if (monitor)
|
if (provider)
|
||||||
gst_object_unref (monitor);
|
gst_object_unref (provider);
|
||||||
|
|
||||||
G_OBJECT_CLASS (gst_device_monitor_factory_parent_class)->finalize (object);
|
G_OBJECT_CLASS (gst_device_provider_factory_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_device_monitor_factory_find:
|
* gst_device_provider_factory_find:
|
||||||
* @name: name of factory to find
|
* @name: name of factory to find
|
||||||
*
|
*
|
||||||
* Search for an device monitor factory of the given name. Refs the returned
|
* Search for an device provider factory of the given name. Refs the returned
|
||||||
* device monitor factory; caller is responsible for unreffing.
|
* device provider factory; caller is responsible for unreffing.
|
||||||
*
|
*
|
||||||
* Returns: (transfer full) (nullable): #GstDeviceMonitorFactory if
|
* Returns: (transfer full) (nullable): #GstDeviceProviderFactory if
|
||||||
* found, %NULL otherwise
|
* found, %NULL otherwise
|
||||||
*
|
*
|
||||||
* Since: 1.4
|
* Since: 1.4
|
||||||
*/
|
*/
|
||||||
GstDeviceMonitorFactory *
|
GstDeviceProviderFactory *
|
||||||
gst_device_monitor_factory_find (const gchar * name)
|
gst_device_provider_factory_find (const gchar * name)
|
||||||
{
|
{
|
||||||
GstPluginFeature *feature;
|
GstPluginFeature *feature;
|
||||||
|
|
||||||
g_return_val_if_fail (name != NULL, NULL);
|
g_return_val_if_fail (name != NULL, NULL);
|
||||||
|
|
||||||
feature = gst_registry_find_feature (gst_registry_get (), name,
|
feature = gst_registry_find_feature (gst_registry_get (), name,
|
||||||
GST_TYPE_DEVICE_MONITOR_FACTORY);
|
GST_TYPE_DEVICE_PROVIDER_FACTORY);
|
||||||
if (feature)
|
if (feature)
|
||||||
return GST_DEVICE_MONITOR_FACTORY (feature);
|
return GST_DEVICE_PROVIDER_FACTORY (feature);
|
||||||
|
|
||||||
/* this isn't an error, for instance when you query if an device monitor factory is
|
/* this isn't an error, for instance when you query if an device provider factory is
|
||||||
* present */
|
* present */
|
||||||
GST_LOG ("no such device monitor factory \"%s\"", name);
|
GST_LOG ("no such device provider factory \"%s\"", name);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_device_monitor_factory_cleanup (GstDeviceMonitorFactory * factory)
|
gst_device_provider_factory_cleanup (GstDeviceProviderFactory * factory)
|
||||||
{
|
{
|
||||||
if (factory->metadata) {
|
if (factory->metadata) {
|
||||||
gst_structure_free ((GstStructure *) factory->metadata);
|
gst_structure_free ((GstStructure *) factory->metadata);
|
||||||
|
@ -143,22 +143,22 @@ gst_device_monitor_factory_cleanup (GstDeviceMonitorFactory * factory)
|
||||||
|
|
||||||
#define CHECK_METADATA_FIELD(klass, name, key) \
|
#define CHECK_METADATA_FIELD(klass, name, key) \
|
||||||
G_STMT_START { \
|
G_STMT_START { \
|
||||||
const gchar *metafield = gst_device_monitor_class_get_metadata (klass, key); \
|
const gchar *metafield = gst_device_provider_class_get_metadata (klass, key); \
|
||||||
if (G_UNLIKELY (metafield == NULL || *metafield == '\0')) { \
|
if (G_UNLIKELY (metafield == NULL || *metafield == '\0')) { \
|
||||||
g_warning ("Device monitor factory metadata for '%s' has no valid %s field", name, key); \
|
g_warning ("Device provider factory metadata for '%s' has no valid %s field", name, key); \
|
||||||
goto detailserror; \
|
goto detailserror; \
|
||||||
} \
|
} \
|
||||||
} G_STMT_END;
|
} G_STMT_END;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_device_monitor_register:
|
* gst_device_provider_register:
|
||||||
* @plugin: (allow-none): #GstPlugin to register the device monitor with, or %NULL for
|
* @plugin: (allow-none): #GstPlugin to register the device provider with, or %NULL for
|
||||||
* a static device monitor.
|
* a static device provider.
|
||||||
* @name: name of device monitors of this type
|
* @name: name of device providers of this type
|
||||||
* @rank: rank of device monitor (higher rank means more importance when autoplugging)
|
* @rank: rank of device provider (higher rank means more importance when autoplugging)
|
||||||
* @type: GType of device monitor to register
|
* @type: GType of device provider to register
|
||||||
*
|
*
|
||||||
* Create a new device monitorfactory capable of instantiating objects of the
|
* Create a new device providerfactory capable of instantiating objects of the
|
||||||
* @type and add the factory to @plugin.
|
* @type and add the factory to @plugin.
|
||||||
*
|
*
|
||||||
* Returns: %TRUE, if the registering succeeded, %FALSE on error
|
* Returns: %TRUE, if the registering succeeded, %FALSE on error
|
||||||
|
@ -166,16 +166,16 @@ gst_device_monitor_factory_cleanup (GstDeviceMonitorFactory * factory)
|
||||||
* Since: 1.4
|
* Since: 1.4
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
gst_device_monitor_register (GstPlugin * plugin, const gchar * name, guint rank,
|
gst_device_provider_register (GstPlugin * plugin, const gchar * name,
|
||||||
GType type)
|
guint rank, GType type)
|
||||||
{
|
{
|
||||||
GstPluginFeature *existing_feature;
|
GstPluginFeature *existing_feature;
|
||||||
GstRegistry *registry;
|
GstRegistry *registry;
|
||||||
GstDeviceMonitorFactory *factory;
|
GstDeviceProviderFactory *factory;
|
||||||
GstDeviceMonitorClass *klass;
|
GstDeviceProviderClass *klass;
|
||||||
|
|
||||||
g_return_val_if_fail (name != NULL, FALSE);
|
g_return_val_if_fail (name != NULL, FALSE);
|
||||||
g_return_val_if_fail (g_type_is_a (type, GST_TYPE_DEVICE_MONITOR), FALSE);
|
g_return_val_if_fail (g_type_is_a (type, GST_TYPE_DEVICE_PROVIDER), FALSE);
|
||||||
|
|
||||||
registry = gst_registry_get ();
|
registry = gst_registry_get ();
|
||||||
|
|
||||||
|
@ -187,24 +187,24 @@ gst_device_monitor_register (GstPlugin * plugin, const gchar * name, guint rank,
|
||||||
if (existing_feature) {
|
if (existing_feature) {
|
||||||
GST_DEBUG_OBJECT (registry, "update existing feature %p (%s)",
|
GST_DEBUG_OBJECT (registry, "update existing feature %p (%s)",
|
||||||
existing_feature, name);
|
existing_feature, name);
|
||||||
factory = GST_DEVICE_MONITOR_FACTORY_CAST (existing_feature);
|
factory = GST_DEVICE_PROVIDER_FACTORY_CAST (existing_feature);
|
||||||
factory->type = type;
|
factory->type = type;
|
||||||
existing_feature->loaded = TRUE;
|
existing_feature->loaded = TRUE;
|
||||||
g_type_set_qdata (type, __gst_devicemonitorclass_factory, factory);
|
g_type_set_qdata (type, __gst_deviceproviderclass_factory, factory);
|
||||||
gst_object_unref (existing_feature);
|
gst_object_unref (existing_feature);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
factory =
|
factory =
|
||||||
GST_DEVICE_MONITOR_FACTORY_CAST (g_object_newv
|
GST_DEVICE_PROVIDER_FACTORY_CAST (g_object_newv
|
||||||
(GST_TYPE_DEVICE_MONITOR_FACTORY, 0, NULL));
|
(GST_TYPE_DEVICE_PROVIDER_FACTORY, 0, NULL));
|
||||||
gst_plugin_feature_set_name (GST_PLUGIN_FEATURE_CAST (factory), name);
|
gst_plugin_feature_set_name (GST_PLUGIN_FEATURE_CAST (factory), name);
|
||||||
GST_LOG_OBJECT (factory, "Created new device monitorfactory for type %s",
|
GST_LOG_OBJECT (factory, "Created new device providerfactory for type %s",
|
||||||
g_type_name (type));
|
g_type_name (type));
|
||||||
|
|
||||||
/* provide info needed during class structure setup */
|
/* provide info needed during class structure setup */
|
||||||
g_type_set_qdata (type, __gst_devicemonitorclass_factory, factory);
|
g_type_set_qdata (type, __gst_deviceproviderclass_factory, factory);
|
||||||
klass = GST_DEVICE_MONITOR_CLASS (g_type_class_ref (type));
|
klass = GST_DEVICE_PROVIDER_CLASS (g_type_class_ref (type));
|
||||||
|
|
||||||
CHECK_METADATA_FIELD (klass, name, GST_ELEMENT_METADATA_LONGNAME);
|
CHECK_METADATA_FIELD (klass, name, GST_ELEMENT_METADATA_LONGNAME);
|
||||||
CHECK_METADATA_FIELD (klass, name, GST_ELEMENT_METADATA_KLASS);
|
CHECK_METADATA_FIELD (klass, name, GST_ELEMENT_METADATA_KLASS);
|
||||||
|
@ -233,34 +233,34 @@ gst_device_monitor_register (GstPlugin * plugin, const gchar * name, guint rank,
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
detailserror:
|
detailserror:
|
||||||
{
|
{
|
||||||
gst_device_monitor_factory_cleanup (factory);
|
gst_device_provider_factory_cleanup (factory);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_device_monitor_factory_get:
|
* gst_device_provider_factory_get:
|
||||||
* @factory: factory to instantiate
|
* @factory: factory to instantiate
|
||||||
*
|
*
|
||||||
* Returns the device monitor of the type defined by the given device
|
* Returns the device provider of the type defined by the given device
|
||||||
* monitorfactory.
|
* providerfactory.
|
||||||
*
|
*
|
||||||
* Returns: (transfer full) (nullable): the #GstDeviceMonitor or %NULL
|
* Returns: (transfer full) (nullable): the #GstDeviceProvider or %NULL
|
||||||
* if the device monitor couldn't be created
|
* if the device provider couldn't be created
|
||||||
*
|
*
|
||||||
* Since: 1.4
|
* Since: 1.4
|
||||||
*/
|
*/
|
||||||
GstDeviceMonitor *
|
GstDeviceProvider *
|
||||||
gst_device_monitor_factory_get (GstDeviceMonitorFactory * factory)
|
gst_device_provider_factory_get (GstDeviceProviderFactory * factory)
|
||||||
{
|
{
|
||||||
GstDeviceMonitor *device_monitor;
|
GstDeviceProvider *device_provider;
|
||||||
GstDeviceMonitorClass *oclass;
|
GstDeviceProviderClass *oclass;
|
||||||
GstDeviceMonitorFactory *newfactory;
|
GstDeviceProviderFactory *newfactory;
|
||||||
|
|
||||||
g_return_val_if_fail (factory != NULL, NULL);
|
g_return_val_if_fail (factory != NULL, NULL);
|
||||||
|
|
||||||
newfactory =
|
newfactory =
|
||||||
GST_DEVICE_MONITOR_FACTORY (gst_plugin_feature_load (GST_PLUGIN_FEATURE
|
GST_DEVICE_PROVIDER_FACTORY (gst_plugin_feature_load (GST_PLUGIN_FEATURE
|
||||||
(factory)));
|
(factory)));
|
||||||
|
|
||||||
if (newfactory == NULL)
|
if (newfactory == NULL)
|
||||||
|
@ -268,45 +268,45 @@ gst_device_monitor_factory_get (GstDeviceMonitorFactory * factory)
|
||||||
|
|
||||||
factory = newfactory;
|
factory = newfactory;
|
||||||
|
|
||||||
GST_INFO ("getting device monitor \"%s\"", GST_OBJECT_NAME (factory));
|
GST_INFO ("getting device provider \"%s\"", GST_OBJECT_NAME (factory));
|
||||||
|
|
||||||
if (factory->type == 0)
|
if (factory->type == 0)
|
||||||
goto no_type;
|
goto no_type;
|
||||||
|
|
||||||
device_monitor = g_atomic_pointer_get (&newfactory->monitor);
|
device_provider = g_atomic_pointer_get (&newfactory->provider);
|
||||||
if (device_monitor)
|
if (device_provider)
|
||||||
return gst_object_ref (device_monitor);
|
return gst_object_ref (device_provider);
|
||||||
|
|
||||||
/* create an instance of the device monitor, cast so we don't assert on NULL
|
/* create an instance of the device provider, cast so we don't assert on NULL
|
||||||
* also set name as early as we can
|
* also set name as early as we can
|
||||||
*/
|
*/
|
||||||
device_monitor = GST_DEVICE_MONITOR_CAST (g_object_newv (factory->type, 0,
|
device_provider = GST_DEVICE_PROVIDER_CAST (g_object_newv (factory->type, 0,
|
||||||
NULL));
|
NULL));
|
||||||
if (G_UNLIKELY (device_monitor == NULL))
|
if (G_UNLIKELY (device_provider == NULL))
|
||||||
goto no_device_monitor;
|
goto no_device_provider;
|
||||||
|
|
||||||
/* fill in the pointer to the factory in the device monitor class. The
|
/* fill in the pointer to the factory in the device provider class. The
|
||||||
* class will not be unreffed currently.
|
* class will not be unreffed currently.
|
||||||
* Be thread safe as there might be 2 threads creating the first instance of
|
* Be thread safe as there might be 2 threads creating the first instance of
|
||||||
* an device monitor at the same moment
|
* an device provider at the same moment
|
||||||
*/
|
*/
|
||||||
oclass = GST_DEVICE_MONITOR_GET_CLASS (device_monitor);
|
oclass = GST_DEVICE_PROVIDER_GET_CLASS (device_provider);
|
||||||
if (!g_atomic_pointer_compare_and_exchange (&oclass->factory, NULL, factory))
|
if (!g_atomic_pointer_compare_and_exchange (&oclass->factory, NULL, factory))
|
||||||
gst_object_unref (factory);
|
gst_object_unref (factory);
|
||||||
|
|
||||||
gst_object_ref_sink (device_monitor);
|
gst_object_ref_sink (device_provider);
|
||||||
|
|
||||||
/* We use an atomic to make sure we don't create two in parallel */
|
/* We use an atomic to make sure we don't create two in parallel */
|
||||||
if (!g_atomic_pointer_compare_and_exchange (&newfactory->monitor, NULL,
|
if (!g_atomic_pointer_compare_and_exchange (&newfactory->provider, NULL,
|
||||||
device_monitor)) {
|
device_provider)) {
|
||||||
gst_object_unref (device_monitor);
|
gst_object_unref (device_provider);
|
||||||
|
|
||||||
device_monitor = g_atomic_pointer_get (&newfactory->monitor);
|
device_provider = g_atomic_pointer_get (&newfactory->provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_DEBUG ("created device monitor \"%s\"", GST_OBJECT_NAME (factory));
|
GST_DEBUG ("created device provider \"%s\"", GST_OBJECT_NAME (factory));
|
||||||
|
|
||||||
return gst_object_ref (device_monitor);
|
return gst_object_ref (device_provider);
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
load_failed:
|
load_failed:
|
||||||
|
@ -322,53 +322,53 @@ no_type:
|
||||||
gst_object_unref (factory);
|
gst_object_unref (factory);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
no_device_monitor:
|
no_device_provider:
|
||||||
{
|
{
|
||||||
GST_WARNING_OBJECT (factory, "could not create device monitor");
|
GST_WARNING_OBJECT (factory, "could not create device provider");
|
||||||
gst_object_unref (factory);
|
gst_object_unref (factory);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_device_monitor_factory_get_by_name:
|
* gst_device_provider_factory_get_by_name:
|
||||||
* @factoryname: a named factory to instantiate
|
* @factoryname: a named factory to instantiate
|
||||||
*
|
*
|
||||||
* Returns the device monitor of the type defined by the given device
|
* Returns the device provider of the type defined by the given device
|
||||||
* monitor factory.
|
* provider factory.
|
||||||
*
|
*
|
||||||
* Returns: (transfer full) (nullable): a #GstDeviceMonitor or %NULL
|
* Returns: (transfer full) (nullable): a #GstDeviceProvider or %NULL
|
||||||
* if unable to create device monitor
|
* if unable to create device provider
|
||||||
*
|
*
|
||||||
* Since: 1.4
|
* Since: 1.4
|
||||||
*/
|
*/
|
||||||
GstDeviceMonitor *
|
GstDeviceProvider *
|
||||||
gst_device_monitor_factory_get_by_name (const gchar * factoryname)
|
gst_device_provider_factory_get_by_name (const gchar * factoryname)
|
||||||
{
|
{
|
||||||
GstDeviceMonitorFactory *factory;
|
GstDeviceProviderFactory *factory;
|
||||||
GstDeviceMonitor *device_monitor;
|
GstDeviceProvider *device_provider;
|
||||||
|
|
||||||
g_return_val_if_fail (factoryname != NULL, NULL);
|
g_return_val_if_fail (factoryname != NULL, NULL);
|
||||||
g_return_val_if_fail (gst_is_initialized (), NULL);
|
g_return_val_if_fail (gst_is_initialized (), NULL);
|
||||||
|
|
||||||
GST_LOG ("gstdevicemonitorfactory: get_by_name \"%s\"", factoryname);
|
GST_LOG ("gstdeviceproviderfactory: get_by_name \"%s\"", factoryname);
|
||||||
|
|
||||||
factory = gst_device_monitor_factory_find (factoryname);
|
factory = gst_device_provider_factory_find (factoryname);
|
||||||
if (factory == NULL)
|
if (factory == NULL)
|
||||||
goto no_factory;
|
goto no_factory;
|
||||||
|
|
||||||
GST_LOG_OBJECT (factory, "found factory %p", factory);
|
GST_LOG_OBJECT (factory, "found factory %p", factory);
|
||||||
device_monitor = gst_device_monitor_factory_get (factory);
|
device_provider = gst_device_provider_factory_get (factory);
|
||||||
if (device_monitor == NULL)
|
if (device_provider == NULL)
|
||||||
goto create_failed;
|
goto create_failed;
|
||||||
|
|
||||||
gst_object_unref (factory);
|
gst_object_unref (factory);
|
||||||
return device_monitor;
|
return device_provider;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
no_factory:
|
no_factory:
|
||||||
{
|
{
|
||||||
GST_INFO ("no such device monitor factory \"%s\"!", factoryname);
|
GST_INFO ("no such device provider factory \"%s\"!", factoryname);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
create_failed:
|
create_failed:
|
||||||
|
@ -380,30 +380,30 @@ create_failed:
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_device_monitor_factory_get_device_monitor_type:
|
* gst_device_provider_factory_get_device_provider_type:
|
||||||
* @factory: factory to get managed #GType from
|
* @factory: factory to get managed #GType from
|
||||||
*
|
*
|
||||||
* Get the #GType for device monitors managed by this factory. The type can
|
* Get the #GType for device providers managed by this factory. The type can
|
||||||
* only be retrieved if the device monitor factory is loaded, which can be
|
* only be retrieved if the device provider factory is loaded, which can be
|
||||||
* assured with gst_plugin_feature_load().
|
* assured with gst_plugin_feature_load().
|
||||||
*
|
*
|
||||||
* Returns: the #GType for device monitors managed by this factory or 0 if
|
* Returns: the #GType for device providers managed by this factory or 0 if
|
||||||
* the factory is not loaded.
|
* the factory is not loaded.
|
||||||
*
|
*
|
||||||
* Since: 1.4
|
* Since: 1.4
|
||||||
*/
|
*/
|
||||||
GType
|
GType
|
||||||
gst_device_monitor_factory_get_device_monitor_type (GstDeviceMonitorFactory *
|
gst_device_provider_factory_get_device_provider_type (GstDeviceProviderFactory *
|
||||||
factory)
|
factory)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (GST_IS_DEVICE_MONITOR_FACTORY (factory), 0);
|
g_return_val_if_fail (GST_IS_DEVICE_PROVIDER_FACTORY (factory), 0);
|
||||||
|
|
||||||
return factory->type;
|
return factory->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_device_monitor_factory_get_metadata:
|
* gst_device_provider_factory_get_metadata:
|
||||||
* @factory: a #GstDeviceMonitorFactory
|
* @factory: a #GstDeviceProviderFactory
|
||||||
* @key: a key
|
* @key: a key
|
||||||
*
|
*
|
||||||
* Get the metadata on @factory with @key.
|
* Get the metadata on @factory with @key.
|
||||||
|
@ -414,15 +414,15 @@ gst_device_monitor_factory_get_device_monitor_type (GstDeviceMonitorFactory *
|
||||||
* Since: 1.4
|
* Since: 1.4
|
||||||
*/
|
*/
|
||||||
const gchar *
|
const gchar *
|
||||||
gst_device_monitor_factory_get_metadata (GstDeviceMonitorFactory * factory,
|
gst_device_provider_factory_get_metadata (GstDeviceProviderFactory * factory,
|
||||||
const gchar * key)
|
const gchar * key)
|
||||||
{
|
{
|
||||||
return gst_structure_get_string ((GstStructure *) factory->metadata, key);
|
return gst_structure_get_string ((GstStructure *) factory->metadata, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_device_monitor_factory_get_metadata_keys:
|
* gst_device_provider_factory_get_metadata_keys:
|
||||||
* @factory: a #GstDeviceMonitorFactory
|
* @factory: a #GstDeviceProviderFactory
|
||||||
*
|
*
|
||||||
* Get the available keys for the metadata on @factory.
|
* Get the available keys for the metadata on @factory.
|
||||||
*
|
*
|
||||||
|
@ -433,13 +433,14 @@ gst_device_monitor_factory_get_metadata (GstDeviceMonitorFactory * factory,
|
||||||
* Since: 1.4
|
* Since: 1.4
|
||||||
*/
|
*/
|
||||||
gchar **
|
gchar **
|
||||||
gst_device_monitor_factory_get_metadata_keys (GstDeviceMonitorFactory * factory)
|
gst_device_provider_factory_get_metadata_keys (GstDeviceProviderFactory *
|
||||||
|
factory)
|
||||||
{
|
{
|
||||||
GstStructure *metadata;
|
GstStructure *metadata;
|
||||||
gchar **arr;
|
gchar **arr;
|
||||||
gint i, num;
|
gint i, num;
|
||||||
|
|
||||||
g_return_val_if_fail (GST_IS_DEVICE_MONITOR_FACTORY (factory), NULL);
|
g_return_val_if_fail (GST_IS_DEVICE_PROVIDER_FACTORY (factory), NULL);
|
||||||
|
|
||||||
metadata = (GstStructure *) factory->metadata;
|
metadata = (GstStructure *) factory->metadata;
|
||||||
if (metadata == NULL)
|
if (metadata == NULL)
|
||||||
|
@ -458,8 +459,8 @@ gst_device_monitor_factory_get_metadata_keys (GstDeviceMonitorFactory * factory)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_device_monitor_factory_has_classesv:
|
* gst_device_provider_factory_has_classesv:
|
||||||
* @factory: a #GstDeviceMonitorFactory
|
* @factory: a #GstDeviceProviderFactory
|
||||||
* @classes: (array zero-terminated=1): a %NULL terminated array of
|
* @classes: (array zero-terminated=1): a %NULL terminated array of
|
||||||
* klasses to match, only match if all classes are matched
|
* klasses to match, only match if all classes are matched
|
||||||
*
|
*
|
||||||
|
@ -470,19 +471,19 @@ gst_device_monitor_factory_get_metadata_keys (GstDeviceMonitorFactory * factory)
|
||||||
* Since: 1.4
|
* Since: 1.4
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
gst_device_monitor_factory_has_classesv (GstDeviceMonitorFactory * factory,
|
gst_device_provider_factory_has_classesv (GstDeviceProviderFactory * factory,
|
||||||
gchar ** classes)
|
gchar ** classes)
|
||||||
{
|
{
|
||||||
const gchar *klass;
|
const gchar *klass;
|
||||||
|
|
||||||
g_return_val_if_fail (GST_IS_DEVICE_MONITOR_FACTORY (factory), FALSE);
|
g_return_val_if_fail (GST_IS_DEVICE_PROVIDER_FACTORY (factory), FALSE);
|
||||||
|
|
||||||
klass = gst_device_monitor_factory_get_metadata (factory,
|
klass = gst_device_provider_factory_get_metadata (factory,
|
||||||
GST_ELEMENT_METADATA_KLASS);
|
GST_ELEMENT_METADATA_KLASS);
|
||||||
|
|
||||||
if (klass == NULL) {
|
if (klass == NULL) {
|
||||||
GST_ERROR_OBJECT (factory,
|
GST_ERROR_OBJECT (factory,
|
||||||
"device monitor factory is missing klass identifiers");
|
"device provider factory is missing klass identifiers");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -509,8 +510,8 @@ gst_device_monitor_factory_has_classesv (GstDeviceMonitorFactory * factory,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_device_monitor_factory_has_classes:
|
* gst_device_provider_factory_has_classes:
|
||||||
* @factory: a #GstDeviceMonitorFactory
|
* @factory: a #GstDeviceProviderFactory
|
||||||
* @classes: a "/" separate list of klasses to match, only match if all classes
|
* @classes: a "/" separate list of klasses to match, only match if all classes
|
||||||
* are matched
|
* are matched
|
||||||
*
|
*
|
||||||
|
@ -521,7 +522,7 @@ gst_device_monitor_factory_has_classesv (GstDeviceMonitorFactory * factory,
|
||||||
* Since: 1.4
|
* Since: 1.4
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
gst_device_monitor_factory_has_classes (GstDeviceMonitorFactory * factory,
|
gst_device_provider_factory_has_classes (GstDeviceProviderFactory * factory,
|
||||||
const gchar * classes)
|
const gchar * classes)
|
||||||
{
|
{
|
||||||
gchar **classesv;
|
gchar **classesv;
|
||||||
|
@ -529,7 +530,7 @@ gst_device_monitor_factory_has_classes (GstDeviceMonitorFactory * factory,
|
||||||
|
|
||||||
classesv = g_strsplit (classes, "/", 0);
|
classesv = g_strsplit (classes, "/", 0);
|
||||||
|
|
||||||
res = gst_device_monitor_factory_has_classesv (factory, classesv);
|
res = gst_device_provider_factory_has_classesv (factory, classesv);
|
||||||
|
|
||||||
g_strfreev (classesv);
|
g_strfreev (classesv);
|
||||||
|
|
||||||
|
@ -543,38 +544,38 @@ typedef struct
|
||||||
} FilterData;
|
} FilterData;
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
device_monitor_filter (GstPluginFeature * feature, FilterData * data)
|
device_provider_filter (GstPluginFeature * feature, FilterData * data)
|
||||||
{
|
{
|
||||||
gboolean res;
|
gboolean res;
|
||||||
|
|
||||||
/* we only care about device monitor factories */
|
/* we only care about device provider factories */
|
||||||
if (G_UNLIKELY (!GST_IS_DEVICE_MONITOR_FACTORY (feature)))
|
if (G_UNLIKELY (!GST_IS_DEVICE_PROVIDER_FACTORY (feature)))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
res = (gst_plugin_feature_get_rank (feature) >= data->minrank) &&
|
res = (gst_plugin_feature_get_rank (feature) >= data->minrank) &&
|
||||||
gst_device_monitor_factory_has_classes (GST_DEVICE_MONITOR_FACTORY_CAST
|
gst_device_provider_factory_has_classes (GST_DEVICE_PROVIDER_FACTORY_CAST
|
||||||
(feature), data->classes);
|
(feature), data->classes);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_device_monitor_factory_list_get_device_monitors:
|
* gst_device_provider_factory_list_get_device_providers:
|
||||||
* @classes: a "/" separate list of klasses to match, only match if all classes
|
* @classes: a "/" separate list of klasses to match, only match if all classes
|
||||||
* are matched
|
* are matched
|
||||||
* @minrank: Minimum rank
|
* @minrank: Minimum rank
|
||||||
*
|
*
|
||||||
* Get a list of factories that match all of the given @classes. Only
|
* Get a list of factories that match all of the given @classes. Only
|
||||||
* device monitors with a rank greater or equal to @minrank will be
|
* device providers with a rank greater or equal to @minrank will be
|
||||||
* returned. The list of factories is returned by decreasing rank.
|
* returned. The list of factories is returned by decreasing rank.
|
||||||
*
|
*
|
||||||
* Returns: (transfer full) (element-type Gst.DeviceMonitorFactory): a #GList of
|
* Returns: (transfer full) (element-type Gst.DeviceProviderFactory): a #GList of
|
||||||
* #GstDeviceMonitorFactory device monitors. Use gst_plugin_feature_list_free() after
|
* #GstDeviceProviderFactory device providers. Use gst_plugin_feature_list_free() after
|
||||||
* usage.
|
* usage.
|
||||||
*
|
*
|
||||||
* Since: 1.4
|
* Since: 1.4
|
||||||
*/
|
*/
|
||||||
GList *gst_device_monitor_factory_list_get_device_monitors
|
GList *gst_device_provider_factory_list_get_device_providers
|
||||||
(const gchar * classes, GstRank minrank)
|
(const gchar * classes, GstRank minrank)
|
||||||
{
|
{
|
||||||
GList *result;
|
GList *result;
|
||||||
|
@ -586,7 +587,7 @@ GList *gst_device_monitor_factory_list_get_device_monitors
|
||||||
|
|
||||||
/* get the feature list using the filter */
|
/* get the feature list using the filter */
|
||||||
result = gst_registry_feature_filter (gst_registry_get (),
|
result = gst_registry_feature_filter (gst_registry_get (),
|
||||||
(GstPluginFeatureFilter) device_monitor_filter, FALSE, &data);
|
(GstPluginFeatureFilter) device_provider_filter, FALSE, &data);
|
||||||
|
|
||||||
/* sort on rank and name */
|
/* sort on rank and name */
|
||||||
result = g_list_sort (result, gst_plugin_feature_rank_compare_func);
|
result = g_list_sort (result, gst_plugin_feature_rank_compare_func);
|
90
gst/gstdeviceproviderfactory.h
Normal file
90
gst/gstdeviceproviderfactory.h
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
/* GStreamer
|
||||||
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
||||||
|
* 2000,2004 Wim Taymans <wim@fluendo.com>
|
||||||
|
* 2012 Olivier Crete <olivier.crete@collabora.com>
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __GST_DEVICE_PROVIDER_FACTORY_H__
|
||||||
|
#define __GST_DEVICE_PROVIDER_FACTORY_H__
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GstDeviceProviderFactory:
|
||||||
|
*
|
||||||
|
* The opaque #GstDeviceProviderFactory data structure.
|
||||||
|
*
|
||||||
|
* Since: 1.4
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GstDeviceProviderFactoryClass:
|
||||||
|
*
|
||||||
|
* The opaque #GstDeviceProviderFactoryClass data structure.
|
||||||
|
*
|
||||||
|
* Since: 1.4
|
||||||
|
*/
|
||||||
|
typedef struct _GstDeviceProviderFactory GstDeviceProviderFactory;
|
||||||
|
typedef struct _GstDeviceProviderFactoryClass GstDeviceProviderFactoryClass;
|
||||||
|
|
||||||
|
#include <gst/gstconfig.h>
|
||||||
|
#include <gst/gstplugin.h>
|
||||||
|
#include <gst/gstpluginfeature.h>
|
||||||
|
#include <gst/gstdeviceprovider.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
#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_provider_factory_get_type (void);
|
||||||
|
|
||||||
|
GstDeviceProviderFactory * gst_device_provider_factory_find (const gchar *name);
|
||||||
|
|
||||||
|
GType gst_device_provider_factory_get_device_provider_type (GstDeviceProviderFactory *factory);
|
||||||
|
|
||||||
|
const gchar * gst_device_provider_factory_get_metadata (GstDeviceProviderFactory *factory, const gchar *key);
|
||||||
|
gchar ** gst_device_provider_factory_get_metadata_keys (GstDeviceProviderFactory *factory);
|
||||||
|
|
||||||
|
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_provider_register (GstPlugin *plugin, const gchar *name,
|
||||||
|
guint rank,
|
||||||
|
GType type);
|
||||||
|
|
||||||
|
gboolean gst_device_provider_factory_has_classesv (GstDeviceProviderFactory * factory,
|
||||||
|
gchar ** classes);
|
||||||
|
|
||||||
|
gboolean gst_device_provider_factory_has_classes (GstDeviceProviderFactory *factory,
|
||||||
|
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_PROVIDER_FACTORY_H__ */
|
|
@ -22,12 +22,12 @@
|
||||||
/**
|
/**
|
||||||
* SECTION:gstglobaldevicemonitor
|
* SECTION:gstglobaldevicemonitor
|
||||||
* @short_description: A global device monitor and prober
|
* @short_description: A global device monitor and prober
|
||||||
* @see_also: #GstDevice, #GstDeviceMonitor
|
* @see_also: #GstDevice, #GstDeviceProvider
|
||||||
*
|
*
|
||||||
* Applications should create a #GstGlobalDeviceMonitor when they want
|
* Applications should create a #GstGlobalDeviceMonitor when they want
|
||||||
* to probe, list and monitor devices of a specific type. The
|
* to probe, list and monitor devices of a specific type. The
|
||||||
* #GstGlobalDeviceMonitor will create the appropriate
|
* #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
|
* messages on its #GstBus for devices that have been added and
|
||||||
* removed.
|
* removed.
|
||||||
*
|
*
|
||||||
|
@ -48,7 +48,7 @@ struct _GstGlobalDeviceMonitorPrivate
|
||||||
|
|
||||||
GstBus *bus;
|
GstBus *bus;
|
||||||
|
|
||||||
GPtrArray *monitors;
|
GPtrArray *providers;
|
||||||
guint cookie;
|
guint cookie;
|
||||||
|
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
|
@ -111,28 +111,28 @@ gst_global_device_monitor_init (GstGlobalDeviceMonitor * self)
|
||||||
self->priv->bus = gst_bus_new ();
|
self->priv->bus = gst_bus_new ();
|
||||||
gst_bus_set_flushing (self->priv->bus, TRUE);
|
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->caps = gst_caps_new_any ();
|
||||||
self->priv->classes = g_strdup ("");
|
self->priv->classes = g_strdup ("");
|
||||||
|
|
||||||
factories =
|
factories =
|
||||||
gst_device_monitor_factory_list_get_device_monitors (self->priv->classes,
|
gst_device_provider_factory_list_get_device_providers (self->priv->
|
||||||
1);
|
classes, 1);
|
||||||
|
|
||||||
while (factories) {
|
while (factories) {
|
||||||
GstDeviceMonitorFactory *factory = factories->data;
|
GstDeviceProviderFactory *factory = factories->data;
|
||||||
GstDeviceMonitor *monitor;
|
GstDeviceProvider *provider;
|
||||||
|
|
||||||
factories = g_list_remove (factories, factory);
|
factories = g_list_remove (factories, factory);
|
||||||
|
|
||||||
monitor = gst_device_monitor_factory_get (factory);
|
provider = gst_device_provider_factory_get (factory);
|
||||||
if (monitor) {
|
if (provider) {
|
||||||
GstBus *bus = gst_device_monitor_get_bus (monitor);
|
GstBus *bus = gst_device_provider_get_bus (provider);
|
||||||
|
|
||||||
gst_bus_enable_sync_message_emission (bus);
|
gst_bus_enable_sync_message_emission (bus);
|
||||||
g_signal_connect (bus, "sync-message",
|
g_signal_connect (bus, "sync-message",
|
||||||
G_CALLBACK (bus_sync_message), self);
|
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);
|
gst_object_unref (factory);
|
||||||
|
@ -143,16 +143,16 @@ gst_global_device_monitor_init (GstGlobalDeviceMonitor * self)
|
||||||
static void
|
static void
|
||||||
gst_global_device_monitor_remove (GstGlobalDeviceMonitor * self, guint i)
|
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;
|
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);
|
g_signal_handlers_disconnect_by_func (bus, bus_sync_message, self);
|
||||||
gst_object_unref (bus);
|
gst_object_unref (bus);
|
||||||
|
|
||||||
gst_object_unref (monitor);
|
gst_object_unref (provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -162,11 +162,11 @@ gst_global_device_monitor_dispose (GObject * object)
|
||||||
|
|
||||||
g_return_if_fail (self->priv->started == FALSE);
|
g_return_if_fail (self->priv->started == FALSE);
|
||||||
|
|
||||||
if (self->priv->monitors) {
|
if (self->priv->providers) {
|
||||||
while (self->priv->monitors->len)
|
while (self->priv->providers->len)
|
||||||
gst_global_device_monitor_remove (self, self->priv->monitors->len - 1);
|
gst_global_device_monitor_remove (self, self->priv->providers->len - 1);
|
||||||
g_ptr_array_unref (self->priv->monitors);
|
g_ptr_array_unref (self->priv->providers);
|
||||||
self->priv->monitors = NULL;
|
self->priv->providers = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_caps_replace (&self->priv->caps, 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:
|
* 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
|
* 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.
|
* probe the hardware if the global monitor is not currently started.
|
||||||
|
@ -207,15 +207,15 @@ again:
|
||||||
|
|
||||||
cookie = monitor->priv->cookie;
|
cookie = monitor->priv->cookie;
|
||||||
|
|
||||||
for (i = 0; i < monitor->priv->monitors->len; i++) {
|
for (i = 0; i < monitor->priv->providers->len; i++) {
|
||||||
GList *tmpdev;
|
GList *tmpdev;
|
||||||
GstDeviceMonitor *device_monitor =
|
GstDeviceProvider *provider =
|
||||||
gst_object_ref (g_ptr_array_index (monitor->priv->monitors, i));
|
gst_object_ref (g_ptr_array_index (monitor->priv->providers, i));
|
||||||
GList *item;
|
GList *item;
|
||||||
|
|
||||||
GST_OBJECT_UNLOCK (monitor);
|
GST_OBJECT_UNLOCK (monitor);
|
||||||
|
|
||||||
tmpdev = gst_device_monitor_get_devices (device_monitor);
|
tmpdev = gst_device_provider_get_devices (provider);
|
||||||
|
|
||||||
for (item = tmpdev; item; item = item->next) {
|
for (item = tmpdev; item; item = item->next) {
|
||||||
GstDevice *dev = GST_DEVICE (item->data);
|
GstDevice *dev = GST_DEVICE (item->data);
|
||||||
|
@ -228,7 +228,7 @@ again:
|
||||||
}
|
}
|
||||||
|
|
||||||
g_list_free_full (tmpdev, gst_object_unref);
|
g_list_free_full (tmpdev, gst_object_unref);
|
||||||
gst_object_unref (device_monitor);
|
gst_object_unref (provider);
|
||||||
|
|
||||||
GST_OBJECT_LOCK (monitor);
|
GST_OBJECT_LOCK (monitor);
|
||||||
|
|
||||||
|
@ -263,20 +263,20 @@ gst_global_device_monitor_start (GstGlobalDeviceMonitor * monitor)
|
||||||
|
|
||||||
GST_OBJECT_LOCK (monitor);
|
GST_OBJECT_LOCK (monitor);
|
||||||
|
|
||||||
if (monitor->priv->monitors->len == 0) {
|
if (monitor->priv->providers->len == 0) {
|
||||||
GST_OBJECT_UNLOCK (monitor);
|
GST_OBJECT_UNLOCK (monitor);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_bus_set_flushing (monitor->priv->bus, FALSE);
|
gst_bus_set_flushing (monitor->priv->bus, FALSE);
|
||||||
|
|
||||||
for (i = 0; i < monitor->priv->monitors->len; i++) {
|
for (i = 0; i < monitor->priv->providers->len; i++) {
|
||||||
if (!gst_device_monitor_start (g_ptr_array_index (monitor->priv->monitors,
|
if (!gst_device_provider_start (g_ptr_array_index (monitor->priv->providers,
|
||||||
i))) {
|
i))) {
|
||||||
gst_bus_set_flushing (monitor->priv->bus, TRUE);
|
gst_bus_set_flushing (monitor->priv->bus, TRUE);
|
||||||
|
|
||||||
for (; i != 0; i--)
|
for (; i != 0; i--)
|
||||||
gst_device_monitor_stop (g_ptr_array_index (monitor->priv->monitors,
|
gst_device_provider_stop (g_ptr_array_index (monitor->priv->providers,
|
||||||
i - 1));
|
i - 1));
|
||||||
|
|
||||||
GST_OBJECT_UNLOCK (monitor);
|
GST_OBJECT_UNLOCK (monitor);
|
||||||
|
@ -292,7 +292,7 @@ gst_global_device_monitor_start (GstGlobalDeviceMonitor * monitor)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_global_device_monitor_stop:
|
* gst_global_device_monitor_stop:
|
||||||
* @monitor: A #GstDeviceMonitor
|
* @monitor: A #GstDeviceProvider
|
||||||
*
|
*
|
||||||
* Stops monitoring the devices.
|
* Stops monitoring the devices.
|
||||||
*
|
*
|
||||||
|
@ -308,8 +308,8 @@ gst_global_device_monitor_stop (GstGlobalDeviceMonitor * monitor)
|
||||||
gst_bus_set_flushing (monitor->priv->bus, TRUE);
|
gst_bus_set_flushing (monitor->priv->bus, TRUE);
|
||||||
|
|
||||||
GST_OBJECT_LOCK (monitor);
|
GST_OBJECT_LOCK (monitor);
|
||||||
for (i = 0; i < monitor->priv->monitors->len; i++)
|
for (i = 0; i < monitor->priv->providers->len; i++)
|
||||||
gst_device_monitor_stop (g_ptr_array_index (monitor->priv->monitors, i));
|
gst_device_provider_stop (g_ptr_array_index (monitor->priv->providers, i));
|
||||||
monitor->priv->started = FALSE;
|
monitor->priv->started = FALSE;
|
||||||
GST_OBJECT_UNLOCK (monitor);
|
GST_OBJECT_UNLOCK (monitor);
|
||||||
|
|
||||||
|
@ -345,15 +345,16 @@ gst_global_device_monitor_set_classes_filter (GstGlobalDeviceMonitor * monitor,
|
||||||
g_free (monitor->priv->classes);
|
g_free (monitor->priv->classes);
|
||||||
monitor->priv->classes = g_strdup (classes);
|
monitor->priv->classes = g_strdup (classes);
|
||||||
|
|
||||||
factories = gst_device_monitor_factory_list_get_device_monitors (classes, 1);
|
factories = gst_device_provider_factory_list_get_device_providers (classes,
|
||||||
|
1);
|
||||||
|
|
||||||
for (i = 0; i < monitor->priv->monitors->len; i++) {
|
for (i = 0; i < monitor->priv->providers->len; i++) {
|
||||||
GstDeviceMonitor *dev_monitor;
|
GstDeviceProvider *provider;
|
||||||
GstDeviceMonitorFactory *f;
|
GstDeviceProviderFactory *f;
|
||||||
GList *item;
|
GList *item;
|
||||||
|
|
||||||
dev_monitor = g_ptr_array_index (monitor->priv->monitors, i);
|
provider = g_ptr_array_index (monitor->priv->providers, i);
|
||||||
f = gst_device_monitor_get_factory (dev_monitor);
|
f = gst_device_provider_get_factory (provider);
|
||||||
|
|
||||||
item = g_list_find (factories, f);
|
item = g_list_find (factories, f);
|
||||||
|
|
||||||
|
@ -364,7 +365,7 @@ gst_global_device_monitor_set_classes_filter (GstGlobalDeviceMonitor * monitor,
|
||||||
factories = g_list_remove_link (factories, item);
|
factories = g_list_remove_link (factories, item);
|
||||||
gst_object_unref (f);
|
gst_object_unref (f);
|
||||||
} else {
|
} else {
|
||||||
/* If it's not in our list, them remove it from the list of monitors.
|
/* If it's not in our list, them remove it from the list of providers.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
monitor->priv->cookie++;
|
monitor->priv->cookie++;
|
||||||
|
@ -374,20 +375,20 @@ gst_global_device_monitor_set_classes_filter (GstGlobalDeviceMonitor * monitor,
|
||||||
}
|
}
|
||||||
|
|
||||||
while (factories) {
|
while (factories) {
|
||||||
GstDeviceMonitorFactory *factory = factories->data;
|
GstDeviceProviderFactory *factory = factories->data;
|
||||||
GstDeviceMonitor *device_monitor;
|
GstDeviceProvider *provider;
|
||||||
|
|
||||||
factories = g_list_remove (factories, factory);
|
factories = g_list_remove (factories, factory);
|
||||||
|
|
||||||
device_monitor = gst_device_monitor_factory_get (factory);
|
provider = gst_device_provider_factory_get (factory);
|
||||||
if (device_monitor) {
|
if (provider) {
|
||||||
GstBus *bus = gst_device_monitor_get_bus (device_monitor);
|
GstBus *bus = gst_device_provider_get_bus (provider);
|
||||||
|
|
||||||
gst_bus_enable_sync_message_emission (bus);
|
gst_bus_enable_sync_message_emission (bus);
|
||||||
g_signal_connect (bus, "sync-message",
|
g_signal_connect (bus, "sync-message",
|
||||||
G_CALLBACK (bus_sync_message), monitor);
|
G_CALLBACK (bus_sync_message), monitor);
|
||||||
gst_object_unref (bus);
|
gst_object_unref (bus);
|
||||||
g_ptr_array_add (monitor->priv->monitors, device_monitor);
|
g_ptr_array_add (monitor->priv->providers, provider);
|
||||||
monitor->priv->cookie++;
|
monitor->priv->cookie++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -484,7 +485,7 @@ gst_global_device_monitor_new (void)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_global_device_monitor_get_bus:
|
* gst_global_device_monitor_get_bus:
|
||||||
* @monitor: a #GstDeviceMonitor
|
* @monitor: a #GstDeviceProvider
|
||||||
*
|
*
|
||||||
* Gets the #GstBus of this #GstGlobalDeviceMonitor
|
* Gets the #GstBus of this #GstGlobalDeviceMonitor
|
||||||
*
|
*
|
||||||
|
|
|
@ -25,8 +25,8 @@
|
||||||
|
|
||||||
#include <gst/gstobject.h>
|
#include <gst/gstobject.h>
|
||||||
#include <gst/gstdevice.h>
|
#include <gst/gstdevice.h>
|
||||||
#include <gst/gstdevicemonitor.h>
|
#include <gst/gstdeviceprovider.h>
|
||||||
#include <gst/gstdevicemonitorfactory.h>
|
#include <gst/gstdeviceproviderfactory.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
|
|
@ -2340,7 +2340,7 @@ gst_message_parse_have_context (GstMessage * message, GstContext ** context)
|
||||||
* @device: (transfer none): The new #GstDevice
|
* @device: (transfer none): The new #GstDevice
|
||||||
*
|
*
|
||||||
* Creates a new device-added message. The device-added message is produced by
|
* Creates a new device-added message. The device-added message is produced by
|
||||||
* #GstDeviceMonitor or a #GstGlobalDeviceMonitor. They announce the appearance
|
* #GstDeviceProvider or a #GstGlobalDeviceMonitor. They announce the appearance
|
||||||
* of monitored devices.
|
* of monitored devices.
|
||||||
*
|
*
|
||||||
* Returns: a newly allocated #GstMessage
|
* Returns: a newly allocated #GstMessage
|
||||||
|
@ -2370,7 +2370,7 @@ gst_message_new_device_added (GstObject * src, GstDevice * device)
|
||||||
* pointer to the new #GstDevice, or %NULL
|
* pointer to the new #GstDevice, or %NULL
|
||||||
*
|
*
|
||||||
* Parses a device-added message. The device-added message is produced by
|
* Parses a device-added message. The device-added message is produced by
|
||||||
* #GstDeviceMonitor or a #GstGlobalDeviceMonitor. It announces the appearance
|
* #GstDeviceProvider or a #GstGlobalDeviceMonitor. It announces the appearance
|
||||||
* of monitored devices.
|
* of monitored devices.
|
||||||
*
|
*
|
||||||
* Since: 1.4
|
* Since: 1.4
|
||||||
|
@ -2392,7 +2392,7 @@ gst_message_parse_device_added (GstMessage * message, GstDevice ** device)
|
||||||
* @device: (transfer none): The removed #GstDevice
|
* @device: (transfer none): The removed #GstDevice
|
||||||
*
|
*
|
||||||
* Creates a new device-removed message. The device-removed message is produced
|
* Creates a new device-removed message. The device-removed message is produced
|
||||||
* by #GstDeviceMonitor or a #GstGlobalDeviceMonitor. They announce the
|
* by #GstDeviceProvider or a #GstGlobalDeviceMonitor. They announce the
|
||||||
* disappearance of monitored devices.
|
* disappearance of monitored devices.
|
||||||
*
|
*
|
||||||
* Returns: a newly allocated #GstMessage
|
* Returns: a newly allocated #GstMessage
|
||||||
|
@ -2422,7 +2422,7 @@ gst_message_new_device_removed (GstObject * src, GstDevice * device)
|
||||||
* pointer to the removed #GstDevice, or %NULL
|
* pointer to the removed #GstDevice, or %NULL
|
||||||
*
|
*
|
||||||
* Parses a device-removed message. The device-removed message is produced by
|
* Parses a device-removed message. The device-removed message is produced by
|
||||||
* #GstDeviceMonitor or a #GstGlobalDeviceMonitor. It announces the
|
* #GstDeviceProvider or a #GstGlobalDeviceMonitor. It announces the
|
||||||
* disappearance of monitored devices.
|
* disappearance of monitored devices.
|
||||||
*
|
*
|
||||||
* Since: 1.4
|
* Since: 1.4
|
||||||
|
|
|
@ -105,9 +105,9 @@ typedef struct _GstMessage GstMessage;
|
||||||
* filter for GST_MESSAGE_EXTENDED and then check the result for the
|
* filter for GST_MESSAGE_EXTENDED and then check the result for the
|
||||||
* specific type. (Since 1.4)
|
* specific type. (Since 1.4)
|
||||||
* @GST_MESSAGE_DEVICE_ADDED: Message indicating a #GstDevice was added to
|
* @GST_MESSAGE_DEVICE_ADDED: Message indicating a #GstDevice was added to
|
||||||
* a #GstDeviceMonitor (Since 1.4)
|
* a #GstDeviceProvider (Since 1.4)
|
||||||
* @GST_MESSAGE_DEVICE_REMOVED: Message indicating a #GstDevice was removed
|
* @GST_MESSAGE_DEVICE_REMOVED: Message indicating a #GstDevice was removed
|
||||||
* from a #GstDeviceMonitor (Since 1.4)
|
* from a #GstDeviceProvider (Since 1.4)
|
||||||
* @GST_MESSAGE_ANY: mask for all of the above messages.
|
* @GST_MESSAGE_ANY: mask for all of the above messages.
|
||||||
*
|
*
|
||||||
* The different message types that are available.
|
* The different message types that are available.
|
||||||
|
|
|
@ -127,7 +127,7 @@
|
||||||
#include "gstinfo.h"
|
#include "gstinfo.h"
|
||||||
#include "gsterror.h"
|
#include "gsterror.h"
|
||||||
#include "gstregistry.h"
|
#include "gstregistry.h"
|
||||||
#include "gstdevicemonitorfactory.h"
|
#include "gstdeviceproviderfactory.h"
|
||||||
|
|
||||||
#include "gstpluginloader.h"
|
#include "gstpluginloader.h"
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ struct _GstRegistryPrivate
|
||||||
guint32 efl_cookie;
|
guint32 efl_cookie;
|
||||||
GList *typefind_factory_list;
|
GList *typefind_factory_list;
|
||||||
guint32 tfl_cookie;
|
guint32 tfl_cookie;
|
||||||
GList *device_monitor_factory_list;
|
GList *device_provider_factory_list;
|
||||||
guint32 dmfl_cookie;
|
guint32 dmfl_cookie;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -317,10 +317,10 @@ gst_registry_finalize (GObject * object)
|
||||||
gst_plugin_feature_list_free (registry->priv->typefind_factory_list);
|
gst_plugin_feature_list_free (registry->priv->typefind_factory_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (registry->priv->device_monitor_factory_list) {
|
if (registry->priv->device_provider_factory_list) {
|
||||||
GST_DEBUG_OBJECT (registry,
|
GST_DEBUG_OBJECT (registry,
|
||||||
"Cleaning up cached device monitor factory list");
|
"Cleaning up cached device provider factory list");
|
||||||
gst_plugin_feature_list_free (registry->priv->device_monitor_factory_list);
|
gst_plugin_feature_list_free (registry->priv->device_provider_factory_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
|
@ -789,20 +789,20 @@ gst_registry_get_typefind_factory_list (GstRegistry * registry)
|
||||||
|
|
||||||
|
|
||||||
static GList *
|
static GList *
|
||||||
gst_registry_get_device_monitor_factory_list (GstRegistry * registry)
|
gst_registry_get_device_provider_factory_list (GstRegistry * registry)
|
||||||
{
|
{
|
||||||
GList *list;
|
GList *list;
|
||||||
|
|
||||||
GST_OBJECT_LOCK (registry);
|
GST_OBJECT_LOCK (registry);
|
||||||
|
|
||||||
gst_registry_get_feature_list_or_create (registry,
|
gst_registry_get_feature_list_or_create (registry,
|
||||||
®istry->priv->device_monitor_factory_list,
|
®istry->priv->device_provider_factory_list,
|
||||||
®istry->priv->dmfl_cookie, GST_TYPE_DEVICE_MONITOR_FACTORY);
|
®istry->priv->dmfl_cookie, GST_TYPE_DEVICE_PROVIDER_FACTORY);
|
||||||
|
|
||||||
/* Return reffed copy */
|
/* Return reffed copy */
|
||||||
list =
|
list =
|
||||||
gst_plugin_feature_list_copy (registry->
|
gst_plugin_feature_list_copy (registry->
|
||||||
priv->device_monitor_factory_list);
|
priv->device_provider_factory_list);
|
||||||
|
|
||||||
GST_OBJECT_UNLOCK (registry);
|
GST_OBJECT_UNLOCK (registry);
|
||||||
|
|
||||||
|
@ -953,8 +953,8 @@ gst_registry_get_feature_list (GstRegistry * registry, GType type)
|
||||||
return gst_registry_get_element_factory_list (registry);
|
return gst_registry_get_element_factory_list (registry);
|
||||||
else if (type == GST_TYPE_TYPE_FIND_FACTORY)
|
else if (type == GST_TYPE_TYPE_FIND_FACTORY)
|
||||||
return gst_registry_get_typefind_factory_list (registry);
|
return gst_registry_get_typefind_factory_list (registry);
|
||||||
else if (type == GST_TYPE_DEVICE_MONITOR_FACTORY)
|
else if (type == GST_TYPE_DEVICE_PROVIDER_FACTORY)
|
||||||
return gst_registry_get_device_monitor_factory_list (registry);
|
return gst_registry_get_device_provider_factory_list (registry);
|
||||||
|
|
||||||
data.type = type;
|
data.type = type;
|
||||||
data.name = NULL;
|
data.name = NULL;
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
#include <gst/gstelement.h>
|
#include <gst/gstelement.h>
|
||||||
#include <gst/gsttypefind.h>
|
#include <gst/gsttypefind.h>
|
||||||
#include <gst/gsttypefindfactory.h>
|
#include <gst/gsttypefindfactory.h>
|
||||||
#include <gst/gstdevicemonitorfactory.h>
|
#include <gst/gstdeviceproviderfactory.h>
|
||||||
#include <gst/gsturi.h>
|
#include <gst/gsturi.h>
|
||||||
#include <gst/gstinfo.h>
|
#include <gst/gstinfo.h>
|
||||||
#include <gst/gstenumtypes.h>
|
#include <gst/gstenumtypes.h>
|
||||||
|
@ -526,7 +526,7 @@ priv_gst_registry_binary_read_cache (GstRegistry * registry,
|
||||||
/* make sure these types exist */
|
/* make sure these types exist */
|
||||||
GST_TYPE_ELEMENT_FACTORY;
|
GST_TYPE_ELEMENT_FACTORY;
|
||||||
GST_TYPE_TYPE_FIND_FACTORY;
|
GST_TYPE_TYPE_FIND_FACTORY;
|
||||||
GST_TYPE_DEVICE_MONITOR_FACTORY;
|
GST_TYPE_DEVICE_PROVIDER_FACTORY;
|
||||||
|
|
||||||
#ifndef GST_DISABLE_GST_DEBUG
|
#ifndef GST_DISABLE_GST_DEBUG
|
||||||
timer = g_timer_new ();
|
timer = g_timer_new ();
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
#include <gst/gstelement.h>
|
#include <gst/gstelement.h>
|
||||||
#include <gst/gsttypefind.h>
|
#include <gst/gsttypefind.h>
|
||||||
#include <gst/gsttypefindfactory.h>
|
#include <gst/gsttypefindfactory.h>
|
||||||
#include <gst/gstdevicemonitorfactory.h>
|
#include <gst/gstdeviceproviderfactory.h>
|
||||||
#include <gst/gsturi.h>
|
#include <gst/gsturi.h>
|
||||||
#include <gst/gstinfo.h>
|
#include <gst/gstinfo.h>
|
||||||
#include <gst/gstenumtypes.h>
|
#include <gst/gstenumtypes.h>
|
||||||
|
@ -333,17 +333,17 @@ gst_registry_chunks_save_feature (GList ** list, GstPluginFeature * feature)
|
||||||
} else {
|
} else {
|
||||||
gst_registry_chunks_save_const_string (list, "");
|
gst_registry_chunks_save_const_string (list, "");
|
||||||
}
|
}
|
||||||
} else if (GST_IS_DEVICE_MONITOR_FACTORY (feature)) {
|
} else if (GST_IS_DEVICE_PROVIDER_FACTORY (feature)) {
|
||||||
GstRegistryChunkDeviceMonitorFactory *tff;
|
GstRegistryChunkDeviceProviderFactory *tff;
|
||||||
GstDeviceMonitorFactory *factory = GST_DEVICE_MONITOR_FACTORY (feature);
|
GstDeviceProviderFactory *factory = GST_DEVICE_PROVIDER_FACTORY (feature);
|
||||||
|
|
||||||
/* Initialize with zeroes because of struct padding and
|
/* Initialize with zeroes because of struct padding and
|
||||||
* valgrind complaining about copying unitialized memory
|
* valgrind complaining about copying unitialized memory
|
||||||
*/
|
*/
|
||||||
tff = g_slice_new0 (GstRegistryChunkDeviceMonitorFactory);
|
tff = g_slice_new0 (GstRegistryChunkDeviceProviderFactory);
|
||||||
chk =
|
chk =
|
||||||
gst_registry_chunks_make_data (tff,
|
gst_registry_chunks_make_data (tff,
|
||||||
sizeof (GstRegistryChunkDeviceMonitorFactory));
|
sizeof (GstRegistryChunkDeviceProviderFactory));
|
||||||
pf = (GstRegistryChunkPluginFeature *) tff;
|
pf = (GstRegistryChunkPluginFeature *) tff;
|
||||||
|
|
||||||
|
|
||||||
|
@ -668,16 +668,16 @@ gst_registry_chunks_load_feature (GstRegistry * registry, gchar ** in,
|
||||||
factory->extensions[i - 1] = str;
|
factory->extensions[i - 1] = str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (GST_IS_DEVICE_MONITOR_FACTORY (feature)) {
|
} else if (GST_IS_DEVICE_PROVIDER_FACTORY (feature)) {
|
||||||
GstRegistryChunkDeviceMonitorFactory *dmf;
|
GstRegistryChunkDeviceProviderFactory *dmf;
|
||||||
GstDeviceMonitorFactory *factory = GST_DEVICE_MONITOR_FACTORY (feature);
|
GstDeviceProviderFactory *factory = GST_DEVICE_PROVIDER_FACTORY (feature);
|
||||||
const gchar *meta_data_str;
|
const gchar *meta_data_str;
|
||||||
|
|
||||||
align (*in);
|
align (*in);
|
||||||
GST_DEBUG
|
GST_DEBUG
|
||||||
("Reading/casting for GstRegistryChunkPluginFeature at address %p",
|
("Reading/casting for GstRegistryChunkPluginFeature at address %p",
|
||||||
*in);
|
*in);
|
||||||
unpack_element (*in, dmf, GstRegistryChunkDeviceMonitorFactory, end, fail);
|
unpack_element (*in, dmf, GstRegistryChunkDeviceProviderFactory, end, fail);
|
||||||
|
|
||||||
pf = (GstRegistryChunkPluginFeature *) dmf;
|
pf = (GstRegistryChunkPluginFeature *) dmf;
|
||||||
|
|
||||||
|
|
|
@ -132,15 +132,15 @@ typedef struct _GstRegistryChunkTypeFindFactory
|
||||||
} GstRegistryChunkTypeFindFactory;
|
} GstRegistryChunkTypeFindFactory;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GstRegistryChunkDeviceMonitorFactory:
|
* GstRegistryChunkDeviceProviderFactory:
|
||||||
*
|
*
|
||||||
* A structure containing the device monitor factory fields
|
* A structure containing the device provider factory fields
|
||||||
*/
|
*/
|
||||||
typedef struct _GstRegistryChunkDeviceMonitorFactory
|
typedef struct _GstRegistryChunkDeviceProviderFactory
|
||||||
{
|
{
|
||||||
GstRegistryChunkPluginFeature plugin_feature;
|
GstRegistryChunkPluginFeature plugin_feature;
|
||||||
|
|
||||||
} GstRegistryChunkDeviceMonitorFactory;
|
} GstRegistryChunkDeviceProviderFactory;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GstRegistryChunkPadTemplate:
|
* GstRegistryChunkPadTemplate:
|
||||||
|
|
|
@ -1139,7 +1139,7 @@ print_plugin_features (GstPlugin * plugin)
|
||||||
gint num_features = 0;
|
gint num_features = 0;
|
||||||
gint num_elements = 0;
|
gint num_elements = 0;
|
||||||
gint num_typefinders = 0;
|
gint num_typefinders = 0;
|
||||||
gint num_devmonitors = 0;
|
gint num_devproviders = 0;
|
||||||
gint num_other = 0;
|
gint num_other = 0;
|
||||||
|
|
||||||
origlist = features =
|
origlist = features =
|
||||||
|
@ -1180,14 +1180,14 @@ print_plugin_features (GstPlugin * plugin)
|
||||||
gst_plugin_feature_get_name (feature));
|
gst_plugin_feature_get_name (feature));
|
||||||
|
|
||||||
num_typefinders++;
|
num_typefinders++;
|
||||||
} else if (GST_IS_DEVICE_MONITOR_FACTORY (feature)) {
|
} else if (GST_IS_DEVICE_PROVIDER_FACTORY (feature)) {
|
||||||
GstDeviceMonitorFactory *factory;
|
GstDeviceProviderFactory *factory;
|
||||||
|
|
||||||
factory = GST_DEVICE_MONITOR_FACTORY (feature);
|
factory = GST_DEVICE_PROVIDER_FACTORY (feature);
|
||||||
n_print (" %s: %s\n", GST_OBJECT_NAME (factory),
|
n_print (" %s: %s\n", GST_OBJECT_NAME (factory),
|
||||||
gst_device_monitor_factory_get_metadata (factory,
|
gst_device_provider_factory_get_metadata (factory,
|
||||||
GST_ELEMENT_METADATA_LONGNAME));
|
GST_ELEMENT_METADATA_LONGNAME));
|
||||||
num_devmonitors++;
|
num_devproviders++;
|
||||||
} else if (feature) {
|
} else if (feature) {
|
||||||
n_print (" %s (%s)\n", gst_object_get_name (GST_OBJECT (feature)),
|
n_print (" %s (%s)\n", gst_object_get_name (GST_OBJECT (feature)),
|
||||||
g_type_name (G_OBJECT_TYPE (feature)));
|
g_type_name (G_OBJECT_TYPE (feature)));
|
||||||
|
@ -1205,8 +1205,8 @@ print_plugin_features (GstPlugin * plugin)
|
||||||
n_print (" +-- %d elements\n", num_elements);
|
n_print (" +-- %d elements\n", num_elements);
|
||||||
if (num_typefinders > 0)
|
if (num_typefinders > 0)
|
||||||
n_print (" +-- %d typefinders\n", num_typefinders);
|
n_print (" +-- %d typefinders\n", num_typefinders);
|
||||||
if (num_devmonitors > 0)
|
if (num_devproviders > 0)
|
||||||
n_print (" +-- %d device monitors\n", num_devmonitors);
|
n_print (" +-- %d device providers\n", num_devproviders);
|
||||||
if (num_other > 0)
|
if (num_other > 0)
|
||||||
n_print (" +-- %d other objects\n", num_other);
|
n_print (" +-- %d other objects\n", num_other);
|
||||||
|
|
||||||
|
|
|
@ -415,31 +415,31 @@ EXPORTS
|
||||||
gst_device_get_type
|
gst_device_get_type
|
||||||
gst_device_has_classes
|
gst_device_has_classes
|
||||||
gst_device_has_classesv
|
gst_device_has_classesv
|
||||||
gst_device_monitor_can_monitor
|
gst_device_provider_can_monitor
|
||||||
gst_device_monitor_class_add_metadata
|
gst_device_provider_class_add_metadata
|
||||||
gst_device_monitor_class_add_static_metadata
|
gst_device_provider_class_add_static_metadata
|
||||||
gst_device_monitor_class_get_metadata
|
gst_device_provider_class_get_metadata
|
||||||
gst_device_monitor_class_set_metadata
|
gst_device_provider_class_set_metadata
|
||||||
gst_device_monitor_class_set_static_metadata
|
gst_device_provider_class_set_static_metadata
|
||||||
gst_device_monitor_device_add
|
gst_device_provider_device_add
|
||||||
gst_device_monitor_device_remove
|
gst_device_provider_device_remove
|
||||||
gst_device_monitor_factory_find
|
gst_device_provider_factory_find
|
||||||
gst_device_monitor_factory_get
|
gst_device_provider_factory_get
|
||||||
gst_device_monitor_factory_get_by_name
|
gst_device_provider_factory_get_by_name
|
||||||
gst_device_monitor_factory_get_device_monitor_type
|
gst_device_provider_factory_get_device_provider_type
|
||||||
gst_device_monitor_factory_get_metadata
|
gst_device_provider_factory_get_metadata
|
||||||
gst_device_monitor_factory_get_metadata_keys
|
gst_device_provider_factory_get_metadata_keys
|
||||||
gst_device_monitor_factory_get_type
|
gst_device_provider_factory_get_type
|
||||||
gst_device_monitor_factory_has_classes
|
gst_device_provider_factory_has_classes
|
||||||
gst_device_monitor_factory_has_classesv
|
gst_device_provider_factory_has_classesv
|
||||||
gst_device_monitor_factory_list_get_device_monitors
|
gst_device_provider_factory_list_get_device_providers
|
||||||
gst_device_monitor_get_bus
|
gst_device_provider_get_bus
|
||||||
gst_device_monitor_get_devices
|
gst_device_provider_get_devices
|
||||||
gst_device_monitor_get_factory
|
gst_device_provider_get_factory
|
||||||
gst_device_monitor_get_type
|
gst_device_provider_get_type
|
||||||
gst_device_monitor_register
|
gst_device_provider_register
|
||||||
gst_device_monitor_start
|
gst_device_provider_start
|
||||||
gst_device_monitor_stop
|
gst_device_provider_stop
|
||||||
gst_device_reconfigure_element
|
gst_device_reconfigure_element
|
||||||
gst_double_range_get_type
|
gst_double_range_get_type
|
||||||
gst_element_abort_state
|
gst_element_abort_state
|
||||||
|
|
Loading…
Reference in a new issue