Add interface to setting GValues directly.

Original commit message from CVS:
Add interface to setting GValues directly.
This commit is contained in:
Colin Walters 2003-12-23 04:50:01 +00:00
parent fd203e87e2
commit 31808e7afa
8 changed files with 230 additions and 0 deletions

View file

@ -576,6 +576,28 @@ gst_tag_list_add (GstTagList *list, GstTagMergeMode mode, const gchar *tag, ...)
gst_tag_list_add_valist (list, mode, tag, args);
va_end (args);
}
/**
* gst_tag_list_add_values:
* @list: list to set tags in
* @mode: the mode to use
* @tag: tag
* @...: GValues to set
*
* Sets the GValues for the given tags using the specified mode.
*/
void
gst_tag_list_add_values (GstTagList *list, GstTagMergeMode mode, const gchar *tag, ...)
{
va_list args;
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);
va_start (args, tag);
gst_tag_list_add_valist_values (list, mode, tag, args);
va_end (args);
}
/**
* gst_tag_list_add_valist:
* @list: list to set tags in
@ -616,6 +638,33 @@ gst_tag_list_add_valist (GstTagList *list, GstTagMergeMode mode, const gchar *ta
tag = va_arg (var_args, gchar *);
}
}
/**
* gst_tag_list_add_valist_values:
* @list: list to set tags in
* @mode: the mode to use
* @tag: tag
* @var_args: tag / GValue pairs to set
*
* Sets the GValues for the given tags using the specified mode.
*/
void
gst_tag_list_add_valist_values (GstTagList *list, GstTagMergeMode mode, const gchar *tag, va_list var_args)
{
GstTagInfo *info;
GQuark quark;
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);
while (tag != NULL) {
quark = g_quark_from_string (tag);
info = gst_tag_lookup (quark);
g_return_if_fail (info != NULL);
gst_tag_list_add_value_internal (list, mode, quark, va_arg (var_args, GValue *));
tag = va_arg (var_args, gchar *);
}
}
/**
* gst_tag_list_remove_tag:
* @list: list to remove tag from

View file

@ -88,10 +88,18 @@ void gst_tag_list_add (GstTagList * list,
GstTagMergeMode mode,
const gchar * tag,
...);
void gst_tag_list_add_values (GstTagList * list,
GstTagMergeMode mode,
const gchar * tag,
...);
void gst_tag_list_add_valist (GstTagList * list,
GstTagMergeMode mode,
const gchar * tag,
va_list var_args);
void gst_tag_list_add_valist_values (GstTagList * list,
GstTagMergeMode mode,
const gchar * tag,
va_list var_args);
void gst_tag_list_remove_tag (GstTagList * list,
const gchar * tag);
void gst_tag_list_foreach (GstTagList * list,

View file

@ -138,6 +138,28 @@ gst_tag_setter_add (GstTagSetter *setter, GstTagMergeMode mode, const gchar *tag
gst_tag_setter_add_valist (setter, mode, tag, args);
va_end (args);
}
/**
* gst_tag_setter_add_values:
* @setter: a #GstTagSetter
* @mode: the mode to use
* @tag: tag to set
* @...: more tag / GValue pairs to set
*
* Adds the given tag / GValue pairs on the setter using the given merge mode.
* The list must be terminated with GST_TAG_INVALID.
*/
void
gst_tag_setter_add_values (GstTagSetter *setter, GstTagMergeMode mode, const gchar *tag, ...)
{
va_list args;
g_return_if_fail (GST_IS_TAG_SETTER (setter));
g_return_if_fail (GST_TAG_MODE_IS_VALID (mode));
va_start (args, tag);
gst_tag_setter_add_valist_values (setter, mode, tag, args);
va_end (args);
}
/**
* gst_tag_setter_add_valist:
* @setter: a #GstTagSetter
@ -162,6 +184,30 @@ gst_tag_setter_add_valist (GstTagSetter *setter, GstTagMergeMode mode, const gch
gst_tag_list_add_valist (data->list, mode, tag, var_args);
}
/**
* gst_tag_setter_add_valist_values:
* @setter: a #GstTagSetter
* @mode: the mode to use
* @tag: tag to set
* @var_args: tag / GValue pairs to set
*
* Adds the given tag / GValue pairs on the setter using the given merge mode.
* The list must be terminated with GST_TAG_INVALID.
*/
void
gst_tag_setter_add_valist_values (GstTagSetter *setter, GstTagMergeMode mode, const gchar *tag, va_list var_args)
{
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_valist_values (data->list, mode, tag, var_args);
}
/**
* gst_tag_setter_get_list:
* @setter: a #GstTagSetter

View file

@ -55,10 +55,22 @@ void gst_tag_setter_add (GstTagSetter * setter,
GstTagMergeMode mode,
const gchar * tag,
...);
void gst_tag_setter_add_values (GstTagSetter * setter,
GstTagMergeMode mode,
const gchar * tag,
...);
void gst_tag_setter_add_valist (GstTagSetter * setter,
GstTagMergeMode mode,
const gchar * tag,
va_list var_args);
void gst_tag_setter_add_valist_values(GstTagSetter * setter,
GstTagMergeMode mode,
const gchar * tag,
va_list var_args);
G_CONST_RETURN GstTagList *
gst_tag_setter_get_list (GstTagSetter * setter);

View file

@ -576,6 +576,28 @@ gst_tag_list_add (GstTagList *list, GstTagMergeMode mode, const gchar *tag, ...)
gst_tag_list_add_valist (list, mode, tag, args);
va_end (args);
}
/**
* gst_tag_list_add_values:
* @list: list to set tags in
* @mode: the mode to use
* @tag: tag
* @...: GValues to set
*
* Sets the GValues for the given tags using the specified mode.
*/
void
gst_tag_list_add_values (GstTagList *list, GstTagMergeMode mode, const gchar *tag, ...)
{
va_list args;
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);
va_start (args, tag);
gst_tag_list_add_valist_values (list, mode, tag, args);
va_end (args);
}
/**
* gst_tag_list_add_valist:
* @list: list to set tags in
@ -616,6 +638,33 @@ gst_tag_list_add_valist (GstTagList *list, GstTagMergeMode mode, const gchar *ta
tag = va_arg (var_args, gchar *);
}
}
/**
* gst_tag_list_add_valist_values:
* @list: list to set tags in
* @mode: the mode to use
* @tag: tag
* @var_args: tag / GValue pairs to set
*
* Sets the GValues for the given tags using the specified mode.
*/
void
gst_tag_list_add_valist_values (GstTagList *list, GstTagMergeMode mode, const gchar *tag, va_list var_args)
{
GstTagInfo *info;
GQuark quark;
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);
while (tag != NULL) {
quark = g_quark_from_string (tag);
info = gst_tag_lookup (quark);
g_return_if_fail (info != NULL);
gst_tag_list_add_value_internal (list, mode, quark, va_arg (var_args, GValue *));
tag = va_arg (var_args, gchar *);
}
}
/**
* gst_tag_list_remove_tag:
* @list: list to remove tag from

View file

@ -88,10 +88,18 @@ void gst_tag_list_add (GstTagList * list,
GstTagMergeMode mode,
const gchar * tag,
...);
void gst_tag_list_add_values (GstTagList * list,
GstTagMergeMode mode,
const gchar * tag,
...);
void gst_tag_list_add_valist (GstTagList * list,
GstTagMergeMode mode,
const gchar * tag,
va_list var_args);
void gst_tag_list_add_valist_values (GstTagList * list,
GstTagMergeMode mode,
const gchar * tag,
va_list var_args);
void gst_tag_list_remove_tag (GstTagList * list,
const gchar * tag);
void gst_tag_list_foreach (GstTagList * list,

View file

@ -138,6 +138,28 @@ gst_tag_setter_add (GstTagSetter *setter, GstTagMergeMode mode, const gchar *tag
gst_tag_setter_add_valist (setter, mode, tag, args);
va_end (args);
}
/**
* gst_tag_setter_add_values:
* @setter: a #GstTagSetter
* @mode: the mode to use
* @tag: tag to set
* @...: more tag / GValue pairs to set
*
* Adds the given tag / GValue pairs on the setter using the given merge mode.
* The list must be terminated with GST_TAG_INVALID.
*/
void
gst_tag_setter_add_values (GstTagSetter *setter, GstTagMergeMode mode, const gchar *tag, ...)
{
va_list args;
g_return_if_fail (GST_IS_TAG_SETTER (setter));
g_return_if_fail (GST_TAG_MODE_IS_VALID (mode));
va_start (args, tag);
gst_tag_setter_add_valist_values (setter, mode, tag, args);
va_end (args);
}
/**
* gst_tag_setter_add_valist:
* @setter: a #GstTagSetter
@ -162,6 +184,30 @@ gst_tag_setter_add_valist (GstTagSetter *setter, GstTagMergeMode mode, const gch
gst_tag_list_add_valist (data->list, mode, tag, var_args);
}
/**
* gst_tag_setter_add_valist_values:
* @setter: a #GstTagSetter
* @mode: the mode to use
* @tag: tag to set
* @var_args: tag / GValue pairs to set
*
* Adds the given tag / GValue pairs on the setter using the given merge mode.
* The list must be terminated with GST_TAG_INVALID.
*/
void
gst_tag_setter_add_valist_values (GstTagSetter *setter, GstTagMergeMode mode, const gchar *tag, va_list var_args)
{
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_valist_values (data->list, mode, tag, var_args);
}
/**
* gst_tag_setter_get_list:
* @setter: a #GstTagSetter

View file

@ -55,10 +55,22 @@ void gst_tag_setter_add (GstTagSetter * setter,
GstTagMergeMode mode,
const gchar * tag,
...);
void gst_tag_setter_add_values (GstTagSetter * setter,
GstTagMergeMode mode,
const gchar * tag,
...);
void gst_tag_setter_add_valist (GstTagSetter * setter,
GstTagMergeMode mode,
const gchar * tag,
va_list var_args);
void gst_tag_setter_add_valist_values(GstTagSetter * setter,
GstTagMergeMode mode,
const gchar * tag,
va_list var_args);
G_CONST_RETURN GstTagList *
gst_tag_setter_get_list (GstTagSetter * setter);