#define GST_TAG_IS_VALID(tag) (gst_tag_get_info (tag) != NULL)
+/* FIXME 0.11: use GParamSpecs or something similar for tag registrations,
+ * possibly even gst_tag_register(). Especially value ranges might be
+ * useful for some tags. */
+
typedef struct
{
GType type; /* type the data is in */
* @type: the type this data is in
* @nick: human-readable name
* @blurb: a human-readable description about this tag
- * @func: function for merging multiple values of this tag
+ * @func: function for merging multiple values of this tag, or NULL
*
* Registers a new tag type for the use with GStreamer's type system. If a type
* with that name is already registered, that one is used.
* The old registration may have used a different type however. So don't rely
* on your supplied values.
+ *
+ * Important: if you do not supply a merge function the implication will be
+ * that there can only be one single value for this tag in a tag list and
+ * any additional values will silenty be discarded when being added (unless
+ * #GST_TAG_MERGE_REPLACE, #GST_TAG_MERGE_REPLACE_ALL, or
+ * #GST_TAG_MERGE_PREPEND is used as merge mode, in which case the new
+ * value will replace the old one in the list).
+ *
+ * The merge function will be called from gst_tag_list_copy_value() when
+ * it is required that one or more values for a tag be condensed into
+ * one single value. This may happen from gst_tag_list_get_string(),
+ * gst_tag_list_get_int(), gst_tag_list_get_double() etc. What will happen
+ * exactly in that case depends on how the tag was registered and if a
+ * merge function was supplied and if so which one.
+ *
+ * Two default merge functions are provided: gst_tag_merge_use_first() and
+ * gst_tag_merge_strings_with_commas().
*/
void
gst_tag_register (const gchar * name, GstTagFlag flag, GType type,
* @list: list to remove tag from
* @tag: tag to remove
*
- * Removes the goven tag from the taglist.
+ * Removes the given tag from the taglist.
*/
void
gst_tag_list_remove_tag (GstTagList * list, const gchar * tag)
/**
* gst_tag_list_get_value_index:
- * @list: a #GStTagList
+ * @list: a #GstTagList
* @tag: tag to read out
* @index: number of entry to read out
*
return TRUE;
}
+/* FIXME 0.11: this whole merge function business is overdesigned, and the
+ * _get_foo() API is misleading as well - how many application developers will
+ * expect gst_tag_list_get_string (list, GST_TAG_ARTIST, &val) might return a
+ * string with multiple comma-separated artists? _get_foo() should just be
+ * a convenience wrapper around _get_foo_index (list, tag, 0, &val),
+ * supplemented by a special _tag_list_get_string_merged() function if needed
+ * (unless someone can actually think of real use cases where the merge
+ * function is not 'use first' for non-strings and merge for strings) */
+
/***** evil macros to get all the gst_tag_list_get_*() functions right *****/
#define TAG_MERGE_FUNCS(name,type) \
return TRUE; \
}
+/* FIXME 0.11: maybe get rid of _get_char*(), _get_uchar*(), _get_long*(),
+ * _get_ulong*() and _get_pointer*()? - they are not really useful/common
+ * enough to warrant convenience accessor functions */
+
#define COPY_FUNC /**/
/**
* gst_tag_list_get_char:
- * @list: a #GStTagList to get the tag from
+ * @list: a #GstTagList to get the tag from
* @tag: tag to read out
* @value: location for the result
*
*/
/**
* gst_tag_list_get_char_index:
- * @list: a #GStTagList to get the tag from
+ * @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
TAG_MERGE_FUNCS (char, gchar)
/**
* gst_tag_list_get_uchar:
- * @list: a #GStTagList to get the tag from
+ * @list: a #GstTagList to get the tag from
* @tag: tag to read out
* @value: location for the result
*
*/
/**
* gst_tag_list_get_uchar_index:
- * @list: a #GStTagList to get the tag from
+ * @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
TAG_MERGE_FUNCS (uchar, guchar)
/**
* gst_tag_list_get_boolean:
- * @list: a #GStTagList to get the tag from
+ * @list: a #GstTagList to get the tag from
* @tag: tag to read out
* @value: location for the result
*
*/
/**
* gst_tag_list_get_boolean_index:
- * @list: a #GStTagList to get the tag from
+ * @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
TAG_MERGE_FUNCS (boolean, gboolean)
/**
* gst_tag_list_get_int:
- * @list: a #GStTagList to get the tag from
+ * @list: a #GstTagList to get the tag from
* @tag: tag to read out
* @value: location for the result
*
*/
/**
* gst_tag_list_get_int_index:
- * @list: a #GStTagList to get the tag from
+ * @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
TAG_MERGE_FUNCS (int, gint)
/**
* gst_tag_list_get_uint:
- * @list: a #GStTagList to get the tag from
+ * @list: a #GstTagList to get the tag from
* @tag: tag to read out
* @value: location for the result
*
*/
/**
* gst_tag_list_get_uint_index:
- * @list: a #GStTagList to get the tag from
+ * @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
TAG_MERGE_FUNCS (uint, guint)
/**
* gst_tag_list_get_long:
- * @list: a #GStTagList to get the tag from
+ * @list: a #GstTagList to get the tag from
* @tag: tag to read out
* @value: location for the result
*
*/
/**
* gst_tag_list_get_long_index:
- * @list: a #GStTagList to get the tag from
+ * @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
TAG_MERGE_FUNCS (long, glong)
/**
* gst_tag_list_get_ulong:
- * @list: a #GStTagList to get the tag from
+ * @list: a #GstTagList to get the tag from
* @tag: tag to read out
* @value: location for the result
*
*/
/**
* gst_tag_list_get_ulong_index:
- * @list: a #GStTagList to get the tag from
+ * @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
TAG_MERGE_FUNCS (ulong, gulong)
/**
* gst_tag_list_get_int64:
- * @list: a #GStTagList to get the tag from
+ * @list: a #GstTagList to get the tag from
* @tag: tag to read out
* @value: location for the result
*
*/
/**
* gst_tag_list_get_int64_index:
- * @list: a #GStTagList to get the tag from
+ * @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
TAG_MERGE_FUNCS (int64, gint64)
/**
* gst_tag_list_get_uint64:
- * @list: a #GStTagList to get the tag from
+ * @list: a #GstTagList to get the tag from
* @tag: tag to read out
* @value: location for the result
*
*/
/**
* gst_tag_list_get_uint64_index:
- * @list: a #GStTagList to get the tag from
+ * @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
TAG_MERGE_FUNCS (uint64, guint64)
/**
* gst_tag_list_get_float:
- * @list: a #GStTagList to get the tag from
+ * @list: a #GstTagList to get the tag from
* @tag: tag to read out
* @value: location for the result
*
*/
/**
* gst_tag_list_get_float_index:
- * @list: a #GStTagList to get the tag from
+ * @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
TAG_MERGE_FUNCS (float, gfloat)
/**
* gst_tag_list_get_double:
- * @list: a #GStTagList to get the tag from
+ * @list: a #GstTagList to get the tag from
* @tag: tag to read out
* @value: location for the result
*
*/
/**
* gst_tag_list_get_double_index:
- * @list: a #GStTagList to get the tag from
+ * @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
TAG_MERGE_FUNCS (double, gdouble)
/**
* gst_tag_list_get_pointer:
- * @list: a #GStTagList to get the tag from
+ * @list: a #GstTagList to get the tag from
* @tag: tag to read out
* @value: location for the result
*
*/
/**
* gst_tag_list_get_pointer_index:
- * @list: a #GStTagList to get the tag from
+ * @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
#define COPY_FUNC g_strdup
/**
* gst_tag_list_get_string:
- * @list: a #GStTagList to get the tag from
+ * @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.
+ * Copies the contents for the given tag into the value, possibly merging
+ * multiple values into one if multiple values are associated with the tag.
+ *
+ * Use gst_tag_list_get_string_index (list, tag, 0, value) if you want
+ * to retrieve the first string associated with this tag unmodified.
*
* The resulting string in @value should be freed by the caller using g_free
* when no longer needed
*/
/**
* gst_tag_list_get_string_index:
- * @list: a #GStTagList to get the tag from
+ * @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
/**
* gst_tag_list_get_date:
- * @list: a #GStTagList to get the tag from
+ * @list: a #GstTagList to get the tag from
* @tag: tag to read out
* @value: location for the result
*
/**
* gst_tag_list_get_date_index:
- * @list: a #GStTagList to get the tag from
+ * @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