GrlMedia: Grilo Reference Manual

## GrlMedia GrlMedia — A multimedia data transfer object |

## Functions

GrlMedia * | grl_media_new ()
GrlMedia * | grl_media_audio_new ()
GrlMedia * | grl_media_image_new ()
GrlMedia * | grl_media_video_new ()
GrlMedia * | grl_media_container_new ()
gboolean | grl_media_is_audio ()
gboolean | grl_media_is_image ()
gboolean | grl_media_is_video ()
gboolean | grl_media_is_container ()
void | grl_media_add_artist ()
void | grl_media_add_author ()
void | grl_media_add_director ()
void | grl_media_add_external_player ()
void | grl_media_add_external_url ()
void | grl_media_add_genre ()
void | grl_media_add_keyword ()
void | grl_media_add_lyrics ()
void | grl_media_add_mb_artist_id ()
void | grl_media_add_performer ()
void | grl_media_add_producer ()
void | grl_media_add_region_data ()
void | grl_media_add_thumbnail ()
void | grl_media_add_thumbnail_binary ()
void | grl_media_add_url_data ()
const gchar * | grl_media_get_album ()
const gchar * | grl_media_get_artist ()
const gchar * | grl_media_get_artist_nth ()
const gchar * | grl_media_get_author ()
const gchar * | grl_media_get_author_nth ()
gint | grl_media_get_bitrate ()
const gchar * | grl_media_get_camera_model ()
const gchar * | grl_media_get_certificate ()
gint | grl_media_get_childcount ()
GDateTime * | grl_media_get_creation_date ()
const gchar * | grl_media_get_description ()
const gchar * | grl_media_get_director ()
const gchar * | grl_media_get_director_nth ()
gint | grl_media_get_duration ()
gint | grl_media_get_episode ()
const gchar * | grl_media_get_episode_title ()
gfloat | grl_media_get_exposure_time ()
gboolean | grl_media_get_favourite ()
const gchar * | grl_media_get_flash_used ()
gfloat | grl_media_get_framerate ()
const gchar * | grl_media_get_genre ()
const gchar * | grl_media_get_genre_nth ()
gint | grl_media_get_height ()
const gchar * | grl_media_get_external_url ()
const gchar * | grl_media_get_external_url_nth ()
const gchar * | grl_media_get_id ()
gfloat | grl_media_get_iso_speed ()
const gchar * | grl_media_get_keyword ()
const gchar * | grl_media_get_keyword_nth ()
GDateTime * | grl_media_get_last_played ()
gint | grl_media_get_last_position ()
const gchar * | grl_media_get_license ()
const gchar * | grl_media_get_mb_album_id ()
const gchar * | grl_media_get_mb_artist_id ()
const gchar * | grl_media_get_mb_artist_id_nth ()
const gchar * | grl_media_get_mb_recording_id ()
const gchar * | grl_media_get_mb_track_id ()
const gchar * | grl_media_get_mime ()
GDateTime * | grl_media_get_modification_date ()
gint | grl_media_get_orientation ()
const gchar * | grl_media_get_original_title ()
const gchar * | grl_media_get_performer ()
const gchar * | grl_media_get_performer_nth ()
const gchar * | grl_media_get_producer ()
const gchar * | grl_media_get_producer_nth ()
gint | grl_media_get_play_count ()
const gchar * | grl_media_get_player ()
const gchar * | grl_media_get_player_nth ()
GDateTime * | grl_media_get_publication_date ()
gfloat | grl_media_get_rating ()
const gchar * | grl_media_get_region ()
const gchar * | grl_media_get_region_data ()
const gchar * | grl_media_get_region_data_nth ()
gint | grl_media_get_season ()
const gchar * | grl_media_get_show ()
const gchar * | grl_media_get_site ()
const gchar * | grl_media_get_source ()
gfloat | grl_media_get_start_time ()
const gchar * | grl_media_get_studio ()
const gchar * | grl_media_get_thumbnail ()
const guint8 * | grl_media_get_thumbnail_binary ()
const guint8 * | grl_media_get_thumbnail_binary_nth ()
const gchar * | grl_media_get_thumbnail_nth ()
gint | grl_media_get_track_number ()
const gchar * | grl_media_get_title ()
const gchar * | grl_media_get_url ()
const gchar * | grl_media_get_url_data ()
const gchar * | grl_media_get_url_data_nth ()
gint64 | grl_media_get_size ()
gint | grl_media_get_width ()
gchar * | grl_media_serialize ()
gchar * | grl_media_serialize_extended ()
void | grl_media_set_album ()
void | grl_media_set_artist ()
void | grl_media_set_author ()
void | grl_media_set_bitrate ()
void | grl_media_set_camera_model ()
void | grl_media_set_certificate ()
void | grl_media_set_childcount ()
void | grl_media_set_creation_date ()
void | grl_media_set_description ()
void | grl_media_set_director ()
void | grl_media_set_duration ()
void | grl_media_set_episode ()
void | grl_media_set_episode_title ()
void | grl_media_set_exposure_time ()
void | grl_media_set_external_player ()
void | grl_media_set_external_url ()
void | grl_media_set_favourite ()
void | grl_media_set_flash_used ()
void | grl_media_set_framerate ()
void | grl_media_set_genre ()
void | grl_media_set_height ()
void | grl_media_set_id ()
void | grl_media_set_iso_speed ()
void | grl_media_set_keyword ()
void | grl_media_set_last_played ()
void | grl_media_set_last_position ()
void | grl_media_set_license ()
void | grl_media_set_lyrics ()
void | grl_media_set_mb_album_id ()
void | grl_media_set_mb_artist_id ()
void | grl_media_set_mb_recording_id ()
void | grl_media_set_mb_track_id ()
void | grl_media_set_mime ()
void | grl_media_set_modification_date ()
void | grl_media_set_original_title ()
void | grl_media_set_orientation ()
void | grl_media_set_performer ()
void | grl_media_set_producer ()
void | grl_media_set_play_count ()
void | grl_media_set_publication_date ()
void | grl_media_set_rating ()
void | grl_media_set_region ()
void | grl_media_set_region_data ()
void | grl_media_set_season ()
void | grl_media_set_show ()
void | grl_media_set_site ()
void | grl_media_set_source ()
void | grl_media_set_studio ()
void | grl_media_set_thumbnail ()
void | grl_media_set_thumbnail_binary ()
void | grl_media_set_title ()
void | grl_media_set_track_number ()
void | grl_media_set_url ()
void | grl_media_set_url_data ()
void | grl_media_set_size ()
void | grl_media_set_width ()
GrlMedia * | grl_media_unserialize ()

