## GstFilterManager GstFilterManager — The filter manager to handle GstFilter objects |

## Synopsis

    #include <gst/filters/gst-filter-manager.h>

                        GstFilterManager;
    struct              GstFilterManagerInterface;
                        GstFilterId;
    GstPad *            gst_filter_manager_apply            (GstFilterManager *self,
                                                             GstBin *bin,
                                                             GstPad *pad);
    GstPad *            gst_filter_manager_revert           (GstFilterManager *self,
                                                             GstBin *bin,
                                                             GstPad *pad);
    GstFilterId *       gst_filter_manager_append_filter    (GstFilterManager *self,
                                                             GstFilter *filter);
    GstFilterId *       gst_filter_manager_prepend_filter   (GstFilterManager *self,
                                                             GstFilter *filter);
    GstFilterId *       gst_filter_manager_insert_filter_before
                                                            (GstFilterManager *self,
                                                             GstFilter *filter,
                                                             GstFilterId *before);
    GstFilterId *       gst_filter_manager_insert_filter_after
                                                            (GstFilterManager *self,
                                                             GstFilter *filter,
                                                             GstFilterId *after);
    GstFilterId *       gst_filter_manager_insert_filter    (GstFilterManager *self,
                                                             GstFilter *filter,
                                                             gint position);
    gboolean            gst_filter_manager_remove_filter    (GstFilterManager *self,
                                                             GstFilterId *id);
    GstFilterId *       gst_filter_manager_replace_filter   (GstFilterManager *self,
                                                             GstFilter *filter,
                                                             GstFilterId *replace);
    GList *             gst_filter_manager_list_filters     (GstFilterManager *self);
    GstFilter *         gst_filter_manager_get_filter_by_id (GstFilterManager *self,
                                                             GstFilterId *id);
    gboolean            gst_filter_manager_handle_message   (GstFilterManager *self,
                                                             GstMessage *message);

## Object Hierarchy

      GInterface
       +----GstFilterManager

## Prerequisites

GstFilterManager requires GObject.

## Known Implementations

GstFilterManager is implemented by GstMultiFilterManager and GstSingleFilterManager.

## Description

This class acts as a manager for multiple GstFilter objects. Its main purpose is to allow the user to easily add and remove filters from a pipeline and it will take care of doing whatever is necessary to keep the pipeline in a consistent state. It will send signals to let the user know of what is happening in terms of applying/reverting filters and whatever or not the apply/revert worked.

See also GstFilter

## Details

### GstFilterManager

    typedef struct _GstFilterManager GstFilterManager;

Opaque structure representing an object implementing the GstFilterManagerInterface

### struct GstFilterManagerInterface

    struct GstFilterManagerInterface {
      GTypeInterface parent;

      GList *(*list_filters) (GstFilterManager * self);
      GstFilterId *(*insert_filter_before) (GstFilterManager * self,
          GstFilter * filter, GstFilterId * before);
      GstFilterId *(*insert_filter_after) (GstFilterManager * self,
          GstFilter * filter, GstFilterId * after);
      GstFilterId *(*replace_filter) (GstFilterManager * self,
          GstFilter * filter, GstFilterId * replace);
      GstFilterId *(*insert_filter) (GstFilterManager * self,
          GstFilter * filter, gint position);
        gboolean (*remove_filter) (GstFilterManager * self, GstFilterId * id);
      GstFilter *(*get_filter_by_id) (GstFilterManager * self, GstFilterId * id);
      GstPad *(*apply) (GstFilterManager * self, GstBin * bin, GstPad * pad);
      GstPad *(*revert) (GstFilterManager * self, GstBin * bin, GstPad * pad);
        gboolean (*handle_message) (GstFilterManager * self, GstMessage * message);
    };

This is the interface for the GstFilterManager that needs to be implemented

GTypeInterface `parent`; | parent interface type.
`list_filters` () | List the GstFilterId in the filter manager
`insert_filter_before` () | Insert the GstFilter before the GstFilterId
`insert_filter_after` () | Insert the GstFilter after the GstFilterId
`replace_filter` () | Remove the GstFilterId and replace it with the GstFilter
`insert_filter` () | Insert the GstFilter at the specified position
`remove_filter` () | Remove the fsuFilterId from the filter manager
`get_filter_by_id` () | Return the GstFilter associated with the GstFilterId
`apply` () | Apply the filter manager on the GstPad on the GstBin
`revert` () | Revert the filter manager from the GstPad on the GstBin
`handle_message` () | Handle the GstMessage by all the filters

### GstFilterId

    typedef struct _GstFilterId GstFilterId;

An opaque structure to represent a single filter application in the filter manager. A filter can be applied multiple times in a filter manager, so this unique GstFilterId represents the filter in a specific position in the filter manager. It becomes invalid as soon as the filter gets removed from the manager.

### gst_filter_manager_apply ()

    GstPad *            gst_filter_manager_apply            (GstFilterManager *self,
                                                             GstBin *bin,
                                                             GstPad *pad);

This will apply the filter manager to a bin on a specific pad. If the filter manager already has some filters in it, they will automatically be applied on that pad, otherwise, the filter manager will hook itself to that pad and will add filters to it once the they get added to the filter manager. The filter manager can be applied on either a source pad or a sink pad, it will still work the same and the order of the filters will stay be respected in a source-to-sink order.

`self` : | The GstFilterManager
`bin` : | The GstBin to apply the filter manager to
`pad` : | The GstPad to apply the filter manager to
Returns : | The new applied GstPad to link with the rest of the pipeline See also: `gst_filter_manager_revert()`. [transfer none]

