From f2ef0cd7b19f8dbc054f08f54c749d4bf145c400 Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Wed, 24 Mar 2010 14:43:21 -0300 Subject: [PATCH] tag: xmp: Add some comments Just adds some comments explaining some stuff about the (de)serialization functions. Add myself to the copyright list too. --- gst-libs/gst/tag/gstxmptag.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/gst-libs/gst/tag/gstxmptag.c b/gst-libs/gst/tag/gstxmptag.c index ad48e8d..0cbb67a 100644 --- a/gst-libs/gst/tag/gstxmptag.c +++ b/gst-libs/gst/tag/gstxmptag.c @@ -1,5 +1,6 @@ /* GStreamer * Copyright (C) 2010 Stefan Kost + * Copyright (C) 2010 Thiago Santos * * gstxmptag.c: library for reading / modifying xmp tags * @@ -41,7 +42,20 @@ #include #include +/* + * Serializes a GValue into a string. + */ typedef gchar *(*XmpSerializationFunc) (const GValue * value); + +/* + * Deserializes @str that is the gstreamer tag @gst_tag represented in + * XMP as the @xmp_tag and adds the result to the @taglist. + * + * @pending_tags is passed so that compound xmp tags can search for its + * complements on the list and use them. Note that used complements should + * be freed and removed from the list. + * The list is of PendingXmpTag + */ typedef void (*XmpDeserializationFunc) (GstTagList * taglist, const gchar * gst_tag, const gchar * xmp_tag, const gchar * str, GSList ** pending_tags); @@ -148,13 +162,17 @@ _xmp_tag_get_mapping_reverse (const gchar * xmp_tag, XmpTag ** _xmp_tag) gint index; XMP_TAG_MAP_LOCK; + + /* Iterate over the hashtable */ g_hash_table_iter_init (&iter, __xmp_tag_map); while (!ret && g_hash_table_iter_next (&iter, &key, &value)) { GSList *list = (GSList *) value; + /* each entry might contain multiple mappigns */ for (walk = list; walk; walk = g_slist_next (walk)) { GPtrArray *array = (GPtrArray *) walk->data; + /* each mapping might contain complementary tags */ for (index = 0; index < array->len; index++) { XmpTag *xmpinfo = (XmpTag *) g_ptr_array_index (array, index); @@ -320,6 +338,7 @@ serialize_exif_altituderef (const GValue * value) num = g_value_get_double (value); + /* 0 means above sea level, 1 means below */ if (num >= 0) return g_strdup ("0"); return g_strdup ("1"); @@ -385,6 +404,7 @@ deserialize_exif_altitude (GstTagList * taglist, const gchar * gst_tag, gst_util_fraction_to_double (frac_n, frac_d, &value); if (altituderef_str[0] == '0') { + /* nop */ } else if (altituderef_str[0] == '1') { value *= -1; } else { -- 2.7.4