## Properties

GrlMediaType | media-type | Read / Write / Construct

## Types and Values

struct | GrlMedia
struct | GrlMediaClass
enum | GrlMediaSerializeType
enum | GrlMediaType

## Object Hierarchy

        GObject
        ╰── GrlData
            ╰── GrlMedia

## Includes

    #include <grilo.h>

## Description

This high level class represents a multimedia item. It has methods to set and get properties like author, title, description, and so on.

## Functions

### grl_media_new ()

    GrlMedia *
    grl_media_new (void);

Creates a new data media object.

#### Returns

a newly-allocated data media.

### grl_media_audio_new ()

    GrlMedia *
    grl_media_audio_new (void);

Creates a new media audio object.

#### Returns

a newly-allocated media audio.

Since: 0.1.4

### grl_media_image_new ()

    GrlMedia *
    grl_media_image_new (void);

Creates a new media image object.

#### Returns

a newly-allocated media image.

Since: 0.1.4

### grl_media_video_new ()

    GrlMedia *
    grl_media_video_new (void);

Creates a new media video object.

#### Returns

a newly-allocated media video.

Since: 0.1.4

### grl_media_container_new ()

    GrlMedia *
    grl_media_container_new (void);

Creates a new media container object.

#### Returns

a newly-allocated media container.

Since: 0.3.0

### grl_media_is_audio ()

    gboolean
    grl_media_is_audio (GrlMedia *media);

Check if `media` is an audio

#### Parameters

media | a media |

#### Returns

`TRUE` if `media` is an audio

Since: 0.3.0

### grl_media_is_image ()

    gboolean
    grl_media_is_image (GrlMedia *media);

Check if `media` is an image

#### Parameters

media | a media |

#### Returns

`TRUE` if `media` is an image

Since: 0.3.0

### grl_media_is_video ()

    gboolean
    grl_media_is_video (GrlMedia *media);

Check if `media` is a video

#### Parameters

media | a media |

#### Returns

`TRUE` if `media` is a video

Since: 0.3.0

### grl_media_is_container ()

    gboolean
    grl_media_is_container (GrlMedia *media);

Check if `media` is a container

#### Parameters

media | a media |

#### Returns

`TRUE` if `media` is a container

Since: 0.3.0

### grl_media_add_artist ()

    void
    grl_media_add_artist (GrlMedia *media,
                          const gchar *artist);

Adds a new artist to `media` .

#### Parameters

media | the media instance |
artist | an audio's artist |

Since: 0.3.0

### grl_media_add_author ()

    void
    grl_media_add_author (GrlMedia *media,
                          const gchar *author);

Adds a new author to `media` .

#### Parameters

media | a GrlMedia |
author | an author for `media` |

Since: 0.1.10

### grl_media_add_director ()

    void
    grl_media_add_director (GrlMedia *media,
                            const gchar *director);

Adds the director of the media

#### Parameters

media | a GrlMedia |
director | director of the movie |

Since: 0.3.0

### grl_media_add_external_player ()

    void
    grl_media_add_external_player (GrlMedia *media,
                                   const gchar *player);

Adds a new external player to `media` .

#### Parameters

media | a GrlMedia |
player | an external player for `media` |

Since: 0.1.10

### grl_media_add_external_url ()

    void
    grl_media_add_external_url (GrlMedia *media,
                                const gchar *url);

Adds a new external url to `media` .

#### Parameters

media | a GrlMedia |
url | an external url for `media` |

Since: 0.1.10

### grl_media_add_genre ()

    void
    grl_media_add_genre (GrlMedia *media,
                         const gchar *genre);

Adds a new genre to `media` .

#### Parameters

media | the media instance |
genre | an audio's genre |

Since: 0.3.0

### grl_media_add_keyword ()

    void
    grl_media_add_keyword (GrlMedia *media,
                           const gchar *keyword);

Adds the keyword describing the `media` .

#### Parameters

media | a GrlMedia |
keyword | a keyword describing the media |

Since: 0.2.3

### grl_media_add_lyrics ()

    void
    grl_media_add_lyrics (GrlMedia *media,
                          const gchar *lyrics);

Adds a new lyrics to `media` .

#### Parameters

media | the media instance |
lyrics | an audio's lyrics |

Since: 0.3.0

### grl_media_add_mb_artist_id ()

    void
    grl_media_add_mb_artist_id (GrlMedia *media,
                                const gchar *mb_artist_id);

Adds a new MusicBrainz artist id to `media` .

#### Parameters

media | the media instance |
mb_artist_id | a MusicBrainz artist identifier |

Since: 0.3.0

### grl_media_add_performer ()

    void
    grl_media_add_performer (GrlMedia *media,
                             const gchar *performer);

Adds the actor performing in the movie.

#### Parameters

media | a GrlMedia |
performer | an actor performing in the movie |

Since: 0.3.0

### grl_media_add_producer ()

    void
    grl_media_add_producer (GrlMedia *media,
                            const gchar *producer);

Adds the producer of the media.

#### Parameters

media | a GrlMedia |
producer | producer of the movie |

Since: 0.3.0

### grl_media_add_region_data ()

    void
    grl_media_add_region_data (GrlMedia *media,
                               const gchar *region,
                               const GDateTime *publication_date,
                               const gchar *certificate);

Adds regional publication and certification information for `region` .

#### Parameters

media | a GrlMedia |
region | the region's ISO-3166-1 code |
publication_date | the publication date |
certificate | the age certification |

Since: 0.2.3

### grl_media_add_thumbnail ()

    void
    grl_media_add_thumbnail (GrlMedia *media,
                             const gchar *thumbnail);