### gst_filter_manager_revert ()

    GstPad *            gst_filter_manager_revert           (GstFilterManager *self,
                                                             GstBin *bin,
                                                             GstPad *pad);

This will revert the filter manager from a bin on the specified pad. The pad has to be the end part of the filter manager. This is necessarily the same output pad from `gst_filter_manager_apply()` because if new filters get added to the start or end of the filter manager, that pad might change. The best way to get the correct pad to revert from is to use get the peer pad of the element that was linked after the filter manager. In the case of GstSingleFilterManager, you can also get the out-pad by querrying the filter manager's "out-pad" property.

`self` : | The GstFilterManager
`bin` : | The GstBin to revert the filter manager from
`pad` : | The GstPad to revert the filter manager from
Returns : | The original GstPad from which the filter manager was applied See also: `gst_filter_manager_apply()`. [transfer none]

### gst_filter_manager_append_filter ()

    GstFilterId *       gst_filter_manager_append_filter    (GstFilterManager *self,
                                                             GstFilter *filter);

Add a filter to the end of the list of filters in the filter manager

`self` : | The GstFilterManager
`filter` : | The filter to append
Returns : | The GstFilterId of the inserted filter or NULL in case of error. [transfer none]

### gst_filter_manager_prepend_filter ()

    GstFilterId *       gst_filter_manager_prepend_filter   (GstFilterManager *self,
                                                             GstFilter *filter);

Add a filter to the beginning of the list of filters in the filter manager

`self` : | The GstFilterManager
`filter` : | The filter to prepend
Returns : | The GstFilterId of the inserted filter or NULL in case of error. [transfer none]

### gst_filter_manager_insert_filter_before ()

    GstFilterId *       gst_filter_manager_insert_filter_before
                                                            (GstFilterManager *self,
                                                             GstFilter *filter,
                                                             GstFilterId *before);

Add a filter before `before` in the list of filters in the filter manager

`self` : | The GstFilterManager
`filter` : | The filter to insert
`before` : | The GstFilterId of the filter before which to insert `filter`
Returns : | The GstFilterId of the inserted filter or NULL in case of error. [transfer none]

### gst_filter_manager_insert_filter_after ()

    GstFilterId *       gst_filter_manager_insert_filter_after
                                                            (GstFilterManager *self,
                                                             GstFilter *filter,
                                                             GstFilterId *after);

Add a filter after `after` in the list of filters in the filter manager

`self` : | The GstFilterManager
`filter` : | The filter to insert
`after` : | The GstFilterId of the filter after which to insert `filter`
Returns : | The GstFilterId of the inserted filter or NULL in case of error. [transfer none]

### gst_filter_manager_insert_filter ()

    GstFilterId *       gst_filter_manager_insert_filter    (GstFilterManager *self,
                                                             GstFilter *filter,
                                                             gint position);

Add a filter in the list of filters in the filter manager at the specified position.

`self` : | The GstFilterManager
`filter` : | The filter to insert
`position` : | The insert position of the filter in the list
Returns : | The GstFilterId of the inserted filter or NULL in case of error See also: `gst_filter_manager_list_filters()`. [transfer none]

### gst_filter_manager_remove_filter ()

    gboolean            gst_filter_manager_remove_filter    (GstFilterManager *self,
                                                             GstFilterId *id);

Removes the filter identified by `id` from the list of filters in the filter manager

`self` : | The GstFilterManager
`id` : | The id of the filter to remove
Returns : | TRUE if the GstFilterId is valid and the filter was removed, FALSE if the `id` is invalid

### gst_filter_manager_replace_filter ()

    GstFilterId *       gst_filter_manager_replace_filter   (GstFilterManager *self,
                                                             GstFilter *filter,
                                                             GstFilterId *replace);

Removes the filter identified by `replace` and replace it with the filter `filter` in the same position in the filter manager

### Note

This function is more optimal than calling `gst_filter_manager_remove_filter()` followed by `gst_filter_manager_insert_filter()`, because those two operations would cause an unlink/revert/link followed by unlink/apply/link while the `gst_filter_manager_replace_filter()` operation only causes a unlink/revert/apply/link which will save you an unlinking and a linking of pads, which would cause a caps renegociation

`self` : | The GstFilterManager
`filter` : | The filter to insert
`replace` : | The GstFilterId of the filter to replace by `filter`
Returns : | The GstFilterId of the inserted filter or NULL in case of error. [transfer none]

### gst_filter_manager_list_filters ()

    GList *             gst_filter_manager_list_filters     (GstFilterManager *self);

List all the filters that are currently in the filter manager.

`self` : | The GstFilterManager
Returns : | The ordered list of filters as a GList of GstFilterId See also: `gst_filter_manager_get_filter_by_id()`. [transfer full][element-type GstFilterId]

### gst_filter_manager_get_filter_by_id ()

    GstFilter *         gst_filter_manager_get_filter_by_id (GstFilterManager *self,
                                                             GstFilterId *id);

Get the GstFilter identified by the `id` GstFilterId from the list of filters in the filter manager

`self` : | The GstFilterManager
`id` : | The id of the filter
Returns : | The GstFilter representing `id` or NULL if `id` is invalid. The returned filter is reffed before being returned, so call `g_object_unref()` once the filter is not needed anymore. [transfer full]

### gst_filter_manager_handle_message ()

    gboolean            gst_filter_manager_handle_message   (GstFilterManager *self,
                                                             GstMessage *message);

Dispatch a message originally received on the GstBus to the filter manager and to all its filters. Once a filter handles the message, it will stop dispatching it to other filters and will return TRUE

`self` : | The GstFilterManager
`message` : | The message to handle
Returns : | TRUE if the message has been handled and should be dropped, FALSE otherwise.