Blame gst/gstplugin.h

Packit f546b1
/* GStreamer
Packit f546b1
 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
Packit f546b1
 *                    2000 Wim Taymans <wtay@chello.be>
Packit f546b1
 *
Packit f546b1
 * gstplugin.h: Header for plugin subsystem
Packit f546b1
 *
Packit f546b1
 * This library is free software; you can redistribute it and/or
Packit f546b1
 * modify it under the terms of the GNU Library General Public
Packit f546b1
 * License as published by the Free Software Foundation; either
Packit f546b1
 * version 2 of the License, or (at your option) any later version.
Packit f546b1
 *
Packit f546b1
 * This library is distributed in the hope that it will be useful,
Packit f546b1
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit f546b1
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit f546b1
 * Library General Public License for more details.
Packit f546b1
 *
Packit f546b1
 * You should have received a copy of the GNU Library General Public
Packit f546b1
 * License along with this library; if not, write to the
Packit f546b1
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Packit f546b1
 * Boston, MA 02110-1301, USA.
Packit f546b1
 */
Packit f546b1
Packit f546b1
Packit f546b1
#ifndef __GST_PLUGIN_H__
Packit f546b1
#define __GST_PLUGIN_H__
Packit f546b1
Packit f546b1
#include <gst/gstconfig.h>
Packit f546b1
Packit f546b1
#include <gst/gstobject.h>
Packit f546b1
#include <gst/gstmacros.h>
Packit f546b1
#include <gst/gststructure.h>
Packit f546b1
Packit f546b1
G_BEGIN_DECLS
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * GstPlugin:
Packit f546b1
 *
Packit f546b1
 * The opaque plugin object
Packit f546b1
 */
Packit f546b1
typedef struct _GstPlugin GstPlugin;
Packit f546b1
typedef struct _GstPluginClass GstPluginClass;
Packit f546b1
typedef struct _GstPluginDesc GstPluginDesc;
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * gst_plugin_error_quark:
Packit f546b1
 *
Packit f546b1
 * Get the error quark.
Packit f546b1
 *
Packit f546b1
 * Returns: The error quark used in GError messages
Packit f546b1
 */
Packit f546b1
Packit f546b1
GST_API
Packit f546b1
GQuark gst_plugin_error_quark (void);
Packit f546b1
/**
Packit f546b1
 * GST_PLUGIN_ERROR:
Packit f546b1
 *
Packit f546b1
 * The error message category quark
Packit f546b1
 */
Packit f546b1
#define GST_PLUGIN_ERROR gst_plugin_error_quark ()
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * GstPluginError:
Packit f546b1
 * @GST_PLUGIN_ERROR_MODULE: The plugin could not be loaded
Packit f546b1
 * @GST_PLUGIN_ERROR_DEPENDENCIES: The plugin has unresolved dependencies
Packit f546b1
 * @GST_PLUGIN_ERROR_NAME_MISMATCH: The plugin has already be loaded from a different file
Packit f546b1
 *
Packit f546b1
 * The plugin loading errors
Packit f546b1
 */
Packit f546b1
typedef enum
Packit f546b1
{
Packit f546b1
  GST_PLUGIN_ERROR_MODULE,
Packit f546b1
  GST_PLUGIN_ERROR_DEPENDENCIES,
Packit f546b1
  GST_PLUGIN_ERROR_NAME_MISMATCH
Packit f546b1
} GstPluginError;
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * GstPluginFlags:
Packit f546b1
 * @GST_PLUGIN_FLAG_CACHED: Temporarily loaded plugins
Packit f546b1
 * @GST_PLUGIN_FLAG_BLACKLISTED: The plugin won't be scanned (again)
Packit f546b1
 *
Packit f546b1
 * The plugin loading state
Packit f546b1
 */
Packit f546b1
typedef enum
Packit f546b1
{
Packit f546b1
  GST_PLUGIN_FLAG_CACHED      = (GST_OBJECT_FLAG_LAST << 0),
Packit f546b1
  GST_PLUGIN_FLAG_BLACKLISTED = (GST_OBJECT_FLAG_LAST << 1)
Packit f546b1
} GstPluginFlags;
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * GstPluginDependencyFlags:
Packit f546b1
 * @GST_PLUGIN_DEPENDENCY_FLAG_NONE : no special flags
Packit f546b1
 * @GST_PLUGIN_DEPENDENCY_FLAG_RECURSE : recurse into subdirectories