Adds a new thumbnail to `media` .

#### Parameters

media | a GrlMedia |
thumbnail | a thumbnail for `media` |

Since: 0.1.10

### grl_media_add_thumbnail_binary ()

    void
    grl_media_add_thumbnail_binary (GrlMedia *media,
                                    const guint8 *thumbnail,
                                    gsize size);

Adds a new thumbnail to `media` .

#### Parameters

media | a GrlMedia |
thumbnail | a buffer containing the thumbnail for `media` |
size | size of buffer |

Since: 0.1.10

### grl_media_add_url_data ()

    void
    grl_media_add_url_data (GrlMedia *media,
                            const gchar *url,
                            const gchar *mime,
                            gint bitrate,
                            gfloat framerate,
                            gint width,
                            gint height);

Sets all the keys related with the URL of a media resource and adds it to `media` (useful for resources with more than one URL).

#### Parameters

media | a GrlMedia |
url | a media's URL |
mime | th `url` mime type |
bitrate | the `url` bitrate, or -1 to ignore |
framerate | media framerate, or -1 to ignore |
width | media width, or -1 to ignore |
height | media height, or -1 to ignore |

Since: 0.3.0

### grl_media_get_album ()

    const gchar *
    grl_media_get_album (GrlMedia *media);

#### Parameters

media | the media instance |

#### Returns

the album of the media

Since: 0.3.0

### grl_media_get_artist ()

    const gchar *
    grl_media_get_artist (GrlMedia *media);

#### Parameters

media | the media instance |

#### Returns

the artist of the media

Since: 0.3.0

### grl_media_get_artist_nth ()

    const gchar *
    grl_media_get_artist_nth (GrlMedia *media,
                              guint index);

#### Parameters

media | the media instance |
index | element to retrieve, starting at 0 |

#### Returns

the n-th artist of the media

Since: 0.3.0

### grl_media_get_author ()

    const gchar *
    grl_media_get_author (GrlMedia *media);

#### Parameters

media | the media object |

#### Returns

the media's author

Since: 0.1.4

### grl_media_get_author_nth ()

    const gchar *
    grl_media_get_author_nth (GrlMedia *media,
                              guint index);

#### Parameters

media | the media object |
index | element to retrieve |

#### Returns

the n-th media's author.

Since: 0.1.10

### grl_media_get_bitrate ()

    gint
    grl_media_get_bitrate (GrlMedia *media);

#### Parameters

media | the media instance |

#### Returns

the bitrate of the media

Since: 0.3.0

### grl_media_get_camera_model ()

    const gchar *
    grl_media_get_camera_model (GrlMedia *media);

#### Parameters

media | the media instance |

#### Returns

model of camera used to take picture

Since: 0.3.0

### grl_media_get_certificate ()

    const gchar *
    grl_media_get_certificate (GrlMedia *media);

Returns the media's first age certificate. This should usually be the media's most relevant age certificate. Use `grl_media_get_region_data_nth()` to get other age certificates.

#### Parameters

media | the media object |

#### Returns

the media's age certification

Since: 0.1.6

### grl_media_get_childcount ()

    gint
    grl_media_get_childcount (GrlMedia *media);

Number of children of this container.

#### Parameters

media | the media container instance |

#### Returns

number of children, or GRL_METADATA_KEY_CHILDCOUNT_UNKNOWN if unknown.

Since: 0.3.0

### grl_media_get_creation_date ()

    GDateTime *
    grl_media_get_creation_date (GrlMedia *media);

#### Parameters

media | the media |

#### Returns

date when media was created (owned by `media` ).

[transfer none]

Since: 0.2.0

### grl_media_get_description ()

    const gchar *
    grl_media_get_description (GrlMedia *media);

#### Parameters

media | the media object |

#### Returns

the media's description

Since: 0.1.4

### grl_media_get_director ()

    const gchar *
    grl_media_get_director (GrlMedia *media);

#### Parameters

media | a GrlMedia |

#### Returns

the director of the movie (owned by `media` ).

[transfer none]

Since: 0.3.0

### grl_media_get_director_nth ()

    const gchar *
    grl_media_get_director_nth (GrlMedia *media,
                                guint index);

#### Parameters

media | a GrlMedia |
index | element to retrieve |

#### Returns

the director of the movie (owned by `media` ).

[transfer none]

Since: 0.3.0

### grl_media_get_duration ()

    gint
    grl_media_get_duration (GrlMedia *media);

#### Parameters

media | the media object |

#### Returns

the media's duration in seconds

Since: 0.1.4

### grl_media_get_episode ()

    gint
    grl_media_get_episode (GrlMedia *media);

#### Parameters

media | the media instance |

#### Returns

the episode number of the media

Since: 0.3.0

### grl_media_get_episode_title ()

    const gchar *
    grl_media_get_episode_title (GrlMedia *media);

#### Parameters

media | the media instance |

#### Returns

the title of the episode

Since: 0.3.0

### grl_media_get_exposure_time ()

    gfloat
    grl_media_get_exposure_time (GrlMedia *media);

#### Parameters

media | the media instance |

#### Returns

picture's exposure time

Since: 0.3.0

### grl_media_get_favourite ()

    gboolean
    grl_media_get_favourite (GrlMedia *media);

#### Parameters

media | the media object |

#### Returns

whether the media is favourite or not

Since: 0.2.3

### grl_media_get_flash_used ()

    const gchar *
    grl_media_get_flash_used (GrlMedia *media);

#### Parameters

media | the media instance |

#### Returns

whether the flash was used.

See http://library.gnome.org/devel/ontology/unstable/nmm-classes.htmlnmm-Flash

Since: 0.3.0

### grl_media_get_framerate ()

    gfloat
    grl_media_get_framerate (GrlMedia *media);

#### Parameters

media | the media instance |

#### Returns

the framerate of the media

Since: 0.3.0

### grl_media_get_genre ()

    const gchar *
    grl_media_get_genre (GrlMedia *media);

#### Parameters

media | the media instance |

#### Returns

the genre of the media

Since: 0.3.0

### grl_media_get_genre_nth ()

    const gchar *
    grl_media_get_genre_nth (GrlMedia *media,
                             guint index);

