taglist: rename _new() to _new_empty() and new_full*() to new*()

This commit is contained in:
Tim-Philipp Müller 2011-10-30 10:26:11 +00:00
parent dc7ec44486
commit 4e7944b0b9
11 changed files with 57 additions and 51 deletions

View file

@ -2444,8 +2444,8 @@ gst_tag_get_description
gst_tag_get_flag
gst_tag_is_fixed
gst_tag_list_new
gst_tag_list_new_full
gst_tag_list_new_full_valist
gst_tag_list_new_empty
gst_tag_list_new_valist
gst_tag_list_new_from_string
gst_tag_list_to_string
gst_is_tag_list
@ -2517,7 +2517,7 @@ gst_tag_merge_mode_get_type
<FILE>gsttagsetter</FILE>
<TITLE>GstTagSetter</TITLE>
GstTagSetter
GstTagSetterIFace
GstTagSetterInterface
gst_tag_setter_reset_tags
gst_tag_setter_merge_tags
gst_tag_setter_add_tags

View file

@ -360,3 +360,10 @@ The 0.11 porting guide
allows bindings to properly use GstIterator and prevents complex
return value ownership issues.
* GstTagList
is now an opaque object instead of being typedefed to a GstStructure. Cast
to GstStructure or use gst_structure_* API on it at your own peril (it may
still work for now, but might be changed in future).
gst_tag_list_new() has been renamed to gst_tag_list_new_empty().
gst_tag_list_new_full*() have been renamed to gst_tag_list_new*().

View file

