## RygelMediaEngine

RygelMediaEngine — This is the base class for media engines that contain knowledge about the streaming and (optionally) the transcoding and seeking capabilites of the media library in use. Derived classes also instantiate any transcoding objects supported by the media engine and specify the list of media formats the engine is capable of playing.

## Synopsis

    #define             RYGEL_TYPE_MEDIA_ENGINE
    GList *             rygel_media_engine_get_dlna_profiles
                                                            (RygelMediaEngine *self);
    GList *             rygel_media_engine_get_transcoders  (RygelMediaEngine *self);
    RygelDataSource *   rygel_media_engine_create_data_source
                                                            (RygelMediaEngine *self,
                                                             const gchar *uri);
    void                rygel_media_engine_init             (GError **error);
    RygelMediaEngine *  rygel_media_engine_get_default      (void);
    struct              RygelMediaEngine;
    struct              RygelMediaEngineClass;
    enum                RygelMediaEngineError;

## Object Hierarchy

      GObject
       +----RygelMediaEngine

## Description

See, for instance, Rygel's built-in "gstreamer" and "simple" media engines, or the external rygel-gst-0-10-media-engine module.

The actual media engine used by Rygel at runtime is specified by the media-engine configuration key. For instance, in rygel.conf: media-engine=librygel-media-engine-gst.so

Media engines should also derive their own RygelDataSource, returning an instance of it from `create_data_source()`.

If this media engine supports transcoding then it will typically implement a set of transcoding classes, typically with one base class and a number of sub-classes - one for each transcoding format you want to support. These should be returned by the `get_transcoders()` virtual function. The base transcoder class could provide a generic way to create a RygelDataSource capable of providing Rygel with a transcoded version of a file using the underlying media framework. The sub-classes could contain the various media-framework-specific parameters required to transcode to a given format and implement a heuristic that can be used to order an item's transcoded resources.

See the <link linkend="implementing-media-engines">Implementing Media Engines</link> section.

## Details

### RYGEL_TYPE_MEDIA_ENGINE

    #define RYGEL_TYPE_MEDIA_ENGINE (rygel_media_engine_get_type ())

The type for RygelMediaEngine.

### rygel_media_engine_get_dlna_profiles ()

    GList *             rygel_media_engine_get_dlna_profiles
                                                            (RygelMediaEngine *self);

Get a list of the DLNA profiles that are supported by this media engine when calling `rygel_media_engine_create_data_source()`.

Other DLNA profiles may be supported as transcoding targets -

This information is needed to implement DLNA's ConnectionManager.GetProtocolInfo call and to determine whether Rygel can accept an uploaded file.

See also: `rygel_media_engine_get_transcoders()`.

`self` : | the RygelMediaEngine instance
Returns : | A list of RygelDLNAProfile<!-- -->s. [transfer none]

### rygel_media_engine_get_transcoders ()

    GList *             rygel_media_engine_get_transcoders  (RygelMediaEngine *self);

Get a list of the transcoders that are provided by this media engine.

`self` : | the RygelMediaEngine instance
Returns : | A list of RygelTranscoder<!-- -->s or null if not supported. [transfer none]

### rygel_media_engine_create_data_source ()

    RygelDataSource *   rygel_media_engine_create_data_source
                                                            (RygelMediaEngine *self,
                                                             const gchar *uri);

Get a data source for the URI.

`self` : | the RygelMediaEngine instance
`uri` : | . to create the data source for. [in]
Returns : | A data source representing the uri

### rygel_media_engine_init ()

    void                rygel_media_engine_init             (GError **error);

`error` : | location to store the error occuring, or `NULL` to ignore

### rygel_media_engine_get_default ()

    RygelMediaEngine *  rygel_media_engine_get_default      (void);

Get the singleton instance of the currently used media engine.

Returns : | An instance of a concrete RygelMediaEngine implementation.

### struct RygelMediaEngine

    struct RygelMediaEngine;

This is the base class for media engines that contain knowledge about the streaming and (optionally) the transcoding and seeking capabilites of the media library in use. Derived classes also instantiate any transcoding objects supported by the media engine and specify the list of media formats the engine is capable of playing.

See, for instance, Rygel's built-in "gstreamer" and "simple" media engines, or the external rygel-gst-0-10-media-engine module.

The actual media engine used by Rygel at runtime is specified by the media-engine configuration key. For instance, in rygel.conf: media-engine=librygel-media-engine-gst.so

Media engines should also derive their own RygelDataSource, returning an instance of it from `create_data_source()`.

If this media engine supports transcoding then it will typically implement a set of transcoding classes, typically with one base class and a number of sub-classes - one for each transcoding format you want to support. These should be returned by the `get_transcoders()` virtual function. The base transcoder class could provide a generic way to create a RygelDataSource capable of providing Rygel with a transcoded version of a file using the underlying media framework. The sub-classes could contain the various media-framework-specific parameters required to transcode to a given format and implement a heuristic that can be used to order an item's transcoded resources.

See the <link linkend="implementing-media-engines">Implementing Media Engines</link> section.

### struct RygelMediaEngineClass

    struct RygelMediaEngineClass {
    	GObjectClass parent_class;
    	GList* (*get_dlna_profiles) (RygelMediaEngine* self);
    	GList* (*get_transcoders) (RygelMediaEngine* self);
    	RygelDataSource* (*create_data_source) (RygelMediaEngine* self, const gchar* uri);
    };

The class structure for `RYGEL_TYPE_MEDIA_ENGINE`. All the fields in this structure are private and should never be accessed directly.

GObjectClass `parent_class`; | the parent class structure
`get_dlna_profiles` () | virtual method called by `rygel_media_engine_get_dlna_profiles()`
`get_transcoders` () | virtual method called by `rygel_media_engine_get_transcoders()`
`create_data_source` () | virtual method called by `rygel_media_engine_create_data_source()`

### enum RygelMediaEngineError

    typedef enum {
    	RYGEL_MEDIA_ENGINE_ERROR_NOT_FOUND
    } RygelMediaEngineError;

`RYGEL_MEDIA_ENGINE_ERROR_NOT_FOUND` |