## Plugins System Plugins System — Functions for manipulating the plugins |

## Synopsis

    #include <ogmrip-plugin.h>

    struct              OGMRipVideoPlugin;
    struct              OGMRipAudioPlugin;
    struct              OGMRipSubpPlugin;
    struct              OGMRipContainerPlugin;
    void                (*OGMRipPluginFunc)                 (GType type,
                                                             const gchar *name,
                                                             const gchar *description,
                                                             gpointer data);
    gint                (*OGMRipPluginCmpFunc)              (GType type,
                                                             const gchar *name,
                                                             const gchar *description,
                                                             gconstpointer data);
    enum                OGMRipPluginError;
    void                ogmrip_plugin_init                  (void);
    void                ogmrip_plugin_uninit                (void);
    gint                ogmrip_plugin_get_n_containers      (void);
    void                ogmrip_plugin_foreach_container     (OGMRipPluginFunc func,
                                                             gpointer data);
    GType               ogmrip_plugin_find_container        (OGMRipPluginCmpFunc func,
                                                             gconstpointer data);
    GType               ogmrip_plugin_get_nth_container     (guint n);
    const gchar *       ogmrip_plugin_get_container_name    (GType container);
    gint                ogmrip_plugin_get_container_index   (GType container);
    gboolean            ogmrip_plugin_get_container_bframes (GType container);
    GModule *           ogmrip_plugin_get_container_module  (GType container);
    gint                ogmrip_plugin_get_container_max_audio
                                                            (GType container);
    gint                ogmrip_plugin_get_container_max_subp
                                                            (GType container);
    GType               ogmrip_plugin_get_container_by_name (const gchar *name);
    gint                ogmrip_plugin_get_n_video_codecs    (void);
    void                ogmrip_plugin_foreach_video_codec   (OGMRipPluginFunc func,
                                                             gpointer data);
    GType               ogmrip_plugin_find_video_codec      (OGMRipPluginCmpFunc func,
                                                             gconstpointer data);
    GType               ogmrip_plugin_get_nth_video_codec   (guint n);
    const gchar *       ogmrip_plugin_get_video_codec_name  (GType codec);
    gint                ogmrip_plugin_get_video_codec_index (GType codec);
    gint                ogmrip_plugin_get_video_codec_format
                                                            (GType codec);
    gint                ogmrip_plugin_get_video_codec_passes
                                                            (GType codec);
    gint                ogmrip_plugin_get_video_codec_threads
                                                            (GType codec);
    GModule *           ogmrip_plugin_get_video_codec_module
                                                            (GType codec);
    GType               ogmrip_plugin_get_video_codec_by_name
                                                            (const gchar *name);
    gint                ogmrip_plugin_get_n_audio_codecs    (void);
    void                ogmrip_plugin_foreach_audio_codec   (OGMRipPluginFunc func,
                                                             gpointer data);
    GType               ogmrip_plugin_find_audio_codec      (OGMRipPluginCmpFunc func,
                                                             gconstpointer data);
    GType               ogmrip_plugin_get_nth_audio_codec   (guint n);
    const gchar *       ogmrip_plugin_get_audio_codec_name  (GType codec);
    gint                ogmrip_plugin_get_audio_codec_index (GType codec);
    gint                ogmrip_plugin_get_audio_codec_format
                                                            (GType codec);
    GModule *           ogmrip_plugin_get_audio_codec_module
                                                            (GType codec);
    GType               ogmrip_plugin_get_audio_codec_by_name
                                                            (const gchar *name);
    gint                ogmrip_plugin_get_n_subp_codecs     (void);
    void                ogmrip_plugin_foreach_subp_codec    (OGMRipPluginFunc func,
                                                             gpointer data);
    GType               ogmrip_plugin_find_subp_codec       (OGMRipPluginCmpFunc func,
                                                             gconstpointer data);
    GType               ogmrip_plugin_get_nth_subp_codec    (guint n);
    const gchar *       ogmrip_plugin_get_subp_codec_name   (GType codec);
    gint                ogmrip_plugin_get_subp_codec_index  (GType codec);
    gint                ogmrip_plugin_get_subp_codec_format (GType codec);
    gboolean            ogmrip_plugin_get_subp_codec_text   (GType codec);
    GModule *           ogmrip_plugin_get_subp_codec_module (GType codec);
    GType               ogmrip_plugin_get_subp_codec_by_name
                                                            (const gchar *name);
    gboolean            ogmrip_plugin_can_contain_video     (GType container,
                                                             GType codec);
    gboolean            ogmrip_plugin_can_contain_audio     (GType container,
                                                             GType codec);
    gboolean            ogmrip_plugin_can_contain_subp      (GType container,
                                                             GType codec);
    gboolean            ogmrip_plugin_can_contain_format    (GType container,
                                                             OGMRipFormatType format);
    gboolean            ogmrip_plugin_can_contain_n_audio   (GType container,
                                                             guint ncodec);
    gboolean            ogmrip_plugin_can_contain_n_subp    (GType container,
                                                             guint ncodec);