@ -626,7 +626,7 @@ gst_tag_is_fixed (const gchar * tag)
}
/**
* gst_tag_list_new:
* gst_tag_list_new_empty:
*
* Creates a new empty GstTagList.
*
@ -635,13 +635,13 @@ gst_tag_is_fixed (const gchar * tag)
* Returns: (transfer full): An empty tag list
*/
GstTagList *
gst_tag_list_new (void)
gst_tag_list_new_empty (void)
{
return GST_TAG_LIST (gst_structure_id_empty_new (GST_QUARK (TAGLIST)));
}
/**
* gst_tag_list_new_full:
* gst_tag_list_new:
* @tag: tag
* @...: NULL-terminated list of values to set
*
@ -660,16 +660,15 @@ gst_tag_list_new (void)
*
* Since: 0.10.24
*/
/* FIXME 0.11: rename gst_tag_list_new_full to _new and _new to _new_empty */
GstTagList *
gst_tag_list_new_full (const gchar * tag, ...)
gst_tag_list_new (const gchar * tag, ...)
{
GstTagList *list;
va_list args;
g_return_val_if_fail (tag != NULL, NULL);
list = gst_tag_list_new ();
list = gst_tag_list_new_empty ();
va_start (args, tag);
gst_tag_list_add_valist (list, GST_TAG_MERGE_APPEND, tag, args);
va_end (args);
@ -678,10 +677,10 @@ gst_tag_list_new_full (const gchar * tag, ...)
}
/**
* gst_tag_list_new_full_valist:
* gst_tag_list_new_valist:
* @var_args: tag / value pairs to set
*
* Just like gst_tag_list_new_full(), only that it takes a va_list argument.
* Just like gst_tag_list_new(), only that it takes a va_list argument.
* Useful mostly for language bindings.
*
* Free-function: gst_tag_list_free
@ -692,12 +691,12 @@ gst_tag_list_new_full (const gchar * tag, ...)
* Since: 0.10.24
*/
GstTagList *
gst_tag_list_new_full_valist (va_list var_args)
gst_tag_list_new_valist (va_list var_args)
{
GstTagList *list;
const gchar *tag;
list = gst_tag_list_new ();
list = gst_tag_list_new_empty ();
tag = va_arg (var_args, gchar *);
gst_tag_list_add_valist (list, GST_TAG_MERGE_APPEND, tag, var_args);
@ -1011,8 +1010,8 @@ gst_tag_list_merge (const GstTagList * list1, const GstTagList * list2,
}
/* create empty list, we need to do this to correctly handling merge modes */
list1_cp = (list1) ? gst_tag_list_copy (list1) : gst_tag_list_new ();
list2_cp = (list2) ? list2 : gst_tag_list_new ();
list1_cp = (list1) ? gst_tag_list_copy (list1) : gst_tag_list_new_empty ();
list2_cp = (list2) ? list2 : gst_tag_list_new_empty ();
gst_tag_list_insert (list1_cp, list2_cp, mode);

View file

@ -198,9 +198,9 @@ GstTagFlag gst_tag_get_flag (const gchar * tag);
gboolean gst_tag_is_fixed (const gchar * tag);
/* tag lists */
GstTagList * gst_tag_list_new (void);
GstTagList * gst_tag_list_new_full (const gchar * tag, ...);
GstTagList * gst_tag_list_new_full_valist (va_list var_args);
GstTagList * gst_tag_list_new_empty (void);
GstTagList * gst_tag_list_new (const gchar * tag, ...);
GstTagList * gst_tag_list_new_valist (va_list var_args);
gchar * gst_tag_list_to_string (const GstTagList * list);
GstTagList * gst_tag_list_new_from_string (const gchar * str);

View file

@ -283,7 +283,7 @@ gst_tag_setter_add_tag_valist (GstTagSetter * setter, GstTagMergeMode mode,
g_static_mutex_lock (&data->lock);
if (!data->list)
data->list = gst_tag_list_new ();
data->list = gst_tag_list_new_empty ();
gst_tag_list_add_valist (data->list, mode, tag, var_args);
@ -314,7 +314,7 @@ gst_tag_setter_add_tag_valist_values (GstTagSetter * setter,
g_static_mutex_lock (&data->lock);
if (!data->list)
data->list = gst_tag_list_new ();
data->list = gst_tag_list_new_empty ();
gst_tag_list_add_valist_values (data->list, mode, tag, var_args);
@ -346,7 +346,7 @@ gst_tag_setter_add_tag_value (GstTagSetter * setter,
g_static_mutex_lock (&data->lock);
if (!data->list)
data->list = gst_tag_list_new ();
data->list = gst_tag_list_new_empty ();
gst_tag_list_add_value (data->list, mode, tag, value);

View file

@ -1316,7 +1316,7 @@ gst_base_parse_post_bitrates (GstBaseParse * parse, gboolean post_min,
GstTagList *taglist = NULL;
if (post_min && parse->priv->post_min_bitrate) {
taglist = gst_tag_list_new ();
taglist = gst_tag_list_new_empty ();
gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE,
GST_TAG_MINIMUM_BITRATE, parse->priv->min_bitrate, NULL);
@ -1324,7 +1324,7 @@ gst_base_parse_post_bitrates (GstBaseParse * parse, gboolean post_min,
if (post_avg && parse->priv->post_avg_bitrate) {
if (taglist == NULL)
taglist = gst_tag_list_new ();
taglist = gst_tag_list_new_empty ();
parse->priv->posted_avg_bitrate = parse->priv->avg_bitrate;
gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE, GST_TAG_BITRATE,
@ -1333,7 +1333,7 @@ gst_base_parse_post_bitrates (GstBaseParse * parse, gboolean post_min,
if (post_max && parse->priv->post_max_bitrate) {
if (taglist == NULL)
taglist = gst_tag_list_new ();
taglist = gst_tag_list_new_empty ();
gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE,
GST_TAG_MAXIMUM_BITRATE, parse->priv->max_bitrate, NULL);

View file

@ -93,7 +93,7 @@ GST_START_TEST (create_events)
/* TAGS */
{
GstTagList *taglist = gst_tag_list_new ();
GstTagList *taglist = gst_tag_list_new_empty ();
GstTagList *tl2 = NULL;
event = gst_event_new_tag (taglist);

View file

@ -102,7 +102,7 @@ GST_START_TEST (test_parsing)
GstTagList *tag;
/* FIXME, do some more tag adding */
tag = gst_tag_list_new ();
tag = gst_tag_list_new_empty ();
fail_if (tag == NULL);
message = gst_message_new_tag (NULL, tag);
fail_if (message == NULL);

View file

@ -67,7 +67,7 @@ check_tags_empty (const GstTagList * list)
#define NEW_LIST_FIXED(mode) \
G_STMT_START { \
if (list) gst_tag_list_free (list); \
list = gst_tag_list_new (); \
list = gst_tag_list_new_empty (); \
gst_tag_list_add (list, mode, FTAG, FIXED1, FTAG, FIXED2, \
FTAG, FIXED3, FTAG, FIXED4, NULL); \
mark_point(); \
@ -76,7 +76,7 @@ G_STMT_START { \
#define NEW_LIST_UNFIXED(mode) \
G_STMT_START { \
if (list) gst_tag_list_free (list); \
list = gst_tag_list_new (); \
list = gst_tag_list_new_empty (); \
gst_tag_list_add (list, mode, UTAG, UNFIXED1, UTAG, UNFIXED2, \
UTAG, UNFIXED3, UTAG, UNFIXED4, NULL); \
mark_point(); \
@ -85,11 +85,11 @@ G_STMT_START { \
#define NEW_LISTS_FIXED(mode) \
G_STMT_START { \
if (list) gst_tag_list_free (list); \
list = gst_tag_list_new (); \
list = gst_tag_list_new_empty (); \
gst_tag_list_add (list, GST_TAG_MERGE_APPEND, FTAG, FIXED1, \
FTAG, FIXED2, NULL); \
if (list2) gst_tag_list_free (list2); \
list2 = gst_tag_list_new (); \
list2 = gst_tag_list_new_empty (); \
gst_tag_list_add (list2, GST_TAG_MERGE_APPEND, FTAG, FIXED3, \
FTAG, FIXED4, NULL); \
if (merge) gst_tag_list_free (merge); \
@ -100,11 +100,11 @@ G_STMT_START { \
#define NEW_LISTS_UNFIXED(mode) \
G_STMT_START { \
if (list) gst_tag_list_free (list); \
list = gst_tag_list_new (); \
list = gst_tag_list_new_empty (); \
gst_tag_list_add (list, GST_TAG_MERGE_APPEND, UTAG, UNFIXED1, \
UTAG, UNFIXED2, NULL); \
if (list2) gst_tag_list_free (list2); \
list2 = gst_tag_list_new (); \
list2 = gst_tag_list_new_empty (); \
gst_tag_list_add (list2, GST_TAG_MERGE_APPEND, UTAG, UNFIXED3,\
UTAG, UNFIXED4, NULL); \
if (merge) gst_tag_list_free (merge); \
@ -117,7 +117,7 @@ G_STMT_START { \
if (list) gst_tag_list_free (list); \
list = NULL; \
if (list2) gst_tag_list_free (list2); \
list2 = gst_tag_list_new (); \
list2 = gst_tag_list_new_empty (); \
gst_tag_list_add (list2, GST_TAG_MERGE_APPEND, FTAG, FIXED3, \
FTAG, FIXED4, NULL); \
if (merge) gst_tag_list_free (merge); \
@ -128,7 +128,7 @@ G_STMT_START { \
#define NEW_LISTS_EMPTY2(mode) \
G_STMT_START { \
if (list) gst_tag_list_free (list); \
list = gst_tag_list_new (); \
list = gst_tag_list_new_empty (); \
gst_tag_list_add (list, GST_TAG_MERGE_APPEND, FTAG, FIXED1, \
FTAG, FIXED2, NULL); \
if (list2) gst_tag_list_free (list2); \
@ -271,7 +271,7 @@ GST_START_TEST (test_date_tags)
gchar *str;
date = g_date_new_dmy (14, 10, 2005);
tag_list = gst_tag_list_new ();
tag_list = gst_tag_list_new_empty ();
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND, GST_TAG_DATE, date, NULL);
str = gst_tag_list_to_string (tag_list);
@ -304,7 +304,7 @@ GST_START_TEST (test_type)
{
GstTagList *taglist;
taglist = gst_tag_list_new ();
taglist = gst_tag_list_new_empty ();
fail_unless (GST_IS_TAG_LIST (taglist));
fail_unless (gst_is_tag_list (taglist));
gst_tag_list_free (taglist);
@ -317,7 +317,7 @@ GST_START_TEST (test_type)
/* check gst_tag_list_is_empty */
ASSERT_CRITICAL (gst_tag_list_is_empty (NULL));
taglist = gst_tag_list_new ();
taglist = gst_tag_list_new_empty ();
fail_unless (gst_tag_list_is_empty (taglist));
gst_tag_list_add (taglist, GST_TAG_MERGE_APPEND, GST_TAG_ARTIST, "JD", NULL);
fail_if (gst_tag_list_is_empty (taglist));
@ -331,7 +331,7 @@ GST_START_TEST (test_set_non_utf8_string)
GstTagList *taglist;
guint8 foobar[2] = { 0xff, 0x00 }; /* not UTF-8 */
taglist = gst_tag_list_new ();
taglist = gst_tag_list_new_empty ();
fail_unless (taglist != NULL);
ASSERT_WARNING (gst_tag_list_add (taglist, GST_TAG_MERGE_APPEND,
@ -350,7 +350,7 @@ GST_START_TEST (test_buffer_tags)
GstTagList *tags;
GstBuffer *buf1, *buf2;
tags = gst_tag_list_new ();
tags = gst_tag_list_new_empty ();
buf1 = gst_buffer_new_and_alloc (222);
buf2 = gst_buffer_new_and_alloc (100);
gst_tag_list_add (tags, GST_TAG_MERGE_APPEND, GST_TAG_IMAGE, buf1,
@ -393,7 +393,7 @@ GST_START_TEST (test_empty_tags)
if (GST_VERSION_NANO != 1)
return;
tags = gst_tag_list_new ();
tags = gst_tag_list_new_empty ();
ASSERT_WARNING (gst_tag_list_add (tags, GST_TAG_MERGE_APPEND,
GST_TAG_ARTIST, NULL, NULL));
ASSERT_WARNING (gst_tag_list_add (tags, GST_TAG_MERGE_APPEND,
@ -411,7 +411,7 @@ GST_START_TEST (test_new_full)
gdouble track_gain;
guint track_num;
tags = gst_tag_list_new_full (GST_TAG_ARTIST, "Arty Ist",
tags = gst_tag_list_new (GST_TAG_ARTIST, "Arty Ist",
GST_TAG_TRACK_NUMBER, 9, GST_TAG_TRACK_GAIN, 4.242, GST_TAG_TITLE,
"Title!", NULL);
@ -437,7 +437,7 @@ GST_START_TEST (test_merge_strings_with_comma)
GstTagList *tags;
gchar *artists = NULL;
tags = gst_tag_list_new ();
tags = gst_tag_list_new_empty ();
gst_tag_list_add (tags, GST_TAG_MERGE_APPEND, GST_TAG_ARTIST, "Foo", NULL);
gst_tag_list_add (tags, GST_TAG_MERGE_APPEND, GST_TAG_ARTIST, "Bar", NULL);
gst_tag_list_add (tags, GST_TAG_MERGE_APPEND, GST_TAG_ARTIST, "Yay", NULL);
@ -457,12 +457,12 @@ GST_START_TEST (test_equal)
{
GstTagList *tags, *tags2;
tags = gst_tag_list_new ();
tags = gst_tag_list_new_empty ();
gst_tag_list_add (tags, GST_TAG_MERGE_APPEND, GST_TAG_ARTIST, "Foo", NULL);
gst_tag_list_add (tags, GST_TAG_MERGE_APPEND, GST_TAG_ARTIST, "Bar", NULL);
gst_tag_list_add (tags, GST_TAG_MERGE_APPEND, GST_TAG_ARTIST, "Yay", NULL);
tags2 = gst_tag_list_new ();
tags2 = gst_tag_list_new_empty ();
fail_unless (!gst_tag_list_is_equal (tags2, tags));
gst_tag_list_add (tags2, GST_TAG_MERGE_APPEND, GST_TAG_ARTIST, "Yay", NULL);
fail_unless (!gst_tag_list_is_equal (tags2, tags));

View file

@ -90,13 +90,13 @@ GST_START_TEST (test_merge)
setter = GST_TAG_SETTER (enc);
list1 = gst_tag_list_new ();
list1 = gst_tag_list_new_empty ();
gst_tag_list_add (list1, GST_TAG_MERGE_APPEND, GST_TAG_ARTIST, "artist1",
NULL);
gst_tag_setter_merge_tags (setter, list1, GST_TAG_MERGE_APPEND);
assert_tag_setter_list_length (setter, 1);
list2 = gst_tag_list_new ();
list2 = gst_tag_list_new_empty ();
gst_tag_list_add (list2, GST_TAG_MERGE_APPEND, GST_TAG_ARTIST, "artist2",
GST_TAG_TITLE, "title1", NULL);
gst_tag_setter_merge_tags (setter, list2, GST_TAG_MERGE_APPEND);
@ -135,8 +135,8 @@ GST_START_TEST (test_merge_modes)
fail_unless (enc != NULL);
setter = GST_TAG_SETTER (enc);
list1 = gst_tag_list_new ();
list2 = gst_tag_list_new ();
list1 = gst_tag_list_new_empty ();
list2 = gst_tag_list_new_empty ();
/* i = 0: - -
* i = 1: list1 -
@ -185,8 +185,8 @@ GST_START_TEST (test_merge_modes_skip_empty)
fail_unless (enc != NULL);
setter = GST_TAG_SETTER (enc);
list1 = gst_tag_list_new ();
list2 = gst_tag_list_new ();
list1 = gst_tag_list_new_empty ();
list2 = gst_tag_list_new_empty ();
if (i == 1) {
gst_tag_list_add (list2, GST_TAG_MERGE_APPEND, GST_TAG_ARTIST,

View file

@ -491,7 +491,7 @@ GST_START_TEST (test_element_found_tags)
pipeline = gst_element_factory_make ("pipeline", NULL);
fakesrc = gst_element_factory_make ("fakesrc", NULL);
fakesink = gst_element_factory_make ("fakesink", NULL);
list = gst_tag_list_new ();
list = gst_tag_list_new_empty ();
g_object_set (fakesrc, "num-buffers", (int) 10, NULL);