1/* GStreamer
2 * Copyright (C) 2012 Olivier Crete <[email protected]>
3 *
4 * gstdeviceprovider.h: Device probing and monitoring
5 *
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.
10 *
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.
15 *
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.
20 */
21
22
23
24#ifndef __GST_DEVICE_PROVIDER_H__
25#define __GST_DEVICE_PROVIDER_H__
26
27#include <gst/gstelement.h>
28
29G_BEGIN_DECLS
30
31typedef struct _GstDeviceProvider GstDeviceProvider;
32typedef struct _GstDeviceProviderClass GstDeviceProviderClass;
33typedef struct _GstDeviceProviderPrivate GstDeviceProviderPrivate;
34
35#include <gst/gstdeviceproviderfactory.h>
36
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))
44
45
46/**
47 * GstDeviceProvider:
48 * @parent: The parent #GstObject
49 * @devices: a #GList of the #GstDevice objects
50 *
51 * The structure of the base #GstDeviceProvider
52 *
53 * Since: 1.4
54 */
55struct _GstDeviceProvider {
56 GstObject parent;
57
58 /* Protected by the Object lock */
59 GList *devices;
60
61 /*< private >*/
62
63 GstDeviceProviderPrivate *priv;
64
65 gpointer _gst_reserved[GST_PADDING];
66};
67
68/**
69 * GstDeviceProviderClass:
70 * @parent_class: the parent #GstObjectClass structure
71 * @factory: a pointer to the #GstDeviceProviderFactory that creates this
72 * provider
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.
79 *
80 * The structure of the base #GstDeviceProviderClass
81 *
82 * Since: 1.4
83 */
84
85struct _GstDeviceProviderClass {
86 GstObjectClass parent_class;
87
88 GstDeviceProviderFactory *factory;
89
90 GList* (*probe) (GstDeviceProvider * provider);
91
92 gboolean (*start) (GstDeviceProvider * provider);
93 void (*stop) (GstDeviceProvider * provider);
94
95 /*< private >*/
96 gpointer metadata;
97
98 /*< private >*/
99 gpointer _gst_reserved[GST_PADDING];
100};
101
102GST_API
103GType gst_device_provider_get_type (void);
104
105
106GST_API
107GList * gst_device_provider_get_devices (GstDeviceProvider * provider);
108
109GST_API
110gboolean gst_device_provider_start (GstDeviceProvider * provider);
111
112GST_API
113void gst_device_provider_stop (GstDeviceProvider * provider);
114
115GST_API
116gboolean gst_device_provider_can_monitor (GstDeviceProvider * provider);
117
118GST_API
119GstBus * gst_device_provider_get_bus (GstDeviceProvider * provider);
120
121GST_API
122void gst_device_provider_device_add (GstDeviceProvider * provider,
123 GstDevice * device);
124GST_API
125void gst_device_provider_device_remove (GstDeviceProvider * provider,
126 GstDevice * device);
127GST_API
128gchar ** gst_device_provider_get_hidden_providers (GstDeviceProvider * provider);
129
130GST_API
131void gst_device_provider_hide_provider (GstDeviceProvider * provider,
132 const gchar * name);
133GST_API
134void gst_device_provider_unhide_provider (GstDeviceProvider * provider,
135 const gchar * name);
136
137GST_API
138const gchar * gst_device_provider_get_metadata (GstDeviceProvider * provider,
139 const gchar * key);
140
141/* device provider class meta data */
142
143GST_API
144void gst_device_provider_class_set_metadata (GstDeviceProviderClass *klass,
145 const gchar *longname,
146 const gchar *classification,
147 const gchar *description,
148 const gchar *author);
149GST_API
150void 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);
155GST_API
156void gst_device_provider_class_add_metadata (GstDeviceProviderClass * klass,
157 const gchar * key, const gchar * value);
158GST_API
159void gst_device_provider_class_add_static_metadata (GstDeviceProviderClass * klass,
160 const gchar * key, const gchar * value);
161GST_API
162const gchar * gst_device_provider_class_get_metadata (GstDeviceProviderClass * klass,
163 const gchar * key);
164
165GST_API
166void gst_device_provider_device_changed (GstDeviceProvider * provider,
167 GstDevice *device,
168 GstDevice *changed_device);
169
170/* factory management */
171
172GST_API
173GstDeviceProviderFactory * gst_device_provider_get_factory (GstDeviceProvider * provider);
174
175#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
176G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstDeviceProvider, gst_object_unref)
177#endif
178
179G_END_DECLS
180
181#endif /* __GST_DEVICE_PROVIDER_H__ */
182