#### Parameters

media | the media instance |
index | element to retrieve, starting at 0 |

#### Returns

the n-th genre of the media

Since: 0.3.0

### grl_media_get_height ()

    gint
    grl_media_get_height (GrlMedia *media);

#### Parameters

media | the media instance |

#### Returns

the height of the media

Since: 0.3.0

### grl_media_get_external_url ()

    const gchar *
    grl_media_get_external_url (GrlMedia *media);

#### Parameters

media | the media object |

#### Returns

URL of an external location where the user play the media.

Since: 0.1.6

### grl_media_get_external_url_nth ()

    const gchar *
    grl_media_get_external_url_nth (GrlMedia *media,
                                    guint index);

#### Parameters

media | the media object |
index | element to retrieve |

#### Returns

the n-th media's external location where the user can play it.

Since: 0.1.10

### grl_media_get_id ()

    const gchar *
    grl_media_get_id (GrlMedia *media);

#### Parameters

media | the media object |

#### Returns

the media's identifier

Since: 0.1.4

### grl_media_get_iso_speed ()

    gfloat
    grl_media_get_iso_speed (GrlMedia *media);

#### Parameters

media | the media instance |

#### Returns

picture's iso speed

Since: 0.3.0

### grl_media_get_keyword ()

    const gchar *
    grl_media_get_keyword (GrlMedia *media);

#### Parameters

media | a GrlMedia |

#### Returns

the keyword describing the `media` (owned by `media` ).

[transfer none]

Since: 0.2.3

### grl_media_get_keyword_nth ()

    const gchar *
    grl_media_get_keyword_nth (GrlMedia *media,
                               guint index);

#### Parameters

media | a GrlMedia |
index | element to retrieve |

#### Returns

the keyword describing the `media` (owned by `media` ).

[transfer none]

Since: 0.2.3

### grl_media_get_last_played ()

    GDateTime *
    grl_media_get_last_played (GrlMedia *media);

#### Parameters

media | the media object |

#### Returns

the media's last played time

Since: 0.3.0

### grl_media_get_last_position ()

    gint
    grl_media_get_last_position (GrlMedia *media);

#### Parameters

media | the media object |

#### Returns

the media's last_played position (in seconds)

Since: 0.1.4

### grl_media_get_license ()

    const gchar *
    grl_media_get_license (GrlMedia *media);

#### Parameters

media | the media object |

#### Returns

the license the media is under

Since: 0.1.6

### grl_media_get_mb_album_id ()

    const gchar *
    grl_media_get_mb_album_id (GrlMedia *media);

#### Parameters

media | the media instance |

#### Returns

the MusicBrainz album identifier

Since: 0.3.0

### grl_media_get_mb_artist_id ()

    const gchar *
    grl_media_get_mb_artist_id (GrlMedia *media);

#### Parameters

media | the media instance |

#### Returns

the MusicBrainz artist identifier

Since: 0.3.0

### grl_media_get_mb_artist_id_nth ()

    const gchar *
    grl_media_get_mb_artist_id_nth (GrlMedia *media,
                                    guint index);

#### Parameters

media | the media instance |
index | element to retrieve, starting at 0 |

#### Returns

the n-th MusicBrainz artist identifier of the media

Since: 0.3.0

### grl_media_get_mb_recording_id ()

    const gchar *
    grl_media_get_mb_recording_id (GrlMedia *media);

#### Parameters

media | the media instance |

#### Returns

the MusicBrainz recording identifier

Since: 0.3.0

### grl_media_get_mb_track_id ()

    const gchar *
    grl_media_get_mb_track_id (GrlMedia *media);

#### Parameters

media | the media instance |

#### Returns

the MusicBrainz track identifier

Since: 0.3.0

### grl_media_get_mime ()

    const gchar *
    grl_media_get_mime (GrlMedia *media);

#### Parameters

media | the media object |

#### Returns

the media's mime-type

Since: 0.1.4

### grl_media_get_modification_date ()

    GDateTime *
    grl_media_get_modification_date (GrlMedia *media);

#### Parameters

media | the media |

#### Returns

date when the media was last modified (owned by `media` ).

[transfer none]

Since: 0.2.0

### grl_media_get_orientation ()

    gint
    grl_media_get_orientation (GrlMedia *media);

#### Parameters

media | the image instance |

#### Returns

degrees clockwise orientation of the picture

Since: 0.3.0

### grl_media_get_original_title ()

    const gchar *
    grl_media_get_original_title (GrlMedia *media);

#### Parameters

media | a GrlMedia |

#### Returns

the original, untranslated title of the movie (owned by `media` ).

[transfer none]

Since: 0.3.0

### grl_media_get_performer ()

    const gchar *
    grl_media_get_performer (GrlMedia *media);

#### Parameters

media | a GrlMedia |

#### Returns

the actor performing in the movie (owned by `media` ).

[transfer none]

Since: 0.3.0

### grl_media_get_performer_nth ()

    const gchar *
    grl_media_get_performer_nth (GrlMedia *media,
                                 guint index);

#### Parameters

media | a GrlMedia |
index | element to retrieve |

#### Returns

the actor performing in the movie (owned by `medi` ).

[transfer none]

Since: 0.3.0

### grl_media_get_producer ()

    const gchar *
    grl_media_get_producer (GrlMedia *media);

#### Parameters

media | a GrlMedia |

#### Returns

the producer of the movie (owned by `media` ).

[transfer none]

Since: 0.3.0

### grl_media_get_producer_nth ()

    const gchar *
    grl_media_get_producer_nth (GrlMedia *media,
                                guint index);

#### Parameters

media | a GrlMedia |
index | element to retrieve |

#### Returns

the producer of the movie (owned by `media` ).

[transfer none]

Since: 0.3.0

### grl_media_get_play_count ()

    gint
    grl_media_get_play_count (GrlMedia *media);

#### Parameters

media | the media object |

#### Returns

the media's play count

Since: 0.1.4

### grl_media_get_player ()

    const gchar *
    grl_media_get_player (GrlMedia *media);

#### Parameters

media | the media object |

#### Returns

URL of an external player object for this media