Packit f546b1
 * @GST_PLUGIN_DEPENDENCY_FLAG_PATHS_ARE_DEFAULT_ONLY : use paths
Packit f546b1
 *         argument only if none of the environment variables is set
Packit f546b1
 * @GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_SUFFIX : interpret
Packit f546b1
 *         filename argument as filter suffix and check all matching files in
Packit f546b1
 *         the directory
Packit f546b1
 * @GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_PREFIX : interpret
Packit f546b1
 *         filename argument as filter prefix and check all matching files in
Packit f546b1
 *         the directory. Since 1.8.
Packit f546b1
 * @GST_PLUGIN_DEPENDENCY_FLAG_PATHS_ARE_RELATIVE_TO_EXE : interpret
Packit f546b1
 *   non-absolute paths as relative to the main executable directory. Since
Packit f546b1
 *   1.14.
Packit f546b1
 *
Packit f546b1
 * Flags used in connection with gst_plugin_add_dependency().
Packit f546b1
 */
Packit f546b1
typedef enum {
Packit f546b1
  GST_PLUGIN_DEPENDENCY_FLAG_NONE = 0,
Packit f546b1
  GST_PLUGIN_DEPENDENCY_FLAG_RECURSE = (1 << 0),
Packit f546b1
  GST_PLUGIN_DEPENDENCY_FLAG_PATHS_ARE_DEFAULT_ONLY = (1 << 1),
Packit f546b1
  GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_SUFFIX = (1 << 2),
Packit f546b1
  GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_PREFIX = (1 << 3),
Packit f546b1
  GST_PLUGIN_DEPENDENCY_FLAG_PATHS_ARE_RELATIVE_TO_EXE = (1 << 4)
Packit f546b1
} GstPluginDependencyFlags;
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * GstPluginInitFunc:
Packit f546b1
 * @plugin: The plugin object
Packit f546b1
 *
Packit f546b1
 * A plugin should provide a pointer to a function of this type in the
Packit f546b1
 * plugin_desc struct.
Packit f546b1
 * This function will be called by the loader at startup. One would then
Packit f546b1
 * register each #GstPluginFeature.
Packit f546b1
 *
Packit f546b1
 * Returns: %TRUE if plugin initialised successfully
Packit f546b1
 */
Packit f546b1
/* FIXME 0.11: Make return void */
Packit f546b1
typedef gboolean (*GstPluginInitFunc) (GstPlugin *plugin);
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * GstPluginInitFullFunc:
Packit f546b1
 * @plugin: The plugin object
Packit f546b1
 * @user_data: extra data
Packit f546b1
 *
Packit f546b1
 * A plugin should provide a pointer to a function of either #GstPluginInitFunc
Packit f546b1
 * or this type in the plugin_desc struct.
Packit f546b1
 * The function will be called by the loader at startup. One would then
Packit f546b1
 * register each #GstPluginFeature. This version allows
Packit f546b1
 * user data to be passed to init function (useful for bindings).
Packit f546b1
 *
Packit f546b1
 * Returns: %TRUE if plugin initialised successfully
Packit f546b1
 */
Packit f546b1
/* FIXME 0.11: Merge with GstPluginInitFunc */
Packit f546b1
typedef gboolean (*GstPluginInitFullFunc) (GstPlugin *plugin, gpointer user_data);
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * GstPluginDesc:
Packit f546b1
 * @major_version: the major version number of core that plugin was compiled for
Packit f546b1
 * @minor_version: the minor version number of core that plugin was compiled for
Packit f546b1
 * @name: a unique name of the plugin
Packit f546b1
 * @description: description of plugin
Packit f546b1
 * @plugin_init: pointer to the init function of this plugin.
Packit f546b1
 * @version: version of the plugin
Packit f546b1
 * @license: effective license of plugin
Packit f546b1
 * @source: source module plugin belongs to
Packit f546b1
 * @package: shipped package plugin belongs to
Packit f546b1
 * @origin: URL to provider of plugin
Packit f546b1
 * @release_datetime: (allow-none): date time string in ISO 8601
Packit f546b1
 *     format (or rather, a subset thereof), or %NULL. Allowed are the
Packit f546b1
 *     following formats: "YYYY-MM-DD" and "YYY-MM-DDTHH:MMZ" (with
Packit f546b1
 *     'T' a separator and 'Z' indicating UTC/Zulu time). This field
Packit f546b1
 *     should be set via the GST_PACKAGE_RELEASE_DATETIME
Packit f546b1
 *     preprocessor macro.
Packit f546b1
 *
