[PATCH 2/2] grl-media-image: Add api to access new picture related metadata



From: Michael Wood <michael g wood linux intel com>

---
 src/data/grl-media-image.c |  275 ++++++++++++++++++++++++++++++++++++++++++++
 src/data/grl-media-image.h |   48 ++++++++-
 2 files changed, 321 insertions(+), 2 deletions(-)

diff --git a/src/data/grl-media-image.c b/src/data/grl-media-image.c
index 95a4342..9fae6be 100644
--- a/src/data/grl-media-image.c
+++ b/src/data/grl-media-image.c
@@ -288,3 +288,278 @@ grl_media_image_get_url_data_nth (GrlMediaImage *image,
 
   return grl_related_keys_get_string (relkeys, GRL_METADATA_KEY_URL);
 }
+
+
+/**
+ * grl_media_image_get_creation_date:
+ * @image: the image instance
+ *
+ * Returns: date picture taken
+ *
+ * Since: 0.1.12
+ */
+const gchar *
+grl_media_image_get_creation_date (GrlMediaImage *image)
+{
+  return grl_data_get_string (GRL_DATA (image),
+                              GRL_METADATA_KEY_CREATION_DATE);
+}
+
+/**
+  * grl_media_set_creation_date:
+  * @image: the image instance
+  * @creation_date: date picture taken
+  *
+  * Set the creation_date of the image
+  *
+  * Since 0.1.12
+  */
+void
+grl_media_image_set_creation_date (GrlMediaImage *image,
+                                   const gchar * creation_date)
+{
+  grl_data_set_string (GRL_DATA (image),
+                       GRL_METADATA_KEY_CREATION_DATE,
+                       creation_date);
+}
+
+
+/**
+ * grl_media_image_get_camera_model:
+ * @image: the image instance
+ *
+ * Returns: model of camera used to take picture
+ *
+ * Since: 0.1.12
+ */
+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
+  *
+  * Since 0.1.12
+  */
+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
+ *
+ * Since: 0.1.12
+ */
+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
+  *
+  * Since 0.1.12
+  */
+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
+ *
+ * Since: 0.1.12
+ */
+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
+  *
+  * Since 0.1.12
+  */
+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
+ *
+ * Since: 0.1.12
+ */
+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
+  *
+  * Since 0.1.12
+  */
+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
+ *
+ * Since: 0.1.12
+ */
+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
+  *
+  * Since 0.1.12
+  */
+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
+ *
+ * Since: 0.1.12
+ */
+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
+  *
+  * Since 0.1.12
+  */
+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
+ *
+ * Since: 0.1.12
+ */
+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
+  *
+  * Since 0.1.12
+  */
+void
+grl_media_image_set_orientation (GrlMediaImage *image,
+                                 gint  orientation)
+{
+  grl_data_set_int (GRL_DATA (image),
+                    GRL_METADATA_KEY_ORIENTATION,
+                    orientation);
+}
diff --git a/src/data/grl-media-image.h b/src/data/grl-media-image.h
index f9bc390..edfd44b 100644
--- a/src/data/grl-media-image.h
+++ b/src/data/grl-media-image.h
@@ -93,8 +93,23 @@ 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_creation_date (GrlMediaImage *image);
+
+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 +137,35 @@ void grl_media_image_add_url_data (GrlMediaImage *image,
                                    gint width,
                                    gint height);
 
+void grl_media_image_set_creation_date (GrlMediaImage *image,
+                                        const gchar *creation_date);
+
+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_ */
-- 
1.7.4.1



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