Since: 0.1.6

### grl_media_get_player_nth ()

    const gchar *
    grl_media_get_player_nth (GrlMedia *media,
                              guint index);

#### Parameters

media | the media object |
index | element to retrieve |

#### Returns

the n-th media's external player object.

Since: 0.1.10

### grl_media_get_publication_date ()

    GDateTime *
    grl_media_get_publication_date (GrlMedia *media);

#### Parameters

media | the media object |

#### Returns

the publication date of `media` (owned by `media` ).

[transfer none]

Since: 0.2.0

### grl_media_get_rating ()

    gfloat
    grl_media_get_rating (GrlMedia *media);

#### Parameters

media | the media object |

#### Returns

the media's rating

Since: 0.1.5

### grl_media_get_region ()

    const gchar *
    grl_media_get_region (GrlMedia *media);

#### Parameters

media | the media object |

#### Returns

the ISO-3166-1 of the region where the media was published (owned by `media` ).

[transfer none]

Since: 0.2.3

### grl_media_get_region_data ()

    const gchar *
    grl_media_get_region_data (GrlMedia *media,
                               const GDateTime **publication_date,
                               const gchar **certificate);

Returns the media's age certificate and publication date for the first region. This should usually be the media's most relevant region. Use `grl_media_get_region_data_nth()` to get the age certificate and publication date for other regions.

#### Parameters

media | the media object |
publication_date | the publication date, or `NULL` to ignore. | [out][transfer none]
certificate | the age certification, or `NULL` to ignore. | [out][transfer none]

#### Returns

the ISO-3166-1 of the region where the media was published (owned by `media` ).

[transfer none]

Since: 0.2.3

### grl_media_get_region_data_nth ()

    const gchar *
    grl_media_get_region_data_nth (GrlMedia *media,
                                   guint index,
                                   const GDateTime **publication_date,
                                   const gchar **certificate);

Returns the media's age certificate and publication date for one region. Use `grl_data_length()` with GRL_METADATA_KEY_REGION to discover how many regions are available. For instance:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    guint count = grl_data_length (GRL_DATA (media), GRL_METADATA_KEY_REGION);
    guint i;
    for (i = 0; i < count; ++i) {
      const GDateTime* publication_date = NULL;
      const gchar* certificate = NULL;
      const gchar* region =
        grl_media_get_region_data_nth (media, i,
          &publication_date, &certificate);
      ...
    }

#### Parameters

media | the media object |
index | element to retrieve |
publication_date | the publication date, or `NULL` to ignore. | [out][transfer none]
certificate | the age certification, or `NULL` to ignore. | [out][transfer none]

#### Returns

the ISO-3166-1 of the region where the media was published (owned by `media` ).

[transfer none]

Since: 0.2.3

### grl_media_get_season ()

    gint
    grl_media_get_season (GrlMedia *media);

#### Parameters

media | the media instance |

#### Returns

the season number of the media

Since: 0.3.0

### grl_media_get_show ()

    const gchar *
    grl_media_get_show (GrlMedia *media);

#### Parameters

media | the media instance |

#### Returns

the show title of the media

Since: 0.3.0

### grl_media_get_site ()

    const gchar *
    grl_media_get_site (GrlMedia *media);

#### Parameters

media | the media object |

#### Returns

the media's site

Since: 0.1.4

### grl_media_get_source ()

    const gchar *
    grl_media_get_source (GrlMedia *media);

#### Parameters

media | the media object source |

#### Returns

the media's source

Since: 0.1.4

### grl_media_get_start_time ()

    gfloat
    grl_media_get_start_time (GrlMedia *media);

#### Parameters

media | the media object |

#### Returns

the start time of the logical media resource inside the file containing it, in seconds.

Since: 0.1.19

### grl_media_get_studio ()

    const gchar *
    grl_media_get_studio (GrlMedia *media);

#### Parameters

media | the media object |

#### Returns

the studio the media is from

Since: 0.1.6

### grl_media_get_thumbnail ()

    const gchar *
    grl_media_get_thumbnail (GrlMedia *media);

#### Parameters

media | the media object |

#### Returns

the media's thumbnail URL

Since: 0.1.4

### grl_media_get_thumbnail_binary ()

    const guint8 *
    grl_media_get_thumbnail_binary (GrlMedia *media,
                                    gsize *size);

#### Parameters

media | the media object |
size | pointer to storing the thumbnail buffer size |

#### Returns

the media's thumbnail data and set size to the thumbnail buffer size

Since: 0.1.9

### grl_media_get_thumbnail_binary_nth ()

    const guint8 *
    grl_media_get_thumbnail_binary_nth (GrlMedia *media,
                                        gsize *size,
                                        guint index);

#### Parameters

media | the media object |
size | pointer to store the thumbnail buffer size |
index | element to retrieve |

#### Returns

the n-th media's thumbnail binary and sets size to the thumbnail buffer size.

Since: 0.1.10

### grl_media_get_thumbnail_nth ()

    const gchar *
    grl_media_get_thumbnail_nth (GrlMedia *media,
                                 guint index);

#### Parameters

media | the media object |
index | element to retrieve |

#### Returns

the n-th media's thumbnail.

Since: 0.1.10

### grl_media_get_track_number ()

    gint
    grl_media_get_track_number (GrlMedia *media);

#### Parameters

media | the media instance |

#### Returns

the track number of the media

Since: 0.3.0

### grl_media_get_title ()

    const gchar *
    grl_media_get_title (GrlMedia *media);

#### Parameters

media | the media object |

#### Returns

the media's title

Since: 0.1.4

### grl_media_get_url ()

    const gchar *
    grl_media_get_url (GrlMedia *media);

#### Parameters

media | the media object |

#### Returns

the media's URL

Since: 0.1.4

### grl_media_get_url_data ()

    const gchar *
    grl_media_get_url_data (GrlMedia *media,
                            gchar **mime,
                            gint *bitrate,
                            gfloat *framerate,
                            gint *width,
                            gint *height);

#### Parameters