Packit f546b1
 * A plugin should export a variable of this type called plugin_desc. The plugin
Packit f546b1
 * loader will use the data provided there to initialize the plugin.
Packit f546b1
 *
Packit f546b1
 * The @licence parameter must be one of: LGPL, GPL, QPL, GPL/QPL, MPL,
Packit f546b1
 * BSD, MIT/X11, Proprietary, unknown.
Packit f546b1
 */
Packit f546b1
struct _GstPluginDesc {
Packit f546b1
  gint major_version;
Packit f546b1
  gint minor_version;
Packit f546b1
  const gchar *name;
Packit f546b1
  const gchar *description;
Packit f546b1
  GstPluginInitFunc plugin_init;
Packit f546b1
  const gchar *version;
Packit f546b1
  const gchar *license;
Packit f546b1
  const gchar *source;
Packit f546b1
  const gchar *package;
Packit f546b1
  const gchar *origin;
Packit f546b1
  const gchar *release_datetime;
Packit f546b1
  /*< private >*/
Packit f546b1
  gpointer _gst_reserved[GST_PADDING];
Packit f546b1
};
Packit f546b1
Packit f546b1
Packit f546b1
#define GST_TYPE_PLUGIN   (gst_plugin_get_type())
Packit f546b1
#define GST_IS_PLUGIN(obj)             (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PLUGIN))
Packit f546b1
#define GST_IS_PLUGIN_CLASS(klass)     (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PLUGIN))
Packit f546b1
#define GST_PLUGIN_GET_CLASS(obj)      (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_PLUGIN, GstPluginClass))
Packit f546b1
#define GST_PLUGIN(obj)                (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PLUGIN, GstPlugin))
Packit f546b1
#define GST_PLUGIN_CLASS(klass)        (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PLUGIN, GstPluginClass))
Packit f546b1
#define GST_PLUGIN_CAST(obj)           ((GstPlugin*)(obj))
Packit f546b1
Packit f546b1
#ifdef GST_PACKAGE_RELEASE_DATETIME
Packit f546b1
#define __GST_PACKAGE_RELEASE_DATETIME GST_PACKAGE_RELEASE_DATETIME
Packit f546b1
#else
Packit f546b1
#define __GST_PACKAGE_RELEASE_DATETIME NULL
Packit f546b1
#endif
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * GST_PLUGIN_STATIC_DECLARE:
Packit f546b1
 * @name: short, but unique name of the plugin
Packit f546b1
 *
Packit f546b1
 * This macro can be used to initialize statically linked plugins. It is
Packit f546b1
 * necessary to call this macro before the plugin can be used.
Packit f546b1
 * It has to be used in combination with GST_PLUGIN_STATIC_REGISTER
Packit f546b1
 * and must be placed outside any block to declare the plugin initialization
Packit f546b1
 * function.
Packit f546b1
 *
Packit f546b1
 * Since: 1.2
Packit f546b1
 */
Packit f546b1
#define GST_PLUGIN_STATIC_DECLARE(name) \
Packit f546b1
  extern void G_PASTE(gst_plugin_, G_PASTE(name, _register)) (void)
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * GST_PLUGIN_STATIC_REGISTER:
Packit f546b1
 * @name: short, but unique name of the plugin
Packit f546b1
 *
Packit f546b1
 * This macro can be used to initialize statically linked plugins. It is
Packit f546b1
 * necessary to call this macro before the plugin can be used.
Packit f546b1
 * It has to be used in combination with GST_PLUGIN_STATIC_DECLARE and
Packit f546b1
 * calls the plugin initialization function.
Packit f546b1
 *
Packit f546b1
 * Since: 1.2
Packit f546b1
 */
Packit f546b1
#define GST_PLUGIN_STATIC_REGISTER(name) G_PASTE(gst_plugin_, G_PASTE(name, _register)) ()
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * GST_PLUGIN_DEFINE:
Packit f546b1
 * @major: major version number of the gstreamer-core that plugin was compiled for
Packit f546b1
 * @minor: minor version number of the gstreamer-core that plugin was compiled for
Packit f546b1
 * @name: short, but unique name of the plugin
Packit f546b1
 * @description: information about the purpose of the plugin
Packit f546b1
 * @init: function pointer to the plugin_init method with the signature of static gboolean plugin_init (GstPlugin * plugin).
Packit f546b1
 * @version: full version string (e.g. VERSION from config.h)
Packit f546b1
 * @license: under which licence the package has been released, e.g. GPL, LGPL.
