| 1 | // Generated by gmmproc 2.50.1 -- DO NOT MODIFY! |
| 2 | #ifndef _GSTREAMERMM_REGISTRY_H |
| 3 | #define _GSTREAMERMM_REGISTRY_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 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 <gstreamermm/plugin.h> |
| 31 | #include <gstreamermm/pluginfeature.h> |
| 32 | |
| 33 | |
| 34 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 35 | using GstRegistry = struct _GstRegistry; |
| 36 | using GstRegistryClass = struct _GstRegistryClass; |
| 37 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 38 | |
| 39 | |
| 40 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 41 | namespace Gst |
| 42 | { class Registry_Class; } // namespace Gst |
| 43 | #endif //DOXYGEN_SHOULD_SKIP_THIS |
| 44 | |
| 45 | namespace Gst |
| 46 | { |
| 47 | |
| 48 | class Plugin; |
| 49 | class PluginFeature; |
| 50 | |
| 51 | /** An abstract base class for management of Gst::Plugin objects. |
| 52 | * One registry holds the metadata of a set of plugins. |
| 53 | * |
| 54 | * Design: |
| 55 | * |
| 56 | * The Gst::Registry object is a list of plugins and some functions for dealing |
| 57 | * with them. Each Gst::Plugin is matched 1-1 with a file on disk, and may or |
| 58 | * may not be loaded at a given time. |
| 59 | * |
| 60 | * The primary source, at all times, of plugin information is each plugin file |
| 61 | * itself. Thus, if an application wants information about a particular plugin, |
| 62 | * or wants to search for a feature that satisfies given criteria, the primary |
| 63 | * means of doing so is to load every plugin and look at the resulting |
| 64 | * information that is gathered in the default registry. Clearly, this is a |
| 65 | * time consuming process, so we cache information in the registry file. The |
| 66 | * format and location of the cache file is internal to gstreamer. |
| 67 | * |
| 68 | * On startup, plugins are searched for in the plugin search path. The |
| 69 | * following locations are checked in this order: |
| 70 | * |
| 71 | * - location from --gst-plugin-path commandline option. |
| 72 | * - the GST_PLUGIN_PATH environment variable. |
| 73 | * - the GST_PLUGIN_SYSTEM_PATH environment variable. |
| 74 | * - default locations (if GST_PLUGIN_SYSTEM_PATH is not set). Those default |
| 75 | * locations are: ~/.gstreamer-$GST_API_VERSION/plugins/ and |
| 76 | * $prefix/libs/gstreamer-$GST_API_VERSION/. |
| 77 | * |
| 78 | * The registry cache file is loaded from |
| 79 | * ~/.gstreamer-$GST_API_VERSION/registry-$ARCH.bin or the file listed in the |
| 80 | * GST_REGISTRY env var. One reason to change the registry location is for |
| 81 | * testing. |
| 82 | * |
| 83 | * For each plugin that is found in the plugin search path, there could be 3 |
| 84 | * possibilities for cached information: |
| 85 | * |
| 86 | * - the cache may not contain information about a given file. |
| 87 | * - the cache may have stale information. |
| 88 | * - the cache may have current information. |
| 89 | * |
| 90 | * In the first two cases, the plugin is loaded and the cache updated. In |
| 91 | * addition to these cases, the cache may have entries for plugins that are not |
| 92 | * relevant to the current process. These are marked as not available to the |
| 93 | * current process. If the cache is updated for whatever reason, it is marked |
| 94 | * dirty. |
| 95 | * |
| 96 | * A dirty cache is written out at the end of initialization. Each entry is |
| 97 | * checked to make sure the information is minimally valid. If not, the entry |
| 98 | * is simply dropped. |
| 99 | * |
| 100 | * Implementation notes: |
| 101 | * |
| 102 | * The "cache" and "registry" are different concepts and can represent |
| 103 | * different sets of plugins. For various reasons, at init time, the cache is |
| 104 | * stored in the default registry, and plugins not relevant to the current |
| 105 | * process are marked with the GST_PLUGIN_FLAG_CACHED bit. These plugins are |
| 106 | * removed at the end of initialization. |
| 107 | * |
| 108 | * Last reviewed on 2012-03-29 (0.11.3) |
| 109 | */ |
| 110 | |
| 111 | class Registry : public Object |
| 112 | { |
| 113 | |
| 114 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 115 | |
| 116 | public: |
| 117 | using CppObjectType = Registry; |
| 118 | using CppClassType = Registry_Class; |
| 119 | using BaseObjectType = GstRegistry; |
| 120 | using BaseClassType = GstRegistryClass; |
| 121 | |
| 122 | // noncopyable |
| 123 | Registry(const Registry&) = delete; |
| 124 | Registry& operator=(const Registry&) = delete; |
| 125 | |
| 126 | private: friend class Registry_Class; |
| 127 | static CppClassType registry_class_; |
| 128 | |
| 129 | protected: |
| 130 | explicit Registry(const Glib::ConstructParams& construct_params); |
| 131 | explicit Registry(GstRegistry* castitem); |
| 132 | |
| 133 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 134 | |
| 135 | public: |
| 136 | |
| 137 | Registry(Registry&& src) noexcept; |
| 138 | Registry& operator=(Registry&& src) noexcept; |
| 139 | |
| 140 | ~Registry() noexcept override; |
| 141 | |
| 142 | /** Get the GType for this class, for use with the underlying GObject type system. |
| 143 | */ |
| 144 | static GType get_type() G_GNUC_CONST; |
| 145 | |
| 146 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 147 | |
| 148 | |
| 149 | static GType get_base_type() G_GNUC_CONST; |
| 150 | #endif |
| 151 | |
| 152 | ///Provides access to the underlying C GObject. |
| 153 | GstRegistry* gobj() { return reinterpret_cast<GstRegistry*>(gobject_); } |
| 154 | |
| 155 | ///Provides access to the underlying C GObject. |
| 156 | const GstRegistry* gobj() const { return reinterpret_cast<GstRegistry*>(gobject_); } |
| 157 | |
| 158 | ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. |
| 159 | GstRegistry* gobj_copy(); |
| 160 | |
| 161 | private: |
| 162 | |
| 163 | |
| 164 | public: |
| 165 | |
| 166 | |
| 167 | /** Retrieves a List of Gst::PluginFeature of @a type. |
| 168 | * |
| 169 | * @param type A Type. |
| 170 | * @return A List of |
| 171 | * Gst::PluginFeature of @a type. Use Gst::PluginFeature::list_free() after use |
| 172 | * |
| 173 | * MT safe. |
| 174 | */ |
| 175 | Glib::ListHandle< Glib::RefPtr<Gst::PluginFeature> > get_feature_list(GType type); |
| 176 | |
| 177 | |
| 178 | /** Retrieves a List of Gst::PluginFeature of @a type. |
| 179 | * |
| 180 | * @param type A Type. |
| 181 | * @return A List of |
| 182 | * Gst::PluginFeature of @a type. Use Gst::PluginFeature::list_free() after use |
| 183 | * |
| 184 | * MT safe. |
| 185 | */ |
| 186 | Glib::ListHandle< Glib::RefPtr<const Gst::PluginFeature> > get_feature_list(GType type) const; |
| 187 | |
| 188 | |
| 189 | /** Returns the registry's feature list cookie. This changes |
| 190 | * every time a feature is added or removed from the registry. |
| 191 | * |
| 192 | * @return The feature list cookie. |
| 193 | */ |
| 194 | guint32 get_feature_list_cookie() const; |
| 195 | |
| 196 | /** Retrieves a List of features of the plugin with name @a name. |
| 197 | * |
| 198 | * @param name A plugin name. |
| 199 | * @return A List of |
| 200 | * Gst::PluginFeature. Use Gst::PluginFeature::list_free() after usage. |
| 201 | */ |
| 202 | Glib::ListHandle< Glib::RefPtr<Gst::PluginFeature> > get_feature_list(const Glib::ustring& name); |
| 203 | |
| 204 | /** Retrieves a List of features of the plugin with name @a name. |
| 205 | * |
| 206 | * @param name A plugin name. |
| 207 | * @return A List of |
| 208 | * Gst::PluginFeature. Use Gst::PluginFeature::list_free() after usage. |
| 209 | */ |
| 210 | Glib::ListHandle< Glib::RefPtr<const Gst::PluginFeature> > get_feature_list(const Glib::ustring& name) const; |
| 211 | |
| 212 | |
| 213 | /** Get a copy of all plugins registered in the given registry. The refcount |
| 214 | * of each element in the list in incremented. |
| 215 | * |
| 216 | * @return A List of Gst::Plugin. |
| 217 | * Use Gst::Plugin::list_free() after usage. |
| 218 | * |
| 219 | * MT safe. |
| 220 | */ |
| 221 | Glib::ListHandle< Glib::RefPtr<Gst::Plugin> > get_plugin_list(); |
| 222 | |
| 223 | |
| 224 | /** Get a copy of all plugins registered in the given registry. The refcount |
| 225 | * of each element in the list in incremented. |
| 226 | * |
| 227 | * @return A List of Gst::Plugin. |
| 228 | * Use Gst::Plugin::list_free() after usage. |
| 229 | * |
| 230 | * MT safe. |
| 231 | */ |
| 232 | Glib::ListHandle< Glib::RefPtr<const Gst::Plugin> > get_plugin_list() const; |
| 233 | |
| 234 | |
| 235 | /** Remove the plugin from the registry. |
| 236 | * |
| 237 | * MT safe. |
| 238 | * |
| 239 | * @param plugin The plugin to remove. |
| 240 | */ |
| 241 | void remove_plugin(const Glib::RefPtr<Gst::Plugin>& plugin); |
| 242 | |
| 243 | |
| 244 | /** Add the plugin to the registry. The plugin-added signal will be emitted. |
| 245 | * This function will sink @a plugin. |
| 246 | * |
| 247 | * @param plugin The plugin to add. |
| 248 | * @return <tt>true</tt> on success. |
| 249 | * |
| 250 | * MT safe. |
| 251 | */ |
| 252 | bool add_plugin(Glib::RefPtr<Gst::Plugin>&& plugin); |
| 253 | |
| 254 | /// A add_plugin() convenience overload. Allows to re-use @a plugin parameter after function call. |
| 255 | void add_plugin(const Glib::RefPtr<Gst::Plugin>& plugin); |
| 256 | /** Runs a filter against all plugins in the registry and returns a List with |
| 257 | * the results. If the first flag is set, only the first match is returned |
| 258 | * (as a list with a single object). |
| 259 | * |
| 260 | * @param filter The filter to use. |
| 261 | * @param first Only return first match. |
| 262 | * @return A list of Gst::Plugin. MT safe. |
| 263 | * |
| 264 | */ |
| 265 | Glib::ListHandle< Glib::RefPtr<Gst::Plugin> > get_plugin_list(const Plugin::SlotFilter& filter, bool first); |
| 266 | |
| 267 | |
| 268 | /** Runs a filter against all plugins in the registry and returns a List with |
| 269 | * the results. If the first flag is set, only the first match is returned |
| 270 | * (as a list with a single object). |
| 271 | * |
| 272 | * @param filter The filter to use. |
| 273 | * @param first Only return first match. |
| 274 | * @return A list of Gst::Plugin. MT safe. |
| 275 | * |
| 276 | */ |
| 277 | Glib::ListHandle< Glib::RefPtr<const Gst::Plugin> > get_plugin_list(const Plugin::SlotFilter& filter, bool first) const; |
| 278 | |
| 279 | /** Runs a filter against all features of the plugins in the registry and |
| 280 | * returns a List with the results. If the first flag is set, only the first |
| 281 | * match is returned (as a list with a single object). |
| 282 | * |
| 283 | * @param filter The filter to use. |
| 284 | * @param first Only return first match. |
| 285 | * @return A list of Gst::PluginFeature. MT safe. |
| 286 | */ |
| 287 | Glib::ListHandle< Glib::RefPtr<Gst::PluginFeature> > get_feature_list(const PluginFeature::SlotFilter& filter, bool first); |
| 288 | |
| 289 | |
| 290 | /** Runs a filter against all features of the plugins in the registry and |
| 291 | * returns a List with the results. If the first flag is set, only the first |
| 292 | * match is returned (as a list with a single object). |
| 293 | * |
| 294 | * @param filter The filter to use. |
| 295 | * @param first Only return first match. |
| 296 | * @return A list of Gst::PluginFeature. MT safe. |
| 297 | */ |
| 298 | Glib::ListHandle< Glib::RefPtr<const Gst::PluginFeature> > get_feature_list(const PluginFeature::SlotFilter& filter, bool first) const; |
| 299 | |
| 300 | |
| 301 | /** Find the plugin with the given name in the registry. |
| 302 | * The plugin will be reffed; caller is responsible for unreffing. |
| 303 | * |
| 304 | * @param name The plugin name to find. |
| 305 | * @return The plugin with the given name |
| 306 | * or <tt>nullptr</tt> if the plugin was not found. Gst::Object::unref() after |
| 307 | * usage. |
| 308 | * |
| 309 | * MT safe. |
| 310 | */ |
| 311 | Glib::RefPtr<Gst::Plugin> find_plugin(const Glib::ustring& name); |
| 312 | |
| 313 | /** Find the plugin with the given name in the registry. |
| 314 | * The plugin will be reffed; caller is responsible for unreffing. |
| 315 | * |
| 316 | * @param name The plugin name to find. |
| 317 | * @return The plugin with the given name |
| 318 | * or <tt>nullptr</tt> if the plugin was not found. Gst::Object::unref() after |
| 319 | * usage. |
| 320 | * |
| 321 | * MT safe. |
| 322 | */ |
| 323 | Glib::RefPtr<const Gst::Plugin> find_plugin(const Glib::ustring& name) const; |
| 324 | |
| 325 | /** Find the pluginfeature with the given name and type in the registry. |
| 326 | * |
| 327 | * @param name The pluginfeature name to find. |
| 328 | * @param type The pluginfeature type to find. |
| 329 | * @return The pluginfeature with the |
| 330 | * given name and type or <tt>nullptr</tt> if the plugin was not |
| 331 | * found. Gst::Object::unref() after usage. |
| 332 | * |
| 333 | * MT safe. |
| 334 | */ |
| 335 | Glib::RefPtr<Gst::PluginFeature> find_feature(const Glib::ustring& name, GType type); |
| 336 | |
| 337 | /** Find the pluginfeature with the given name and type in the registry. |
| 338 | * |
| 339 | * @param name The pluginfeature name to find. |
| 340 | * @param type The pluginfeature type to find. |
| 341 | * @return The pluginfeature with the |
| 342 | * given name and type or <tt>nullptr</tt> if the plugin was not |
| 343 | * found. Gst::Object::unref() after usage. |
| 344 | * |
| 345 | * MT safe. |
| 346 | */ |
| 347 | Glib::RefPtr<const Gst::PluginFeature> find_feature(const Glib::ustring& name, GType type) const; |
| 348 | |
| 349 | /** Find a Gst::PluginFeature with @a name in @a registry. |
| 350 | * |
| 351 | * @param name A Gst::PluginFeature name. |
| 352 | * @return A Gst::PluginFeature with its refcount incremented, |
| 353 | * use Gst::Object::unref() after usage. |
| 354 | * |
| 355 | * MT safe. |
| 356 | */ |
| 357 | Glib::RefPtr<Gst::PluginFeature> lookup_feature(const Glib::ustring& name); |
| 358 | |
| 359 | /** Find a Gst::PluginFeature with @a name in @a registry. |
| 360 | * |
| 361 | * @param name A Gst::PluginFeature name. |
| 362 | * @return A Gst::PluginFeature with its refcount incremented, |
| 363 | * use Gst::Object::unref() after usage. |
| 364 | * |
| 365 | * MT safe. |
| 366 | */ |
| 367 | Glib::RefPtr<const Gst::PluginFeature> lookup_feature(const Glib::ustring& name) const; |
| 368 | |
| 369 | /** Scan the given path for plugins to add to the registry. The syntax of the |
| 370 | * path is specific to the registry. |
| 371 | * |
| 372 | * @param path The path to scan. |
| 373 | * @return <tt>true</tt> if registry changed. |
| 374 | */ |
| 375 | bool scan_path(const Glib::ustring& path); |
| 376 | |
| 377 | |
| 378 | /** Look up a plugin in the given registry with the given filename. |
| 379 | * If found, plugin is reffed. |
| 380 | * |
| 381 | * @param filename The name of the file to look up. |
| 382 | * @return The Gst::Plugin if found, or |
| 383 | * <tt>nullptr</tt> if not. Gst::Object::unref() after usage. |
| 384 | */ |
| 385 | Glib::RefPtr<Gst::Plugin> lookup(const Glib::ustring& filename); |
| 386 | |
| 387 | /** Look up a plugin in the given registry with the given filename. |
| 388 | * If found, plugin is reffed. |
| 389 | * |
| 390 | * @param filename The name of the file to look up. |
| 391 | * @return The Gst::Plugin if found, or |
| 392 | * <tt>nullptr</tt> if not. Gst::Object::unref() after usage. |
| 393 | */ |
| 394 | Glib::RefPtr<const Gst::Plugin> lookup(const Glib::ustring& filename) const; |
| 395 | |
| 396 | /** Remove the feature from the registry. |
| 397 | * |
| 398 | * MT safe. |
| 399 | * |
| 400 | * @param feature The feature to remove. |
| 401 | */ |
| 402 | void remove_feature(const Glib::RefPtr<Gst::PluginFeature>& feature); |
| 403 | |
| 404 | /** Add the feature to the registry. The feature-added signal will be emitted. |
| 405 | * This function sinks @a feature. |
| 406 | * |
| 407 | * @param feature The feature to add. |
| 408 | * @return <tt>true</tt> on success. |
| 409 | * |
| 410 | * MT safe. |
| 411 | */ |
| 412 | void add_feature(Glib::RefPtr<Gst::PluginFeature>&& feature); |
| 413 | |
| 414 | /** Checks whether a plugin feature by the given name exists in |
| 415 | * @a registry and whether its version is at least the |
| 416 | * version required. |
| 417 | * |
| 418 | * @param feature_name The name of the feature (e.g. "oggdemux"). |
| 419 | * @param min_major The minimum major version number. |
| 420 | * @param min_minor The minimum minor version number. |
| 421 | * @param min_micro The minimum micro version number. |
| 422 | * @return <tt>true</tt> if the feature could be found and the version is |
| 423 | * the same as the required version or newer, and <tt>false</tt> otherwise. |
| 424 | */ |
| 425 | bool check_feature_version(const Glib::ustring& feature_name, guint min_major, guint min_minor, guint min_micro); |
| 426 | |
| 427 | /// This methods appear in .defs file, because they are removed from API using #if 0 directive. |
| 428 | /// h2def.py script can't detect that case, so methods have to be ignored manually. |
| 429 | |
| 430 | |
| 431 | /// A add_feature() convenience overload. Allows to re-use @a feature parameter after function call. |
| 432 | void add_feature(const Glib::RefPtr<Gst::PluginFeature>& feature); |
| 433 | |
| 434 | static Glib::RefPtr<Gst::Registry> get(); |
| 435 | |
| 436 | |
| 437 | public: |
| 438 | |
| 439 | public: |
| 440 | //C++ methods used to invoke GTK+ virtual functions: |
| 441 | |
| 442 | protected: |
| 443 | //GTK+ Virtual Functions (override these to change behaviour): |
| 444 | |
| 445 | //Default Signal Handlers:: |
| 446 | |
| 447 | |
| 448 | }; |
| 449 | |
| 450 | } // namespace Gst |
| 451 | |
| 452 | |
| 453 | namespace Glib |
| 454 | { |
| 455 | /** A Glib::wrap() method for this object. |
| 456 | * |
| 457 | * @param object The C instance. |
| 458 | * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. |
| 459 | * @result A C++ instance that wraps this C instance. |
| 460 | * |
| 461 | * @relates Gst::Registry |
| 462 | */ |
| 463 | Glib::RefPtr<Gst::Registry> wrap(GstRegistry* object, bool take_copy = false); |
| 464 | } |
| 465 | |
| 466 | |
| 467 | #endif /* _GSTREAMERMM_REGISTRY_H */ |
| 468 |