## Description

## Details

### struct OGMRipVideoPlugin

    struct OGMRipVideoPlugin {
      GModule *module;
      GType type;
      gchar *name;
      gchar *description;
      OGMRipFormatType format;
      gint passes;
      gint threads;
    };

A structure describing a video codec plugin

GModule *`module`; | For internal use only
GType `type`; | The type of the codec
gchar *`name`; | The name of the codec
gchar *`description`; | The description of the codec
OGMRipFormatType `format`; | The codec output format
gint `passes`; | The number of passes supported by the codec
gint `threads`; | The number of threads supported by the codec

### struct OGMRipAudioPlugin

    struct OGMRipAudioPlugin {
      GModule *module;
      GType type;
      gchar *name;
      gchar *description;
      OGMRipFormatType format;
    };

A structure describing an audio codec plugin

GModule *`module`; | For internal use only
GType `type`; | The type of the codec
gchar *`name`; | The name of the codec
gchar *`description`; | The description of the codec
OGMRipFormatType `format`; | The codec output format

### struct OGMRipSubpPlugin

    struct OGMRipSubpPlugin {
      GModule *module;
      GType type;
      gchar *name;
      gchar *description;
      OGMRipFormatType format;
      gboolean text;
    };

A structure describing a subtitle codec plugin

GModule *`module`; | For internal use only
GType `type`; | The type of the codec
gchar *`name`; | The name of the codec
gchar *`description`; | The description of the codec
OGMRipFormatType `format`; | The codec output format
gboolean `text`; | Whether the codec outputs text subtitles

### struct OGMRipContainerPlugin

    struct OGMRipContainerPlugin {
      GModule *module;
      GType type;
      gchar *name;
      gchar *description;
      gboolean video;
      gboolean bframes;
      gint max_audio;
      gint max_subp;
      gint *formats;
    };

A structure describing a container plugin

GModule *`module`; | For internal use only
GType `type`; | The type of the container
gchar *`name`; | The name of the container
gchar *`description`; | The description of the container
gboolean `video`; | Whether the container requires a video stream
gboolean `bframes`; | Whether the container supports B-frames
gint `max_audio`; | The maximum number of audio streams that can be embedded in the container
gint `max_subp`; | The maximum number of subtitle streams that can be embedded in the container
gint *`formats`; | A NULL terminated array of OGMRipFormatType supported by the container

### OGMRipPluginFunc ()

    void                (*OGMRipPluginFunc)                 (GType type,
                                                             const gchar *name,
                                                             const gchar *description,
                                                             gpointer data);

Specifies the type of functions passed to `ogmrip_plugin_foreach_container()`, `ogmrip_plugin_foreach_video_codec()`, `ogmrip_plugin_foreach_audio_codec()`, and `ogmrip_plugin_foreach_subp_codec()`.

`type` : | The type of the plugin
`name` : | The name of the plugin
`description` : | The description of the plugin
`data` : | The user data

### OGMRipPluginCmpFunc ()

    gint                (*OGMRipPluginCmpFunc)              (GType type,
                                                             const gchar *name,
                                                             const gchar *description,
                                                             gconstpointer data);

Specifieѕ the type of functions passed to `ogmrip_plugin_find_container()`, `ogmrip_plugin_find_video_codec()`, `ogmrip_plugin_find_audio_codec()`, and `ogmrip_plugin_find_subp_codec()`.

`type` : | The type of the plugin
`name` : | The name of the plugin
`description` : | The description of the plugin
`data` : | The user data
Returns : | 0 when the expected plugin is found

### enum OGMRipPluginError

    typedef enum {
      OGMRIP_PLUGIN_ERROR_REQ
    } OGMRipPluginError;

Error codes returned by `ogmrip_init_plugin()`.

`OGMRIP_PLUGIN_ERROR_REQ` | Some requirements are not met

