1 /* GStreamer 2 * Copyright (C) 2012 Olivier Crete <olivier.crete@collabora.com> 3 * 4 * gstdevice.c: Device discovery 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 #ifndef __GST_DEVICE_H__ 24 #define __GST_DEVICE_H__ 25 26 typedef struct _GstDevice GstDevice; 27 typedef struct _GstDeviceClass GstDeviceClass; 28 29 #include <gst/gstelement.h> 30 #include <gst/gstcaps.h> 31 32 33 G_BEGIN_DECLS 34 35 typedef struct _GstDevicePrivate GstDevicePrivate; 36 37 #define GST_TYPE_DEVICE (gst_device_get_type()) 38 #define GST_IS_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DEVICE)) 39 #define GST_IS_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_DEVICE)) 40 #define GST_DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_DEVICE, GstDeviceClass)) 41 #define GST_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DEVICE, GstDevice)) 42 #define GST_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DEVICE, GstDeviceClass)) 43 #define GST_DEVICE_CAST(obj) ((GstDevice *)(obj)) 44 45 /** 46 * GstDevice: 47 * @parent: The parent #GstObject structure. 48 * 49 * A device object. 50 * 51 * Since: 1.4 52 */ 53 54 struct _GstDevice { 55 GstObject parent; 56 57 /*< private >*/ 58 GstDevicePrivate *priv; 59 60 gpointer _gst_reserved[GST_PADDING]; 61 }; 62 63 /** 64 * GstDeviceClass: 65 * @parent_class: The parent #GstObjectClass structure. 66 * @create_element: Creates the fully configured element to access this device. 67 * Subclasses need to override this and return a new element. 68 * @reconfigure_element: This only needs to be implemented by subclasses if the 69 * element can be reconfigured to use a different device. See the documentation 70 * for gst_device_reconfigure_element(). 71 * 72 * The class structure for a #GstDevice object. 73 * 74 * Since: 1.4 75 */ 76 77 struct _GstDeviceClass { 78 GstObjectClass parent_class; 79 80 GstElement * (*create_element) (GstDevice * device, const gchar * name); 81 gboolean (*reconfigure_element) (GstDevice * device, GstElement * element); 82 83 /*< private >*/ 84 gpointer _gst_reserved[GST_PADDING]; 85 }; 86 87 GST_API 88 GType gst_device_get_type (void); 89 90 GST_API 91 GstElement * gst_device_create_element (GstDevice * device, const gchar * name); 92 93 GST_API 94 GstCaps * gst_device_get_caps (GstDevice * device); 95 96 GST_API 97 gchar * gst_device_get_display_name (GstDevice * device); 98 99 GST_API 100 gchar * gst_device_get_device_class (GstDevice * device); 101 102 GST_API 103 GstStructure * gst_device_get_properties (GstDevice * device); 104 105 GST_API 106 gboolean gst_device_reconfigure_element (GstDevice * device, 107 GstElement * element); 108 GST_API 109 gboolean gst_device_has_classesv (GstDevice * device, 110 gchar ** classes); 111 GST_API 112 gboolean gst_device_has_classes (GstDevice * device, 113 const gchar * classes); 114 115 116 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstDevice, gst_object_unref) 117 118 G_END_DECLS 119 120 #endif /* __GST_DEVICE_H__ */ 121