[grilo] grl-media-image: Add api to access new picture related metadata



commit 9b721ccdf89979e03a7ab439b227e0b872ca409c
Author: Michael Wood <michael g wood linux intel com>
Date:   Fri Mar 18 14:00:27 2011 +0000

    grl-media-image: Add api to access new picture related metadata
    
    Signed-off-by: Juan A. Suarez Romero <jasuarez igalia com>

 src/data/grl-media-image.c |  212 ++++++++++++++++++++++++++++++++++++++++++++
 src/data/grl-media-image.h |   43 +++++++++-
 src/data/grl-media.c       |   29 ++++++
 src/data/grl-media.h       |    4 +
 4 files changed, 286 insertions(+), 2 deletions(-)
---
diff --git a/src/data/grl-media-image.c b/src/data/grl-media-image.c
index 95a4342..f1fe04b 100644
--- a/src/data/grl-media-image.c
+++ b/src/data/grl-media-image.c
@@ -288,3 +288,215 @@ grl_media_image_get_url_data_nth (GrlMediaImage *image,
 
   return grl_related_keys_get_string (relkeys, GRL_METADATA_KEY_URL);
 }
+
+/**
+ * grl_media_image_get_camera_model:
+ * @image: the image instance
+ *
+ * Returns: model of camera used to take picture
+ */
+const gchar *
+grl_media_image_get_camera_model (GrlMediaImage *image)
+{
+  return grl_data_get_string (GRL_DATA (image),
+                              GRL_METADATA_KEY_CAMERA_MODEL);
+}
+
+/**
+  * grl_media_set_camera_model:
+  * @image: the image instance
+  * @camera_model: model of camera used to take picture
+  *
+  * Set the camera_model of the image
+  */
+void
+grl_media_image_set_camera_model (GrlMediaImage *image,
+                                  const gchar * camera_model)
+{
+  grl_data_set_string (GRL_DATA (image),
+                       GRL_METADATA_KEY_CAMERA_MODEL,
+                       camera_model);
+}
+
+
+/**
+ * grl_media_image_get_flash_used:
+ * @image: the image instance
+ *
+ * Returns: whether the flash was used
+ * See
+ * http://library.gnome.org/devel/ontology/unstable/nmm-classes.html#nmm-Flash
+ */
+const gchar *
+grl_media_image_get_flash_used (GrlMediaImage *image)
+{
+  return grl_data_get_string (GRL_DATA (image),
+                              GRL_METADATA_KEY_FLASH_USED);
+}
+
+/**
+  * grl_media_set_flash_used:
+  * @image: the image instance
+  * @flash_used: whether the flash was used
+  *
+  * Set the flash_used of the image
+  * See
+  * http://library.gnome.org/devel/ontology/unstable/nmm-classes.html#nmm-Flash
+  */
+void
+grl_media_image_set_flash_used (GrlMediaImage *image,
+                                const gchar  *flash_used)
+{
+  grl_data_set_string (GRL_DATA (image),
+                       GRL_METADATA_KEY_FLASH_USED,
+                       flash_used);
+}
+
+
+/**
+ * grl_media_image_get_exposure_time:
+ * @image: the image instance
+ *
+ * Returns: picture's exposure time
+ */
+gfloat
+grl_media_image_get_exposure_time (GrlMediaImage *image)
+{
+  return grl_data_get_float (GRL_DATA (image),
+                             GRL_METADATA_KEY_EXPOSURE_TIME);
+}
+
+/**
+  * grl_media_set_exposure_time:
+  * @image: the image instance
+  * @exposure_time: picture's exposure time
+  *
+  * Set the exposure_time of the image
+  */
+void
+grl_media_image_set_exposure_time (GrlMediaImage *image,
+                                   gfloat  exposure_time)
+{
+  grl_data_set_float (GRL_DATA (image),
+                      GRL_METADATA_KEY_EXPOSURE_TIME,
+                      exposure_time);
+}
+
+/**
+ * grl_media_image_get_iso_speed:
+ * @image: the image instance
+ *
+ * Returns: picture's iso speed
+ */
+gfloat
+grl_media_image_get_iso_speed (GrlMediaImage *image)
+{
+  return grl_data_get_float (GRL_DATA (image),
+                             GRL_METADATA_KEY_ISO_SPEED);
+}
+
+/**
+  * grl_media_set_iso_speed:
+  * @image: the image instance
+  * @iso_speed: picture's iso speed
+  *
+  * Set the iso_speed of the image
+  */
+void
+grl_media_image_set_iso_speed (GrlMediaImage *image,
+                               gfloat  iso_speed)
+{
+  grl_data_set_float (GRL_DATA (image),
+                      GRL_METADATA_KEY_ISO_SPEED,
+                      iso_speed);
+}
+
+
+/**
+ * grl_media_image_get_original_width:
+ * @image: the image instance
+ *
+ * Returns: original width of picture
+ */
+gint
+grl_media_image_get_original_width (GrlMediaImage *image)
+{
+  return grl_data_get_int (GRL_DATA (image),
+                           GRL_METADATA_KEY_ORIGINAL_WIDTH);
+}
+
+/**
+  * grl_media_set_original_width:
+  * @image: the image instance
+  * @original_width: original width of picture
+  *
+  * Set the original_width of the image
+  */
+void
+grl_media_image_set_original_width (GrlMediaImage *image,
+                                    gint  original_width)
+{
+  grl_data_set_int (GRL_DATA (image),
+                    GRL_METADATA_KEY_ORIGINAL_WIDTH,
+                    original_width);
+}
+
+
+/**
+ * grl_media_image_get_original_height:
+ * @image: the image instance
+ *
+ * Returns: original height of picture
+ */
+gint
+grl_media_image_get_original_height (GrlMediaImage *image)
+{
+  return grl_data_get_int (GRL_DATA (image),
+                           GRL_METADATA_KEY_ORIGINAL_HEIGHT);
+}
+
+/**
+  * grl_media_set_original_height:
+  * @image: the image instance
+  * @original_height: original height of picture
+  *
+  * Set the original height of the image
+  */
+void
+grl_media_image_set_original_height (GrlMediaImage *image,
+                                     gint  original_height)
+{
+  grl_data_set_int (GRL_DATA (image),
+                    GRL_METADATA_KEY_ORIGINAL_HEIGHT,
+                    original_height);
+}
+
+
+/**
+ * grl_media_image_get_orientation:
+ * @image: the image instance
+ *
+ * Returns: degrees clockwise orientation of the picture
+ */
+gint
+grl_media_image_get_orientation (GrlMediaImage *image)
+{
+  return grl_data_get_int (GRL_DATA (image),
+                           GRL_METADATA_KEY_ORIENTATION);
+}
+
+/**
+  * grl_media_set_orientation:
+  * @image: the image instance
+  * @orientation: degrees clockwise orientation of the picture
+  *
+  * Set the orientation of the image
+  */
+void
+grl_media_image_set_orientation (GrlMediaImage *image,
+                                 gint orientation)
+{
+  grl_data_set_int (GRL_DATA (image),
+                    GRL_METADATA_KEY_ORIENTATION,
+                    orientation % 360);
+}
diff --git a/src/data/grl-media-image.h b/src/data/grl-media-image.h
index f9bc390..6d78b20 100644
--- a/src/data/grl-media-image.h
+++ b/src/data/grl-media-image.h
@@ -93,8 +93,21 @@ gint grl_media_image_get_width (GrlMediaImage *image);
 
 gint grl_media_image_get_height (GrlMediaImage *image);
 