Packit f546b1
 * @package: the package-name (e.g. PACKAGE_NAME from config.h)
Packit f546b1
 * @origin: a description from where the package comes from (e.g. the homepage URL)
Packit f546b1
 *
Packit f546b1
 * This macro needs to be used to define the entry point and meta data of a
Packit f546b1
 * plugin. One would use this macro to export a plugin, so that it can be used
Packit f546b1
 * by other applications.
Packit f546b1
 *
Packit f546b1
 * The macro uses a define named PACKAGE for the #GstPluginDesc,source field.
Packit f546b1
 * When using autoconf, this is usually set automatically via the AC_INIT
Packit f546b1
 * macro, and set in config.h. If you are not using autoconf, you will need to
Packit f546b1
 * define PACKAGE yourself and set it to a short mnemonic string identifying
Packit f546b1
 * your application/package, e.g. 'someapp' or 'my-plugins-foo.
Packit f546b1
 *
Packit f546b1
 * If defined, the GST_PACKAGE_RELEASE_DATETIME will also be used for the
Packit f546b1
 * #GstPluginDesc,release_datetime field.
Packit f546b1
 */
Packit f546b1
#define GST_PLUGIN_DEFINE(major,minor,name,description,init,version,license,package,origin) \
Packit f546b1
G_BEGIN_DECLS \
Packit f546b1
GST_PLUGIN_EXPORT const GstPluginDesc * G_PASTE(gst_plugin_, G_PASTE(name, _get_desc)) (void); \
Packit f546b1
GST_PLUGIN_EXPORT void G_PASTE(gst_plugin_, G_PASTE(name, _register)) (void); \
Packit f546b1
\
Packit f546b1
static const GstPluginDesc gst_plugin_desc = { \
Packit f546b1
  major, \
Packit f546b1
  minor, \
Packit f546b1
  G_STRINGIFY(name), \
Packit f546b1
  (gchar *) description, \
Packit f546b1
  init, \
Packit f546b1
  version, \
Packit f546b1
  license, \
Packit f546b1
  PACKAGE, \
Packit f546b1
  package, \
Packit f546b1
  origin, \
Packit f546b1
  __GST_PACKAGE_RELEASE_DATETIME, \
Packit f546b1
  GST_PADDING_INIT \
Packit f546b1
};                                       \
Packit f546b1
\
Packit f546b1
const GstPluginDesc * \
Packit f546b1
G_PASTE(gst_plugin_, G_PASTE(name, _get_desc)) (void) \
Packit f546b1
{ \
Packit f546b1
    return &gst_plugin_desc; \
Packit f546b1
} \
Packit f546b1
\
Packit f546b1
void \
Packit f546b1
G_PASTE(gst_plugin_, G_PASTE(name, _register)) (void) \
Packit f546b1
{ \
Packit f546b1
  gst_plugin_register_static (major, minor, G_STRINGIFY(name), \
Packit f546b1
      description, init, version, license, \
Packit f546b1
      PACKAGE, package, origin); \
Packit f546b1
} \
Packit f546b1
G_END_DECLS
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * GST_LICENSE_UNKNOWN:
Packit f546b1
 *
Packit f546b1
 * To be used in GST_PLUGIN_DEFINE if unsure about the licence.
Packit f546b1
 */
Packit f546b1
#define GST_LICENSE_UNKNOWN "unknown"
Packit f546b1
Packit f546b1
Packit f546b1
/* function for filters */
Packit f546b1
/**
Packit f546b1
 * GstPluginFilter:
Packit f546b1
 * @plugin: the plugin to check
Packit f546b1
 * @user_data: the user_data that has been passed on e.g. gst_registry_plugin_filter()
Packit f546b1
 *
Packit f546b1
 * A function that can be used with e.g. gst_registry_plugin_filter()
Packit f546b1
 * to get a list of plugins that match certain criteria.
Packit f546b1
 *
Packit f546b1
 * Returns: %TRUE for a positive match, %FALSE otherwise
Packit f546b1
 */
Packit f546b1
typedef gboolean        (*GstPluginFilter)              (GstPlugin *plugin,
Packit f546b1
                                                         gpointer user_data);