### ogmrip_plugin_init ()

    void                ogmrip_plugin_init                  (void);

Initializes the plugin system.

### ogmrip_plugin_uninit ()

    void                ogmrip_plugin_uninit                (void);

Uninitializes the plugin system.

### ogmrip_plugin_get_n_containers ()

    gint                ogmrip_plugin_get_n_containers      (void);

Gets the number of container plugins.

Returns : | the number of container plugins

### ogmrip_plugin_foreach_container ()

    void                ogmrip_plugin_foreach_container     (OGMRipPluginFunc func,
                                                             gpointer data);

Calls a function for each container plugin.

`func` : | The function to call with each container plugin's data
`data` : | User data to pass to the function

### ogmrip_plugin_find_container ()

    GType               ogmrip_plugin_find_container        (OGMRipPluginCmpFunc func,
                                                             gconstpointer data);

Finds a container using the supplied function.

`func` : | The function to call for each container plugin. It should return 0 when the desired container is found
`data` : | User data passed to the function
Returns : | The type of the container, or `G_TYPE_NONE`

### ogmrip_plugin_get_nth_container ()

    GType               ogmrip_plugin_get_nth_container     (guint n);

Gets the container at the given position.

`n` : | The index of the container
Returns : | The type of the container, or `G_TYPE_NONE`

### ogmrip_plugin_get_container_name ()

    const gchar *       ogmrip_plugin_get_container_name    (GType container);

Gets the name of the given container.

`container` : | A container type
Returns : | The name of the container, or NULL

### ogmrip_plugin_get_container_index ()

    gint                ogmrip_plugin_get_container_index   (GType container);

Gets the position of the given container.

`container` : | A container type
Returns : | The index of the container, or -1

### ogmrip_plugin_get_container_bframes ()

    gboolean            ogmrip_plugin_get_container_bframes (GType container);

Gets whether the given container supports B-frames

`container` : | A container type
Returns : | `TRUE` if the container supports B-frames

### ogmrip_plugin_get_container_module ()

    GModule *           ogmrip_plugin_get_container_module  (GType container);

Gets the GModule associated with `container`.

`container` : | A container type
Returns : | A GModule, or NULL

### ogmrip_plugin_get_container_max_audio ()

    gint                ogmrip_plugin_get_container_max_audio
                                                            (GType container);

Returns the number of audio streams the given container can contain.

`container` : | A container type
Returns : | the number of audio streams, or -1

### ogmrip_plugin_get_container_max_subp ()

    gint                ogmrip_plugin_get_container_max_subp
                                                            (GType container);

Returns the number of subtitle streams the given container can contain.

`container` : | A container type
Returns : | the number of subtitle streams, or -1

### ogmrip_plugin_get_container_by_name ()

    GType               ogmrip_plugin_get_container_by_name (const gchar *name);

Gets the container with the given name.

`name` : | The name of the container
Returns : | The type of the container, or `G_TYPE_NONE`

### ogmrip_plugin_get_n_video_codecs ()

    gint                ogmrip_plugin_get_n_video_codecs    (void);

Gets the number of video codec plugins.

Returns : | the number of video codec plugins

### ogmrip_plugin_foreach_video_codec ()

    void                ogmrip_plugin_foreach_video_codec   (OGMRipPluginFunc func,
                                                             gpointer data);

Calls a function for each video codec plugin.

`func` : | The function to call with each video codec plugin's data
`data` : | User data to pass to the function

### ogmrip_plugin_find_video_codec ()

    GType               ogmrip_plugin_find_video_codec      (OGMRipPluginCmpFunc func,
                                                             gconstpointer data);

Finds a video codec using the supplied function.

`func` : | The function to call for each video codec plugin. It should return 0 when the desired video codec is found
`data` : | User data passed to the function
Returns : | The type of the video codec, or `G_TYPE_NONE`

### ogmrip_plugin_get_nth_video_codec ()

    GType               ogmrip_plugin_get_nth_video_codec   (guint n);

Gets the video codec at the given position.

`n` : | The index of the video codec
Returns : | The type of the video codec, or `G_TYPE_NONE`

### ogmrip_plugin_get_video_codec_name ()

    const gchar *       ogmrip_plugin_get_video_codec_name  (GType codec);

Gets the name of the given video codec.

`codec` : | A video codec type
Returns : | The name of the video codec, or NULL

### ogmrip_plugin_get_video_codec_index ()

    gint                ogmrip_plugin_get_video_codec_index (GType codec);

