tags: API: Add functions to add single tags to GstTagList or GstTagSetter

The new functions are gst_tag_setter_add_tag_value()
and gst_tag_list_add_value()). This fixes bug #581198.
This commit is contained in:
Sebastian Dröge 2009-05-07 09:31:01 +02:00
parent c003165b76
commit ad8a35ff3e
4 changed files with 59 additions and 0 deletions

View file

@ -895,6 +895,29 @@ gst_tag_list_add_valist_values (GstTagList * list, GstTagMergeMode mode,
}
}
/**
* gst_tag_list_add_value:
* @list: list to set tags in
* @mode: the mode to use
* @tag: tag
* @value: GValue for this tag
*
* Sets the GValue for a given tag using the specified mode.
*
* Since: 0.10.24
*/
void
gst_tag_list_add_value (GstTagList * list, GstTagMergeMode mode,
const gchar * tag, const GValue * value)
{
g_return_if_fail (GST_IS_TAG_LIST (list));
g_return_if_fail (GST_TAG_MODE_IS_VALID (mode));
g_return_if_fail (tag != NULL);
gst_tag_list_add_value_internal (list, mode, g_quark_from_string (tag),
value);
}
/**
* gst_tag_list_remove_tag:
* @list: list to remove tag from

View file

@ -226,6 +226,10 @@ void gst_tag_list_add_valist_values (GstTagList * list,
GstTagMergeMode mode,
const gchar * tag,
va_list var_args);
void gst_tag_list_add_value (GstTagList * list,
GstTagMergeMode mode,
const gchar * tag,
const GValue * value);
void gst_tag_list_remove_tag (GstTagList * list,
const gchar * tag);
void gst_tag_list_foreach (const GstTagList * list,

View file

@ -300,6 +300,33 @@ gst_tag_setter_add_tag_valist_values (GstTagSetter * setter,
gst_tag_list_add_valist_values (data->list, mode, tag, var_args);
}
/**
* gst_tag_setter_add_tag_value:
* @setter: a #GstTagSetter
* @mode: the mode to use
* @tag: tag to set
* @value: GValue to set for the tag
*
* Adds the given tag / GValue pair on the setter using the given merge mode.
*
* Since: 0.10.24
*/
void
gst_tag_setter_add_tag_value (GstTagSetter * setter,
GstTagMergeMode mode, const gchar * tag, const GValue * value)
{
GstTagData *data;
g_return_if_fail (GST_IS_TAG_SETTER (setter));
g_return_if_fail (GST_TAG_MODE_IS_VALID (mode));
data = gst_tag_setter_get_data (setter);
if (!data->list)
data->list = gst_tag_list_new ();
gst_tag_list_add_value (data->list, mode, tag, value);
}
/**
* gst_tag_setter_get_tag_list:
* @setter: a #GstTagSetter

View file

@ -83,6 +83,11 @@ void gst_tag_setter_add_tag_valist_values(GstTagSetter * setter,
const gchar * tag,
va_list var_args);
void gst_tag_setter_add_tag_value (GstTagSetter * setter,
GstTagMergeMode mode,
const gchar * tag,
const GValue * value);
G_CONST_RETURN GstTagList *
gst_tag_setter_get_tag_list (GstTagSetter * setter);