-GType grl_media_image_get_type (void) G_GNUC_CONST;
-GrlMedia *grl_media_image_new (void);
+const gchar *grl_media_image_get_camera_model (GrlMediaImage *image);
+
+const gchar *grl_media_image_get_flash_used (GrlMediaImage *image);
+
+gfloat grl_media_image_get_exposure_time (GrlMediaImage *image);
+
+gfloat grl_media_image_get_iso_speed (GrlMediaImage *image);
+
+gint grl_media_image_get_original_height (GrlMediaImage *image);
+
+gint grl_media_image_get_original_width (GrlMediaImage *image);
+
+gint grl_media_image_get_orientation (GrlMediaImage *image);
+
+
 void grl_media_image_set_size (GrlMediaImage *image,
                                gint width,
                                gint height);
@@ -122,6 +135,32 @@ void grl_media_image_add_url_data (GrlMediaImage *image,
                                    gint width,
                                    gint height);
 
+void grl_media_image_set_camera_model (GrlMediaImage *image,
+                                       const gchar *camera_model);
+
+void grl_media_image_set_flash_used (GrlMediaImage *image,
+                                     const gchar *flash_used);
+
+void grl_media_image_set_exposure_time (GrlMediaImage *image,
+                                        gfloat exposure_time);
+
+void grl_media_image_set_iso_speed (GrlMediaImage *image,
+                                    gfloat iso_speed);
+
+void grl_media_image_set_original_width (GrlMediaImage *image,
+                                         gint original_width);
+
+void grl_media_image_set_original_height (GrlMediaImage *image,
+                                          gint original_height);
+
+void grl_media_image_set_orientation (GrlMediaImage *image,
+                                      gint orientation);
+
+GType grl_media_image_get_type (void) G_GNUC_CONST;
+
+GrlMedia *grl_media_image_new (void);
+
+
 G_END_DECLS
 
 #endif /* _GRL_MEDIA_IMAGE_H_ */