media | the media object |
mime | the mime-type, or `NULL` to ignore. | [out][transfer none]
bitrate | the url bitrate, or `NULL` to ignore. | [out]
framerate | the url framerate, or `NULL` to ignore |
width | the url width, or `NULL` to ignore |
height | the url height, or `NULL` to ignore |

#### Returns

the media's URL and its related properties.

Since: 0.3.0

### grl_media_get_url_data_nth ()

    const gchar *
    grl_media_get_url_data_nth (GrlMedia *media,
                                guint index,
                                gchar **mime,
                                gint *bitrate,
                                gfloat *framerate,
                                gint *width,
                                gint *height);

#### Parameters

media | the media object |
index | element to retrieve |
mime | the mime-type, or `NULL` to ignore. | [out][transfer none]
bitrate | the url bitrate, or `NULL` to ignore. | [out]
framerate | the url framerate, or `NULL` to ignore |
width | the url width, or `NULL` to ignore |
height | the url height, or `NULL` to ignore |

#### Returns

the n-th media's URL and its related properties.

Since: 0.3.0

### grl_media_get_size ()

    gint64
    grl_media_get_size (GrlMedia *media);

#### Parameters

media | the media object |

#### Returns

the media's size, in bytes or -1 if unknown.

Since: 0.2.10

### grl_media_get_width ()

    gint
    grl_media_get_width (GrlMedia *media);

#### Parameters

media | the media instance |

#### Returns

the width of the media

Since: 0.3.0

### grl_media_serialize ()

    gchar *
    grl_media_serialize (GrlMedia *media);

Serializes a GrlMedia into a string. It does a basic serialization.

See `grl_media_serialize_extended()` to get more serialization approaches.

#### Parameters

media | a GrlMedia |

#### Returns

serialized media

Since: 0.1.6

### grl_media_serialize_extended ()

    gchar *
    grl_media_serialize_extended (GrlMedia *media,
                                  GrlMediaSerializeType serial_type,
                                  ...);

Serializes a GrlMedia into a string.

See `grl_media_unserialize()` to recover back the GrlMedia from the string.

If serialization type is `GRL_MEDIA_SERIALIZE_PARTIAL` then it requires a `GList` with the properties to consider in serialization (id and source are always considered).

#### Parameters

media | a GrlMedia |
serial_type | type of serialization |
... | media keys to serialize |

#### Returns

serialized media

Since: 0.1.6

### grl_media_set_album ()

    void
    grl_media_set_album (GrlMedia *media,
                         const gchar *album);

Set the album of the media

#### Parameters

media | the media instance |
album | the audio's album |

Since: 0.3.0

### grl_media_set_artist ()

    void
    grl_media_set_artist (GrlMedia *media,
                          const gchar *artist);

Set the artist of the media

#### Parameters

media | the media instance |
artist | the audio's artist |

Since: 0.3.0

### grl_media_set_author ()

    void
    grl_media_set_author (GrlMedia *media,
                          const gchar *author);

Set the media's author

#### Parameters

media | the media |
author | the media's author |

Since: 0.1.4

### grl_media_set_bitrate ()

    void
    grl_media_set_bitrate (GrlMedia *media,
                           gint bitrate);

Set the bitrate of the media

#### Parameters

media | the media instance |
bitrate | the audio's bitrate |

Since: 0.3.0

### grl_media_set_camera_model ()

    void
    grl_media_set_camera_model (GrlMedia *media,
                                const gchar *camera_model);

Set the camera_model of the media

#### Parameters

media | the media instance |
camera_model | model of camera used to take picture |

Since: 0.3.0

### grl_media_set_certificate ()

    void
    grl_media_set_certificate (GrlMedia *media,
                               const gchar *certificate);

Set the media's first age certification. This should usually be the media's most relevant age certificate. Use `grl_media_set_region_data()` to set other age certificates.

#### Parameters

media | the media |
certificate | The age certificate of the media |

Since: 0.1.6

### grl_media_set_childcount ()

    void
    grl_media_set_childcount (GrlMedia *media,
                              gint childcount);

Sets the number of children of this container. Use GRL_METADATA_KEY_CHILDCOUNT_UNKNOWN if it is unknown.

#### Parameters

media | the media container instance |
childcount | number of children |

Since: 0.3.0

### grl_media_set_creation_date ()

    void
    grl_media_set_creation_date (GrlMedia *media,
                                 const GDateTime *creation_date);

Set the creation_date of the media

#### Parameters

media | the media |
creation_date | date when media was created |

Since: 0.2.0

### grl_media_set_description ()

    void
    grl_media_set_description (GrlMedia *media,
                               const gchar *description);

Set the media's description

#### Parameters

media | the media |
description | the description |

Since: 0.1.4

### grl_media_set_director ()

    void
    grl_media_set_director (GrlMedia *media,
                            const gchar *director);

Sets the director of the media.

#### Parameters

media | a GrlMedia |
director | director of the movie |

Since: 0.3.0

### grl_media_set_duration ()

    void
    grl_media_set_duration (GrlMedia *media,
                            gint duration);

Set the media's duration

#### Parameters

media | the media |
duration | the duration in seconds |

Since: 0.1.4

### grl_media_set_episode ()

    void
    grl_media_set_episode (GrlMedia *media,
                           gint episode);

Sets the episode number of the media

#### Parameters

media | the media instance |
episode | the video's episode |

Since: 0.3.0

### grl_media_set_episode_title ()

    void
    grl_media_set_episode_title (GrlMedia *media,
                                 const gchar *episode_title);

Sets the title of an media

#### Parameters

media | the media instance |
episode_title | the title of the episode |

Since: 0.3.0

### grl_media_set_exposure_time ()

    void
    grl_media_set_exposure_time (GrlMedia *media,
                                 gfloat exposure_time);

Set the exposure_time of the media

#### Parameters

media | the media instance |
exposure_time | picture's exposure time |

Since: 0.3.0

### grl_media_set_external_player ()

    void
    grl_media_set_external_player (GrlMedia *media,
                                   const gchar *player);

Set the location of a player for the media (usually a flash player)

#### Parameters

media | the media |
player | location of an external player for this media |

Since: 0.1.6

### grl_media_set_external_url ()

    void
    grl_media_set_external_url (GrlMedia *media,
                                const gchar *url);

