2 * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
4 * gsttag.c: tag support (aka metadata)
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
26 #include "gst_private.h"
27 #include "gst-i18n-lib.h"
32 #include <gobject/gvaluecollector.h>
35 #define GST_TAG_IS_VALID(tag) (gst_tag_get_info (tag) != NULL)
38 GType type; /* type the data is in */
40 gchar * nick; /* translated name */
41 gchar * blurb; /* translated description of type */
43 GstTagMergeFunc merge_func; /* functions to merge the values */
46 #define TAGLIST "taglist"
47 static GQuark gst_tag_list_quark;
48 static GMutex *__tag_mutex;
49 static GHashTable *__tags;
50 #define TAG_LOCK g_mutex_lock (__tag_mutex)
51 #define TAG_UNLOCK g_mutex_unlock (__tag_mutex)
54 _gst_tag_initialize (void)
56 gst_tag_list_quark = g_quark_from_static_string (TAGLIST);
57 __tag_mutex = g_mutex_new ();
58 __tags = g_hash_table_new (g_direct_hash, g_direct_equal);
59 gst_tag_register (GST_TAG_TITLE,
62 _("commonly used title"),
63 gst_tag_merge_strings_with_comma);
64 gst_tag_register (GST_TAG_ARTIST,
67 _("person(s) responsible for the recording"),
68 gst_tag_merge_strings_with_comma);
69 gst_tag_register (GST_TAG_ALBUM,
72 _("album containing this data"),
73 gst_tag_merge_strings_with_comma);
74 gst_tag_register (GST_TAG_DATE,
75 G_TYPE_UINT, /* FIXME: own data type for dates? */
77 _("date the data was created (in Julian calendar days)"),
79 gst_tag_register (GST_TAG_GENRE,
82 _("genre this data belongs to"),
83 gst_tag_merge_strings_with_comma);
84 gst_tag_register (GST_TAG_COMMENT,
87 _("free text commenting the data"),
88 gst_tag_merge_strings_with_comma);
89 gst_tag_register (GST_TAG_TRACK_NUMBER,
92 _("track number inside a collection"),
93 gst_tag_merge_use_first);
94 gst_tag_register (GST_TAG_TRACK_COUNT,
97 _("count of tracks inside collection this track belongs to"),
98 gst_tag_merge_use_first);
99 gst_tag_register (GST_TAG_LOCATION,
102 _("original location of file as a URI"),
103 gst_tag_merge_strings_with_comma);
104 gst_tag_register (GST_TAG_DESCRIPTION,
107 _("short text describing the content of the data"),
108 gst_tag_merge_strings_with_comma);
109 gst_tag_register (GST_TAG_VERSION,
112 _("version of this data"),
114 gst_tag_register (GST_TAG_ISRC,
117 _("International Standard Recording Code - see http://www.ifpi.org/isrc/"),
119 gst_tag_register (GST_TAG_ORGANIZATION,
122 _("organization"), /* FIXME */
123 gst_tag_merge_strings_with_comma);
124 gst_tag_register (GST_TAG_COPYRIGHT,
127 _("copyright notice of the data"),
129 gst_tag_register (GST_TAG_CONTACT,
132 _("contact information"),
133 gst_tag_merge_strings_with_comma);
134 gst_tag_register (GST_TAG_LICENSE,
137 _("license of data"),
139 gst_tag_register (GST_TAG_PERFORMER,
142 _("person(s) performing"),
143 gst_tag_merge_strings_with_comma);
144 gst_tag_register (GST_TAG_DURATION,
147 _("length in GStreamer time units (nanoseconds)"),
149 gst_tag_register (GST_TAG_CODEC,
152 _("codec the data is stored in"),
153 gst_tag_merge_strings_with_comma);
154 gst_tag_register (GST_TAG_BITRATE,
157 _("exact or average bitrate in bits/s"),
159 gst_tag_register (GST_TAG_NOMINAL_BITRATE,
161 _("nominal bitrate"),
162 _("nominal bitrate in bits/s"),
164 gst_tag_register (GST_TAG_MINIMUM_BITRATE,
166 _("minimum bitrate"),
167 _("minimum bitrate in bits/s"),
169 gst_tag_register (GST_TAG_MAXIMUM_BITRATE,
171 _("maximum bitrate"),
172 _("maximum bitrate in bits/s"),
174 gst_tag_register (GST_TAG_ENCODER_VERSION,
176 _("encoder version"),
177 _("version of the encoder used to encode this stream"),
179 gst_tag_register (GST_TAG_SERIAL,
182 _("serial number of track"),
184 gst_tag_register (GST_TAG_TRACK_GAIN,
186 _("replaygain track gain"),
187 _("track gain in db"),
189 gst_tag_register (GST_TAG_TRACK_PEAK,
191 _("replaygain track peak"),
192 _("peak of the track"),
194 gst_tag_register (GST_TAG_ALBUM_GAIN,
196 _("replaygain album gain"),
197 _("album gain in db"),
199 gst_tag_register (GST_TAG_ALBUM_PEAK,
201 _("replaygain album peak"),
202 _("peak of the album"),
206 * gst_tag_merge_use_first:
207 * @dest: uninitialized GValue to store result in
208 * @src: GValue to copy from
210 * This is a convenience function for the func argument of gst_tag_register().
211 * It creates a copy of the first value from the list.
214 gst_tag_merge_use_first (GValue *dest, const GValue *src)
216 const GValue *ret = gst_value_list_get_value (src, 0);
218 g_value_init (dest, G_VALUE_TYPE (ret));
219 g_value_copy (ret, dest);
222 * gst_tag_merge_strings_with_comma:
223 * @dest: uninitialized GValue to store result in
224 * @src: GValue to copy from
226 * This is a convenience function for the func argument of gst_tag_register().
227 * It concatenates all given strings using a comma. The tag must be registered
228 * as a G_TYPE_STRING or this function will fail.
231 gst_tag_merge_strings_with_comma (GValue *dest, const GValue *src)
236 count = gst_value_list_get_size (src);
237 str = g_string_new (g_value_get_string (gst_value_list_get_value (src, 0)));
238 for (i = 1; i < count; i++) {
239 /* seperator between two string */
240 str = g_string_append (str, _(", "));
241 str = g_string_append (str, g_value_get_string (gst_value_list_get_value (src, 1)));
244 g_value_init (dest, G_TYPE_STRING);
245 g_value_set_string_take_ownership (dest, str->str);
246 g_string_free (str, FALSE);
249 gst_tag_lookup (GQuark entry)
254 ret = g_hash_table_lookup (__tags, GUINT_TO_POINTER (entry));
261 * @name: the name or identifier string
262 * @type: the type this data is in
263 * @nick: human-readable name
264 * @blurb: a human-readable description about this tag
265 * @func: function for merging multiple values of this tag
267 * Registers a new tag type for the use with GStreamer's type system. If a type
268 * with that name is already registered, that one is used.
269 * The old registration may have used a different type however. So don't rely
270 * on youre supplied values.
271 * If you know the type is already registered, use gst_tag_lookup instead.
272 * This function takes ownership of all supplied variables.
275 gst_tag_register (gchar *name, GType type, gchar *nick, gchar *blurb,
276 GstTagMergeFunc func)
281 g_return_if_fail (name != NULL);
282 g_return_if_fail (nick != NULL);
283 g_return_if_fail (blurb != NULL);
284 g_return_if_fail (type != 0 && type != GST_TYPE_LIST);
286 key = g_quark_from_string (name);
287 info = gst_tag_lookup (key);
288 g_return_if_fail (info == NULL);
290 info = g_new (GstTagInfo, 1);
294 info->merge_func = func;
297 g_hash_table_insert (__tags, GUINT_TO_POINTER (key), info);
302 * @tag: name of the tag
304 * Checks if the given type is already registered.
306 * Returns: TRUE if the type is already registered
309 gst_tag_exists (const gchar *tag)
311 g_return_val_if_fail (tag != NULL, FALSE);
313 return gst_tag_lookup (g_quark_from_string (tag)) != NULL;
319 * Gets the #GType used for this tag.
321 * Returns: the #GType of this tag
324 gst_tag_get_type (const gchar *tag)
328 g_return_val_if_fail (tag != NULL, 0);
329 info = gst_tag_lookup (g_quark_from_string (tag));
330 g_return_val_if_fail (info != NULL, 0);
338 * Returns the human-readable name of this tag, You must not change or free
341 * Returns: the human-readable name of this tag
344 gst_tag_get_nick (const gchar *tag)
348 g_return_val_if_fail (tag != NULL, NULL);
349 info = gst_tag_lookup (g_quark_from_string (tag));
350 g_return_val_if_fail (info != NULL, NULL);
355 * gst_tag_get_description:
358 * Returns the human-readable description of this tag, You must not change or
361 * Return the human-readable description of this tag
364 gst_tag_get_description (const gchar *tag)
368 g_return_val_if_fail (tag != NULL, NULL);
369 info = gst_tag_lookup (g_quark_from_string (tag));
370 g_return_val_if_fail (info != NULL, NULL);
375 * gst_tag_list_is_fixed:
378 * Checks if the given tag is fixed. A fixed tag can only contain one value.
379 * Unfixed tags can contain lists of values.
381 * Returns: TRUE, if the given tag is fixed.
384 gst_tag_is_fixed (const gchar *tag)
388 g_return_val_if_fail (tag != NULL, FALSE);
389 info = gst_tag_lookup (g_quark_from_string (tag));
390 g_return_val_if_fail (info != NULL, FALSE);
392 return info->merge_func == NULL;
397 * Creates a new empty GstTagList.
399 * Returns: An empty tag list
402 gst_tag_list_new (void)
404 return GST_TAG_LIST (gst_structure_new (TAGLIST, NULL));
408 * @p: Object that might be a taglist
410 * Checks if the given pointer is a taglist.
412 * Returns: TRUE, if the given pointer is a taglist
415 gst_is_tag_list (gconstpointer p)
417 g_return_val_if_fail (p != NULL, FALSE);
419 return ((GstStructure *) p)->name == gst_tag_list_quark;
423 GstTagMergeMode mode;
426 gst_tag_list_add_value_internal (GstStructure *list, GstTagMergeMode mode, GQuark tag, GValue *value)
428 GstTagInfo *info = gst_tag_lookup (tag);
429 const GValue *value2;
431 g_assert (info != NULL);
433 if (info->merge_func && (value2 = gst_structure_id_get_value (list, tag)) != NULL) {
434 GValue dest = { 0, };
436 case GST_TAG_MERGE_REPLACE_ALL:
437 case GST_TAG_MERGE_REPLACE:
438 gst_structure_id_set_value (list, tag, value);
440 case GST_TAG_MERGE_PREPEND:
441 gst_value_list_concat (&dest, value, value2);
442 gst_structure_id_set_value (list, tag, &dest);
443 g_value_unset (&dest);
445 case GST_TAG_MERGE_APPEND:
446 gst_value_list_concat (&dest, value2, value);
447 gst_structure_id_set_value (list, tag, &dest);
448 g_value_unset (&dest);
450 case GST_TAG_MERGE_KEEP:
451 case GST_TAG_MERGE_KEEP_ALL:
454 g_assert_not_reached ();
459 case GST_TAG_MERGE_APPEND:
460 case GST_TAG_MERGE_KEEP:
461 if (gst_structure_id_get_value (list, tag) != NULL)
464 case GST_TAG_MERGE_REPLACE_ALL:
465 case GST_TAG_MERGE_REPLACE:
466 case GST_TAG_MERGE_PREPEND:
467 gst_structure_id_set_value (list, tag, value);
469 case GST_TAG_MERGE_KEEP_ALL:
472 g_assert_not_reached ();
478 gst_tag_list_copy_foreach (GQuark tag, GValue *value, gpointer user_data)
480 GstTagCopyData *copy = (GstTagCopyData *) user_data;
482 gst_tag_list_add_value_internal (copy->list, copy->mode, tag, value);
487 * gst_tag_list_insert:
488 * @into: list to merge into
489 * @from: list to merge from
490 * @mode: the mode to use
492 * Inserts the tags of the second list into the first list using the given mode.
495 gst_tag_list_insert (GstTagList *into, const GstTagList *from, GstTagMergeMode mode)
499 g_return_if_fail (GST_IS_TAG_LIST (into));
500 g_return_if_fail (GST_IS_TAG_LIST (from));
501 g_return_if_fail (GST_TAG_MODE_IS_VALID (mode));
503 data.list = (GstStructure *) into;
505 if (mode == GST_TAG_MERGE_REPLACE_ALL) {
506 gst_structure_remove_all_fields (data.list);
508 gst_structure_foreach ((GstStructure *) from, gst_tag_list_copy_foreach, &data);
512 * @list: list to copy
514 * Copies a given #GstTagList.
516 * Returns: copy of the given list
519 gst_tag_list_copy (const GstTagList *list)
521 g_return_val_if_fail (GST_IS_TAG_LIST (list), NULL);
523 return GST_TAG_LIST (gst_structure_copy ((GstStructure *) list));
526 * gst_tag_list_merge:
527 * @list1: first list to merge
528 * @list2: second list to merge
529 * @mode: the mode to use
531 * Merges the two given lists into a new list. If one of the lists is NULL, a
532 * copy of the other is returned. If both lists are NULL, NULL is returned.
534 * Returns: the new list
537 gst_tag_list_merge (const GstTagList *list1, const GstTagList *list2, GstTagMergeMode mode)
539 g_return_val_if_fail (list1 == NULL || GST_IS_TAG_LIST (list1), NULL);
540 g_return_val_if_fail (list2 == NULL || GST_IS_TAG_LIST (list2), NULL);
541 g_return_val_if_fail (GST_TAG_MODE_IS_VALID (mode), NULL);
543 if (!list1 && !list2) {
546 return gst_tag_list_copy (list2);
548 return gst_tag_list_copy (list1);
552 ret = gst_tag_list_copy (list1);
553 gst_tag_list_insert (ret, list2, mode);
559 * @list: the list to free
561 * Frees the given list and all associated values.
564 gst_tag_list_free (GstTagList *list)
566 g_return_if_fail (GST_IS_TAG_LIST (list));
567 gst_structure_free ((GstStructure *) list);
570 * gst_tag_list_get_tag_size:
572 * @tag: the tag to query
574 * Checks how many value are stored in this tag list for the given tag.
576 * Returns: The number of tags stored
579 gst_tag_list_get_tag_size (const GstTagList *list, const gchar *tag)
583 g_return_val_if_fail (GST_IS_TAG_LIST (list), 0);
585 value = gst_structure_get_value ((GstStructure *) list, tag);
588 if (G_VALUE_TYPE (value) != GST_TYPE_LIST)
591 return gst_value_list_get_size (value);
595 * @list: list to set tags in
596 * @mode: the mode to use
598 * @...: NULL-terminated list of values to set
600 * Sets the values for the given tags using the specified mode.
603 gst_tag_list_add (GstTagList *list, GstTagMergeMode mode, const gchar *tag, ...)
607 g_return_if_fail (GST_IS_TAG_LIST (list));
608 g_return_if_fail (GST_TAG_MODE_IS_VALID (mode));
609 g_return_if_fail (tag != NULL);
611 va_start (args, tag);
612 gst_tag_list_add_valist (list, mode, tag, args);
616 * gst_tag_list_add_values:
617 * @list: list to set tags in
618 * @mode: the mode to use
620 * @...: GValues to set
622 * Sets the GValues for the given tags using the specified mode.
625 gst_tag_list_add_values (GstTagList *list, GstTagMergeMode mode, const gchar *tag, ...)
629 g_return_if_fail (GST_IS_TAG_LIST (list));
630 g_return_if_fail (GST_TAG_MODE_IS_VALID (mode));
631 g_return_if_fail (tag != NULL);
633 va_start (args, tag);
634 gst_tag_list_add_valist_values (list, mode, tag, args);
638 * gst_tag_list_add_valist:
639 * @list: list to set tags in
640 * @mode: the mode to use
642 * @var_args: tag / value pairs to set
644 * Sets the values for the given tags using the specified mode.
647 gst_tag_list_add_valist (GstTagList *list, GstTagMergeMode mode, const gchar *tag, va_list var_args)
653 g_return_if_fail (GST_IS_TAG_LIST (list));
654 g_return_if_fail (GST_TAG_MODE_IS_VALID (mode));
655 g_return_if_fail (tag != NULL);
657 while (tag != NULL) {
658 GValue value = { 0, };
659 quark = g_quark_from_string (tag);
660 info = gst_tag_lookup (quark);
662 g_warning ("no GstTag for %s", tag);
663 g_return_if_fail (info != NULL);
664 g_value_init (&value, info->type);
665 G_VALUE_COLLECT (&value, var_args, 0, &error);
667 g_warning ("%s: %s", G_STRLOC, error);
669 /* we purposely leak the value here, it might not be
670 * in a sane state if an error condition occoured
674 gst_tag_list_add_value_internal (list, mode, quark, &value);
675 g_value_unset (&value);
676 tag = va_arg (var_args, gchar *);
680 * gst_tag_list_add_valist_values:
681 * @list: list to set tags in
682 * @mode: the mode to use
684 * @var_args: tag / GValue pairs to set
686 * Sets the GValues for the given tags using the specified mode.
689 gst_tag_list_add_valist_values (GstTagList *list, GstTagMergeMode mode, const gchar *tag, va_list var_args)
694 g_return_if_fail (GST_IS_TAG_LIST (list));
695 g_return_if_fail (GST_TAG_MODE_IS_VALID (mode));
696 g_return_if_fail (tag != NULL);
698 while (tag != NULL) {
699 quark = g_quark_from_string (tag);
700 info = gst_tag_lookup (quark);
701 g_return_if_fail (info != NULL);
702 gst_tag_list_add_value_internal (list, mode, quark, va_arg (var_args, GValue *));
703 tag = va_arg (var_args, gchar *);
707 * gst_tag_list_remove_tag:
708 * @list: list to remove tag from
709 * @tag: tag to remove
711 * Removes the goven tag from the taglist.
714 gst_tag_list_remove_tag (GstTagList *list, const gchar *tag)
716 g_return_if_fail (GST_IS_TAG_LIST (list));
717 g_return_if_fail (tag != NULL);
719 gst_structure_remove_field ((GstStructure *) list, tag);
722 GstTagForeachFunc func;
723 GstTagList * tag_list;
727 structure_foreach_wrapper (GQuark field_id,
728 GValue *value, gpointer user_data)
730 TagForeachData *data = (TagForeachData *) user_data;
731 data->func (data->tag_list, g_quark_to_string (field_id), data->data);
735 * gst_tag_list_foreach:
736 * @list: list to iterate over
737 * @func: function to be called for each tag
738 * @user_data: user specified data
740 * Calls the given function for each tag inside the tag list. Note that if there
741 * is no tag, the function won't be called at all.
744 gst_tag_list_foreach (GstTagList *list, GstTagForeachFunc func, gpointer user_data)
748 g_return_if_fail (GST_IS_TAG_LIST (list));
749 g_return_if_fail (func != NULL);
752 data.tag_list = list;
753 data.data = user_data;
754 gst_structure_foreach ((GstStructure *) list, structure_foreach_wrapper, &data);
757 /***** tag events *****/
761 * @list: the tag list to put into the event or NULL for an empty list
763 * Creates a new tag event with the given list and takes ownership of it.
765 * Returns: a new tag event
768 gst_event_new_tag (GstTagList *list)
772 g_return_val_if_fail (list == NULL || GST_IS_TAG_LIST (list), NULL);
774 ret = gst_event_new (GST_EVENT_TAG);
776 list = gst_tag_list_new ();
777 ret->event_data.structure.structure = (GstStructure *) list;
782 * get_event_tag_get_list:
783 * @tag_event: a tagging #GstEvent
785 * Gets the taglist from a given tagging event.
787 * Returns: The #GstTagList of the event
790 gst_event_tag_get_list (GstEvent *tag_event)
792 g_return_val_if_fail (GST_IS_EVENT (tag_event), NULL);
793 g_return_val_if_fail (GST_EVENT_TYPE (tag_event) == GST_EVENT_TAG, NULL);
795 return GST_TAG_LIST (tag_event->event_data.structure.structure);
799 * gst_tag_list_get_value_index:
800 * @list: a #GStTagList
801 * @tag: tag to read out
802 * @index: number of entry to read out
804 * Gets the value that is at the given index for the given tag in the given
807 * Returns: The GValue for the specified entry or NULL if the tag wasn't available
808 * or the tag doesn't have as many entries
810 G_CONST_RETURN GValue *
811 gst_tag_list_get_value_index (const GstTagList *list, const gchar *tag, guint index)
815 g_return_val_if_fail (GST_IS_TAG_LIST (list), NULL);
816 g_return_val_if_fail (tag != NULL, NULL);
818 value = gst_structure_get_value ((GstStructure *) list, tag);
819 if (value == NULL) return NULL;
821 if (GST_VALUE_HOLDS_LIST (value)) {
822 if (index >= gst_value_list_get_size (value)) return NULL;
823 return gst_value_list_get_value (value, index);
825 if (index > 0) return NULL;
831 * gst_tag_list_copy_value:
832 * @dest: uninitialized #GValue to copy into
833 * @list: list to get the tag from
834 * @tag: tag to read out
836 * Copies the contents for the given tag into the value, merging multiple values
837 * into one if multiple values are associated with the tag.
838 * You must g_value_unset() the value after use.
840 * Returns: TRUE, if a value was copied, FALSE if the tag didn't exist in the
844 gst_tag_list_copy_value (GValue *dest, const GstTagList *list, const gchar *tag)
848 g_return_val_if_fail (GST_IS_TAG_LIST (list), FALSE);
849 g_return_val_if_fail (tag != NULL, FALSE);
850 g_return_val_if_fail (dest != NULL, FALSE);
851 g_return_val_if_fail (G_VALUE_TYPE (dest) == 0, FALSE);
853 src = gst_structure_get_value ((GstStructure *) list, tag);
854 if (!src) return FALSE;
856 if (G_VALUE_TYPE (src) == GST_TYPE_LIST) {
857 GstTagInfo *info = gst_tag_lookup (g_quark_from_string (tag));
858 /* must be there or lists aren't allowed */
859 g_assert (info->merge_func);
860 info->merge_func (dest, src);
862 g_value_init (dest, G_VALUE_TYPE (src));
863 g_value_copy (src, dest);
868 /***** evil macros to get all the gst_tag_list_get_*() functions right *****/
870 #define TAG_MERGE_FUNCS(name,type) \
872 gst_tag_list_get_ ## name (const GstTagList *list, const gchar *tag, \
877 g_return_val_if_fail (GST_IS_TAG_LIST (list), FALSE); \
878 g_return_val_if_fail (tag != NULL, FALSE); \
879 g_return_val_if_fail (value != NULL, FALSE); \
881 if (!gst_tag_list_copy_value (&v, list, tag)) \
883 *value = COPY_FUNC (g_value_get_ ## name (&v)); \
884 g_value_unset (&v); \
889 gst_tag_list_get_ ## name ## _index (const GstTagList *list, const gchar *tag, \
890 guint index, type *value) \
894 g_return_val_if_fail (GST_IS_TAG_LIST (list), FALSE); \
895 g_return_val_if_fail (tag != NULL, FALSE); \
896 g_return_val_if_fail (value != NULL, FALSE); \
898 if ((v = gst_tag_list_get_value_index (list, tag, index)) == NULL) \
900 *value = COPY_FUNC (g_value_get_ ## name (v)); \
904 #define COPY_FUNC /**/
905 TAG_MERGE_FUNCS (char, gchar)
906 TAG_MERGE_FUNCS (uchar, guchar)
907 TAG_MERGE_FUNCS (boolean, gboolean)
908 TAG_MERGE_FUNCS (int, gint)
909 TAG_MERGE_FUNCS (uint, guint)
910 TAG_MERGE_FUNCS (long, glong)
911 TAG_MERGE_FUNCS (ulong, gulong)
912 TAG_MERGE_FUNCS (int64, gint64)
913 TAG_MERGE_FUNCS (uint64, guint64)
914 TAG_MERGE_FUNCS (float, gfloat)
915 TAG_MERGE_FUNCS (double, gdouble)
918 #define COPY_FUNC g_strdup
919 TAG_MERGE_FUNCS (string, gchar *)