From: Thiago Santos Date: Thu, 22 Jul 2010 01:08:21 +0000 (-0300) Subject: taglist: Add datetime get functions X-Git-Tag: RELEASE-0.10.31~274 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3449bfc30ebf78ac0e2a4a10455ccd2d9d9a5067;p=platform%2Fupstream%2Fgstreamer.git taglist: Add datetime get functions Adds _date_time_get and _date_time_get_index functions to taglist. API: gst_tag_list_get_date_time API: gst_tag_list_get_date_time_index Fixes #594504 --- diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt index 4a2c0ea..868ca12 100644 --- a/docs/gst/gstreamer-sections.txt +++ b/docs/gst/gstreamer-sections.txt @@ -2268,6 +2268,8 @@ gst_tag_list_get_pointer gst_tag_list_get_pointer_index gst_tag_list_get_date gst_tag_list_get_date_index +gst_tag_list_get_date_time +gst_tag_list_get_date_time_index gst_tag_list_get_buffer gst_tag_list_get_buffer_index diff --git a/gst/gsttaglist.c b/gst/gsttaglist.c index f343d1b..bacbe45 100644 --- a/gst/gsttaglist.c +++ b/gst/gsttaglist.c @@ -1702,6 +1702,71 @@ gst_tag_list_get_date_index (const GstTagList * list, } /** + * gst_tag_list_get_date_time: + * @list: a #GstTagList to get the tag from + * @tag: tag to read out + * @value: address of a #GstDateTime pointer variable to store the result into + * + * Copies the first datetime for the given tag in the taglist into the variable + * pointed to by @value. Unref the date with gst_date_time_unref() when + * it is no longer needed. + * + * Returns: TRUE, if a datetime was copied, FALSE if the tag didn't exist in the + * given list or if it was #NULL. + * Since: 0.10.31 + */ +gboolean +gst_tag_list_get_date_time (const GstTagList * list, const gchar * tag, + GstDateTime ** value) +{ + GValue v = { 0, }; + + g_return_val_if_fail (GST_IS_TAG_LIST (list), FALSE); + g_return_val_if_fail (tag != NULL, FALSE); + g_return_val_if_fail (value != NULL, FALSE); + + if (!gst_tag_list_copy_value (&v, list, tag)) + return FALSE; + + g_return_val_if_fail (GST_VALUE_HOLDS_DATE_TIME (&v), FALSE); + + *value = (GstDateTime *) g_value_dup_boxed (&v); + g_value_unset (&v); + return (*value != NULL); +} + +/** + * gst_tag_list_get_date_time_index: + * @list: a #GstTagList to get the tag from + * @tag: tag to read out + * @index: number of entry to read out + * @value: location for the result + * + * Gets the datetime that is at the given index for the given tag in the given + * list and copies it into the variable pointed to by @value. Unref the datetime + * with gst_date_time_unref() when it is no longer needed. + * + * Returns: TRUE, if a value was copied, FALSE if the tag didn't exist in the + * given list or if it was #NULL. + * Since: 0.10.31 + */ +gboolean +gst_tag_list_get_date_time_index (const GstTagList * list, + const gchar * tag, guint index, GstDateTime ** value) +{ + const GValue *v; + + g_return_val_if_fail (GST_IS_TAG_LIST (list), FALSE); + g_return_val_if_fail (tag != NULL, FALSE); + g_return_val_if_fail (value != NULL, FALSE); + + if ((v = gst_tag_list_get_value_index (list, tag, index)) == NULL) + return FALSE; + *value = (GstDateTime *) g_value_dup_boxed (v); + return (*value != NULL); +} + +/** * gst_tag_list_get_buffer: * @list: a #GstTagList to get the tag from * @tag: tag to read out diff --git a/gst/gsttaglist.h b/gst/gsttaglist.h index add6ea3..bafa647 100644 --- a/gst/gsttaglist.h +++ b/gst/gsttaglist.h @@ -23,6 +23,7 @@ #ifndef __GST_TAGLIST_H__ #define __GST_TAGLIST_H__ +#include #include #include #include @@ -363,6 +364,13 @@ gboolean gst_tag_list_get_date_index (const GstTagList * list, const gchar * tag, guint index, GDate ** value); +gboolean gst_tag_list_get_date_time (const GstTagList * list, + const gchar * tag, + GstDateTime ** value); +gboolean gst_tag_list_get_date_time_index (const GstTagList * list, + const gchar * tag, + guint index, + GstDateTime ** value); gboolean gst_tag_list_get_buffer (const GstTagList * list, const gchar * tag, GstBuffer ** value); diff --git a/win32/common/libgstreamer.def b/win32/common/libgstreamer.def index c9759cb..6c2da35 100644 --- a/win32/common/libgstreamer.def +++ b/win32/common/libgstreamer.def @@ -980,6 +980,8 @@ EXPORTS gst_tag_list_get_char_index gst_tag_list_get_date gst_tag_list_get_date_index + gst_tag_list_get_date_time + gst_tag_list_get_date_time_index gst_tag_list_get_double gst_tag_list_get_double_index gst_tag_list_get_float