1 /* GStreamer 2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu> 3 * 2000,2004 Wim Taymans <wim@fluendo.com> 4 * 5 * gstelementfactory.h: Header for GstElementFactory 6 * 7 * This library is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU Library General Public 9 * License as published by the Free Software Foundation; either 10 * version 2 of the License, or (at your option) any later version. 11 * 12 * This library is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Library General Public License for more details. 16 * 17 * You should have received a copy of the GNU Library General Public 18 * License along with this library; if not, write to the 19 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 20 * Boston, MA 02110-1301, USA. 21 */ 22 23 24 #ifndef __GST_ELEMENT_FACTORY_H__ 25 #define __GST_ELEMENT_FACTORY_H__ 26 27 /** 28 * GstElementFactory: 29 * 30 * The opaque #GstElementFactory data structure. 31 */ 32 typedef struct _GstElementFactory GstElementFactory; 33 typedef struct _GstElementFactoryClass GstElementFactoryClass; 34 35 #include <gst/gstconfig.h> 36 #include <gst/gstelement.h> 37 #include <gst/gstpad.h> 38 #include <gst/gstplugin.h> 39 #include <gst/gstpluginfeature.h> 40 #include <gst/gsturi.h> 41 42 G_BEGIN_DECLS 43 44 #define GST_TYPE_ELEMENT_FACTORY (gst_element_factory_get_type()) 45 #define GST_ELEMENT_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ELEMENT_FACTORY,\ 46 GstElementFactory)) 47 #define GST_ELEMENT_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ELEMENT_FACTORY,\ 48 GstElementFactoryClass)) 49 #define GST_IS_ELEMENT_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ELEMENT_FACTORY)) 50 #define GST_IS_ELEMENT_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ELEMENT_FACTORY)) 51 #define GST_ELEMENT_FACTORY_CAST(obj) ((GstElementFactory *)(obj)) 52 53 GST_API 54 GType gst_element_factory_get_type (void); 55 56 GST_API 57 GstElementFactory * gst_element_factory_find (const gchar *name); 58 59 GST_API 60 GType gst_element_factory_get_element_type (GstElementFactory *factory); 61 62 GST_API 63 const gchar * gst_element_factory_get_metadata (GstElementFactory *factory, const gchar *key); 64 65 GST_API 66 gchar ** gst_element_factory_get_metadata_keys (GstElementFactory *factory); 67 68 GST_API 69 guint gst_element_factory_get_num_pad_templates (GstElementFactory *factory); 70 71 GST_API 72 const GList * gst_element_factory_get_static_pad_templates (GstElementFactory *factory); 73 74 GST_API 75 GstURIType gst_element_factory_get_uri_type (GstElementFactory *factory); 76 77 GST_API 78 const gchar * const * gst_element_factory_get_uri_protocols (GstElementFactory *factory); 79 80 GST_API 81 gboolean gst_element_factory_has_interface (GstElementFactory *factory, 82 const gchar *interfacename); 83 GST_API 84 GstElement* gst_element_factory_create (GstElementFactory *factory, 85 const gchar *name) G_GNUC_MALLOC; 86 GST_API 87 GstElement* gst_element_factory_create_full (GstElementFactory * factory, 88 const gchar * first, ...) G_GNUC_MALLOC; 89 GST_API 90 GstElement * gst_element_factory_create_valist (GstElementFactory * factory, 91 const gchar * first, va_list properties) G_GNUC_MALLOC; 92 GST_API 93 GstElement * gst_element_factory_create_with_properties (GstElementFactory * factory, 94 guint n, const gchar *names[], const GValue values[]) G_GNUC_MALLOC; 95 GST_API 96 GstElement* gst_element_factory_make (const gchar *factoryname, const gchar *name) G_GNUC_MALLOC; 97 98 GST_API 99 GstElement* gst_element_factory_make_full (const gchar *factoryname, 100 const gchar *first, ...) G_GNUC_MALLOC; 101 GST_API 102 GstElement* gst_element_factory_make_valist (const gchar *factoryname, 103 const gchar *first, va_list properties) G_GNUC_MALLOC; 104 GST_API 105 GstElement* gst_element_factory_make_with_properties (const gchar *factoryname, 106 guint n, const gchar *names[], const GValue values[]) G_GNUC_MALLOC; 107 GST_API 108 gboolean gst_element_register (GstPlugin *plugin, const gchar *name, 109 guint rank, GType type); 110 111 GST_API 112 void gst_element_type_set_skip_documentation (GType type); 113 114 GST_API 115 gboolean gst_element_factory_get_skip_documentation (GstElementFactory * factory); 116 117 /* Factory list functions */ 118 119 /** 120 * GstFactoryListType: 121 * @GST_ELEMENT_FACTORY_TYPE_DECODER: Decoder elements 122 * @GST_ELEMENT_FACTORY_TYPE_ENCODER: Encoder elements 123 * @GST_ELEMENT_FACTORY_TYPE_SINK: Sink elements 124 * @GST_ELEMENT_FACTORY_TYPE_SRC: Source elements 125 * @GST_ELEMENT_FACTORY_TYPE_MUXER: Muxer elements 126 * @GST_ELEMENT_FACTORY_TYPE_DEMUXER: Demuxer elements 127 * @GST_ELEMENT_FACTORY_TYPE_PARSER: Parser elements 128 * @GST_ELEMENT_FACTORY_TYPE_PAYLOADER: Payloader elements 129 * @GST_ELEMENT_FACTORY_TYPE_DEPAYLOADER: Depayloader elements 130 * @GST_ELEMENT_FACTORY_TYPE_DECRYPTOR: Elements handling decryption (Since: 1.6) 131 * @GST_ELEMENT_FACTORY_TYPE_ENCRYPTOR: Elements handling encryption (Since: 1.6) 132 * @GST_ELEMENT_FACTORY_TYPE_HARDWARE: Hardware based elements (Since: 1.18) 133 * @GST_ELEMENT_FACTORY_TYPE_MAX_ELEMENTS: Private, do not use 134 * @GST_ELEMENT_FACTORY_TYPE_MEDIA_VIDEO: Elements handling video media types 135 * @GST_ELEMENT_FACTORY_TYPE_MEDIA_AUDIO: Elements handling audio media types 136 * @GST_ELEMENT_FACTORY_TYPE_MEDIA_IMAGE: Elements handling image media types 137 * @GST_ELEMENT_FACTORY_TYPE_MEDIA_SUBTITLE: Elements handling subtitle media types 138 * @GST_ELEMENT_FACTORY_TYPE_MEDIA_METADATA: Elements handling metadata media types 139 * 140 * The type of #GstElementFactory to filter. 141 * 142 * All @GstFactoryListType up to @GST_ELEMENT_FACTORY_TYPE_MAX_ELEMENTS are exclusive. 143 * 144 * If one or more of the MEDIA types are specified, then only elements 145 * matching the specified media types will be selected. 146 */ 147 148 /** 149 * GstElementFactoryListType: 150 * 151 * A type defining the type of an element factory. 152 */ 153 typedef guint64 GstElementFactoryListType; 154 155 #define GST_ELEMENT_FACTORY_TYPE_DECODER ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 0)) 156 #define GST_ELEMENT_FACTORY_TYPE_ENCODER ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 1)) 157 #define GST_ELEMENT_FACTORY_TYPE_SINK ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 2)) 158 #define GST_ELEMENT_FACTORY_TYPE_SRC ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 3)) 159 #define GST_ELEMENT_FACTORY_TYPE_MUXER ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 4)) 160 #define GST_ELEMENT_FACTORY_TYPE_DEMUXER ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 5)) 161 #define GST_ELEMENT_FACTORY_TYPE_PARSER ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 6)) 162 #define GST_ELEMENT_FACTORY_TYPE_PAYLOADER ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 7)) 163 #define GST_ELEMENT_FACTORY_TYPE_DEPAYLOADER ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 8)) 164 #define GST_ELEMENT_FACTORY_TYPE_FORMATTER ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 9)) 165 #define GST_ELEMENT_FACTORY_TYPE_DECRYPTOR ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 10)) 166 #define GST_ELEMENT_FACTORY_TYPE_ENCRYPTOR ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 11)) 167 #define GST_ELEMENT_FACTORY_TYPE_HARDWARE ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 12)) 168 169 #define GST_ELEMENT_FACTORY_TYPE_MAX_ELEMENTS ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 48)) 170 171 #define GST_ELEMENT_FACTORY_TYPE_MEDIA_VIDEO ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 49)) 172 #define GST_ELEMENT_FACTORY_TYPE_MEDIA_AUDIO ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 50)) 173 #define GST_ELEMENT_FACTORY_TYPE_MEDIA_IMAGE ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 51)) 174 #define GST_ELEMENT_FACTORY_TYPE_MEDIA_SUBTITLE ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 52)) 175 #define GST_ELEMENT_FACTORY_TYPE_MEDIA_METADATA ((GstElementFactoryListType)(G_GUINT64_CONSTANT (1) << 53)) 176 177 /** 178 * GST_ELEMENT_FACTORY_TYPE_ANY: (value 562949953421311) (type GstElementFactoryListType) 179 * 180 * Elements of any of the defined GST_ELEMENT_FACTORY_LIST types 181 */ 182 #define GST_ELEMENT_FACTORY_TYPE_ANY ((GstElementFactoryListType)((G_GUINT64_CONSTANT (1) << 49) - 1)) 183 184 /** 185 * GST_ELEMENT_FACTORY_TYPE_MEDIA_ANY: (value 18446462598732840960) (type GstElementFactoryListType) 186 * 187 * Elements matching any of the defined GST_ELEMENT_FACTORY_TYPE_MEDIA types 188 * 189 * Note: Do not use this if you wish to not filter against any of the defined 190 * media types. If you wish to do this, simply don't specify any 191 * GST_ELEMENT_FACTORY_TYPE_MEDIA flag. 192 */ 193 #define GST_ELEMENT_FACTORY_TYPE_MEDIA_ANY ((GstElementFactoryListType)(~G_GUINT64_CONSTANT (0) << 48)) 194 195 /** 196 * GST_ELEMENT_FACTORY_TYPE_VIDEO_ENCODER: (value 2814749767106562) (type GstElementFactoryListType) 197 * 198 * All encoders handling video or image media types 199 */ 200 #define GST_ELEMENT_FACTORY_TYPE_VIDEO_ENCODER ((GstElementFactoryListType)(GST_ELEMENT_FACTORY_TYPE_ENCODER | GST_ELEMENT_FACTORY_TYPE_MEDIA_VIDEO | GST_ELEMENT_FACTORY_TYPE_MEDIA_IMAGE)) 201 202 /** 203 * GST_ELEMENT_FACTORY_TYPE_AUDIO_ENCODER: (value 1125899906842626) (type GstElementFactoryListType) 204 * 205 * All encoders handling audio media types 206 */ 207 #define GST_ELEMENT_FACTORY_TYPE_AUDIO_ENCODER ((GstElementFactoryListType)(GST_ELEMENT_FACTORY_TYPE_ENCODER | GST_ELEMENT_FACTORY_TYPE_MEDIA_AUDIO)) 208 209 /** 210 * GST_ELEMENT_FACTORY_TYPE_AUDIOVIDEO_SINKS: (value 3940649673949188) (type GstElementFactoryListType) 211 * 212 * All sinks handling audio, video or image media types 213 */ 214 #define GST_ELEMENT_FACTORY_TYPE_AUDIOVIDEO_SINKS ((GstElementFactoryListType)(GST_ELEMENT_FACTORY_TYPE_SINK | GST_ELEMENT_FACTORY_TYPE_MEDIA_AUDIO | GST_ELEMENT_FACTORY_TYPE_MEDIA_VIDEO | GST_ELEMENT_FACTORY_TYPE_MEDIA_IMAGE)) 215 216 /** 217 * GST_ELEMENT_FACTORY_TYPE_DECODABLE: (value 1377) (type GstElementFactoryListType) 218 * 219 * All elements used to 'decode' streams (decoders, demuxers, parsers, depayloaders) 220 */ 221 #define GST_ELEMENT_FACTORY_TYPE_DECODABLE \ 222 ((GstElementFactoryListType)(GST_ELEMENT_FACTORY_TYPE_DECODER | GST_ELEMENT_FACTORY_TYPE_DEMUXER | GST_ELEMENT_FACTORY_TYPE_DEPAYLOADER | GST_ELEMENT_FACTORY_TYPE_PARSER | GST_ELEMENT_FACTORY_TYPE_DECRYPTOR)) 223 224 /* Element klass defines */ 225 #define GST_ELEMENT_FACTORY_KLASS_DECODER "Decoder" 226 #define GST_ELEMENT_FACTORY_KLASS_ENCODER "Encoder" 227 #define GST_ELEMENT_FACTORY_KLASS_SINK "Sink" 228 #define GST_ELEMENT_FACTORY_KLASS_SRC "Source" 229 #define GST_ELEMENT_FACTORY_KLASS_MUXER "Muxer" 230 #define GST_ELEMENT_FACTORY_KLASS_DEMUXER "Demuxer" 231 #define GST_ELEMENT_FACTORY_KLASS_PARSER "Parser" 232 #define GST_ELEMENT_FACTORY_KLASS_PAYLOADER "Payloader" 233 #define GST_ELEMENT_FACTORY_KLASS_DEPAYLOADER "Depayloader" 234 #define GST_ELEMENT_FACTORY_KLASS_FORMATTER "Formatter" 235 #define GST_ELEMENT_FACTORY_KLASS_DECRYPTOR "Decryptor" 236 #define GST_ELEMENT_FACTORY_KLASS_ENCRYPTOR "Encryptor" 237 238 #define GST_ELEMENT_FACTORY_KLASS_MEDIA_VIDEO "Video" 239 #define GST_ELEMENT_FACTORY_KLASS_MEDIA_AUDIO "Audio" 240 #define GST_ELEMENT_FACTORY_KLASS_MEDIA_IMAGE "Image" 241 #define GST_ELEMENT_FACTORY_KLASS_MEDIA_SUBTITLE "Subtitle" 242 #define GST_ELEMENT_FACTORY_KLASS_MEDIA_METADATA "Metadata" 243 244 /** 245 * GST_ELEMENT_FACTORY_KLASS_HARDWARE: 246 * 247 * Elements interacting with hardware devices should specify this classifier in 248 * their metadata. You may need to put the element in "READY" state to test if 249 * the hardware is present in the system. 250 * 251 * Since: 1.16 252 */ 253 #define GST_ELEMENT_FACTORY_KLASS_HARDWARE "Hardware" 254 255 GST_API 256 gboolean gst_element_factory_list_is_type (GstElementFactory *factory, 257 GstElementFactoryListType type); 258 259 GST_API 260 GList * gst_element_factory_list_get_elements (GstElementFactoryListType type, 261 GstRank minrank) G_GNUC_MALLOC; 262 263 264 GST_API 265 GList * gst_element_factory_list_filter (GList *list, const GstCaps *caps, 266 GstPadDirection direction, 267 gboolean subsetonly) G_GNUC_MALLOC; 268 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstElementFactory, gst_object_unref) 269 270 G_END_DECLS 271 272 #endif /* __GST_ELEMENT_FACTORY_H__ */ 273