Set an external location where users can play the media

#### Parameters

media | the media |
url | external location where this media can be played. |

Since: 0.1.6

### grl_media_set_favourite ()

    void
    grl_media_set_favourite (GrlMedia *media,
                             gboolean favourite);

Set if the media is favourite or not

#### Parameters

media | a media |
favourite | whether the item is favourite or not |

Since: 0.2.3

### grl_media_set_flash_used ()

    void
    grl_media_set_flash_used (GrlMedia *media,
                              const gchar *flash_used);

Set the flash_used of the media See http://library.gnome.org/devel/ontology/unstable/nmm-classes.htmlnmm-Flash

#### Parameters

media | the media instance |
flash_used | whether the flash was used |

Since: 0.3.0

### grl_media_set_framerate ()

    void
    grl_media_set_framerate (GrlMedia *media,
                             gfloat framerate);

Set the framerate of the media

#### Parameters

media | the media instance |
framerate | the video's framerate |

Since: 0.3.0

### grl_media_set_genre ()

    void
    grl_media_set_genre (GrlMedia *media,
                         const gchar *genre);

Set the genre of the media

#### Parameters

media | the media instance |
genre | the audio's genre |

Since: 0.3.0

### grl_media_set_height ()

    void
    grl_media_set_height (GrlMedia *media,
                          gint height);

Set the height of the media

#### Parameters

media | the media instance |
height | the video's height |

Since: 0.3.0

### grl_media_set_id ()

    void
    grl_media_set_id (GrlMedia *media,
                      const gchar *id);

Set the media identifier

#### Parameters

media | the media |
id | the identifier of the media |

Since: 0.1.4

### grl_media_set_iso_speed ()

    void
    grl_media_set_iso_speed (GrlMedia *media,
                             gfloat iso_speed);

Set the iso_speed of the media

#### Parameters

media | the media instance |
iso_speed | picture's iso speed |

Since: 0.3.0

### grl_media_set_keyword ()

    void
    grl_media_set_keyword (GrlMedia *media,
                           const gchar *keyword);

Sets the keyword describing the `media` .

#### Parameters

media | a GrlMedia |
keyword | a keyword describing the media |

Since: 0.2.3

### grl_media_set_last_played ()

    void
    grl_media_set_last_played (GrlMedia *media,
                               const GDateTime *last_played);

Set the media last played date

#### Parameters

media | the media |
last_played | date when the media was last played |

Since: 0.3.0

### grl_media_set_last_position ()

    void
    grl_media_set_last_position (GrlMedia *media,
                                 gint last_position);

Set the media last played position

#### Parameters

media | the media |
last_position | second at which the media playback was interrupted |

Since: 0.1.4

### grl_media_set_license ()

    void
    grl_media_set_license (GrlMedia *media,
                           const gchar *license);

Set the media license

#### Parameters

media | the media |
license | The license of the media |

Since: 0.1.6

### grl_media_set_lyrics ()

    void
    grl_media_set_lyrics (GrlMedia *media,
                          const gchar *lyrics);

Set the lyrics of the media

#### Parameters

media | the media instance |
lyrics | the audio's lyrics |

Since: 0.3.0

### grl_media_set_mb_album_id ()

    void
    grl_media_set_mb_album_id (GrlMedia *media,
                               const gchar *mb_album_id);

Set the MusicBrainz album identifier of the media

#### Parameters

media | the media instance |
mb_album_id | the MusicBrainz album identifier |

Since: 0.3.0

### grl_media_set_mb_artist_id ()

    void
    grl_media_set_mb_artist_id (GrlMedia *media,
                                const gchar *mb_artist_id);

Set the MusicBrainz artist identifier of the media

#### Parameters

media | the media instance |
mb_artist_id | the MusicBrainz artist identifier |

Since: 0.3.0

### grl_media_set_mb_recording_id ()

    void
    grl_media_set_mb_recording_id (GrlMedia *media,
                                   const gchar *mb_recording_id);

Set the MusicBrainz recording identifier of the media

#### Parameters

media | the media instance |
mb_recording_id | the MusicBrainz recording identifier |

Since: 0.3.0

### grl_media_set_mb_track_id ()

    void
    grl_media_set_mb_track_id (GrlMedia *media,
                               const gchar *mb_track_id);

Set the MusicBrainz track identifier of the media

#### Parameters

media | the media instance |
mb_track_id | the MusicBrainz track identifier |

Since: 0.3.0

### grl_media_set_mime ()

    void
    grl_media_set_mime (GrlMedia *media,
                        const gchar *mime);

Set the media's mime-type

#### Parameters

media | the media |
mime | the mime type |

Since: 0.1.4

### grl_media_set_modification_date ()

    void
    grl_media_set_modification_date (GrlMedia *media,
                                     const GDateTime *modification_date);

Set the modification date of the media

#### Parameters

media | the media |
modification_date | date when the media was last modified |

Since: 0.2.0

### grl_media_set_original_title ()

    void
    grl_media_set_original_title (GrlMedia *media,
                                  const gchar *original_title);

Sets the original, untranslated title of the media.

#### Parameters

media | a GrlMedia |
original_title | original, untranslated title of the movie |

Since: 0.3.0

### grl_media_set_orientation ()

    void
    grl_media_set_orientation (GrlMedia *media,
                               gint orientation);

Set the orientation of the media

#### Parameters

media | the media instance |
orientation | degrees clockwise orientation of the picture |

Since: 0.3.0

### grl_media_set_performer ()

    void
    grl_media_set_performer (GrlMedia *media,
                             const gchar *performer);

Sets the actor performing in the movie.

#### Parameters

media | a GrlMedia |
performer | an actor performing in the movie |

Since: 0.3.0

### grl_media_set_producer ()

    void
    grl_media_set_producer (GrlMedia *media,
                            const gchar *producer);

Sets the producer of the media.

#### Parameters

media | a GrlMedia |
producer | producer of the movie |

Since: 0.3.0

### grl_media_set_play_count ()

    void
    grl_media_set_play_count (GrlMedia *media,
                              gint play_count);

Set the media play count

