gstdeviceprovider.h 5.68 KB
Newer Older
1 2 3
/* GStreamer
 * Copyright (C) 2012 Olivier Crete <olivier.crete@collabora.com>
 *
4
 * gstdeviceprovider.h: Device probing and monitoring
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
 *
 * 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.
 */

22
#include <gst/gstdeviceproviderfactory.h>
23 24


25 26
#ifndef __GST_DEVICE_PROVIDER_H__
#define __GST_DEVICE_PROVIDER_H__
27 28 29 30 31

#include <gst/gstelement.h>

G_BEGIN_DECLS

32 33 34
typedef struct _GstDeviceProvider GstDeviceProvider;
typedef struct _GstDeviceProviderClass GstDeviceProviderClass;
typedef struct _GstDeviceProviderPrivate GstDeviceProviderPrivate;
35

36 37 38 39 40 41 42
#define GST_TYPE_DEVICE_PROVIDER                 (gst_device_provider_get_type())
#define GST_IS_DEVICE_PROVIDER(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DEVICE_PROVIDER))
#define GST_IS_DEVICE_PROVIDER_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_DEVICE_PROVIDER))
#define GST_DEVICE_PROVIDER_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_DEVICE_PROVIDER, GstDeviceProviderClass))
#define GST_DEVICE_PROVIDER(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DEVICE_PROVIDER, GstDeviceProvider))
#define GST_DEVICE_PROVIDER_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DEVICE_PROVIDER, GstDeviceProviderClass))
#define GST_DEVICE_PROVIDER_CAST(obj)            ((GstDeviceProvider *)(obj))
43 44


45
/**
46
 * GstDeviceProvider:
47 48 49
 * @parent: The parent #GstObject
 * @devices: a #GList of the #GstDevice objects
 *
50
 * The structure of the base #GstDeviceProvider
51 52 53
 *
 * Since: 1.4
 */
54
struct _GstDeviceProvider {
55 56 57 58 59
  GstObject         parent;

  /* Protected by the Object lock */
  GList *devices;

60 61
  /*< private >*/

62
  GstDeviceProviderPrivate *priv;
63 64 65 66 67

  gpointer _gst_reserved[GST_PADDING];
};

/**
68
 * GstDeviceProviderClass:
69
 * @parent_class: the parent #GstObjectClass structure
70 71
 * @factory: a pointer to the #GstDeviceProviderFactory that creates this
 *  provider
72
 * @probe: Returns a list of devices that are currently available.
73
 *  This should never block.
74 75 76 77
 * @start: Starts monitoring for new devices. Only subclasses that can know
 *  that devices have been added or remove need to implement this method.
 * @stop: Stops monitoring for new devices. Only subclasses that implement
 *  the start() method need to implement this method.
78
 *
79
 * The structure of the base #GstDeviceProviderClass
80 81 82 83
 *
 * Since: 1.4
 */

84
struct _GstDeviceProviderClass {
85 86
  GstObjectClass    parent_class;

87
  GstDeviceProviderFactory     *factory;
88

89
  GList*      (*probe) (GstDeviceProvider * provider);
90

91 92
  gboolean    (*start) (GstDeviceProvider * provider);
  void        (*stop)  (GstDeviceProvider * provider);
93

94
  /*< private >*/
95 96 97 98 99 100
  gpointer metadata;

  /*< private >*/
  gpointer _gst_reserved[GST_PADDING];
};

101
GType       gst_device_provider_get_type (void);
102 103


104
GList *     gst_device_provider_get_devices    (GstDeviceProvider * provider);
105

106 107
gboolean    gst_device_provider_start          (GstDeviceProvider * provider);
void        gst_device_provider_stop           (GstDeviceProvider * provider);
108

109
gboolean    gst_device_provider_can_monitor    (GstDeviceProvider * provider);
110

111
GstBus *    gst_device_provider_get_bus        (GstDeviceProvider * provider);
112

113
void        gst_device_provider_device_add     (GstDeviceProvider * provider,
114
                                               GstDevice * device);
115
void        gst_device_provider_device_remove  (GstDeviceProvider * provider,
116 117 118
                                               GstDevice * device);


119 120
/* device provider class meta data */
void        gst_device_provider_class_set_metadata          (GstDeviceProviderClass *klass,
121 122 123 124
                                                            const gchar     *longname,
                                                            const gchar     *classification,
                                                            const gchar     *description,
                                                            const gchar     *author);
125
void        gst_device_provider_class_set_static_metadata   (GstDeviceProviderClass *klass,
126 127 128 129
                                                            const gchar     *longname,
                                                            const gchar     *classification,
                                                            const gchar     *description,
                                                            const gchar     *author);
130
void        gst_device_provider_class_add_metadata          (GstDeviceProviderClass * klass,
131
                                                            const gchar * key, const gchar * value);
132
void        gst_device_provider_class_add_static_metadata   (GstDeviceProviderClass * klass,
133
                                                            const gchar * key, const gchar * value);
134
const gchar * gst_device_provider_class_get_metadata        (GstDeviceProviderClass * klass,
135 136 137
                                                              const gchar * key);

/* factory management */
138
GstDeviceProviderFactory * gst_device_provider_get_factory   (GstDeviceProvider * provider);
139 140 141

G_END_DECLS

142
#endif /* __GST_DEVICE_PROVIDER_H__ */