summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan A. Suarez Romero <jasuarez@igalia.com>2015-12-15 17:35:11 +0100
committerJuan A. Suarez Romero <jasuarez@igalia.com>2015-12-16 13:52:54 +0100
commit11c7c84667749a9d6f942744d5eab287e3c73197 (patch)
treed84c66b0f552c0e5240431ff673a638780683d4f
parent53e9029b3bf7fb65123f060d1782aca698827920 (diff)
core: merge GrlMediaVideo into GrlMedia
Get rid of GrlMediaVideo and use instead GrlMedia. https://bugzilla.gnome.org/show_bug.cgi?id=755551
-rw-r--r--bindings/vala/grilo-0.3.vapi77
-rw-r--r--src/Makefile.am2
-rw-r--r--src/data/grl-media-video.c750
-rw-r--r--src/data/grl-media-video.h191
-rw-r--r--src/data/grl-media.c584
-rw-r--r--src/data/grl-media.h69
-rw-r--r--src/grilo.c1
-rw-r--r--src/grilo.h1
-rw-r--r--tools/grilo-test-ui/main.c4
9 files changed, 668 insertions, 1011 deletions
diff --git a/bindings/vala/grilo-0.3.vapi b/bindings/vala/grilo-0.3.vapi
index 2b1939d..73e5712 100644
--- a/bindings/vala/grilo-0.3.vapi
+++ b/bindings/vala/grilo-0.3.vapi
@@ -104,16 +104,19 @@ namespace Grl {
public Media ();
public void add_artist (string artist);
public void add_author (string author);
+ public void add_director (string director);
public void add_external_player (string player);
public void add_external_url (string url);
public void add_genre (string genre);
public void add_keyword (string keyword);
public void add_lyrics (string lyrics);
public void add_mb_artist_id (string mb_artist_id);
+ public void add_performer (string performer);
+ public void add_producer (string producer);
public void add_region_data (string region, GLib.DateTime publication_date, string certificate);
public void add_thumbnail (string thumbnail);
public void add_thumbnail_binary (uint8 thumbnail, size_t size);
- public void add_url_data (string url, string mime, int bitrate);
+ public void add_url_data (string url, string mime, int bitrate, float framerate, int width, int height);
[CCode (cname = "grl_media_audio_new", has_construct_function = false)]
public Media.audio_new ();
public unowned string get_album ();
@@ -125,12 +128,18 @@ namespace Grl {
public unowned string get_certificate ();
public unowned GLib.DateTime get_creation_date ();
public unowned string get_description ();
+ public unowned string get_director ();
+ public unowned string get_director_nth (uint index);
public int get_duration ();
+ public int get_episode ();
+ public unowned string get_episode_title ();
public unowned string get_external_url ();
public unowned string get_external_url_nth (uint index);
public bool get_favourite ();
+ public float get_framerate ();
public unowned string get_genre ();
public unowned string get_genre_nth (uint index);
+ public int get_height ();
public unowned string get_id ();
public unowned string get_keyword ();
public unowned string get_keyword_nth (uint index);
@@ -147,14 +156,21 @@ namespace Grl {
public Grl.MediaType get_media_type ();
public unowned string get_mime ();
public unowned GLib.DateTime get_modification_date ();
+ public unowned string get_original_title ();
+ public unowned string get_performer ();
+ public unowned string get_performer_nth (uint index);
public int get_play_count ();
public unowned string get_player ();
public unowned string get_player_nth (uint index);
+ public unowned string get_producer ();
+ public unowned string get_producer_nth (uint index);
public unowned GLib.DateTime get_publication_date ();
public float get_rating ();
public unowned string get_region ();
public unowned string get_region_data (out unowned GLib.DateTime publication_date, out unowned string certificate);
public unowned string get_region_data_nth (uint index, out unowned GLib.DateTime publication_date, out unowned string certificate);
+ public int get_season ();
+ public unowned string get_show ();
public unowned string get_site ();
public int64 get_size ();
public unowned string get_source ();
@@ -167,9 +183,11 @@ namespace Grl {
public unowned string get_title ();
public int get_track_number ();
public unowned string get_url ();
- public unowned string get_url_data (out unowned string mime, out int bitrate);
- public unowned string get_url_data_nth (uint index, out unowned string mime, out int bitrate);
+ public unowned string get_url_data (out unowned string mime, out int bitrate, float framerate, int width, int height);
+ public unowned string get_url_data_nth (uint index, out unowned string mime, out int bitrate, float framerate, int width, int height);
+ public int get_width ();
public bool is_audio ();
+ public bool is_video ();
public string serialize ();
public void set_album (string album);
public void set_artist (string artist);
@@ -178,11 +196,16 @@ namespace Grl {
public void set_certificate (string certificate);
public void set_creation_date (GLib.DateTime creation_date);
public void set_description (string description);
+ public void set_director (string director);
public void set_duration (int duration);
+ public void set_episode (int episode);
+ public void set_episode_title (string episode_title);
public void set_external_player (string player);
public void set_external_url (string url);
public void set_favourite (bool favourite);
+ public void set_framerate (float framerate);
public void set_genre (string genre);
+ public void set_height (int height);
public void set_id (string id);
public void set_keyword (string keyword);
public void set_last_played (GLib.DateTime last_played);
@@ -195,11 +218,16 @@ namespace Grl {
public void set_mb_track_id (string mb_track_id);
public void set_mime (string mime);
public void set_modification_date (GLib.DateTime modification_date);
+ public void set_original_title (string original_title);
+ public void set_performer (string performer);
public void set_play_count (int play_count);
+ public void set_producer (string producer);
public void set_publication_date (GLib.DateTime date);
public void set_rating (float rating, float max);
public void set_region (string region);
public void set_region_data (string region, GLib.DateTime publication_date, string certificate);
+ public void set_season (int season);
+ public void set_show (string show);
public void set_site (string site);
public void set_size (int64 size);
public void set_source (string source);
@@ -209,8 +237,11 @@ namespace Grl {
public void set_title (string title);
public void set_track_number (int track_number);
public void set_url (string url);
- public void set_url_data (string url, string mime, int bitrate);
+ public void set_url_data (string url, string mime, int bitrate, float framerate, int width, int height);
+ public void set_width (int width);
public static Grl.Media unserialize (string serial);
+ [CCode (cname = "grl_media_video_new", has_construct_function = false)]
+ public Media.video_new ();
[NoAccessorMethod]
public Grl.MediaType media_type { get; set construct; }
}
@@ -245,44 +276,6 @@ namespace Grl {
public void set_url_data (string url, string mime, int width, int height);
public void set_width (int width);
}
- [CCode (cheader_filename = "grilo.h", type_id = "grl_media_video_get_type ()")]
- public class MediaVideo : Grl.Media {
- [CCode (has_construct_function = false, type = "GrlMedia*")]
- public MediaVideo ();
- public void add_director (string director);
- public void add_performer (string performer);
- public void add_producer (string producer);
- public void add_url_data (string url, string mime, float framerate, int width, int height);
- public unowned string get_director ();
- public unowned string get_director_nth (uint index);
- public int get_episode ();
- public unowned string get_episode_title ();
- public float get_framerate ();
- public int get_height ();
- public unowned string get_original_title ();
- public unowned string get_performer ();
- public unowned string get_performer_nth (uint index);
- public unowned string get_producer ();
- public unowned string get_producer_nth (uint index);
- public int get_season ();
- public unowned string get_show ();
- public unowned string get_url_data (out unowned string mime, float framerate, int width, int height);
- public unowned string get_url_data_nth (uint index, out unowned string mime, float framerate, int width, int height);
- public int get_width ();
- public void set_director (string director);
- public void set_episode (int episode);
- public void set_episode_title (string episode_title);
- public void set_framerate (float framerate);
- public void set_height (int height);
- public void set_original_title (string original_title);
- public void set_performer (string performer);
- public void set_producer (string producer);
- public void set_season (int season);
- public void set_show (string show);
- public void set_size (int width, int height);
- public void set_url_data (string url, string mime, float framerate, int width, int height);
- public void set_width (int width);
- }
[CCode (cheader_filename = "grilo.h", type_id = "grl_operation_options_get_type ()")]
public class OperationOptions : GLib.Object {
[CCode (has_construct_function = false)]
diff --git a/src/Makefile.am b/src/Makefile.am
index 9c6b792..1495827 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -72,7 +72,6 @@ data_c_sources = \
data/grl-data.c \
data/grl-related-keys.c \
data/grl-media.c \
- data/grl-media-video.c \
data/grl-media-image.c \
data/grl-media-box.c \
data/grl-config.c
@@ -104,7 +103,6 @@ data_h_headers = \
data/grl-related-keys.h \
data/grl-media.h \
data/grl-media-box.h \
- data/grl-media-video.h \
data/grl-media-image.h \
data/grl-config.h
diff --git a/src/data/grl-media-video.c b/src/data/grl-media-video.c
deleted file mode 100644
index d971a1c..0000000
--- a/src/data/grl-media-video.c
+++ /dev/null
@@ -1,750 +0,0 @@
-/*
- * Copyright (C) 2010, 2011 Igalia S.L.
- *
- * Contact: Iago Toral Quiroga <itoral@igalia.com>
- *
- * Authors: Juan A. Suarez Romero <jasuarez@igalia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-/**
- * SECTION:grl-media-video
- * @short_description: A multimedia data for video
- * @see_also: #GrlConfig, #GrlMediaBox, #GrlMediaAudio, #GrlMediaImage
- *
- * This high level class represents an video multimedia item. It has methods to
- * set and get properties like framerate, width, height, and so on.
- */
-
-#include "grl-media-video.h"
-
-
-static void grl_media_video_finalize (GObject *object);
-
-G_DEFINE_TYPE (GrlMediaVideo, grl_media_video, GRL_TYPE_MEDIA);
-
-static void
-grl_media_video_class_init (GrlMediaVideoClass *klass)
-{
- GObjectClass *gobject_class = (GObjectClass *)klass;
-
- gobject_class->finalize = grl_media_video_finalize;
-}
-
-static void
-grl_media_video_init (GrlMediaVideo *self)
-{
-}
-
-static void
-grl_media_video_finalize (GObject *object)
-{
- g_signal_handlers_destroy (object);
- G_OBJECT_CLASS (grl_media_video_parent_class)->finalize (object);
-}
-
-/**
- * grl_media_video_new:
- *
- * Creates a new data video object.
- *
- * Returns: a newly-allocated data video.
- *
- * Since: 0.1.4
- */
-GrlMedia *
-grl_media_video_new (void)
-{
- return GRL_MEDIA (g_object_new (GRL_TYPE_MEDIA_VIDEO,
- NULL));
-}
-
-/**
- * grl_media_video_set_size:
- * @video: the media instance
- * @width: the video's width
- * @height: the video's height
- *
- * Set the width and the height of the video
- *
- * Since: 0.1.4
- */
-void
-grl_media_video_set_size (GrlMediaVideo *video,
- gint width,
- int height)
-{
- g_return_if_fail (GRL_IS_MEDIA_VIDEO (video));
-
- grl_media_video_set_width (video, width);
- grl_media_video_set_height (video, height);
-}
-
-/**
- * grl_media_video_set_width:
- * @video: the media instance
- * @width: the video's width
- *
- * Set the width of the video
- *
- * Since: 0.1.4
- */
-void
-grl_media_video_set_width (GrlMediaVideo *video, gint width)
-{
- grl_data_set_int (GRL_DATA (video),
- GRL_METADATA_KEY_WIDTH,
- width);
-}
-
-/**
- * grl_media_video_set_height:
- * @video: the media instance
- * @height: the video's height
- *
- * Set the height of the video
- *
- * Since: 0.1.4
- */
-void
-grl_media_video_set_height (GrlMediaVideo *video, gint height)
-{
- grl_data_set_int (GRL_DATA (video),
- GRL_METADATA_KEY_HEIGHT,
- height);
-}
-
-/**
- * grl_media_video_set_framerate:
- * @video: the media instance
- * @framerate: the video's framerate
- *
- * Set the framerate of the video
- *
- * Since: 0.1.4
- */
-void
-grl_media_video_set_framerate (GrlMediaVideo *video, gfloat framerate)
-{
- grl_data_set_float (GRL_DATA (video),
- GRL_METADATA_KEY_FRAMERATE,
- framerate);
-}
-
-/**
- * grl_media_video_set_season:
- * @video: the media instance
- * @season: the video's season
- *
- * Sets the season number of the video
- *
- * Since: 0.1.11
- */
-void
-grl_media_video_set_season (GrlMediaVideo *video, gint season)
-{
- grl_data_set_int (GRL_DATA (video), GRL_METADATA_KEY_SEASON, season);
-}
-
-/**
- * grl_media_video_set_episode:
- * @video: the media instance
- * @episode: the video's episode
- *
- * Sets the episode number of the video
- *
- * Since: 0.1.11
- */
-void
-grl_media_video_set_episode (GrlMediaVideo *video, gint episode)
-{
- grl_data_set_int (GRL_DATA (video), GRL_METADATA_KEY_EPISODE, episode);
-}
-
-/**
- * grl_media_video_set_episode_title:
- * @video: the media instance
- * @episode_title: the title of the episode
- *
- * Sets the title of an episode
- *
- * Since: 0.2.12
- */
-void
-grl_media_video_set_episode_title (GrlMediaVideo *video,
- const gchar *episode_title)
-{
- g_return_if_fail (GRL_IS_MEDIA_VIDEO (video));
-
- grl_data_set_string (GRL_DATA (video),
- GRL_METADATA_KEY_EPISODE_TITLE,
- episode_title);
-}
-
-/**
- * grl_media_video_set_show:
- * @video: the media instance
- * @show: the video's show name
- *
- * Sets the show title of the video
- *
- * Since: 0.1.11
- */
-void
-grl_media_video_set_show (GrlMediaVideo *video, const gchar *show)
-{
- grl_data_set_string (GRL_DATA (video), GRL_METADATA_KEY_SHOW, show);
-}
-
-/**
- * grl_media_video_get_width:
- * @video: the media instance
- *
- * Returns: the width of the video
- *
- * Since: 0.1.4
- */
-gint
-grl_media_video_get_width (GrlMediaVideo *video)
-{
- return grl_data_get_int (GRL_DATA (video), GRL_METADATA_KEY_WIDTH);
-}
-
-/**
- * grl_media_video_get_height:
- * @video: the media instance
- *
- * Returns: the height of the video
- *
- * Since: 0.1.4
- */
-gint
-grl_media_video_get_height (GrlMediaVideo *video)
-{
- return grl_data_get_int (GRL_DATA (video), GRL_METADATA_KEY_HEIGHT);
-}
-
-/**
- * grl_media_video_get_framerate:
- * @video: the media instance
- *
- * Returns: the framerate of the video
- *
- * Since: 0.1.4
- */
-gfloat
-grl_media_video_get_framerate (GrlMediaVideo *video)
-{
- return grl_data_get_float (GRL_DATA (video), GRL_METADATA_KEY_FRAMERATE);
-}
-
-/**
- * grl_media_video_get_season:
- * @video: the media instance
- *
- * Returns: the season number of the video
- *
- * Since: 0.1.11
- */
-gint
-grl_media_video_get_season (GrlMediaVideo *video)
-{
- return grl_data_get_int (GRL_DATA (video), GRL_METADATA_KEY_SEASON);
-}
-
-/**
- * grl_media_video_get_episode:
- * @video: the media instance
- *
- * Returns: the episode number of the video
- *
- * Since: 0.1.11
- */
-gint
-grl_media_video_get_episode (GrlMediaVideo *video)
-{
- return grl_data_get_int (GRL_DATA (video), GRL_METADATA_KEY_EPISODE);
-}
-
-/**
- * grl_media_video_get_episode_title:
- * @video: the media instance
- *
- * Returns: the title of the episode
- *
- * Since: 0.2.12
- */
-const gchar *
-grl_media_video_get_episode_title (GrlMediaVideo *video)
-{
- g_return_val_if_fail (GRL_IS_MEDIA_VIDEO (video), NULL);
-
- return grl_data_get_string (GRL_DATA (video), GRL_METADATA_KEY_EPISODE_TITLE);
-}
-
-/**
- * grl_media_video_get_show:
- * @video: the media instance
- *
- * Returns: the show title of the video
- *
- * Since: 0.1.11
- */
-const gchar *
-grl_media_video_get_show (GrlMediaVideo *video)
-{
- return grl_data_get_string (GRL_DATA (video), GRL_METADATA_KEY_SHOW);
-}
-
-/**
- * grl_media_video_set_url_data:
- * @video: the media instance
- * @url: the video's url
- * @mime: video mime-type
- * @framerate: video framerate, or -1 to ignore
- * @width: video width, or -1 to ignore
- * @height: video height, or -1 to ignore
- *
- * Sets all the keys related with the URL of a video resource in one go.
- *
- * Since: 0.1.10
- **/
-void
-grl_media_video_set_url_data (GrlMediaVideo *video,
- const gchar *url,
- const gchar *mime,
- gfloat framerate,
- gint width,
- gint height)
-{
- GrlRelatedKeys *relkeys;
-
- g_return_if_fail (GRL_IS_MEDIA_VIDEO (video));
-
- relkeys = grl_related_keys_new ();
- grl_related_keys_set_string (relkeys, GRL_METADATA_KEY_URL, url);
- grl_related_keys_set_string (relkeys, GRL_METADATA_KEY_MIME, mime);
- if (framerate >= 0) {
- grl_related_keys_set_float (relkeys, GRL_METADATA_KEY_FRAMERATE, framerate);
- }
- if (width >= 0) {
- grl_related_keys_set_int (relkeys, GRL_METADATA_KEY_WIDTH, width);
- }
- if (height >= 0) {
- grl_related_keys_set_int (relkeys, GRL_METADATA_KEY_HEIGHT, height);
- }
- grl_data_set_related_keys (GRL_DATA (video), relkeys, 0);
-}
-
-/**
- * grl_media_video_add_url_data:
- * @video: the media instance
- * @url: a video's url
- * @mime: video mime-type
- * @framerate: video framerate, or -1 to ignore
- * @width: video width, or -1 to ignore
- * @height: video height, or -1 to ignore
- *
- * Sets all the keys related with the URL of a media resource and adds it to
- * @video (useful for resources with more than one URL).
- *
- * Since: 0.1.10
- **/
-void
-grl_media_video_add_url_data (GrlMediaVideo *video,
- const gchar *url,
- const gchar *mime,
- gfloat framerate,
- gint width,
- gint height)
-{
- GrlRelatedKeys *relkeys;
-
- g_return_if_fail (GRL_IS_MEDIA_VIDEO (video));
-
- relkeys = grl_related_keys_new ();
- grl_related_keys_set_string (relkeys, GRL_METADATA_KEY_URL, url);
- grl_related_keys_set_string (relkeys, GRL_METADATA_KEY_MIME, mime);
- if (framerate >= 0) {
- grl_related_keys_set_float (relkeys, GRL_METADATA_KEY_FRAMERATE, framerate);
- }
- if (width >= 0) {
- grl_related_keys_set_int (relkeys, GRL_METADATA_KEY_WIDTH, width);
- }
- if (height >= 0) {
- grl_related_keys_set_int (relkeys, GRL_METADATA_KEY_HEIGHT, height);
- }
- grl_data_add_related_keys (GRL_DATA (video), relkeys);
-}
-
-/**
- * grl_media_video_get_url_data:
- * @video: the media instance
- * @mime: (out) (transfer none): the url mime-type, or %NULL to ignore
- * @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: all the keys related with the URL of a video resource in one go.
- *
- * Since: 0.1.10
- **/
-const gchar *
-grl_media_video_get_url_data (GrlMediaVideo *video,
- gchar **mime,
- gfloat *framerate,
- gint *width,
- gint *height)
-{
- return grl_media_video_get_url_data_nth (video,
- 0,
- mime,
- framerate,
- width,
- height);
-}
-
-/**
- * grl_media_video_get_url_data_nth:
- * @video: the media instance
- * @index: element to retrieve
- * @mime: (out) (transfer none): the url mime-type, or %NULL to ignore
- * @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: all the keys related with the URL number @index of a video resource
- * in one go.
- *
- * Since: 0.1.10
- **/
-const gchar *
-grl_media_video_get_url_data_nth (GrlMediaVideo *video,
- guint index,
- gchar **mime,
- gfloat *framerate,
- gint *width,
- gint *height)
-{
- GrlRelatedKeys *relkeys;
-
- g_return_val_if_fail (GRL_IS_MEDIA_VIDEO (video), NULL);
-
- relkeys =
- grl_data_get_related_keys (GRL_DATA (video), GRL_METADATA_KEY_URL, index);
-
- if (!relkeys) {
- return NULL;
- }
-
- if (mime) {
- *mime = (gchar *) grl_related_keys_get_string (relkeys,
- GRL_METADATA_KEY_MIME);
- }
-
- if (framerate) {
- *framerate = grl_related_keys_get_float (relkeys,
- GRL_METADATA_KEY_FRAMERATE);
- }
-
- if (width) {
- *width = grl_related_keys_get_int (relkeys, GRL_METADATA_KEY_WIDTH);
- }
-
- if (height) {
- *height = grl_related_keys_get_int (relkeys, GRL_METADATA_KEY_HEIGHT);
- }
-
- return grl_related_keys_get_string (relkeys, GRL_METADATA_KEY_URL);
-}
-
-/**
- * grl_media_video_set_performer:
- * @video: a #GrlMediaVideo
- * @performer: an actor performing in the movie
- *
- * Sets the actor performing in the movie.
- *
- * Since: 0.2.3
- */
-void
-grl_media_video_set_performer (GrlMediaVideo *video,
- const gchar *performer)
-{
- grl_data_set_string (GRL_DATA (video),
- GRL_METADATA_KEY_PERFORMER,
- performer);
-}
-
-/**
- * grl_media_video_add_performer:
- * @video: a #GrlMediaVideo
- * @performer: an actor performing in the movie
- *
- * Adds the actor performing in the movie.
- *
- * Since: 0.2.3
- */
-void
-grl_media_video_add_performer (GrlMediaVideo *video,
- const gchar *performer)
-{
- grl_data_add_string (GRL_DATA (video),
- GRL_METADATA_KEY_PERFORMER,
- performer);
-}
-
-/**
- * grl_media_video_get_performer:
- * @video: a #GrlMediaVideo
- *
- * Returns: (transfer none): the actor performing in the movie (owned by @video).
- *
- * Since: 0.2.3
- */
-const gchar *
-grl_media_video_get_performer (GrlMediaVideo *video)
-{
- return grl_data_get_string (GRL_DATA (video),
- GRL_METADATA_KEY_PERFORMER);
-}
-
-/**
- * grl_media_video_get_performer_nth:
- * @video: a #GrlMediaVideo
- * @index: element to retrieve
- *
- * Returns: (transfer none): the actor performing in the movie (owned by @video).
- *
- * Since: 0.2.3
- */
-const gchar *
-grl_media_video_get_performer_nth (GrlMediaVideo *video,
- guint index)
-{
- GrlRelatedKeys *relkeys;
-
- g_return_val_if_fail (GRL_IS_MEDIA_VIDEO (video), NULL);
-
- relkeys =
- grl_data_get_related_keys (GRL_DATA (video),
- GRL_METADATA_KEY_PERFORMER,
- index);
-
- if (!relkeys) {
- return NULL;
- }
-
- return grl_related_keys_get_string (relkeys,
- GRL_METADATA_KEY_PERFORMER);
-}
-
-/**
- * grl_media_video_set_producer:
- * @video: a #GrlMediaVideo
- * @producer: producer of the movie
- *
- * Sets the producer of the movie.
- *
- * Since: 0.2.3
- */
-void
-grl_media_video_set_producer (GrlMediaVideo *video,
- const gchar *producer)
-{
- grl_data_set_string (GRL_DATA (video),
- GRL_METADATA_KEY_PRODUCER,
- producer);
-}
-
-/**
- * grl_media_video_add_producer:
- * @video: a #GrlMediaVideo
- * @producer: producer of the movie
- *
- * Adds the producer of the movie.
- *
- * Since: 0.2.3
- */
-void
-grl_media_video_add_producer (GrlMediaVideo *video,
- const gchar *producer)
-{
- grl_data_add_string (GRL_DATA (video),
- GRL_METADATA_KEY_PRODUCER,
- producer);
-}
-
-/**
- * grl_media_video_get_producer:
- * @video: a #GrlMediaVideo
- *
- * Returns: (transfer none): the producer of the movie (owned by @video).
- *
- * Since: 0.2.3
- */
-const gchar *
-grl_media_video_get_producer (GrlMediaVideo *video)
-{
- return grl_data_get_string (GRL_DATA (video),
- GRL_METADATA_KEY_PRODUCER);
-}
-
-/**
- * grl_media_video_get_producer_nth:
- * @video: a #GrlMediaVideo
- * @index: element to retrieve
- *
- * Returns: (transfer none): the producer of the movie (owned by @video).
- *
- * Since: 0.2.3
- */
-const gchar *
-grl_media_video_get_producer_nth (GrlMediaVideo *video,
- guint index)
-{
- GrlRelatedKeys *relkeys;
-
- g_return_val_if_fail (GRL_IS_MEDIA_VIDEO (video), NULL);
-
- relkeys =
- grl_data_get_related_keys (GRL_DATA (video),
- GRL_METADATA_KEY_PRODUCER,
- index);
-
- if (!relkeys) {
- return NULL;
- }
-
- return grl_related_keys_get_string (relkeys,
- GRL_METADATA_KEY_PRODUCER);
-}
-
-/**
- * grl_media_video_set_director:
- * @video: a #GrlMediaVideo
- * @director: director of the movie
- *
- * Sets the director of the movie.
- *
- * Since: 0.2.3
- */
-void
-grl_media_video_set_director (GrlMediaVideo *video,
- const gchar *director)
-{
- grl_data_set_string (GRL_DATA (video),
- GRL_METADATA_KEY_DIRECTOR,
- director);
-}
-
-/**
- * grl_media_video_add_director:
- * @video: a #GrlMediaVideo
- * @director: director of the movie
- *
- * Adds the director of the movie.
- *
- * Since: 0.2.3
- */
-void
-grl_media_video_add_director (GrlMediaVideo *video,
- const gchar *director)
-{
- grl_data_add_string (GRL_DATA (video),
- GRL_METADATA_KEY_DIRECTOR,
- director);
-}
-
-/**
- * grl_media_video_get_director:
- * @video: a #GrlMediaVideo
- *
- * Returns: (transfer none): the director of the movie (owned by @video).
- *
- * Since: 0.2.3
- */
-const gchar *
-grl_media_video_get_director (GrlMediaVideo *video)
-{
- return grl_data_get_string (GRL_DATA (video),
- GRL_METADATA_KEY_DIRECTOR);
-}
-
-/**
- * grl_media_video_get_director_nth:
- * @video: a #GrlMediaVideo
- * @index: element to retrieve
- *
- * Returns: (transfer none): the director of the movie (owned by @video).
- *
- * Since: 0.2.3
- */
-const gchar *
-grl_media_video_get_director_nth (GrlMediaVideo *video,
- guint index)
-{
- GrlRelatedKeys *relkeys;
-
- g_return_val_if_fail (GRL_IS_MEDIA_VIDEO (video), NULL);
-
- relkeys =
- grl_data_get_related_keys (GRL_DATA (video),
- GRL_METADATA_KEY_DIRECTOR,
- index);
-
- if (!relkeys) {
- return NULL;
- }
-
- return grl_related_keys_get_string (relkeys,
- GRL_METADATA_KEY_DIRECTOR);
-}
-
-/**
- * grl_media_video_set_original_title:
- * @video: a #GrlMediaVideo
- * @original_title: original, untranslated title of the movie
- *
- * Sets the original, untranslated title of the movie.
- *
- * Since: 0.2.3
- */
-void
-grl_media_video_set_original_title (GrlMediaVideo *video,
- const gchar *original_title)
-{
- grl_data_set_string (GRL_DATA (video),
- GRL_METADATA_KEY_ORIGINAL_TITLE,
- original_title);
-}
-
-/**
- * grl_media_video_get_original_title:
- * @video: a #GrlMediaVideo
- *
- * Returns: (transfer none): the original, untranslated title of the movie (owned by @video).
- *
- * Since: 0.2.3
- */
-const gchar *
-grl_media_video_get_original_title (GrlMediaVideo *video)
-{
- return grl_data_get_string (GRL_DATA (video),
- GRL_METADATA_KEY_ORIGINAL_TITLE);
-}
diff --git a/src/data/grl-media-video.h b/src/data/grl-media-video.h
deleted file mode 100644
index a486fdb..0000000
--- a/src/data/grl-media-video.h
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Copyright (C) 2010, 2011 Igalia S.L.
- *
- * Contact: Iago Toral Quiroga <itoral@igalia.com>
- *
- * Authors: Juan A. Suarez Romero <jasuarez@igalia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#if !defined (_GRILO_H_INSIDE_) && !defined (GRILO_COMPILATION)
-#error "Only <grilo.h> can be included directly."
-#endif
-
-#ifndef _GRL_MEDIA_VIDEO_H_
-#define _GRL_MEDIA_VIDEO_H_
-
-#include <grl-media.h>
-#include <grl-definitions.h>
-
-G_BEGIN_DECLS
-
-#define GRL_TYPE_MEDIA_VIDEO \
- (grl_media_video_get_type())
-
-#define GRL_MEDIA_VIDEO(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- GRL_TYPE_MEDIA_VIDEO, \
- GrlMediaVideo))
-
-#define GRL_MEDIA_VIDEO_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- GRL_TYPE_MEDIA_VIDEO, \
- GrlMediaVideoClass))
-
-#define GRL_IS_MEDIA_VIDEO(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- GRL_TYPE_MEDIA_VIDEO))
-
-#define GRL_IS_MEDIA_VIDEO_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- GRL_TYPE_MEDIA_VIDEO))
-
-#define GRL_MEDIA_VIDEO_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- GRL_TYPE_MEDIA_VIDEO, \
- GrlMediaVideoClass))
-
-typedef struct _GrlMediaVideo GrlMediaVideo;
-typedef struct _GrlMediaVideoClass GrlMediaVideoClass;
-
-struct _GrlMediaVideo
-{
- GrlMedia parent;
-
- /*< private >*/
- gpointer _grl_reserved[GRL_PADDING_SMALL];
-};
-
-/**
- * GrlMediaVideoClass:
- * @parent_class: the parent class structure
- *
- * Grilo Media video Class
- */
-struct _GrlMediaVideoClass
-{
- GrlMediaClass parent_class;
-
- /*< private >*/
- gpointer _grl_reserved[GRL_PADDING];
-};
-
-void grl_media_video_set_width (GrlMediaVideo *video, gint width);
-
-void grl_media_video_set_height (GrlMediaVideo *video, gint height);
-
-void grl_media_video_set_framerate (GrlMediaVideo *video, gfloat framerate);
-
-void grl_media_video_set_season (GrlMediaVideo *video, gint season);
-
-void grl_media_video_set_episode (GrlMediaVideo *video, gint episode);
-
-void grl_media_video_set_episode_title (GrlMediaVideo *video, const gchar *episode_title);
-
-void grl_media_video_set_show (GrlMediaVideo *video, const gchar *show);
-
-gint grl_media_video_get_width (GrlMediaVideo *video);
-
-gint grl_media_video_get_height (GrlMediaVideo *video);
-
-gfloat grl_media_video_get_framerate (GrlMediaVideo *video);
-
-gint grl_media_video_get_season (GrlMediaVideo *video);
-
-gint grl_media_video_get_episode (GrlMediaVideo *video);
-
-const gchar *grl_media_video_get_episode_title (GrlMediaVideo *video);
-
-const gchar *grl_media_video_get_show (GrlMediaVideo *video);
-
-GType grl_media_video_get_type (void) G_GNUC_CONST;
-
-GrlMedia *grl_media_video_new (void);
-
-void grl_media_video_set_size (GrlMediaVideo *video,
- gint width,
- gint height);
-
-void grl_media_video_set_url_data (GrlMediaVideo *video,
- const gchar *url,
- const gchar *mime,
- gfloat framerate,
- gint width,
- gint height);
-
-void grl_media_video_add_url_data (GrlMediaVideo *video,
- const gchar *url,
- const gchar *mime,
- gfloat framerate,
- gint width,
- gint height);
-
-const gchar *grl_media_video_get_url_data (GrlMediaVideo *video,
- gchar **mime,
- gfloat *framerate,
- gint *width,
- gint *height);
-
-const gchar *grl_media_video_get_url_data_nth (GrlMediaVideo *video,
- guint index,
- gchar **mime,
- gfloat *framerate,
- gint *width,
- gint *height);
-
-void grl_media_video_set_performer (GrlMediaVideo *video,
- const gchar *performer);
-
-void grl_media_video_add_performer (GrlMediaVideo *video,
- const gchar *performer);
-
-const gchar * grl_media_video_get_performer (GrlMediaVideo *video);
-
-const gchar * grl_media_video_get_performer_nth (GrlMediaVideo *video,
- guint index);
-
-void grl_media_video_set_producer (GrlMediaVideo *video,
- const gchar *producer);
-
-void grl_media_video_add_producer (GrlMediaVideo *video,
- const gchar *producer);
-
-const gchar * grl_media_video_get_producer (GrlMediaVideo *video);
-
-const gchar * grl_media_video_get_producer_nth (GrlMediaVideo *video,
- guint index);
-
-void grl_media_video_set_director (GrlMediaVideo *video,
- const gchar *director);
-
-void grl_media_video_add_director (GrlMediaVideo *video,
- const gchar *director);
-
-const gchar * grl_media_video_get_director (GrlMediaVideo *video);
-
-const gchar * grl_media_video_get_director_nth (GrlMediaVideo *video,
- guint index);
-
-void grl_media_video_set_original_title (GrlMediaVideo *video,
- const gchar *original_title);
-
-const gchar * grl_media_video_get_original_title (GrlMediaVideo *video);
-
-G_END_DECLS
-
-#endif /* _GRL_MEDIA_VIDEO_H_ */
diff --git a/src/data/grl-media.c b/src/data/grl-media.c
index 51dfc85..782cffb 100644
--- a/src/data/grl-media.c
+++ b/src/data/grl-media.c
@@ -175,6 +175,24 @@ grl_media_audio_new (void)
NULL);
}
+/**
+ * grl_media_video_new:
+ *
+ * Creates a new media video object.
+ *
+ * Returns: a newly-allocated media video.
+ *
+ * Since: 0.1.4
+ */
+GrlMedia *
+grl_media_video_new (void)
+{
+ return g_object_new (GRL_TYPE_MEDIA,
+ "media-type", GRL_MEDIA_TYPE_VIDEO,
+ NULL);
+}
+
+
gboolean
grl_media_is_audio (GrlMedia *media)
{
@@ -183,6 +201,14 @@ grl_media_is_audio (GrlMedia *media)
return (media->priv->media_type == GRL_MEDIA_TYPE_AUDIO);
}
+gboolean
+grl_media_is_video (GrlMedia *media)
+{
+ g_return_val_if_fail (GRL_IS_MEDIA (media), FALSE);
+
+ return (media->priv->media_type == GRL_MEDIA_TYPE_VIDEO);
+}
+
/**
* grl_media_set_rating:
* @media: a media
@@ -213,14 +239,20 @@ grl_media_set_rating (GrlMedia *media, gfloat rating, gfloat max)
* @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
*
- * Set the media's URL and its mime-type and bitrate.
+ * Sets all the keys related with the URL of a media resource in one go.
**/
void
grl_media_set_url_data (GrlMedia *media,
const gchar *url,
const gchar *mime,
- gint bitrate)
+ gint bitrate,
+ gfloat framerate,
+ gint width,
+ gint height)
{
GrlRelatedKeys *relkeys;
@@ -232,6 +264,15 @@ grl_media_set_url_data (GrlMedia *media,
if (bitrate >= 0) {
grl_related_keys_set_int (relkeys, GRL_METADATA_KEY_BITRATE, bitrate);
}
+ if (framerate >= 0) {
+ grl_related_keys_set_float (relkeys, GRL_METADATA_KEY_FRAMERATE, framerate);
+ }
+ if (width >= 0) {
+ grl_related_keys_set_int (relkeys, GRL_METADATA_KEY_WIDTH, width);
+ }
+ if (height >= 0) {
+ grl_related_keys_set_int (relkeys, GRL_METADATA_KEY_HEIGHT, height);
+ }
grl_data_set_related_keys (GRL_DATA (media), relkeys, 0);
}
@@ -241,14 +282,21 @@ grl_media_set_url_data (GrlMedia *media,
* @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
*
- * Adds a new media's URL with its mime-type and bitrate.
+ * 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).
**/
void
grl_media_add_url_data (GrlMedia *media,
const gchar *url,
const gchar *mime,
- gint bitrate)
+ gint bitrate,
+ gfloat framerate,
+ gint width,
+ gint height)
{
GrlRelatedKeys *relkeys;
@@ -260,6 +308,15 @@ grl_media_add_url_data (GrlMedia *media,
if (bitrate >= 0) {
grl_related_keys_set_int (relkeys, GRL_METADATA_KEY_BITRATE, bitrate);
}
+ if (framerate >= 0) {
+ grl_related_keys_set_float (relkeys, GRL_METADATA_KEY_FRAMERATE, framerate);
+ }
+ if (width >= 0) {
+ grl_related_keys_set_int (relkeys, GRL_METADATA_KEY_WIDTH, width);
+ }
+ if (height >= 0) {
+ grl_related_keys_set_int (relkeys, GRL_METADATA_KEY_HEIGHT, height);
+ }
grl_data_add_related_keys (GRL_DATA (media), relkeys);
}
@@ -438,6 +495,57 @@ grl_media_add_mb_artist_id (GrlMedia *media,
}
/**
+ * grl_media_add_performer:
+ * @media: a #GrlMedia
+ * @performer: an actor performing in the movie
+ *
+ * Adds the actor performing in the movie.
+ */
+void
+grl_media_add_performer (GrlMedia *media,
+ const gchar *performer)
+{
+ g_return_if_fail (GRL_IS_MEDIA (media));
+ grl_data_add_string (GRL_DATA (media),
+ GRL_METADATA_KEY_PERFORMER,
+ performer);
+}
+
+/**
+ * grl_media_add_producer:
+ * @media: a #GrlMedia
+ * @producer: producer of the movie
+ *
+ * Adds the producer of the media.
+ */
+void
+grl_media_add_producer (GrlMedia *media,
+ const gchar *producer)
+{
+ g_return_if_fail (GRL_IS_MEDIA (media));
+ grl_data_add_string (GRL_DATA (media),
+ GRL_METADATA_KEY_PRODUCER,
+ producer);
+}
+
+/**
+ * grl_media_add_director:
+ * @media: a #GrlMedia
+ * @director: director of the movie
+ *
+ * Adds the director of the media
+ */
+void
+grl_media_add_director (GrlMedia *media,
+ const gchar *director)
+{
+ g_return_if_fail (GRL_IS_MEDIA (media));
+ grl_data_add_string (GRL_DATA (media),
+ GRL_METADATA_KEY_DIRECTOR,
+ director);
+}
+
+/**
* grl_media_serialize:
* @media: a #GrlMedia
*
@@ -1540,6 +1648,187 @@ grl_media_set_artist (GrlMedia *media, const gchar *artist)
}
/**
+ * grl_media_set_width:
+ * @media: the media instance
+ * @width: the video's width
+ *
+ * Set the width of the media
+ */
+void
+grl_media_set_width (GrlMedia *media, gint width)
+{
+ g_return_if_fail (GRL_IS_MEDIA (media));
+ grl_data_set_int (GRL_DATA (media),
+ GRL_METADATA_KEY_WIDTH,
+ width);
+}
+
+/**
+ * grl_media_set_height:
+ * @media: the media instance
+ * @height: the video's height
+ *
+ * Set the height of the media
+ */
+void
+grl_media_set_height (GrlMedia *media, gint height)
+{
+ g_return_if_fail (GRL_IS_MEDIA (media));
+ grl_data_set_int (GRL_DATA (media),
+ GRL_METADATA_KEY_HEIGHT,
+ height);
+}
+
+/**
+ * grl_media_set_framerate:
+ * @media: the media instance
+ * @framerate: the video's framerate
+ *
+ * Set the framerate of the media
+ */
+void
+grl_media_set_framerate (GrlMedia *media, gfloat framerate)
+{
+ g_return_if_fail (GRL_IS_MEDIA (media));
+ grl_data_set_float (GRL_DATA (media),
+ GRL_METADATA_KEY_FRAMERATE,
+ framerate);
+}
+
+/**
+ * grl_media_set_season:
+ * @media: the media instance
+ * @season: the video's season
+ *
+ * Sets the season number of the media
+ */
+void
+grl_media_set_season (GrlMedia *media, gint season)
+{
+ g_return_if_fail (GRL_IS_MEDIA (media));
+ grl_data_set_int (GRL_DATA (media),
+ GRL_METADATA_KEY_SEASON,
+ season);
+}
+
+/**
+ * grl_media_set_episode:
+ * @media: the media instance
+ * @episode: the video's episode
+ *
+ * Sets the episode number of the media
+ */
+void
+grl_media_set_episode (GrlMedia *media, gint episode)
+{
+ g_return_if_fail (GRL_IS_MEDIA (media));
+ grl_data_set_int (GRL_DATA (media),
+ GRL_METADATA_KEY_EPISODE,
+ episode);
+}
+
+/**
+ * grl_media_set_episode_title:
+ * @media: the media instance
+ * @episode_title: the title of the episode
+ *
+ * Sets the title of an media
+ */
+void
+grl_media_set_episode_title (GrlMedia *media,
+ const gchar *episode_title)
+{
+ g_return_if_fail (GRL_IS_MEDIA (media));
+
+ grl_data_set_string (GRL_DATA (media),
+ GRL_METADATA_KEY_EPISODE_TITLE,
+ episode_title);
+}
+
+/**
+ * grl_media_set_show:
+ * @media: the media instance
+ * @show: the video's show name
+ *
+ * Sets the show title of the media
+ */
+void
+grl_media_set_show (GrlMedia *media, const gchar *show)
+{
+ g_return_if_fail (GRL_IS_MEDIA (media));
+ grl_data_set_string (GRL_DATA (media),
+ GRL_METADATA_KEY_SHOW,
+ show);
+}
+
+/**
+ * grl_media_set_performer:
+ * @media: a #GrlMedia
+ * @performer: an actor performing in the movie
+ *
+ * Sets the actor performing in the movie.
+ */
+void
+grl_media_set_performer (GrlMedia *media,
+ const gchar *performer)
+{
+ g_return_if_fail (GRL_IS_MEDIA (media));
+ grl_data_set_string (GRL_DATA (media),
+ GRL_METADATA_KEY_PERFORMER,
+ performer);
+}
+
+/**
+ * grl_media_set_producer:
+ * @media: a #GrlMedia
+ * @producer: producer of the movie
+ *
+ * Sets the producer of the media.
+ */
+void
+grl_media_set_producer (GrlMedia *media, const gchar *producer)
+{
+ g_return_if_fail (GRL_IS_MEDIA (media));
+ grl_data_set_string (GRL_DATA (media),
+ GRL_METADATA_KEY_PRODUCER,
+ producer);
+}
+
+/**
+ * grl_media_set_director:
+ * @media: a #GrlMedia
+ * @director: director of the movie
+ *
+ * Sets the director of the media.
+ */
+void
+grl_media_set_director (GrlMedia *media,
+ const gchar *director)
+{
+ g_return_if_fail (GRL_IS_MEDIA (media));
+ grl_data_set_string (GRL_DATA (media),
+ GRL_METADATA_KEY_DIRECTOR,
+ director);
+}
+
+/**
+ * grl_media_set_original_title:
+ * @media: a #GrlMedia
+ * @original_title: original, untranslated title of the movie
+ *
+ * Sets the original, untranslated title of the media.
+ */
+void
+grl_media_set_original_title (GrlMedia *media,
+ const gchar *original_title)
+{
+ g_return_if_fail (GRL_IS_MEDIA (media));
+ grl_data_set_string (GRL_DATA (media),
+ GRL_METADATA_KEY_ORIGINAL_TITLE,
+ original_title);
+}
+
+/**
* grl_media_get_id:
* @media: the media object
*
@@ -1576,19 +1865,30 @@ grl_media_get_url (GrlMedia *media)
* @media: the media object
* @mime: (out) (transfer none): the mime-type, or %NULL to ignore.
* @bitrate: (out): the url bitrate, or %NULL to ignore
+ * @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 mime-type.
- *
- * Since: 0.1.10
+ * Returns: the media's URL and its related properties.
*/
const gchar *
grl_media_get_url_data (GrlMedia *media,
gchar **mime,
- gint *bitrate)
+ gint *bitrate,
+ gfloat *framerate,
+ gint *width,
+ gint *height)
+
{
g_return_val_if_fail (GRL_IS_MEDIA (media), NULL);
- return grl_media_get_url_data_nth (media, 0, mime, bitrate);
+ return grl_media_get_url_data_nth (media,
+ 0,
+ mime,
+ bitrate,
+ framerate,
+ width,
+ height);
}
/**
@@ -1597,16 +1897,20 @@ grl_media_get_url_data (GrlMedia *media,
* @index: element to retrieve
* @mime: (out) (transfer none): the mime-type, or %NULL to ignore.
* @bitrate: (out): the url bitrate, or %NULL to ignore
- *
- * Returns: the n-th media's URL and its mime-type.
- *
- * Since: 0.1.10
+ * @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.
*/
const gchar *
grl_media_get_url_data_nth (GrlMedia *media,
guint index,
gchar **mime,
- gint *bitrate)
+ gint *bitrate,
+ gfloat *framerate,
+ gint *width,
+ gint *height)
{
GrlRelatedKeys *relkeys;
@@ -1619,14 +1923,25 @@ grl_media_get_url_data_nth (GrlMedia *media,
}
if (mime) {
- *mime = (gchar *) grl_related_keys_get_string (relkeys,
- GRL_METADATA_KEY_MIME);
+ *mime = (gchar *) grl_related_keys_get_string (relkeys, GRL_METADATA_KEY_MIME);
}
if (bitrate) {
*bitrate = grl_related_keys_get_int (relkeys, GRL_METADATA_KEY_BITRATE);
}
+ if (framerate) {
+ *framerate = grl_related_keys_get_float (relkeys, GRL_METADATA_KEY_FRAMERATE);
+ }
+
+ if (width) {
+ *width = grl_related_keys_get_int (relkeys, GRL_METADATA_KEY_WIDTH);
+ }
+
+ if (height) {
+ *height = grl_related_keys_get_int (relkeys, GRL_METADATA_KEY_HEIGHT);
+ }
+
return grl_related_keys_get_string (relkeys, GRL_METADATA_KEY_URL);
}
@@ -2335,7 +2650,7 @@ grl_media_get_size (GrlMedia *media)
gint
grl_media_get_track_number (GrlMedia *media)
{
- g_return_val_if_fail (GRL_IS_MEDIA (media), -1);
+ g_return_val_if_fail (GRL_IS_MEDIA (media), 0);
return grl_data_get_int (GRL_DATA (media), GRL_METADATA_KEY_TRACK_NUMBER);
}
@@ -2348,7 +2663,7 @@ grl_media_get_track_number (GrlMedia *media)
gint
grl_media_get_bitrate (GrlMedia *media)
{
- g_return_val_if_fail (GRL_IS_MEDIA (media), -1);
+ g_return_val_if_fail (GRL_IS_MEDIA (media), 0);
return grl_data_get_int (GRL_DATA (media), GRL_METADATA_KEY_BITRATE);
}
@@ -2566,3 +2881,236 @@ grl_media_get_media_type (GrlMedia *media)
return media->priv->media_type;
}
+
+/**
+ * grl_media_get_width:
+ * @media: the media instance
+ *
+ * Returns: the width of the media
+ */
+gint
+grl_media_get_width (GrlMedia *media)
+{
+ g_return_val_if_fail (GRL_MEDIA (media), 0);
+ return grl_data_get_int (GRL_DATA (media), GRL_METADATA_KEY_WIDTH);
+}
+
+/**
+ * grl_media_get_height:
+ * @media: the media instance
+ *
+ * Returns: the height of the media
+ */
+gint
+grl_media_get_height (GrlMedia *media)
+{
+ g_return_val_if_fail (GRL_MEDIA (media), 0);
+ return grl_data_get_int (GRL_DATA (media), GRL_METADATA_KEY_HEIGHT);
+}
+
+/**
+ * grl_media_get_framerate:
+ * @media: the media instance
+ *
+ * Returns: the framerate of the media
+ */
+gfloat
+grl_media_get_framerate (GrlMedia *media)
+{
+ g_return_val_if_fail (GRL_MEDIA (media), 0);
+ return grl_data_get_float (GRL_DATA (media), GRL_METADATA_KEY_FRAMERATE);
+}
+
+/**
+ * grl_media_get_season:
+ * @media: the media instance
+ *
+ * Returns: the season number of the media
+ */
+gint
+grl_media_get_season (GrlMedia *media)
+{
+ g_return_val_if_fail (GRL_MEDIA (media), 0);
+ return grl_data_get_int (GRL_DATA (media), GRL_METADATA_KEY_SEASON);
+}
+
+/**
+ * grl_media_get_episode:
+ * @media: the media instance
+ *
+ * Returns: the episode number of the media
+ */
+gint
+grl_media_get_episode (GrlMedia *media)
+{
+ g_return_val_if_fail (GRL_MEDIA (media), 0);
+ return grl_data_get_int (GRL_DATA (media), GRL_METADATA_KEY_EPISODE);
+}
+
+/**
+ * grl_media_get_episode_title:
+ * @media: the media instance
+ *
+ * Returns: the title of the episode
+ */
+const gchar *
+grl_media_get_episode_title (GrlMedia *media)
+{
+ g_return_val_if_fail (GRL_IS_MEDIA (media), NULL);
+
+ return grl_data_get_string (GRL_DATA (media), GRL_METADATA_KEY_EPISODE_TITLE);
+}
+
+/**
+ * grl_media_get_show:
+ * @media: the media instance
+ *
+ * Returns: the show title of the media
+ */
+const gchar *
+grl_media_get_show (GrlMedia *media)
+{
+ g_return_val_if_fail (GRL_IS_MEDIA (media), NULL);
+
+ return grl_data_get_string (GRL_DATA (media), GRL_METADATA_KEY_SHOW);
+}
+
+/**
+ * grl_media_get_performer:
+ * @media: a #GrlMedia
+ *
+ * Returns: (transfer none): the actor performing in the movie (owned by @media).
+ */
+const gchar *
+grl_media_get_performer (GrlMedia *media)
+{
+ g_return_val_if_fail (GRL_IS_MEDIA (media), NULL);
+ return grl_data_get_string (GRL_DATA (media),
+ GRL_METADATA_KEY_PERFORMER);
+}
+
+/**
+ * grl_media_get_performer_nth:
+ * @media: a #GrlMedia
+ * @index: element to retrieve
+ *
+ * Returns: (transfer none): the actor performing in the movie (owned by @medi).
+ */
+const gchar *
+grl_media_get_performer_nth (GrlMedia *media,
+ guint index)
+{
+ GrlRelatedKeys *relkeys;
+
+ g_return_val_if_fail (GRL_IS_MEDIA (media), NULL);
+
+ relkeys =
+ grl_data_get_related_keys (GRL_DATA (media),
+ GRL_METADATA_KEY_PERFORMER,
+ index);
+
+ if (!relkeys) {
+ return NULL;
+ }
+
+ return grl_related_keys_get_string (relkeys,
+ GRL_METADATA_KEY_PERFORMER);
+}
+
+/**
+ * grl_media_get_producer:
+ * @media: a #GrlMedia
+ *
+ * Returns: (transfer none): the producer of the movie (owned by @media).
+ */
+const gchar *
+grl_media_get_producer (GrlMedia *media)
+{
+ g_return_val_if_fail (GRL_IS_MEDIA (media), NULL);
+ return grl_data_get_string (GRL_DATA (media),
+ GRL_METADATA_KEY_PRODUCER);
+}
+
+/**
+ * grl_media_get_producer_nth:
+ * @media: a #GrlMedia
+ * @index: element to retrieve
+ *
+ * Returns: (transfer none): the producer of the movie (owned by @media).
+ */
+const gchar *
+grl_media_get_producer_nth (GrlMedia *media,
+ guint index)
+{
+ GrlRelatedKeys *relkeys;
+
+ g_return_val_if_fail (GRL_IS_MEDIA (media), NULL);
+
+ relkeys =
+ grl_data_get_related_keys (GRL_DATA (media),
+ GRL_METADATA_KEY_PRODUCER,
+ index);
+
+ if (!relkeys) {
+ return NULL;
+ }
+
+ return grl_related_keys_get_string (relkeys,
+ GRL_METADATA_KEY_PRODUCER);
+}
+
+/**
+ * grl_media_get_director:
+ * @media: a #GrlMedia
+ *
+ * Returns: (transfer none): the director of the movie (owned by @media).
+ */
+const gchar *
+grl_media_get_director (GrlMedia *media)
+{
+ g_return_val_if_fail (GRL_IS_MEDIA (media), NULL);
+ return grl_data_get_string (GRL_DATA (media),
+ GRL_METADATA_KEY_DIRECTOR);
+}
+
+/**
+ * grl_media_get_director_nth:
+ * @media: a #GrlMedia
+ * @index: element to retrieve
+ *
+ * Returns: (transfer none): the director of the movie (owned by @media).
+ */
+const gchar *
+grl_media_get_director_nth (GrlMedia *media,
+ guint index)
+{
+ GrlRelatedKeys *relkeys;
+
+ g_return_val_if_fail (GRL_IS_MEDIA (media), NULL);
+
+ relkeys =
+ grl_data_get_related_keys (GRL_DATA (media),
+ GRL_METADATA_KEY_DIRECTOR,
+ index);
+
+ if (!relkeys) {
+ return NULL;
+ }
+
+ return grl_related_keys_get_string (relkeys,
+ GRL_METADATA_KEY_DIRECTOR);
+}
+
+/**
+ * grl_media_get_original_title:
+ * @media: a #GrlMedia
+ *
+ * Returns: (transfer none): the original, untranslated title of the movie (owned by @media).
+ */
+const gchar *
+grl_media_get_original_title (GrlMedia *media)
+{
+ g_return_val_if_fail (GRL_IS_MEDIA (media), NULL);
+ return grl_data_get_string (GRL_DATA (media),
+ GRL_METADATA_KEY_ORIGINAL_TITLE);
+}
diff --git a/src/data/grl-media.h b/src/data/grl-media.h
index af1d311..87609e4 100644
--- a/src/data/grl-media.h
+++ b/src/data/grl-media.h
@@ -165,7 +165,7 @@ void grl_media_set_license (GrlMedia *media, const gchar *license);
void grl_media_set_rating (GrlMedia *media, gfloat rating, gfloat max);
-void grl_media_set_url_data (GrlMedia *media, const gchar *url, const gchar *mime, gint bitrate);
+void grl_media_set_url_data (GrlMedia *media, const gchar *url, const gchar *mime, gint bitrate, gfloat framerate, gint width, gint height);
void grl_media_set_favourite (GrlMedia *media, gboolean favourite);
@@ -193,7 +193,29 @@ void grl_media_set_album (GrlMedia *media, const gchar *album);
void grl_media_set_artist (GrlMedia *media, const gchar *artist);
-void grl_media_add_url_data (GrlMedia *media, const gchar *url, const gchar *mime, gint bitrate);
+void grl_media_set_width (GrlMedia *media, gint width);
+
+void grl_media_set_height (GrlMedia *media, gint height);
+
+void grl_media_set_framerate (GrlMedia *media, gfloat framerate);
+
+void grl_media_set_season (GrlMedia *media, gint season);
+
+void grl_media_set_episode (GrlMedia *media, gint episode);
+
+void grl_media_set_episode_title (GrlMedia *media, const gchar *episode_title);
+
+void grl_media_set_show (GrlMedia *media, const gchar *show);
+
+void grl_media_set_performer (GrlMedia *media, const gchar *performer);
+
+void grl_media_set_producer (GrlMedia *media, const gchar *producer);
+
+void grl_media_set_director (GrlMedia *media, const gchar *director);
+
+void grl_media_set_original_title (GrlMedia *media, const gchar *original_title);
+
+void grl_media_add_url_data (GrlMedia *media, const gchar *url, const gchar *mime, gint bitrate, gfloat framerate, gint width, gint height);
void grl_media_add_author (GrlMedia *media, const gchar *author);
@@ -215,13 +237,19 @@ void grl_media_add_lyrics (GrlMedia *media, const gchar *lyrics);
void grl_media_add_mb_artist_id (GrlMedia *media, const gchar *mb_artist_id);
+void grl_media_add_performer (GrlMedia *media, const gchar *performer);
+
+void grl_media_add_producer (GrlMedia *media, const gchar *producer);
+
+void grl_media_add_director (GrlMedia *media, const gchar *director);
+
const gchar *grl_media_get_id (GrlMedia *media);
const gchar *grl_media_get_url (GrlMedia *media);
-const gchar *grl_media_get_url_data (GrlMedia *media, gchar **mime, gint *bitrate);
+const gchar *grl_media_get_url_data (GrlMedia *media, gchar **mime, gint *bitrate, gfloat *framerate, gint *width, gint *height);
-const gchar *grl_media_get_url_data_nth (GrlMedia *media, guint index, gchar **mime, gint *bitrate);
+const gchar *grl_media_get_url_data_nth (GrlMedia *media, guint index, gchar **mime, gint *bitrate, gfloat *framerate, gint *width, gint *height);
const gchar *grl_media_get_author (GrlMedia *media);
@@ -326,15 +354,48 @@ const gchar *grl_media_get_artist_nth (GrlMedia *media, guint index);
GrlMediaType grl_media_get_media_type (GrlMedia *media);
+gint grl_media_get_width (GrlMedia *media);
+
+gint grl_media_get_height (GrlMedia *media);
+
+gfloat grl_media_get_framerate (GrlMedia *media);
+
+gint grl_media_get_season (GrlMedia *media);
+
+gint grl_media_get_episode (GrlMedia *media);
+
+const gchar *grl_media_get_episode_title (GrlMedia *media);
+
+const gchar *grl_media_get_show (GrlMedia *media);
+
+const gchar *grl_media_get_performer (GrlMedia *media);
+
+const gchar *grl_media_get_performer_nth (GrlMedia *media, guint index);
+
+const gchar *grl_media_get_producer (GrlMedia *media);
+
+const gchar *grl_media_get_producer_nth (GrlMedia *media, guint index);
+
+const gchar *grl_media_get_director (GrlMedia *media);
+
+const gchar *grl_media_get_director_nth (GrlMedia *media, guint index);
+
+const gchar *grl_media_get_original_title (GrlMedia *media);
+
GType grl_media_get_type (void) G_GNUC_CONST;
GrlMedia *grl_media_new (void);
GrlMedia *grl_media_audio_new (void);
+GrlMedia *grl_media_video_new (void);
+
gboolean
grl_media_is_audio (GrlMedia *media);
+gboolean
+grl_media_is_video (GrlMedia *media);
+
gchar *grl_media_serialize (GrlMedia *media);
gchar *grl_media_serialize_extended (GrlMedia *media,
diff --git a/src/grilo.c b/src/grilo.c
index de2684d..e5a3db8 100644
--- a/src/grilo.c
+++ b/src/grilo.c
@@ -110,7 +110,6 @@ post_parse_hook_cb (GOptionContext *context,
/* Register GrlMedia in glib typesystem */
g_type_class_ref (GRL_TYPE_MEDIA_BOX);
- g_type_class_ref (GRL_TYPE_MEDIA_VIDEO);
g_type_class_ref (GRL_TYPE_MEDIA_IMAGE);
/* Set default plugin directories */
diff --git a/src/grilo.h b/src/grilo.h
index 9f93287..fc48869 100644
--- a/src/grilo.h
+++ b/src/grilo.h
@@ -34,7 +34,6 @@
#include <grl-metadata-key.h>
#include <grl-data.h>
#include <grl-media.h>
-#include <grl-media-video.h>
#include <grl-media-image.h>
#include <grl-media-box.h>
#include <grl-config.h>
diff --git a/tools/grilo-test-ui/main.c b/tools/grilo-test-ui/main.c
index 4b82ca4..ff93aef 100644
--- a/tools/grilo-test-ui/main.c
+++ b/tools/grilo-test-ui/main.c
@@ -343,7 +343,7 @@ get_icon_for_media (GrlMedia *media)
{
if (GRL_IS_MEDIA_BOX (media)) {
return g_themed_icon_new ("folder");
- } else if (GRL_IS_MEDIA_VIDEO (media)) {
+ } else if (grl_media_is_video (media)) {
return g_themed_icon_new ("gnome-mime-video");
} else if (grl_media_is_audio (media)) {
return g_themed_icon_new ("gnome-mime-audio");
@@ -617,7 +617,7 @@ resolve_cb (GrlSource *source,
/* Set/unset show button */
if ((grl_media_is_audio (media) ||
- GRL_IS_MEDIA_VIDEO (media) ||
+ grl_media_is_video (media) ||
GRL_IS_MEDIA_IMAGE (media)) &&
(ui_state->last_url = grl_media_get_url (media))) {
gtk_widget_set_sensitive (view->show_btn, TRUE);