diff --git a/src/data/grl-media.c b/src/data/grl-media.c
index 2b43e5c..c3a3453 100644
--- a/src/data/grl-media.c
+++ b/src/data/grl-media.c
@@ -687,6 +687,22 @@ grl_media_set_date (GrlMedia *media, const gchar *date)
 }
 
 /**
+  * grl_media_set_creation_date:
+  * @image: the media
+  * @creation_date: date when media was created
+  *
+  * Set the creation_date of the media
+  */
+void
+grl_media_set_creation_date (GrlMedia *media,
+                             const gchar * creation_date)
+{
+  grl_data_set_string (GRL_DATA (media),
+                       GRL_METADATA_KEY_CREATION_DATE,
+                       creation_date);
+}
+
+/**
  * grl_media_set_mime:
  * @media: the media
  * @mime: the mime type
@@ -1116,6 +1132,19 @@ grl_media_get_date (GrlMedia *media)
 }
 
 /**
+ * grl_media_get_creation_date:
+ * @image: the media
+ *
+ * Returns: date when media was created
+ */
+const gchar *
+grl_media_get_creation_date (GrlMedia *media)
+{
+  return grl_data_get_string (GRL_DATA (media),
+                              GRL_METADATA_KEY_CREATION_DATE);
+}
+
+/**
  * grl_media_get_mime:
  * @media: the media object
  *
diff --git a/src/data/grl-media.h b/src/data/grl-media.h
index b486556..ed8a3b1 100644
--- a/src/data/grl-media.h
+++ b/src/data/grl-media.h
@@ -121,6 +121,8 @@ void grl_media_set_duration (GrlMedia *media, gint duration);
 
 void grl_media_set_date (GrlMedia *media, const gchar *date);
 
+void grl_media_set_creation_date (GrlMedia *media, const gchar *creation_date);
+
 void grl_media_set_mime (GrlMedia *media, const gchar *mime);
 
 void grl_media_set_play_count (GrlMedia *media, gint play_count);
@@ -187,6 +189,8 @@ gint grl_media_get_duration (GrlMedia *media);
 
 const gchar *grl_media_get_date (GrlMedia *media);
 
+const gchar *grl_media_get_creation_date (GrlMedia *media);
+
 const gchar *grl_media_get_mime (GrlMedia *media);
 
 gfloat grl_media_get_rating (GrlMedia *media);



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