[grilo] core: Add GRL_METADATA_KEY_START_TIME



commit b0a56c0015d5c032848262b1efcc380b7303ab2e
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       |   14 ++++++++++++++
 src/grl-metadata-key.h       |    1 +
 5 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/doc/grilo/grilo-sections.txt b/doc/grilo/grilo-sections.txt
index 397c32a..36cef11 100644
--- a/doc/grilo/grilo-sections.txt
+++ b/doc/grilo/grilo-sections.txt
@@ -382,6 +382,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
@@ -611,6 +612,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 fa15f76..90c1646 100644
--- a/src/data/grl-media.c
+++ b/src/data/grl-media.c
@@ -1371,3 +1371,16 @@ grl_media_get_license (GrlMedia *media)
 {
   return grl_data_get_string (GRL_DATA (media), GRL_METADATA_KEY_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);
+}
diff --git a/src/data/grl-media.h b/src/data/grl-media.h
index e28c2bf..96fc20c 100644
--- a/src/data/grl-media.h
+++ b/src/data/grl-media.h
@@ -221,6 +221,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 befbcac..6f98425 100644
--- a/src/grl-metadata-key.c
+++ b/src/grl-metadata-key.c
@@ -440,6 +440,16 @@ grl_metadata_key_setup_system_keys (GrlPluginRegistry *registry)
                                                   GRL_METADATA_KEY_MODIFICATION_DATE,
                                                   NULL);
 
+  grl_plugin_registry_register_metadata_key_full (registry,
+                                                  g_param_spec_float ("start-time",
+                                                                      "Start Time",
+                                                                      "Start offset in seconds relative to container",
+                                                                      0.0, G_MAXFLOAT,
+                                                                      0.0,
+                                                                      G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE),
+                                                  GRL_METADATA_KEY_START_TIME,
+                                                  NULL);
+
   /* Create the relations */
   grl_plugin_registry_register_metadata_key_relation (registry,
                                                       GRL_METADATA_KEY_URL,
@@ -456,6 +466,10 @@ grl_metadata_key_setup_system_keys (GrlPluginRegistry *registry)
   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 e82b8a4..fcda65c 100644
--- a/src/grl-metadata-key.h
+++ b/src/grl-metadata-key.h
@@ -84,6 +84,7 @@ typedef guint32 GrlKeyID;
 #define GRL_METADATA_KEY_ISO_SPEED            39
 #define GRL_METADATA_KEY_TRACK_NUMBER         40
 #define GRL_METADATA_KEY_MODIFICATION_DATE    41
+#define GRL_METADATA_KEY_START_TIME           42
 
 const gchar *grl_metadata_key_get_name (GrlKeyID key);
 



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