## GstPluginFeature

GstPluginFeature — Base class for contents of a GstPlugin

## Synopsis

    #include <gst/gst.h>

                        GstPluginFeature;
    #define             GST_PLUGIN_FEATURE_NAME             (feature)
                        GstTypeNameData;
    gboolean            (*GstPluginFeatureFilter)           (GstPluginFeature *feature,
                                                             gpointer user_data);
    enum                GstRank;
    gboolean            gst_plugin_feature_type_name_filter (GstPluginFeature *feature,
                                                             GstTypeNameData *data);
    void                gst_plugin_feature_set_rank         (GstPluginFeature *feature,
                                                             guint rank);
    void                gst_plugin_feature_set_name         (GstPluginFeature *feature,
                                                             const gchar *name);
    guint               gst_plugin_feature_get_rank         (GstPluginFeature *feature);
    const gchar *       gst_plugin_feature_get_name         (GstPluginFeature *feature);
    GstPluginFeature *  gst_plugin_feature_load             (GstPluginFeature *feature);
    GList *             gst_plugin_feature_list_copy        (GList *list);
    void                gst_plugin_feature_list_free        (GList *list);
    void                gst_plugin_feature_list_debug       (GList *list);
    gboolean            gst_plugin_feature_check_version    (GstPluginFeature *feature,
                                                             guint min_major,
                                                             guint min_minor,
                                                             guint min_micro);
    gint                gst_plugin_feature_rank_compare_func
                                                            (gconstpointer p1,
                                                             gconstpointer p2);

## Object Hierarchy

      GObject
       +----GstObject
             +----GstPluginFeature
                   +----GstElementFactory
                   +----GstTypeFindFactory
                   +----GstIndexFactory

## Description

This is a base class for anything that can be added to a GstPlugin.

## Details

### GstPluginFeature

    typedef struct _GstPluginFeature GstPluginFeature;

Opaque GstPluginFeature structure.

### GST_PLUGIN_FEATURE_NAME()

    #define GST_PLUGIN_FEATURE_NAME(feature)  (GST_PLUGIN_FEATURE (feature)->name)

Get the name of the feature

`feature` : | The feature to query

### GstTypeNameData

    typedef struct {
      const gchar   *name;
      GType          type;
    } GstTypeNameData;

Structure used for filtering based on `name` and `type`.

const gchar *`name`; | a name
GType `type`; | a GType

### GstPluginFeatureFilter ()

    gboolean            (*GstPluginFeatureFilter)           (GstPluginFeature *feature,
                                                             gpointer user_data);

A function that can be used with e.g. `gst_registry_feature_filter()` to get a list of pluginfeature that match certain criteria.

`feature` : | the pluginfeature to check
`user_data` : | the user_data that has been passed on e.g. `gst_registry_feature_filter()`
Returns : | `TRUE` for a positive match, `FALSE` otherwise

### enum GstRank

    typedef enum {
      GST_RANK_NONE                 = 0,
      GST_RANK_MARGINAL             = 64,
      GST_RANK_SECONDARY            = 128,
      GST_RANK_PRIMARY              = 256
    } GstRank;

Element priority ranks. Defines the order in which the autoplugger (or similar rank-picking mechanisms, such as e.g. `gst_element_make_from_uri()`) will choose this element over an alternative one with the same function.

These constants serve as a rough guidance for defining the rank of a GstPluginFeature. Any value is valid, including values bigger than `GST_RANK_PRIMARY`.

`GST_RANK_NONE` | will be chosen last or not at all
`GST_RANK_MARGINAL` | unlikly to be chosen
`GST_RANK_SECONDARY` | likely to be chosen
`GST_RANK_PRIMARY` | will be chosen first

### gst_plugin_feature_type_name_filter ()

    gboolean            gst_plugin_feature_type_name_filter (GstPluginFeature *feature,
                                                             GstTypeNameData *data);

Compares type and name of plugin feature. Can be used with `gst_filter_run()`.

`feature` : | the GstPluginFeature
`data` : | the type and name to check against
Returns : | TRUE if equal.

### gst_plugin_feature_set_rank ()

    void                gst_plugin_feature_set_rank         (GstPluginFeature *feature,
                                                             guint rank);

Specifies a rank for a plugin feature, so that autoplugging uses the most appropriate feature.

`feature` : | feature to rank
`rank` : | rank value - higher number means more priority rank

### gst_plugin_feature_set_name ()

    void                gst_plugin_feature_set_name         (GstPluginFeature *feature,
                                                             const gchar *name);

Sets the name of a plugin feature. The name uniquely identifies a feature within all features of the same type. Renaming a plugin feature is not allowed. A copy is made of the name so you should free the supplied `name` after calling this function.

`feature` : | a feature
`name` : | the name to set

### gst_plugin_feature_get_rank ()

    guint               gst_plugin_feature_get_rank         (GstPluginFeature *feature);

Gets the rank of a plugin feature.

`feature` : | a feature
Returns : | The rank of the feature

### gst_plugin_feature_get_name ()

    const gchar *       gst_plugin_feature_get_name         (GstPluginFeature *feature);

Gets the name of a plugin feature.

`feature` : | a feature
Returns : | the name

### gst_plugin_feature_load ()

    GstPluginFeature *  gst_plugin_feature_load             (GstPluginFeature *feature);

Loads the plugin containing `feature` if it's not already loaded. `feature` is unaffected; use the return value instead.

Normally this function is used like this:

    1
    2
    3
    4
    5
    6

    GstPluginFeature *loaded_feature;

    loaded_feature = gst_plugin_feature_load (feature);
    // presumably, we're no longer interested in the potentially-unloaded feature
    gst_object_unref (feature);
    feature = loaded_feature;

`feature` : | the plugin feature to check
Returns : | A reference to the loaded feature, or NULL on error.

### gst_plugin_feature_list_copy ()

    GList *             gst_plugin_feature_list_copy        (GList *list);

Copies the list of features. Caller should call `gst_plugin_feature_list_free` when done with the list.

`list` : | list of GstPluginFeature
Returns : | a copy of `list`, with each feature's reference count incremented.

Since 0.10.26

### gst_plugin_feature_list_free ()

    void                gst_plugin_feature_list_free        (GList *list);

Unrefs each member of `list`, then frees the list.

`list` : | list of GstPluginFeature

### gst_plugin_feature_list_debug ()

    void                gst_plugin_feature_list_debug       (GList *list);

Debug the plugin feature names in `list`.

`list` : | a GList of plugin features

Since 0.10.31

### gst_plugin_feature_check_version ()

    gboolean            gst_plugin_feature_check_version    (GstPluginFeature *feature,
                                                             guint min_major,
                                                             guint min_minor,
                                                             guint min_micro);

Checks whether the given plugin feature is at least the required version

`feature` : | a feature
`min_major` : | minimum required major version
`min_minor` : | minimum required minor version
`min_micro` : | minimum required micro version
Returns : | TRUE if the plugin feature has at least the required version, otherwise FALSE.

### gst_plugin_feature_rank_compare_func ()

    gint                gst_plugin_feature_rank_compare_func
                                                            (gconstpointer p1,
                                                             gconstpointer p2);

Compares the two given GstPluginFeature instances. This function can be used as a GCompareFunc when sorting by rank and then by name.

`p1` : | a GstPluginFeature
`p2` : | a GstPluginFeature
Returns : | negative value if the rank of p1 > the rank of p2 or the ranks are equal but the name of p1 comes before the name of p2; zero if the rank and names are equal; positive value if the rank of p1 < the rank of p2 or the ranks are equal but the name of p2 comes after the name of p1

Since 0.10.31

## See Also

GstPlugin