Debian Codegraph @

gstreamer/gstreamermm/plugin.h

raw symbols SCIP
1 // Generated by gmmproc 2.50.1 -- DO NOT MODIFY!
2 #ifndef _GSTREAMERMM_PLUGIN_H
3 #define _GSTREAMERMM_PLUGIN_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/object.h>
30 #include <glibmm/arrayhandle.h>
31
32
33 #ifndef DOXYGEN_SHOULD_SKIP_THIS
34 using GstPlugin = struct _GstPlugin;
35 using GstPluginClass = struct _GstPluginClass;
36 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
37
38
39 #ifndef DOXYGEN_SHOULD_SKIP_THIS
40 namespace Gst
41 { class Plugin_Class; } // namespace Gst
42 #endif //DOXYGEN_SHOULD_SKIP_THIS
43
44 namespace Gst
45 {
46
47 /** @addtogroup gstreamermmEnums gstreamermm Enums and Flags */
48
49 /**
50 * @var PluginDependencyFlags PLUGIN_DEPENDENCY_FLAG_NONE
51 * No special flags.
52 *
53 * @var PluginDependencyFlags PLUGIN_DEPENDENCY_FLAG_RECURSE
54 * Recurse into subdirectories.
55 *
56 * @var PluginDependencyFlags PLUGIN_DEPENDENCY_FLAG_PATHS_ARE_DEFAULT_ONLY
57 * Use paths
58 * argument only if none of the environment variables is set.
59 *
60 * @var PluginDependencyFlags PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_SUFFIX
61 * Interpret
62 * filename argument as filter suffix and check all matching files in
63 * the directory.
64 *
65 * @var PluginDependencyFlags PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_PREFIX
66 * Interpret
67 * filename argument as filter prefix and check all matching files in
68 * the directory. @newin{1,8}
69 *
70 * @enum PluginDependencyFlags
71 *
72 * Flags used in connection with Gst::Plugin::add_dependency().
73 *
74 * @ingroup gstreamermmEnums
75 * @par Bitwise operators:
76 * <tt>%PluginDependencyFlags operator|(PluginDependencyFlags, PluginDependencyFlags)</tt><br>
77 * <tt>%PluginDependencyFlags operator&(PluginDependencyFlags, PluginDependencyFlags)</tt><br>
78 * <tt>%PluginDependencyFlags operator^(PluginDependencyFlags, PluginDependencyFlags)</tt><br>
79 * <tt>%PluginDependencyFlags operator~(PluginDependencyFlags)</tt><br>
80 * <tt>%PluginDependencyFlags& operator|=(PluginDependencyFlags&, PluginDependencyFlags)</tt><br>
81 * <tt>%PluginDependencyFlags& operator&=(PluginDependencyFlags&, PluginDependencyFlags)</tt><br>
82 * <tt>%PluginDependencyFlags& operator^=(PluginDependencyFlags&, PluginDependencyFlags)</tt><br>
83 */
84 enum PluginDependencyFlags
85 {
86 PLUGIN_DEPENDENCY_FLAG_NONE = 0x0,
87 PLUGIN_DEPENDENCY_FLAG_RECURSE = (1 << 0),
88 PLUGIN_DEPENDENCY_FLAG_PATHS_ARE_DEFAULT_ONLY = (1 << 1),
89 PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_SUFFIX = (1 << 2),
90 PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_PREFIX = (1 << 3)
91 };
92
93 /** @ingroup gstreamermmEnums */
94 inline PluginDependencyFlags operator|(PluginDependencyFlags lhs, PluginDependencyFlags rhs)
95 { return static_cast<PluginDependencyFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
96
97 /** @ingroup gstreamermmEnums */
98 inline PluginDependencyFlags operator&(PluginDependencyFlags lhs, PluginDependencyFlags rhs)
99 { return static_cast<PluginDependencyFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
100
101 /** @ingroup gstreamermmEnums */
102 inline PluginDependencyFlags operator^(PluginDependencyFlags lhs, PluginDependencyFlags rhs)
103 { return static_cast<PluginDependencyFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
104
105 /** @ingroup gstreamermmEnums */
106 inline PluginDependencyFlags operator~(PluginDependencyFlags flags)
107 { return static_cast<PluginDependencyFlags>(~static_cast<unsigned>(flags)); }
108
109 /** @ingroup gstreamermmEnums */
110 inline PluginDependencyFlags& operator|=(PluginDependencyFlags& lhs, PluginDependencyFlags rhs)
111 { return (lhs = static_cast<PluginDependencyFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
112
113 /** @ingroup gstreamermmEnums */
114 inline PluginDependencyFlags& operator&=(PluginDependencyFlags& lhs, PluginDependencyFlags rhs)
115 { return (lhs = static_cast<PluginDependencyFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
116
117 /** @ingroup gstreamermmEnums */
118 inline PluginDependencyFlags& operator^=(PluginDependencyFlags& lhs, PluginDependencyFlags rhs)
119 { return (lhs = static_cast<PluginDependencyFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
120
121 } // namespace Gst
122
123 #ifndef DOXYGEN_SHOULD_SKIP_THIS
124 namespace Glib
125 {
126
127 template <>
128 class Value<Gst::PluginDependencyFlags> : public Glib::Value_Flags<Gst::PluginDependencyFlags>
129 {
130 public:
131 static GType value_type() G_GNUC_CONST;
132 };
133
134 } // namespace Glib
135 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
136
137 namespace Gst
138 {
139
140 /**
141 * @var PluginFlags PLUGIN_FLAG_CACHED
142 * Temporarily loaded plugins.
143 *
144 * @var PluginFlags PLUGIN_FLAG_BLACKLISTED
145 * The plugin won't be scanned (again).
146 *
147 * @enum PluginFlags
148 *
149 * The plugin loading state
150 *
151 * @ingroup gstreamermmEnums
152 * @par Bitwise operators:
153 * <tt>%PluginFlags operator|(PluginFlags, PluginFlags)</tt><br>
154 * <tt>%PluginFlags operator&(PluginFlags, PluginFlags)</tt><br>
155 * <tt>%PluginFlags operator^(PluginFlags, PluginFlags)</tt><br>
156 * <tt>%PluginFlags operator~(PluginFlags)</tt><br>
157 * <tt>%PluginFlags& operator|=(PluginFlags&, PluginFlags)</tt><br>
158 * <tt>%PluginFlags& operator&=(PluginFlags&, PluginFlags)</tt><br>
159 * <tt>%PluginFlags& operator^=(PluginFlags&, PluginFlags)</tt><br>
160 */
161 enum PluginFlags
162 {
163 PLUGIN_FLAG_CACHED = 0x10,
164 PLUGIN_FLAG_BLACKLISTED = 0x20
165 };
166
167 /** @ingroup gstreamermmEnums */
168 inline PluginFlags operator|(PluginFlags lhs, PluginFlags rhs)
169 { return static_cast<PluginFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
170
171 /** @ingroup gstreamermmEnums */
172 inline PluginFlags operator&(PluginFlags lhs, PluginFlags rhs)
173 { return static_cast<PluginFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
174
175 /** @ingroup gstreamermmEnums */
176 inline PluginFlags operator^(PluginFlags lhs, PluginFlags rhs)
177 { return static_cast<PluginFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
178
179 /** @ingroup gstreamermmEnums */
180 inline PluginFlags operator~(PluginFlags flags)
181 { return static_cast<PluginFlags>(~static_cast<unsigned>(flags)); }
182
183 /** @ingroup gstreamermmEnums */
184 inline PluginFlags& operator|=(PluginFlags& lhs, PluginFlags rhs)
185 { return (lhs = static_cast<PluginFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
186
187 /** @ingroup gstreamermmEnums */
188 inline PluginFlags& operator&=(PluginFlags& lhs, PluginFlags rhs)
189 { return (lhs = static_cast<PluginFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
190
191 /** @ingroup gstreamermmEnums */
192 inline PluginFlags& operator^=(PluginFlags& lhs, PluginFlags rhs)
193 { return (lhs = static_cast<PluginFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
194
195 } // namespace Gst
196
197 #ifndef DOXYGEN_SHOULD_SKIP_THIS
198 namespace Glib
199 {
200
201 template <>
202 class Value<Gst::PluginFlags> : public Glib::Value_Flags<Gst::PluginFlags>
203 {
204 public:
205 static GType value_type() G_GNUC_CONST;
206 };
207
208 } // namespace Glib
209 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
210
211 namespace Gst
212 {
213
214
215 /** The plugin loading errors.
216 *
217 * - MODULE - The plugin could not be loaded
218 * - DEPENDENCIES - The plugin has unresolved dependencies
219 * - NAME_MISMATCH - The plugin has already be loaded from a different file
220 */
221 class PluginError : public Glib::Error
222 {
223 public:
224 /** @var Code MODULE
225 * The plugin could not be loaded.
226 *
227 * @var Code DEPENDENCIES
228 * The plugin has unresolved dependencies.
229 *
230 * @var Code NAME_MISMATCH
231 * The plugin has already be loaded from a different file.
232 *
233 * @enum Code
234 *
235 * The plugin loading errors
236 */
237 enum Code
238 {
239 MODULE,
240 DEPENDENCIES,
241 NAME_MISMATCH
242 };
243
244 PluginError(Code error_code, const Glib::ustring& error_message);
245 explicit PluginError(GError* gobject);
246 Code code() const;
247
248 #ifndef DOXYGEN_SHOULD_SKIP_THIS
249 private:
250
251 static void throw_func(GError* gobject);
252
253 friend void wrap_init(); // uses throw_func()
254
255 #endif //DOXYGEN_SHOULD_SKIP_THIS
256 };
257
258 } // namespace Gst
259
260 #ifndef DOXYGEN_SHOULD_SKIP_THIS
261 namespace Glib
262 {
263
264 template <>
265 class Value<Gst::PluginError::Code> : public Glib::Value_Enum<Gst::PluginError::Code>
266 {
267 public:
268 static GType value_type() G_GNUC_CONST;
269 };
270
271 } // namespace Glib
272 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
273
274 namespace Gst
275 {
276
277
278 class Structure;
279
280 /** A container for features loaded from a shared object module.
281 * GStreamer is extensible, so Gst::Element instances can be loaded at runtime.
282 * A plugin system can provide one or more of the basic GStreamer
283 * Gst::PluginFeature subclasses.
284 *
285 * A plugin should export a symbol gst_plugin_desc that is a struct of type
286 * PluginDesc. the plugin loader will check the version of the core library
287 * the plugin was linked against and will create a new Gst::Plugin. It will
288 * then call the PluginInitFunc function that was provided in the
289 * gst_plugin_desc.
290 *
291 * Once you have a handle to a Gst::Plugin (e.g. from the RegistryPool), you
292 * can add any object that subclasses Gst::PluginFeature.
293 *
294 * Usually plugins are always automaticlly loaded so you don't need to call
295 * gst_plugin_load() explicitly to bring it into memory. There are options to
296 * statically link plugins to an app or even use GStreamer without a plugin
297 * repository in which case load() can be needed to bring the plugin
298 * into memory.
299 *
300 * Last reviewed on 2016-06-06 (1.8.0)
301 */
302
303 class Plugin : public Object
304 {
305
306 #ifndef DOXYGEN_SHOULD_SKIP_THIS
307
308 public:
309 using CppObjectType = Plugin;
310 using CppClassType = Plugin_Class;
311 using BaseObjectType = GstPlugin;
312 using BaseClassType = GstPluginClass;
313
314 // noncopyable
315 Plugin(const Plugin&) = delete;
316 Plugin& operator=(const Plugin&) = delete;
317
318 private: friend class Plugin_Class;
319 static CppClassType plugin_class_;
320
321 protected:
322 explicit Plugin(const Glib::ConstructParams& construct_params);
323 explicit Plugin(GstPlugin* castitem);
324
325 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
326
327 public:
328
329 Plugin(Plugin&& src) noexcept;
330 Plugin& operator=(Plugin&& src) noexcept;
331
332 ~Plugin() noexcept override;
333
334 /** Get the GType for this class, for use with the underlying GObject type system.
335 */
336 static GType get_type() G_GNUC_CONST;
337
338 #ifndef DOXYGEN_SHOULD_SKIP_THIS
339
340
341 static GType get_base_type() G_GNUC_CONST;
342 #endif
343
344 ///Provides access to the underlying C GObject.
345 GstPlugin* gobj() { return reinterpret_cast<GstPlugin*>(gobject_); }
346
347 ///Provides access to the underlying C GObject.
348 const GstPlugin* gobj() const { return reinterpret_cast<GstPlugin*>(gobject_); }
349
350 ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
351 GstPlugin* gobj_copy();
352
353 private:
354
355
356 public:
357 /** For example,
358 * bool on_plugin_init(const Glib::RefPtr<Gst::Plugin>& plugin);.
359 * The init function should return true if plugin was initialized
360 * successfully, false otherwise.
361 */
362 typedef sigc::slot< bool, const Glib::RefPtr<Gst::Plugin>& > SlotInit;
363
364 /** For example,
365 * bool on_plugin_filter(const Glib::RefPtr<Gst::Plugin>& plugin);.
366 * The filter function should return true if plugin is a match, false
367 * otherwise.
368 */
369 typedef sigc::slot< bool, const Glib::RefPtr<Gst::Plugin>& > SlotFilter;
370
371
372 /** Get the error quark.
373 *
374 * @return The error quark used in GError messages.
375 */
376 static Glib::QueryQuark error_quark();
377
378 /** Get the short name of the plugin
379 *
380 * @return The name of the plugin.
381 */
382 Glib::ustring get_name() const;
383
384 /** Get the long descriptive name of the plugin
385 *
386 * @return The long name of the plugin.
387 */
388 Glib::ustring get_description() const;
389
390 /** get the filename of the plugin
391 *
392 * @return The filename of the plugin.
393 */
394 Glib::ustring get_filename() const;
395
396 /** get the license of the plugin
397 *
398 * @return The license of the plugin.
399 */
400 Glib::ustring get_license() const;
401
402 /** get the package the plugin belongs to.
403 *
404 * @return The package of the plugin.
405 */
406 Glib::ustring get_package() const;
407
408 /** get the URL where the plugin comes from
409 *
410 * @return The origin of the plugin.
411 */
412 Glib::ustring get_origin() const;
413
414 /** get the source module the plugin belongs to.
415 *
416 * @return The source of the plugin.
417 */
418 Glib::ustring get_source() const;
419
420 /** get the version of the plugin
421 *
422 * @return The version of the plugin.
423 */
424 Glib::ustring get_version() const;
425
426 /** Get the release date (and possibly time) in form of a string, if available.
427 *
428 * For normal GStreamer plugin releases this will usually just be a date in
429 * the form of "YYYY-MM-DD", while pre-releases and builds from git may contain
430 * a time component after the date as well, in which case the string will be
431 * formatted like "YYYY-MM-DDTHH:MMZ" (e.g. "2012-04-30T09:30Z").
432 *
433 * There may be plugins that do not have a valid release date set on them.
434 *
435 * @return The date string of the plugin, or <tt>nullptr</tt> if not
436 * available.
437 */
438 Glib::ustring get_release_date_string() const;
439
440
441 /** queries if the plugin is loaded into memory
442 *
443 * @return <tt>true</tt> is loaded, <tt>false</tt> otherwise.
444 */
445 bool is_loaded() const;
446
447 // A copy is taken so that the original is not freed by the wrapper.
448
449
450 /** Gets the plugin specific data cache. If it is <tt>nullptr</tt> there is no cached data
451 * stored. This is the case when the registry is getting rebuilt.
452 *
453 * @return The cached data as a
454 * Gst::Structure or <tt>nullptr</tt>.
455 */
456 Gst::Structure get_cache_data() const;
457
458
459 /** Adds plugin specific data to cache. Passes the ownership of the structure to
460 * the @a plugin.
461 *
462 * The cache is flushed every time the registry is rebuilt.
463 *
464 * @param cache_data A structure containing the data to cache.
465 */
466 void set_cache_data(Gst::Structure& cache_data);
467
468
469 /** @throw Gst::PluginError.
470 */
471 static Glib::RefPtr<Gst::Plugin> load_file(const Glib::ustring& filename);
472
473
474 /** Loads @a plugin. Note that the *return value* is the loaded plugin; @a plugin is
475 * untouched. The normal use pattern of this function goes like this:
476 *
477 *
478 * GstPlugin *loaded_plugin;
479 * loaded_plugin = gst_plugin_load (plugin);
480 * // presumably, we're no longer interested in the potentially-unloaded plugin
481 * gst_object_unref (plugin);
482 * plugin = loaded_plugin;
483 *
484 *
485 * @return A reference to a loaded plugin, or <tt>nullptr</tt> on error.
486 */
487 Glib::RefPtr<Gst::Plugin> load();
488
489 /** Load the named plugin. Refs the plugin.
490 *
491 * @param name Name of plugin to load.
492 * @return A reference to a loaded plugin, or <tt>nullptr</tt> on error.
493 */
494 static Glib::RefPtr<Gst::Plugin> load_by_name(const Glib::ustring& name);
495
496 // Don't wrap gst_plugin_list_free because Glib::ListHandle<> already takes
497 // care of freeing.
498
499
500 static bool register_static(int major_version, int minor_version,
501 const Glib::ustring& name, const Glib::ustring& description,
502 const SlotInit& init_slot, const Glib::ustring& version,
503 const Glib::ustring& license, const Glib::ustring& source,
504 const Glib::ustring& package, const Glib::ustring& origin);
505
506
507 /** Make GStreamer aware of external dependencies which affect the feature
508 * set of this plugin (ie. the elements or typefinders associated with it).
509 *
510 * GStreamer will re-inspect plugins with external dependencies whenever any
511 * of the external dependencies change. This is useful for plugins which wrap
512 * other plugin systems, e.g. a plugin which wraps a plugin-based visualisation
513 * library and makes visualisations available as GStreamer elements, or a
514 * codec loader which exposes elements and/or caps dependent on what external
515 * codec libraries are currently installed.
516 *
517 * @param env_vars <tt>nullptr</tt>-terminated array of environment variables affecting the
518 * feature set of the plugin (e.g. an environment variable containing
519 * paths where to look for additional modules/plugins of a library),
520 * or <tt>nullptr</tt>. Environment variable names may be followed by a path component
521 * which will be added to the content of the environment variable, e.g.
522 * "HOME/.mystuff/plugins".
523 * @param paths <tt>nullptr</tt>-terminated array of directories/paths where dependent files
524 * may be, or <tt>nullptr</tt>.
525 * @param names <tt>nullptr</tt>-terminated array of file names (or file name suffixes,
526 * depending on @a flags) to be used in combination with the paths from
527 * @a paths and/or the paths extracted from the environment variables in
528 * @a env_vars, or <tt>nullptr</tt>.
529 * @param flags Optional flags, or Gst::PLUGIN_DEPENDENCY_FLAG_NONE.
530 */
531 void add_dependency(const Glib::StringArrayHandle& env_vars, const Glib::StringArrayHandle& paths, const Glib::StringArrayHandle& names, Gst::PluginDependencyFlags flags);
532
533
534 /** Make GStreamer aware of external dependencies which affect the feature
535 * set of this plugin (ie. the elements or typefinders associated with it).
536 *
537 * GStreamer will re-inspect plugins with external dependencies whenever any
538 * of the external dependencies change. This is useful for plugins which wrap
539 * other plugin systems, e.g. a plugin which wraps a plugin-based visualisation
540 * library and makes visualisations available as GStreamer elements, or a
541 * codec loader which exposes elements and/or caps dependent on what external
542 * codec libraries are currently installed.
543 *
544 * Convenience wrapper function for add_dependency() which
545 * takes simple strings as arguments instead of string arrays, with multiple
546 * arguments separated by predefined delimiters (see above).
547 *
548 * @param env_vars One or more environment variables (separated by ':', ';' or ','),
549 * or <tt>nullptr</tt>. Environment variable names may be followed by a path component
550 * which will be added to the content of the environment variable, e.g.
551 * "HOME/.mystuff/plugins:MYSTUFF_PLUGINS_PATH".
552 * @param paths One ore more directory paths (separated by ':' or ';' or ','),
553 * or <tt>nullptr</tt>. Example: "/usr/lib/mystuff/plugins".
554 * @param names One or more file names or file name suffixes (separated by commas),
555 * or <tt>nullptr</tt>.
556 * @param flags Optional flags, or Gst::PLUGIN_DEPENDENCY_FLAG_NONE.
557 */
558 void add_dependency(const Glib::ustring& env_vars, const Glib::ustring& paths, const Glib::ustring& names, Gst::PluginDependencyFlags flags);
559
560
561 public:
562
563 public:
564 //C++ methods used to invoke GTK+ virtual functions:
565
566 protected:
567 //GTK+ Virtual Functions (override these to change behaviour):
568
569 //Default Signal Handlers::
570
571
572 };
573
574 } // namespace Gst
575
576
577 namespace Glib
578 {
579 /** A Glib::wrap() method for this object.
580 *
581 * @param object The C instance.
582 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
583 * @result A C++ instance that wraps this C instance.
584 *
585 * @relates Gst::Plugin
586 */
587 Glib::RefPtr<Gst::Plugin> wrap(GstPlugin* object, bool take_copy = false);
588 }
589
590
591 #endif /* _GSTREAMERMM_PLUGIN_H */
592