Gets the position of the given video codec.

`codec` : | A video codec type
Returns : | The index of the video codec, or -1

### ogmrip_plugin_get_video_codec_format ()

    gint                ogmrip_plugin_get_video_codec_format
                                                            (GType codec);

Gets the format of the given video codec.

`codec` : | A video codec type
Returns : | The format of the video codec, or NULL

### ogmrip_plugin_get_video_codec_passes ()

    gint                ogmrip_plugin_get_video_codec_passes
                                                            (GType codec);

Gets the maximum number of passes the given video codec supports.

`codec` : | A video codec type
Returns : | The maximum number of passes, or -1

### ogmrip_plugin_get_video_codec_threads ()

    gint                ogmrip_plugin_get_video_codec_threads
                                                            (GType codec);

Gets the maximum number of threads the given video codec supports.

`codec` : | A video codec type
Returns : | The maximum number of threads, or -1

### ogmrip_plugin_get_video_codec_module ()

    GModule *           ogmrip_plugin_get_video_codec_module
                                                            (GType codec);

Gets the GModule associated with `codec`.

`codec` : | A video codec type
Returns : | A GModule, or NULL

### ogmrip_plugin_get_video_codec_by_name ()

    GType               ogmrip_plugin_get_video_codec_by_name
                                                            (const gchar *name);

Gets the video codec with the given name.

`name` : | The name of the video codec
Returns : | The type of the video codec, or `G_TYPE_NONE`

### ogmrip_plugin_get_n_audio_codecs ()

    gint                ogmrip_plugin_get_n_audio_codecs    (void);

Gets the number of audio codec plugins.

Returns : | the number of audio codec plugins

### ogmrip_plugin_foreach_audio_codec ()

    void                ogmrip_plugin_foreach_audio_codec   (OGMRipPluginFunc func,
                                                             gpointer data);

Calls a function for each plugin.

`func` : | The function to call with each plugin's data
`data` : | User data to pass to the function

### ogmrip_plugin_find_audio_codec ()

    GType               ogmrip_plugin_find_audio_codec      (OGMRipPluginCmpFunc func,
                                                             gconstpointer data);

Finds a audio codec using the supplied function.

`func` : | The function to call for each audio codec plugin. It should return 0 when the desired audio codec is found
`data` : | User data passed to the function
Returns : | The type of the audio codec, or `G_TYPE_NONE`

### ogmrip_plugin_get_nth_audio_codec ()

    GType               ogmrip_plugin_get_nth_audio_codec   (guint n);

Gets the audio codec at the given position.

`n` : | The index of the audio codec
Returns : | The type of the audio codec, or `G_TYPE_NONE`

### ogmrip_plugin_get_audio_codec_name ()

    const gchar *       ogmrip_plugin_get_audio_codec_name  (GType codec);

Gets the name of the given audio codec.

`codec` : | An audio codec type
Returns : | The name of the audio codec, or NULL

### ogmrip_plugin_get_audio_codec_index ()

    gint                ogmrip_plugin_get_audio_codec_index (GType codec);

Gets the position of the given audio codec.

`codec` : | An audio codec type
Returns : | The index of the audio codec, or -1

### ogmrip_plugin_get_audio_codec_format ()

    gint                ogmrip_plugin_get_audio_codec_format
                                                            (GType codec);

Gets the format of the given audio codec.

`codec` : | A audio codec type
Returns : | The format of the audio codec, or NULL

### ogmrip_plugin_get_audio_codec_module ()

    GModule *           ogmrip_plugin_get_audio_codec_module
                                                            (GType codec);

Gets the GModule associated with `codec`.

`codec` : | A audio codec type
Returns : | A GModule, or NULL

### ogmrip_plugin_get_audio_codec_by_name ()

    GType               ogmrip_plugin_get_audio_codec_by_name
                                                            (const gchar *name);

Gets the audio codec with the given name.

`name` : | The name of the audio codec
Returns : | The type of the audio codec, or `G_TYPE_NONE`

### ogmrip_plugin_get_n_subp_codecs ()

    gint                ogmrip_plugin_get_n_subp_codecs     (void);

Gets the number of subtitle codec plugins.

Returns : | the number of subtitle codec plugins

### ogmrip_plugin_foreach_subp_codec ()

    void                ogmrip_plugin_foreach_subp_codec    (OGMRipPluginFunc func,
                                                             gpointer data);

Calls a function for each plugin.

