GrlMedia

GrlMedia — A multimedia data transfer object

Synopsis

#include <grilo.h>

enum                GrlMediaSerializeType;
struct              GrlMediaClass;
void                grl_media_set_id                    (GrlMedia *data,
                                                         const gchar *id);
void                grl_media_set_url                   (GrlMedia *data,
                                                         const gchar *url);
void                grl_media_set_author                (GrlMedia *data,
                                                         const gchar *author);
void                grl_media_set_title                 (GrlMedia *data,
                                                         const gchar *title);
void                grl_media_set_description           (GrlMedia *data,
                                                         const gchar *description);
void                grl_media_set_source                (GrlMedia *data,
                                                         const gchar *source);
void                grl_media_set_thumbnail             (GrlMedia *data,
                                                         const gchar *thumbnail);
void                grl_media_set_site                  (GrlMedia *data,
                                                         const gchar *site);
void                grl_media_set_duration              (GrlMedia *data,
                                                         gint duration);
void                grl_media_set_date                  (GrlMedia *data,
                                                         const gchar *date);
void                grl_media_set_mime                  (GrlMedia *data,
                                                         const gchar *mime);
void                grl_media_set_play_count            (GrlMedia *data,
                                                         gint play_count);
void                grl_media_set_last_played           (GrlMedia *data,
                                                         const gchar *last_played);
void                grl_media_set_last_position         (GrlMedia *data,
                                                         gint last_position);
void                grl_media_set_external_player       (GrlMedia *data,
                                                         const gchar *player);
void                grl_media_set_external_url          (GrlMedia *data,
                                                         const gchar *url);
void                grl_media_set_studio                (GrlMedia *data,
                                                         const gchar *studio);
void                grl_media_set_certificate           (GrlMedia *data,
                                                         const gchar *certificate);
void                grl_media_set_license               (GrlMedia *data,
                                                         const gchar *license);
void                grl_media_set_rating                (GrlMedia *media,
                                                         gfloat rating,
                                                         gfloat max);
const gchar *       grl_media_get_id                    (GrlMedia *data);
const gchar *       grl_media_get_url                   (GrlMedia *data);
const gchar *       grl_media_get_author                (GrlMedia *data);
const gchar *       grl_media_get_title                 (GrlMedia *data);
const gchar *       grl_media_get_description           (GrlMedia *data);
const gchar *       grl_media_get_source                (GrlMedia *data);
const gchar *       grl_media_get_thumbnail             (GrlMedia *data);
const gchar *       grl_media_get_site                  (GrlMedia *data);
gint                grl_media_get_duration              (GrlMedia *data);
const gchar *       grl_media_get_date                  (GrlMedia *data);
const gchar *       grl_media_get_mime                  (GrlMedia *data);
gfloat              grl_media_get_rating                (GrlMedia *data);
gint                grl_media_get_play_count            (GrlMedia *data);
gint                grl_media_get_last_position         (GrlMedia *data);
const gchar *       grl_media_get_last_played           (GrlMedia *data);
const gchar *       grl_media_get_player                (GrlMedia *data);
const gchar *       grl_media_get_external_url          (GrlMedia *data);
const gchar *       grl_media_get_studio                (GrlMedia *data);
const gchar *       grl_media_get_certificate           (GrlMedia *data);
const gchar *       grl_media_get_license               (GrlMedia *data);
GrlMedia *          grl_media_new                       (void);
gchar *             grl_media_serialize                 (GrlMedia *media);
gchar *             grl_media_serialize_extended        (GrlMedia *media,
                                                         GrlMediaSerializeType serial_type,
                                                         ...);
GrlMedia *          grl_media_unserialize               (const gchar *serial);

Description

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

Details

enum GrlMediaSerializeType

typedef enum {
  GRL_MEDIA_SERIALIZE_BASIC,
  GRL_MEDIA_SERIALIZE_PARTIAL,
  GRL_MEDIA_SERIALIZE_FULL
} GrlMediaSerializeType;

GrlMedia serialize type

GRL_MEDIA_SERIALIZE_BASIC

Basic mode

GRL_MEDIA_SERIALIZE_PARTIAL

Partial mode

GRL_MEDIA_SERIALIZE_FULL

Full mode

struct GrlMediaClass

struct GrlMediaClass {
  GrlDataClass parent_class;
};

Grilo Media Class

GrlDataClass parent_class;

the parent class structure

grl_media_set_id ()

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

Set the media identifier

data :

the media

id :

the identifier of the media

Since 0.1.4


grl_media_set_url ()

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

Set the media's URL

data :

the media

url :

the media's URL

Since 0.1.4


grl_media_set_author ()

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

Set the media's author

data :

the media

author :

the media's author

Since 0.1.4


grl_media_set_title ()

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

Set the media's title

data :

the media

title :

the title

Since 0.1.4


grl_media_set_description ()

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

Set the media's description

data :

the media

description :

the description

Since 0.1.4


grl_media_set_source ()

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

Set the media's source

data :

the media

source :

the source

Since 0.1.4


grl_media_set_thumbnail ()

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

Set the media's thumbnail URL

data :

the media

thumbnail :

the thumbnail URL

Since 0.1.4


grl_media_set_site ()

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

Set the media's site

data :

the media

site :

the site

Since 0.1.4


grl_media_set_duration ()

void                grl_media_set_duration              (GrlMedia *data,
                                                         gint duration);

Set the media's duration

data :

the media

duration :

the duration

Since 0.1.4


grl_media_set_date ()