#### Parameters

media | the media |
play_count | the play count |

Since: 0.1.4

### grl_media_set_publication_date ()

    void
    grl_media_set_publication_date (GrlMedia *media,
                                    const GDateTime *date);

Set the publication date of `media` .

#### Parameters

media | the media |
date | the date |

Since: 0.2.0

### grl_media_set_rating ()

    void
    grl_media_set_rating (GrlMedia *media,
                          gfloat rating,
                          gfloat max);

This method receives a rating and its scale and normalizes it on a scale from 0...5 to match the usual five-star rating.

#### Parameters

media | a media |
rating | a rating value |
max | maximum rating value |

Since: 0.1.5

### grl_media_set_region ()

    void
    grl_media_set_region (GrlMedia *media,
                          const gchar *region);

Sets the `region` where `media` was published.

#### Parameters

media | a GrlMedia |
region | the region's ISO-3166-1 code |

Since: 0.2.3

### grl_media_set_region_data ()

    void
    grl_media_set_region_data (GrlMedia *media,
                               const gchar *region,
                               const GDateTime *publication_date,
                               const gchar *certificate);

Sets regional publication and certification information for `region` .

#### Parameters

media | a GrlMedia |
region | the region's ISO-3166-1 code |
publication_date | the publication date |
certificate | the age certification |

Since: 0.2.3

### grl_media_set_season ()

    void
    grl_media_set_season (GrlMedia *media,
                          gint season);

Sets the season number of the media

#### Parameters

media | the media instance |
season | the video's season |

Since: 0.3.0

### grl_media_set_show ()

    void
    grl_media_set_show (GrlMedia *media,
                        const gchar *show);

Sets the show title of the media

#### Parameters

media | the media instance |
show | the video's show name |

Since: 0.3.0

### grl_media_set_site ()

    void
    grl_media_set_site (GrlMedia *media,
                        const gchar *site);

Set the media's site. A site is a website about the media such as a studio's promotional website for a movie.

#### Parameters

media | the media |
site | the site |

Since: 0.1.4

### grl_media_set_source ()

    void
    grl_media_set_source (GrlMedia *media,
                          const gchar *source);

Set the media's source

#### Parameters

media | the media |
source | the source |

Since: 0.1.4

### grl_media_set_studio ()

    void
    grl_media_set_studio (GrlMedia *media,
                          const gchar *studio);

Set the media studio

#### Parameters

media | the media |
studio | The studio the media is from |

Since: 0.1.6

### grl_media_set_thumbnail ()

    void
    grl_media_set_thumbnail (GrlMedia *media,
                             const gchar *thumbnail);

Set the media's thumbnail URL

#### Parameters

media | the media |
thumbnail | the thumbnail URL |

Since: 0.1.4

### grl_media_set_thumbnail_binary ()

    void
    grl_media_set_thumbnail_binary (GrlMedia *media,
                                    const guint8 *thumbnail,
                                    gsize size);

Set the media's binary thumbnail

#### Parameters

media | the media |
thumbnail | thumbnail buffer |
size | thumbnail buffer size |

Since: 0.1.9

### grl_media_set_title ()

    void
    grl_media_set_title (GrlMedia *media,
                         const gchar *title);

Set the media's title

#### Parameters

media | the media |
title | the title |

Since: 0.1.4

### grl_media_set_track_number ()

    void
    grl_media_set_track_number (GrlMedia *media,
                                gint track_number);

Set the track number of the media

#### Parameters

media | the media instance |
track_number | the audio's track number |

Since: 0.3.0

### grl_media_set_url ()

    void
    grl_media_set_url (GrlMedia *media,
                       const gchar *url);

Set the media's URL

#### Parameters

media | the media |
url | the media's URL |

Since: 0.1.4

### grl_media_set_url_data ()

    void
    grl_media_set_url_data (GrlMedia *media,
                            const gchar *url,
                            const gchar *mime,
                            gint bitrate,
                            gfloat framerate,
                            gint width,
                            gint height);

Sets all the keys related with the URL of a media resource in one go.

#### Parameters

media | a GrlMedia |
url | the media's URL |
mime | the `url` mime type |
bitrate | the `url` bitrate, or -1 to ignore |
framerate | media framerate, or -1 to ignore |
width | media width, or -1 to ignore |
height | media height, or -1 to ignore |

Since: 0.3.0

### grl_media_set_size ()

    void
    grl_media_set_size (GrlMedia *media,
                        gint64 size);

Set the size of the media

#### Parameters

media | the media |
size | the size in bytes |

Since: 0.2.10

### grl_media_set_width ()

    void
    grl_media_set_width (GrlMedia *media,
                         gint width);

Set the width of the media

#### Parameters

media | the media instance |
width | the video's width |

Since: 0.3.0

### grl_media_unserialize ()

    GrlMedia *
    grl_media_unserialize (const gchar *serial);

Unserializes a GrlMedia.

#### Parameters

serial | a serialized media |

#### Returns

the GrlMedia from the serial.

[transfer full]

Since: 0.1.6

## Types and Values

### struct GrlMedia

    struct GrlMedia;

### struct GrlMediaClass

    struct GrlMediaClass {
      GrlDataClass parent_class;
    };

Grilo Media Class

#### Members

### enum GrlMediaSerializeType

GrlMedia serialize type

#### Members

GRL_MEDIA_SERIALIZE_BASIC | Basic mode |
GRL_MEDIA_SERIALIZE_PARTIAL | Partial mode |
GRL_MEDIA_SERIALIZE_FULL | Full mode |

Since: 0.2.3

### enum GrlMediaType

#### Members

GRL_MEDIA_TYPE_UNKNOWN | unknown media |
GRL_MEDIA_TYPE_AUDIO | audio media |
GRL_MEDIA_TYPE_VIDEO | video media |
GRL_MEDIA_TYPE_IMAGE | image media |
GRL_MEDIA_TYPE_CONTAINER | container media |

## Property Details

### The `“media-type”` property

      “media-type”               GrlMediaType

Type of media.

Flags: Read / Write / Construct

Default value: GRL_MEDIA_TYPE_UNKNOWN

## See Also

GrlData