`func` : | The function to call with each plugin's data
`data` : | User data to pass to the function

### ogmrip_plugin_find_subp_codec ()

    GType               ogmrip_plugin_find_subp_codec       (OGMRipPluginCmpFunc func,
                                                             gconstpointer data);

Finds a subtitle codec using the supplied function.

`func` : | The function to call for each subtitle codec plugin. It should return 0 when the desired subtitle codec is found
`data` : | User data passed to the function
Returns : | The type of the subtitle codec, or `G_TYPE_NONE`

### ogmrip_plugin_get_nth_subp_codec ()

    GType               ogmrip_plugin_get_nth_subp_codec    (guint n);

Gets the subtitle codec at the given position.

`n` : | The index of the subtitle codec
Returns : | The type of the subtitle codec, or `G_TYPE_NONE`

### ogmrip_plugin_get_subp_codec_name ()

    const gchar *       ogmrip_plugin_get_subp_codec_name   (GType codec);

Gets the name of the given subtitle codec.

`codec` : | A subtitle codec type
Returns : | The name of the subtitle codec, or NULL

### ogmrip_plugin_get_subp_codec_index ()

    gint                ogmrip_plugin_get_subp_codec_index  (GType codec);

Gets the position of the given subtitle codec.

`codec` : | A subtitle codec type
Returns : | The index of the subtitle codec, or -1

### ogmrip_plugin_get_subp_codec_format ()

    gint                ogmrip_plugin_get_subp_codec_format (GType codec);

Gets the format of the given subtitle codec.

`codec` : | A subtitle codec type
Returns : | The format of the subtitle codec, or NULL

### ogmrip_plugin_get_subp_codec_text ()

    gboolean            ogmrip_plugin_get_subp_codec_text   (GType codec);

Gets whether the given codec outputs text subtitles.

`codec` : | A subtitle codec type
Returns : | `TRUE` if the codec output text subtitles

### ogmrip_plugin_get_subp_codec_module ()

    GModule *           ogmrip_plugin_get_subp_codec_module (GType codec);

Gets the GModule associated with `codec`.

`codec` : | A subp codec type
Returns : | A GModule, or NULL

### ogmrip_plugin_get_subp_codec_by_name ()

    GType               ogmrip_plugin_get_subp_codec_by_name
                                                            (const gchar *name);

Gets the subp codec with the given name.

`name` : | The name of the subp codec
Returns : | The type of the subp codec, or `G_TYPE_NONE`

### ogmrip_plugin_can_contain_video ()

    gboolean            ogmrip_plugin_can_contain_video     (GType container,
                                                             GType codec);

Returns whether `container` supports the given video codec.

`container` : | A container type
`codec` : | A video codec type
Returns : | `TRUE` if `container` supports `type`

### ogmrip_plugin_can_contain_audio ()

    gboolean            ogmrip_plugin_can_contain_audio     (GType container,
                                                             GType codec);

Returns whether `container` supports the given audio codec.

`container` : | A container type
`codec` : | An audio codec type
Returns : | `TRUE` if `container` supports `type`

### ogmrip_plugin_can_contain_subp ()

    gboolean            ogmrip_plugin_can_contain_subp      (GType container,
                                                             GType codec);

Returns whether `container` supports the given subtitle codec.

`container` : | A container type
`codec` : | A subtitle codec type
Returns : | `TRUE` if `container` supports `type`

### ogmrip_plugin_can_contain_format ()

    gboolean            ogmrip_plugin_can_contain_format    (GType container,
                                                             OGMRipFormatType format);

Returns whether `container` supports the given format.

`container` : | A container type
`format` : | An OGMRipFormatType
Returns : | `TRUE` if `container` supports `format`

### ogmrip_plugin_can_contain_n_audio ()

    gboolean            ogmrip_plugin_can_contain_n_audio   (GType container,
                                                             guint ncodec);

Returns whether `container` can contain `ncodec` audio streams.

`container` : | A container type
`ncodec` : | The number of audio codecs
Returns : | `TRUE` if `container` can contain `ncodec` audio streams

### ogmrip_plugin_can_contain_n_subp ()

    gboolean            ogmrip_plugin_can_contain_n_subp    (GType container,
                                                             guint ncodec);

Returns whether `container` can contain `ncodec` subtitle streams.

`container` : | A container type
`ncodec` : | The number of subtitle codecs
Returns : | `TRUE` if `container` can contain `ncodec` subtitle streams