Debian Codegraph @

gstreamer/gstreamermm/elementfactory.h

raw symbols SCIP
1 // Generated by gmmproc 2.50.1 -- DO NOT MODIFY!
2 #ifndef _GSTREAMERMM_ELEMENTFACTORY_H
3 #define _GSTREAMERMM_ELEMENTFACTORY_H
4
5
6 #include <glibmm/ustring.h>
7 #include <sigc++/sigc++.h>
8
9 /* gstreamermm - a C++ wrapper for gstreamer
10 *
11 * Copyright 2008-2016 The gstreamermm Development Team
12 *
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Lesser General Public
15 * License as published by the Free Software Foundation; either
16 * version 2.1 of the License, or (at your option) any later version.
17 *
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Lesser General Public License for more details.
22 *
23 * You should have received a copy of the GNU Lesser General Public
24 * License along with this library; if not, write to the Free
25 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 */
27
28 #include <gst/gst.h>
29 #include <gstreamermm/pad.h>
30 #include <gstreamermm/pluginfeature.h>
31 #include <gstreamermm/urihandler.h>
32
33
34 #ifndef DOXYGEN_SHOULD_SKIP_THIS
35 using GstElementFactory = struct _GstElementFactory;
36 using GstElementFactoryClass = struct _GstElementFactoryClass;
37 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
38
39
40 #ifndef DOXYGEN_SHOULD_SKIP_THIS
41 namespace Gst
42 { class ElementFactory_Class; } // namespace Gst
43 #endif //DOXYGEN_SHOULD_SKIP_THIS
44
45 namespace Gst
46 {
47
48 enum ElementFactoryListType
49 {
50 ELEMENT_FACTORY_TYPE_ANY,
51 ELEMENT_FACTORY_TYPE_AUDIOVIDEO_SINKS,
52 ELEMENT_FACTORY_TYPE_AUDIO_ENCODER,
53 ELEMENT_FACTORY_TYPE_DECODABLE,
54 ELEMENT_FACTORY_TYPE_DECODER,
55 ELEMENT_FACTORY_TYPE_DEMUXER,
56 ELEMENT_FACTORY_TYPE_DEPAYLOADER,
57 ELEMENT_FACTORY_TYPE_ENCODER,
58 ELEMENT_FACTORY_TYPE_FORMATTER,
59 ELEMENT_FACTORY_TYPE_MAX_ELEMENTS,
60 ELEMENT_FACTORY_TYPE_MEDIA_AUDIO,
61 ELEMENT_FACTORY_TYPE_MEDIA_IMAGE,
62 ELEMENT_FACTORY_TYPE_MEDIA_METADATA,
63 ELEMENT_FACTORY_TYPE_MEDIA_SUBTITLE,
64 ELEMENT_FACTORY_TYPE_MEDIA_VIDEO,
65 ELEMENT_FACTORY_TYPE_MEDIA_ANY,
66 ELEMENT_FACTORY_TYPE_MUXER,
67 ELEMENT_FACTORY_TYPE_PARSER,
68 ELEMENT_FACTORY_TYPE_PAYLOADER,
69 ELEMENT_FACTORY_TYPE_SINK,
70 ELEMENT_FACTORY_TYPE_SRC,
71 ELEMENT_FACTORY_TYPE_VIDEO_ENCODER
72 };
73
74 class ArrayHandler;
75 class Caps;
76 class Element;
77 class StaticPadTemplate;
78 struct StaticPadTemplateTraits;
79 class Plugin;
80
81 /** Create Gst::Element 's from a factory
82 *
83 * Gst::ElementFactory is used to create instances of elements. A
84 * Gst::ElementFactory can be added to a Gst::Plugin as it is also a
85 * Gst::PluginFeature.
86 *
87 * Use the find() and create()
88 * functions to create element instances or use create_element() as a
89 * convenient shortcut.
90 *
91 * The following code example shows you how to create a 'filesrc' element.
92 *
93 * @code
94 * #include <gstreamermm.h>
95 * #include <iostream>
96 *
97 * int main (int argc, char *argc[])
98 * {
99 * Glib::RefPtr<Gst::Element> src;
100 * Glib::RefPtr<Gst::ElementFactory> srcfactory;
101 *
102 * Gst::init(&argc,&argv);
103 *
104 * srcfactory = Gst::ElementFactory::find("filesrc");
105 *
106 * if(!srcfactory)
107 * {
108 * std::cout << "Could not find factory 'filesrc'" << std::endl;
109 * exit(1);
110 * }
111 *
112 * src = srcfactory->create("src");
113 *
114 * if(!src)
115 * {
116 * std::cout << "Could not create element 'src'" << std::endl;
117 * exit(1);
118 * }
119 * ...
120 * }
121 * @endcode
122 *
123 * Last reviewed on 2016-05-21 (1.8.0).
124 *
125 */
126
127 class ElementFactory : public PluginFeature
128 {
129
130 #ifndef DOXYGEN_SHOULD_SKIP_THIS
131
132 public:
133 using CppObjectType = ElementFactory;
134 using CppClassType = ElementFactory_Class;
135 using BaseObjectType = GstElementFactory;
136 using BaseClassType = GstElementFactoryClass;
137
138 // noncopyable
139 ElementFactory(const ElementFactory&) = delete;
140 ElementFactory& operator=(const ElementFactory&) = delete;
141
142 private: friend class ElementFactory_Class;
143 static CppClassType elementfactory_class_;
144
145 protected:
146 explicit ElementFactory(const Glib::ConstructParams& construct_params);
147 explicit ElementFactory(GstElementFactory* castitem);
148
149 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
150
151 public:
152
153 ElementFactory(ElementFactory&& src) noexcept;
154 ElementFactory& operator=(ElementFactory&& src) noexcept;
155
156 ~ElementFactory() noexcept override;
157
158 /** Get the GType for this class, for use with the underlying GObject type system.
159 */
160 static GType get_type() G_GNUC_CONST;
161
162 #ifndef DOXYGEN_SHOULD_SKIP_THIS
163
164
165 static GType get_base_type() G_GNUC_CONST;
166 #endif
167
168 ///Provides access to the underlying C GObject.
169 GstElementFactory* gobj() { return reinterpret_cast<GstElementFactory*>(gobject_); }
170
171 ///Provides access to the underlying C GObject.
172 const GstElementFactory* gobj() const { return reinterpret_cast<GstElementFactory*>(gobject_); }
173
174 ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
175 GstElementFactory* gobj_copy();
176
177 private:
178
179
180 public:
181
182 /** Create a new elementfactory capable of instantiating objects of the
183 * @a type and add the factory to @a plugin.
184 *
185 * @param plugin Gst::Plugin to register the element with, or <tt>nullptr</tt> for
186 * a static element.
187 * @param name Name of elements of this type.
188 * @param rank Rank of element (higher rank means more importance when autoplugging).
189 * @param type GType of element to register.
190 * @return <tt>true</tt>, if the registering succeeded, <tt>false</tt> on error.
191 */
192 static bool register_element(const Glib::RefPtr<Gst::Plugin>& plugin, const Glib::ustring& name, guint rank, GType type);
193
194
195 /** Search for an element factory of the given name. Refs the returned
196 * element factory; caller is responsible for unreffing.
197 *
198 * @param name Name of factory to find.
199 * @return Gst::ElementFactory if found,
200 * <tt>nullptr</tt> otherwise.
201 */
202 static Glib::RefPtr<Gst::ElementFactory> find(const Glib::ustring& name);
203
204
205 /** Create a new element of the type defined by the given elementfactory.
206 * It will be given the name supplied, since all elements require a name as
207 * their first argument.
208 *
209 * @param name Name of new element, or <tt>nullptr</tt> to automatically create
210 * a unique name.
211 * @return New Gst::Element or <tt>nullptr</tt>
212 * if the element couldn't be created.
213 */
214 Glib::RefPtr<Gst::Element> create(const Glib::ustring& name);
215
216 /// A create() convenience overload.
217 Glib::RefPtr<Gst::Element> create();
218
219
220 /** Create a new element of the type defined by the given element factory.
221 *
222 * @param factory_name A named factory to instantiate.
223 * @param name Name of new element.
224 * @return New Gst::Element or <tt>nullptr</tt> if unable to create element.
225 */
226 static Glib::RefPtr<Gst::Element> create_element(const Glib::ustring& factory_name, const Glib::ustring& name);
227
228 /// A create_element() convenience overload.
229 static Glib::RefPtr<Gst::Element> create_element(const Glib::ustring& factory_name);
230
231
232 /** Checks if the factory can sink all possible capabilities.
233 *
234 * @param caps The caps to check.
235 * @return <tt>true</tt> if the caps are fully compatible.
236 */
237 bool can_sink_all_caps(const Glib::RefPtr<const Gst::Caps>& caps) const;
238
239 /** Checks if the factory can src all possible capabilities.
240 *
241 * @param caps The caps to check.
242 * @return <tt>true</tt> if the caps are fully compatible.
243 */
244 bool can_src_all_caps(const Glib::RefPtr<const Gst::Caps>& caps) const;
245
246 /** Checks if the factory can sink any possible capability.
247 *
248 * @param caps The caps to check.
249 * @return <tt>true</tt> if the caps have a common subset.
250 */
251 bool can_sink_any_caps(const Glib::RefPtr<const Gst::Caps>& caps) const;
252
253 /** Checks if the factory can src any possible capability.
254 *
255 * @param caps The caps to check.
256 * @return <tt>true</tt> if the caps have a common subset.
257 */
258 bool can_src_any_caps(const Glib::RefPtr<const Gst::Caps>& caps) const;
259
260
261 /** Get the Type for elements managed by this factory. The type can
262 * only be retrieved if the element factory is loaded, which can be
263 * assured with Gst::PluginFeature::load().
264 *
265 * @return The Type for elements managed by this factory or 0 if
266 * the factory is not loaded.
267 */
268 GType get_element_type() const;
269
270
271 /** Get the available keys for the metadata on @a factory.
272 *
273 * @return A <tt>nullptr</tt>-terminated array of key strings, or <tt>nullptr</tt> when there is no
274 * metadata.
275 */
276 std::vector<Glib::ustring> get_metadata_keys() const;
277
278 /** Get the metadata on @a factory with @a key.
279 *
280 * @param key A key.
281 * @return The metadata with @a key on @a factory or <tt>nullptr</tt>
282 * when there was no metadata with the given @a key.
283 */
284 Glib::ustring get_metadata(const Glib::ustring& key) const;
285
286
287 /** Gets the number of pad_templates in this factory.
288 *
289 * @return The number of pad_templates.
290 */
291 guint get_num_pad_templates() const;
292
293 /** Gets the type of URIs the element supports or Gst::URI_UNKNOWN if none.
294 *
295 * @return Type of URIs this element supports.
296 */
297 URIType get_uri_type() const;
298
299
300 /** Gets a <tt>nullptr</tt>-terminated array of protocols this element supports or <tt>nullptr</tt> if
301 * no protocols are supported. You may not change the contents of the returned
302 * array, as it is still owned by the element factory. Use Glib::strdupv() to
303 * make a copy of the protocol string array if you need to.
304 *
305 * @return The supported protocols
306 * or <tt>nullptr</tt>.
307 */
308 std::vector<Glib::ustring> get_uri_protocols() const;
309
310
311 /** Check if @a factory implements the interface with name @a name.
312 *
313 * @param name An interface name.
314 * @return <tt>true</tt> when @a factory implement the interface.
315 */
316 bool has_interface(const Glib::ustring& name) const;
317
318
319 /** Gets the List of Gst::StaticPadTemplate for this factory.
320 *
321 * @return The
322 * static pad templates.
323 */
324 std::vector< Gst::StaticPadTemplate > get_static_pad_templates() const;
325
326
327 /** Filter out all the elementfactories in @a list that can handle @a caps in
328 * the given direction.
329 *
330 * If @a subsetonly is <tt>true</tt>, then only the elements whose pads templates
331 * are a complete superset of @a caps will be returned. Else any element
332 * whose pad templates caps can intersect with @a caps will be returned.
333 *
334 * @param list A List of
335 * Gst::ElementFactory to filter.
336 * @param caps A Gst::Caps.
337 * @param direction A Gst::PadDirection to filter on.
338 * @param subsetonly Whether to filter on caps subsets or not.
339 * @return A List of
340 * Gst::ElementFactory elements that match the given requisites.
341 * Use #gst_plugin_feature_list_free after usage.
342 */
343 static std::vector< Glib::RefPtr<Gst::ElementFactory> > filter(const std::vector< Glib::RefPtr<Gst::ElementFactory> >& list, const Glib::RefPtr<const Gst::Caps>& caps, PadDirection direction, bool subsetonly);
344
345
346 /** Get a list of factories that match the given @a type. Only elements
347 * with a rank greater or equal to @a minrank will be returned.
348 * The list of factories is returned by decreasing rank.
349 *
350 * @param type A Gst::ElementFactoryListType.
351 * @param minrank Minimum rank.
352 * @return A List of
353 * Gst::ElementFactory elements. Use Gst::PluginFeature::list_free() after
354 * usage.
355 */
356 static std::vector< Glib::RefPtr<Gst::ElementFactory> > get_elements(ElementFactoryListType type, Rank minrank);
357
358 /** Check if @a factory is of the given types.
359 *
360 * @param type A Gst::ElementFactoryListType.
361 * @return <tt>true</tt> if @a factory is of @a type.
362 */
363 bool is_type(ElementFactoryListType type) const;
364
365
366 public:
367
368 public:
369 //C++ methods used to invoke GTK+ virtual functions:
370
371 protected:
372 //GTK+ Virtual Functions (override these to change behaviour):
373
374 //Default Signal Handlers::
375
376
377 };
378
379 /*! A gstreamermm Gst::ElementFactory example.
380 * @example basics/element_factory.cc
381 */
382
383 } // namespace Gst
384
385
386 namespace Glib
387 {
388 /** A Glib::wrap() method for this object.
389 *
390 * @param object The C instance.
391 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
392 * @result A C++ instance that wraps this C instance.
393 *
394 * @relates Gst::ElementFactory
395 */
396 Glib::RefPtr<Gst::ElementFactory> wrap(GstElementFactory* object, bool take_copy = false);
397 }
398
399
400 #endif /* _GSTREAMERMM_ELEMENTFACTORY_H */
401