2 * Copyright (C) 2012 Olivier Crete <olivier.crete@collabora.com>
4 * gstdeviceprovider.h: Device probing and monitoring
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
24 #ifndef __GST_DEVICE_PROVIDER_H__
25 #define __GST_DEVICE_PROVIDER_H__
27 #include <gst/gstelement.h>
31 typedef struct _GstDeviceProvider GstDeviceProvider;
32 typedef struct _GstDeviceProviderClass GstDeviceProviderClass;
33 typedef struct _GstDeviceProviderPrivate GstDeviceProviderPrivate;
35 #include <gst/gstdeviceproviderfactory.h>
37 #define GST_TYPE_DEVICE_PROVIDER (gst_device_provider_get_type())
38 #define GST_IS_DEVICE_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DEVICE_PROVIDER))
39 #define GST_IS_DEVICE_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_DEVICE_PROVIDER))
40 #define GST_DEVICE_PROVIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_DEVICE_PROVIDER, GstDeviceProviderClass))
41 #define GST_DEVICE_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DEVICE_PROVIDER, GstDeviceProvider))
42 #define GST_DEVICE_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DEVICE_PROVIDER, GstDeviceProviderClass))
43 #define GST_DEVICE_PROVIDER_CAST(obj) ((GstDeviceProvider *)(obj))
48 * @parent: The parent #GstObject
49 * @devices: a #GList of the #GstDevice objects
51 * The structure of the base #GstDeviceProvider
55 struct _GstDeviceProvider {
58 /* Protected by the Object lock */
63 GstDeviceProviderPrivate *priv;
65 gpointer _gst_reserved[GST_PADDING];
69 * GstDeviceProviderClass:
70 * @parent_class: the parent #GstObjectClass structure
71 * @factory: a pointer to the #GstDeviceProviderFactory that creates this
73 * @probe: Returns a list of devices that are currently available.
74 * This should never block.
75 * @start: Starts monitoring for new devices. Only subclasses that can know
76 * that devices have been added or remove need to implement this method.
77 * @stop: Stops monitoring for new devices. Only subclasses that implement
78 * the start() method need to implement this method.
80 * The structure of the base #GstDeviceProviderClass
85 struct _GstDeviceProviderClass {
86 GstObjectClass parent_class;
88 GstDeviceProviderFactory *factory;
90 GList* (*probe) (GstDeviceProvider * provider);
92 gboolean (*start) (GstDeviceProvider * provider);
93 void (*stop) (GstDeviceProvider * provider);
99 gpointer _gst_reserved[GST_PADDING];
103 GType gst_device_provider_get_type (void);
107 GList * gst_device_provider_get_devices (GstDeviceProvider * provider);
110 gboolean gst_device_provider_start (GstDeviceProvider * provider);
113 void gst_device_provider_stop (GstDeviceProvider * provider);
116 gboolean gst_device_provider_can_monitor (GstDeviceProvider * provider);
119 GstBus * gst_device_provider_get_bus (GstDeviceProvider * provider);
122 void gst_device_provider_device_add (GstDeviceProvider * provider,
125 void gst_device_provider_device_remove (GstDeviceProvider * provider,
128 gchar ** gst_device_provider_get_hidden_providers (GstDeviceProvider * provider);
131 void gst_device_provider_hide_provider (GstDeviceProvider * provider,
134 void gst_device_provider_unhide_provider (GstDeviceProvider * provider,
138 const gchar * gst_device_provider_get_metadata (GstDeviceProvider * provider,
141 /* device provider class meta data */
144 void gst_device_provider_class_set_metadata (GstDeviceProviderClass *klass,
145 const gchar *longname,
146 const gchar *classification,
147 const gchar *description,
148 const gchar *author);
150 void gst_device_provider_class_set_static_metadata (GstDeviceProviderClass *klass,
151 const gchar *longname,
152 const gchar *classification,
153 const gchar *description,
154 const gchar *author);
156 void gst_device_provider_class_add_metadata (GstDeviceProviderClass * klass,
157 const gchar * key, const gchar * value);
159 void gst_device_provider_class_add_static_metadata (GstDeviceProviderClass * klass,
160 const gchar * key, const gchar * value);
162 const gchar * gst_device_provider_class_get_metadata (GstDeviceProviderClass * klass,
165 /* factory management */
168 GstDeviceProviderFactory * gst_device_provider_get_factory (GstDeviceProvider * provider);
170 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
171 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstDeviceProvider, gst_object_unref)
176 #endif /* __GST_DEVICE_PROVIDER_H__ */