[grilo/0.1.x] core: Add GRL_METADATA_KEY_START_TIME



commit b8f518c7db246fef52676c5656f1df396bb0a567
Author: Sam Thursfield <sam thursfield codethink co uk>
Date:   Tue Oct 25 17:36:57 2011 +0100

    core: Add GRL_METADATA_KEY_START_TIME
    
    This is used to specify the start offset of a logical resource inside
    a larger container, such as a track in a single-file rip of an entire CD.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=662748
    
    Signed-off-by: Juan A. Suarez Romero <jasuarez igalia com>

 doc/grilo/grilo-sections.txt |    2 ++
 src/data/grl-media.c         |   13 +++++++++++++
 src/data/grl-media.h         |    2 ++
 src/grl-metadata-key.c       |   15 +++++++++++++++
 src/grl-metadata-key.h       |    1 +
 5 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/doc/grilo/grilo-sections.txt b/doc/grilo/grilo-sections.txt
index a54c989..befd12d 100644
--- a/doc/grilo/grilo-sections.txt
+++ b/doc/grilo/grilo-sections.txt
@@ -338,6 +338,7 @@ grl_media_get_external_url_nth
 grl_media_get_studio
 grl_media_get_certificate
 grl_media_get_license
+grl_media_get_start_time
 grl_media_new
 grl_media_serialize
 grl_media_serialize_extended
@@ -567,6 +568,7 @@ GRL_METADATA_KEY_ORIENTATION
 GRL_METADATA_KEY_FLASH_USED
 GRL_METADATA_KEY_EXPOSURE_TIME
 GRL_METADATA_KEY_ISO_SPEED
+GRL_METADATA_KEY_START_TIME
 grl_metadata_key_get_name
 grl_metadata_key_get_desc
 grl_metadata_key_get_type
diff --git a/src/data/grl-media.c b/src/data/grl-media.c
index d467920..a4570ca 100644
--- a/src/data/grl-media.c
+++ b/src/data/grl-media.c
@@ -858,6 +858,19 @@ grl_media_set_license (GrlMedia *media, const gchar *license)
 }
 
 /**
+ * grl_media_get_start_time:
+ * @media: the media object
+ *
+ * Returns: the start time of the logical media resource inside the
+ *          file containing it, in seconds.
+ */
+gfloat
+grl_media_get_start_time (GrlMedia *media)
+{
+  return grl_data_get_float (GRL_DATA (media), GRL_METADATA_KEY_START_TIME);
+}
+
+/**
  * grl_media_get_id:
  * @media: the media object
  *
diff --git a/src/data/grl-media.h b/src/data/grl-media.h
index 242f16a..897751f 100644
--- a/src/data/grl-media.h
+++ b/src/data/grl-media.h
@@ -215,6 +215,8 @@ const gchar *grl_media_get_certificate (GrlMedia *media);
 
 const gchar *grl_media_get_license (GrlMedia *media);
 
+gfloat grl_media_get_start_time (GrlMedia *media);
+
 GType grl_media_get_type (void) G_GNUC_CONST;
 
 GrlMedia *grl_media_new (void);
diff --git a/src/grl-metadata-key.c b/src/grl-metadata-key.c
index 64f8128..aef78b8 100644
--- a/src/grl-metadata-key.c
+++ b/src/grl-metadata-key.c
@@ -85,6 +85,8 @@ GrlKeyID GRL_METADATA_KEY_ISO_SPEED = NULL;
 
 GrlKeyID GRL_METADATA_KEY_TRACK_NUMBER = NULL;
 
+GrlKeyID GRL_METADATA_KEY_START_TIME = NULL;
+
 void
 grl_metadata_key_setup_system_keys (GrlPluginRegistry *registry)
 {
@@ -443,6 +445,16 @@ GRL_METADATA_KEY_STUDIO =
                                                                  G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE),
                                                NULL);
 
+  GRL_METADATA_KEY_START_TIME =
+    grl_plugin_registry_register_metadata_key (registry,
+                                               g_param_spec_float ("start-time",
+                                                                   "Start Time",
+                                                                   "Start offset in seconds relative to container",
+                                                                   0, G_MAXFLOAT,
+                                                                   0,
+                                                                   G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE),
+                                               NULL);
+
   /* Create the relations */
   grl_plugin_registry_register_metadata_key_relation (registry,
                                                       GRL_METADATA_KEY_URL,
@@ -459,6 +471,9 @@ GRL_METADATA_KEY_STUDIO =
   grl_plugin_registry_register_metadata_key_relation (registry,
                                                       GRL_METADATA_KEY_URL,
                                                       GRL_METADATA_KEY_WIDTH);
+  grl_plugin_registry_register_metadata_key_relation (registry,
+                                                      GRL_METADATA_KEY_URL,
+                                                      GRL_METADATA_KEY_START_TIME);
 }
 
 /**
diff --git a/src/grl-metadata-key.h b/src/grl-metadata-key.h
index 2559317..960eec1 100644
--- a/src/grl-metadata-key.h
+++ b/src/grl-metadata-key.h
@@ -83,6 +83,7 @@ extern GrlKeyID GRL_METADATA_KEY_FLASH_USED;
 extern GrlKeyID GRL_METADATA_KEY_EXPOSURE_TIME;
 extern GrlKeyID GRL_METADATA_KEY_ISO_SPEED;
 extern GrlKeyID GRL_METADATA_KEY_TRACK_NUMBER;
+extern GrlKeyID GRL_METADATA_KEY_START_TIME;
 
 const gchar *grl_metadata_key_get_name (GrlKeyID key);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]