Added gst_tag_list_get_date() and gst_tag_list_get_date_index().

Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gsttaglist.h:
* gst/gsttaglist.c: (_gst_tag_initialize), (gst_tag_list_get_date),
(gst_tag_list_get_date_index):
Added gst_tag_list_get_date() and gst_tag_list_get_date_index().
GST_TAG_DATE now has a tag type of GST_TYPE_DATE (#170777).
This commit is contained in:
Tim-Philipp Müller 2005-10-13 15:13:32 +00:00
parent 04f521f191
commit c32c04303c
4 changed files with 79 additions and 4 deletions

View file

@ -1,3 +1,12 @@
2005-10-13 Tim-Philipp Müller <tim at centricular dot net>
* docs/gst/gstreamer-sections.txt:
* gst/gsttaglist.h:
* gst/gsttaglist.c: (_gst_tag_initialize), (gst_tag_list_get_date),
(gst_tag_list_get_date_index):
Added gst_tag_list_get_date() and gst_tag_list_get_date_index().
GST_TAG_DATE now has a tag type of GST_TYPE_DATE (#170777).
2005-10-13 Julien MOUTTE <julien@moutte.net>
* gst/base/gstcollectpads.c: (gst_collectpads_event),

View file

@ -1801,6 +1801,8 @@ gst_tag_list_get_string
gst_tag_list_get_string_index
gst_tag_list_get_pointer
gst_tag_list_get_pointer_index
gst_tag_list_get_date
gst_tag_list_get_date_index
<SUBSECTION Standard>
GST_TAG_LIST
GST_IS_TAG_LIST

View file

@ -95,9 +95,8 @@ _gst_tag_initialize (void)
G_TYPE_STRING,
_("album"),
_("album containing this data"), gst_tag_merge_strings_with_comma);
gst_tag_register (GST_TAG_DATE, GST_TAG_FLAG_META, G_TYPE_UINT, /* FIXME: own data type for dates? */
_("date"),
_("date the data was created (in Julian calendar days)"), NULL);
gst_tag_register (GST_TAG_DATE, GST_TAG_FLAG_META, GST_TYPE_DATE,
_("date"), _("date the data was created (as a GDate structure)"), NULL);
gst_tag_register (GST_TAG_GENRE, GST_TAG_FLAG_META,
G_TYPE_STRING,
_("genre"),
@ -1272,3 +1271,61 @@ TAG_MERGE_FUNCS (pointer, gpointer)
* given list.
*/
TAG_MERGE_FUNCS (string, gchar *)
/**
* gst_tag_list_get_date:
* @list: a #GStTagList to get the tag from
* @tag: tag to read out
* @value: location for the result
*
* Copies the contents for the given tag into the value, merging multiple values
* into one if multiple values are associated with the tag.
*
* Returns: TRUE, if a value was copied, FALSE if the tag didn't exist in the
* given list or if it was #NULL.
*/
gboolean
gst_tag_list_get_date (const GstTagList * list, const gchar * tag,
GDate ** 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;
*value = (GDate *) g_value_dup_boxed (&v);
g_value_unset (&v);
return (*value != NULL);
}
/**
* gst_tag_list_get_date_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 value that is at the given index for the given tag in the given
* list.
*
* Returns: TRUE, if a value was copied, FALSE if the tag didn't exist in the
* given list or if it was #NULL.
*/
gboolean
gst_tag_list_get_date_index (const GstTagList * list,
const gchar * tag, guint index, GDate ** 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 = (GDate *) g_value_dup_boxed (v);
return (*value != NULL);
}

View file

@ -220,6 +220,13 @@ gboolean gst_tag_list_get_pointer_index (const GstTagList * list,
const gchar * tag,
guint index,
gpointer * value);
gboolean gst_tag_list_get_date (const GstTagList * list,
const gchar * tag,
GDate ** value);
gboolean gst_tag_list_get_date_index (const GstTagList * list,
const gchar * tag,
guint index,
GDate ** value);
/* GStreamer core tags (need to be discussed) */
/**
@ -243,7 +250,7 @@ gboolean gst_tag_list_get_pointer_index (const GstTagList * list,
/**
* GST_TAG_DATE:
*
* date the data was created (in Julian calendar days)
* date the data was created (#GDate structure)
*/
#define GST_TAG_DATE "date"
/**