void                grl_media_set_date                  (GrlMedia *data,
                                                         const gchar *date);

Set the media's date (TBD)

data :

the media

date :

the date

grl_media_set_mime ()

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

Set the media's mime-type

data :

the media

mime :

the mime type

Since 0.1.4


grl_media_set_play_count ()

void                grl_media_set_play_count            (GrlMedia *data,
                                                         gint play_count);

Set the media play count

data :

the media

play_count :

the play count

Since 0.1.4


grl_media_set_last_played ()

void                grl_media_set_last_played           (GrlMedia *data,
                                                         const gchar *last_played);

Set the media last played date

data :

the media

last_played :

date when the media was last played

Since 0.1.4


grl_media_set_last_position ()

void                grl_media_set_last_position         (GrlMedia *data,
                                                         gint last_position);

Set the media last played position

data :

the media

last_position :

second at which the media playback was interrupted

Since 0.1.4


grl_media_set_external_player ()

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

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

data :

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 *data,
                                                         const gchar *url);

Set an external location where users can play the media

data :

the media

url :

external location where this media can be played.

Since 0.1.6


grl_media_set_studio ()

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

Set the media studio

data :

the media

studio :

The studio the media is from

Since 0.1.6


grl_media_set_certificate ()

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

Set the media certificate

data :

the media

certificate :

The rating certificate of the media

Since 0.1.6


grl_media_set_license ()

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

Set the media license

data :

the media

license :

The license of the media

Since 0.1.6


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

media :

a media

rating :

a rating value

max :

maximum rating value

Since 0.1.5


grl_media_get_id ()

const gchar *       grl_media_get_id                    (GrlMedia *data);

data :

the media object

Returns :

the media's identifier

Since 0.1.4


grl_media_get_url ()

const gchar *       grl_media_get_url                   (GrlMedia *data);

data :

the media object

Returns :

the media's URL

Since 0.1.4


grl_media_get_author ()

const gchar *       grl_media_get_author                (GrlMedia *data);

data :

the media object

Returns :

the media's author

Since 0.1.4


grl_media_get_title ()

const gchar *       grl_media_get_title                 (GrlMedia *data);

data :

the media object

Returns :

the media's title

Since 0.1.4


grl_media_get_description ()

const gchar *       grl_media_get_description           (GrlMedia *data);

data :

the media object

Returns :

the media's description

Since 0.1.4


grl_media_get_source ()

const gchar *       grl_media_get_source                (GrlMedia *data);

data :

the media object source

Returns :

the media's source

Since 0.1.4


grl_media_get_thumbnail ()

const gchar *       grl_media_get_thumbnail             (GrlMedia *data);

data :

the media object

Returns :

the media's thumbnail URL

Since 0.1.4


grl_media_get_site ()

const gchar *       grl_media_get_site                  (GrlMedia *data);

data :

the media object

Returns :

the media's site

Since 0.1.4


grl_media_get_duration ()

gint                grl_media_get_duration              (GrlMedia *data);

data :

the media object

Returns :

the media's duration

Since 0.1.4


grl_media_get_date ()

const gchar *       grl_media_get_date                  (GrlMedia *data);

data :

the media object

Returns :

the media's date (TBD)

Since 0.1.4


grl_media_get_mime ()

const gchar *       grl_media_get_mime                  (GrlMedia *data);

data :

the media object

Returns :

the media's mime-type

Since 0.1.4


grl_media_get_rating ()

gfloat              grl_media_get_rating                (GrlMedia *data);

data :

the media object

Returns :

the media's rating

Since 0.1.5


grl_media_get_play_count ()

gint                grl_media_get_play_count            (GrlMedia *data);

data :

the media object

Returns :

the media's play count

Since 0.1.4


grl_media_get_last_position ()

gint                grl_media_get_last_position         (GrlMedia *data);

data :

the media object

Returns :

the media's last_played position (in seconds)

Since 0.1.4


grl_media_get_last_played ()

const gchar *       grl_media_get_last_played           (GrlMedia *data);

data :

the media object

Returns :

the media's last played time

Since 0.1.4


grl_media_get_player ()

const gchar *       grl_media_get_player                (GrlMedia *data);

data :

the media object

Returns :

URL of an external player object for this media

Since 0.1.6


grl_media_get_external_url ()

const gchar *       grl_media_get_external_url          (GrlMedia *data);

data :

the media object

Returns :

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

Since 0.1.6


grl_media_get_studio ()

const gchar *       grl_media_get_studio                (GrlMedia *data);

data :

the media object

Returns :

the studio the media is from

Since 0.1.6


grl_media_get_certificate ()

const gchar *       grl_media_get_certificate           (GrlMedia *data);

data :

the media object

Returns :

the media's certificate

Since 0.1.6


grl_media_get_license ()

const gchar *       grl_media_get_license               (GrlMedia *data);

data :

the media object

Returns :

the license the media is under

Since 0.1.6


grl_media_new ()

GrlMedia *          grl_media_new                       (void);

Creates a new data media object.

Returns :

a newly-allocated data media.

Since 0.1.4


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.

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).

media :

a GrlMedia

serial_type :

type of serialization

... :

media keys to serialize

Returns :

serialized media

Since 0.1.6


grl_media_unserialize ()

GrlMedia *          grl_media_unserialize               (const gchar *serial);

Unserializes a GrlMedia.

serial :

a serialized media

Returns :

the GrlMedia from the serial. [transfer full]

Since 0.1.6

See Also

GrlData, GrlMediaBox, GrlMediaVideo, GrlMediaAudio, GrlMediaImage