Packit f546b1
Packit f546b1
GST_API
Packit f546b1
GType                   gst_plugin_get_type             (void);
Packit f546b1
Packit f546b1
GST_API
Packit f546b1
gboolean		gst_plugin_register_static	(gint major_version,
Packit f546b1
                                                         gint minor_version,
Packit f546b1
                                                         const gchar *name,
Packit f546b1
                                                         const gchar *description,
Packit f546b1
                                                         GstPluginInitFunc init_func,
Packit f546b1
                                                         const gchar *version,
Packit f546b1
                                                         const gchar *license,
Packit f546b1
                                                         const gchar *source,
Packit f546b1
                                                         const gchar *package,
Packit f546b1
                                                         const gchar *origin);
Packit f546b1
GST_API
Packit f546b1
gboolean		gst_plugin_register_static_full	(gint major_version,
Packit f546b1
                                                         gint minor_version,
Packit f546b1
                                                         const gchar *name,
Packit f546b1
                                                         const gchar *description,
Packit f546b1
                                                         GstPluginInitFullFunc init_full_func,
Packit f546b1
                                                         const gchar *version,
Packit f546b1
                                                         const gchar *license,
Packit f546b1
                                                         const gchar *source,
Packit f546b1
                                                         const gchar *package,
Packit f546b1
                                                         const gchar *origin,
Packit f546b1
                                                         gpointer user_data);
Packit f546b1
GST_API
Packit f546b1
const gchar*		gst_plugin_get_name		(GstPlugin *plugin);
Packit f546b1
Packit f546b1
GST_API
Packit f546b1
const gchar*		gst_plugin_get_description	(GstPlugin *plugin);
Packit f546b1
Packit f546b1
GST_API
Packit f546b1
const gchar*		gst_plugin_get_filename		(GstPlugin *plugin);
Packit f546b1
Packit f546b1
GST_API
Packit f546b1
const gchar*		gst_plugin_get_version		(GstPlugin *plugin);
Packit f546b1
Packit f546b1
GST_API
Packit f546b1
const gchar*		gst_plugin_get_license		(GstPlugin *plugin);
Packit f546b1
Packit f546b1
GST_API
Packit f546b1
const gchar*		gst_plugin_get_source		(GstPlugin *plugin);
Packit f546b1
Packit f546b1
GST_API
Packit f546b1
const gchar*		gst_plugin_get_package		(GstPlugin *plugin);
Packit f546b1
Packit f546b1
GST_API
Packit f546b1
const gchar*		gst_plugin_get_origin		(GstPlugin *plugin);
Packit f546b1
Packit f546b1
GST_API
Packit f546b1
const gchar*		gst_plugin_get_release_date_string (GstPlugin *plugin);
Packit f546b1
Packit f546b1
GST_API
Packit f546b1
const GstStructure*	gst_plugin_get_cache_data	(GstPlugin * plugin);
Packit f546b1
Packit f546b1
GST_API
Packit f546b1
void			gst_plugin_set_cache_data	(GstPlugin * plugin, GstStructure *cache_data);
Packit f546b1
Packit f546b1
GST_API
Packit f546b1
gboolean		gst_plugin_is_loaded		(GstPlugin *plugin);
Packit f546b1
Packit f546b1
GST_API
Packit f546b1
GstPlugin *		gst_plugin_load_file		(const gchar *filename, GError** error);
Packit f546b1
Packit f546b1
GST_API
Packit f546b1
GstPlugin *             gst_plugin_load                 (GstPlugin *plugin);
Packit f546b1
Packit f546b1
GST_API
Packit f546b1
GstPlugin *             gst_plugin_load_by_name         (const gchar *name);
Packit f546b1
Packit f546b1
GST_API
Packit f546b1
void                    gst_plugin_add_dependency        (GstPlugin    * plugin,
Packit f546b1
                                                          const gchar ** env_vars,
Packit f546b1
                                                          const gchar ** paths,
Packit f546b1
                                                          const gchar ** names,
Packit f546b1
                                                          GstPluginDependencyFlags flags);
Packit f546b1
GST_API
Packit f546b1
void                    gst_plugin_add_dependency_simple (GstPlugin   * plugin,
Packit f546b1
                                                          const gchar * env_vars,
Packit f546b1
                                                          const gchar * paths,
Packit f546b1
                                                          const gchar * names,
Packit f546b1
                                                          GstPluginDependencyFlags flags);
Packit f546b1
GST_API
Packit f546b1
void                    gst_plugin_list_free (GList *list);
Packit f546b1
Packit f546b1
#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
Packit f546b1
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstPlugin, gst_object_unref)
Packit f546b1
#endif
Packit f546b1
Packit f546b1
G_END_DECLS
Packit f546b1
Packit f546b1
#endif /* __GST_PLUGIN_H__ */