mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-20 04:56:24 +00:00
tests: don't use GstStructure API on tag lists
This commit is contained in:
parent
af7dc60479
commit
fa832bedb8
3 changed files with 13 additions and 34 deletions
|
@ -209,27 +209,6 @@ GST_START_TEST (test_musicbrainz_tag_registration)
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
||||||
/* is there an easier way to compare two structures / tagslists? */
|
|
||||||
static gboolean
|
|
||||||
taglists_are_equal (const GstTagList * list_1, const GstTagList * list_2)
|
|
||||||
{
|
|
||||||
GstCaps *c_list_1 = gst_caps_new_empty ();
|
|
||||||
GstCaps *c_list_2 = gst_caps_new_empty ();
|
|
||||||
gboolean ret;
|
|
||||||
|
|
||||||
gst_caps_append_structure (c_list_1,
|
|
||||||
gst_structure_copy ((GstStructure *) list_1));
|
|
||||||
gst_caps_append_structure (c_list_2,
|
|
||||||
gst_structure_copy ((GstStructure *) list_2));
|
|
||||||
|
|
||||||
ret = gst_caps_is_equal (c_list_2, c_list_1);
|
|
||||||
|
|
||||||
gst_caps_unref (c_list_1);
|
|
||||||
gst_caps_unref (c_list_2);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_START_TEST (test_vorbis_tags)
|
GST_START_TEST (test_vorbis_tags)
|
||||||
{
|
{
|
||||||
GstTagList *list;
|
GstTagList *list;
|
||||||
|
@ -347,7 +326,7 @@ GST_START_TEST (test_vorbis_tags)
|
||||||
vendor_id = NULL;
|
vendor_id = NULL;
|
||||||
|
|
||||||
GST_LOG ("new_list = %" GST_PTR_FORMAT, new_list);
|
GST_LOG ("new_list = %" GST_PTR_FORMAT, new_list);
|
||||||
fail_unless (taglists_are_equal (list, new_list));
|
fail_unless (gst_tag_list_is_equal (list, new_list));
|
||||||
|
|
||||||
buf2 = gst_tag_list_to_vorbiscomment_buffer (new_list,
|
buf2 = gst_tag_list_to_vorbiscomment_buffer (new_list,
|
||||||
(const guint8 *) "\003vorbis", 7, "libgstunittest");
|
(const guint8 *) "\003vorbis", 7, "libgstunittest");
|
||||||
|
@ -360,7 +339,7 @@ GST_START_TEST (test_vorbis_tags)
|
||||||
vendor_id = NULL;
|
vendor_id = NULL;
|
||||||
|
|
||||||
GST_LOG ("even_newer_list = %" GST_PTR_FORMAT, even_newer_list);
|
GST_LOG ("even_newer_list = %" GST_PTR_FORMAT, even_newer_list);
|
||||||
fail_unless (taglists_are_equal (new_list, even_newer_list));
|
fail_unless (gst_tag_list_is_equal (new_list, even_newer_list));
|
||||||
|
|
||||||
gst_tag_list_free (new_list);
|
gst_tag_list_free (new_list);
|
||||||
gst_tag_list_free (even_newer_list);
|
gst_tag_list_free (even_newer_list);
|
||||||
|
@ -466,14 +445,14 @@ GST_START_TEST (test_vorbis_tags)
|
||||||
fail_unless (vendor != NULL);
|
fail_unless (vendor != NULL);
|
||||||
fail_unless_equals_string (vendor, "foo");
|
fail_unless_equals_string (vendor, "foo");
|
||||||
fail_unless (list != NULL);
|
fail_unless (list != NULL);
|
||||||
fail_unless (gst_structure_n_fields ((GstStructure *) list) == 0);
|
fail_unless (gst_tag_list_n_tags (list) == 0);
|
||||||
g_free (vendor);
|
g_free (vendor);
|
||||||
gst_tag_list_free (list);
|
gst_tag_list_free (list);
|
||||||
|
|
||||||
/* now again without vendor */
|
/* now again without vendor */
|
||||||
list = gst_tag_list_from_vorbiscomment_buffer (buf, NULL, 0, NULL);
|
list = gst_tag_list_from_vorbiscomment_buffer (buf, NULL, 0, NULL);
|
||||||
fail_unless (list != NULL);
|
fail_unless (list != NULL);
|
||||||
fail_unless (gst_structure_n_fields ((GstStructure *) list) == 0);
|
fail_unless (gst_tag_list_n_tags (list) == 0);
|
||||||
gst_tag_list_free (list);
|
gst_tag_list_free (list);
|
||||||
|
|
||||||
gst_buffer_unref (buf);
|
gst_buffer_unref (buf);
|
||||||
|
@ -513,7 +492,7 @@ GST_START_TEST (test_vorbis_tags)
|
||||||
fail_unless (vendor != NULL);
|
fail_unless (vendor != NULL);
|
||||||
fail_unless_equals_string (vendor, "foo");
|
fail_unless_equals_string (vendor, "foo");
|
||||||
fail_unless (list != NULL);
|
fail_unless (list != NULL);
|
||||||
fail_unless (gst_structure_n_fields ((GstStructure *) list) == 1);
|
fail_unless (gst_tag_list_n_tags (list) == 1);
|
||||||
ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_ARTIST, "foo bar");
|
ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_ARTIST, "foo bar");
|
||||||
g_free (vendor);
|
g_free (vendor);
|
||||||
gst_tag_list_free (list);
|
gst_tag_list_free (list);
|
||||||
|
@ -522,7 +501,7 @@ GST_START_TEST (test_vorbis_tags)
|
||||||
list = gst_tag_list_from_vorbiscomment_buffer (buf,
|
list = gst_tag_list_from_vorbiscomment_buffer (buf,
|
||||||
(guint8 *) "\003vorbis", 7, NULL);
|
(guint8 *) "\003vorbis", 7, NULL);
|
||||||
fail_unless (list != NULL);
|
fail_unless (list != NULL);
|
||||||
fail_unless (gst_structure_n_fields ((GstStructure *) list) == 1);
|
fail_unless (gst_tag_list_n_tags (list) == 1);
|
||||||
ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_ARTIST, "foo bar");
|
ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_ARTIST, "foo bar");
|
||||||
gst_tag_list_free (list);
|
gst_tag_list_free (list);
|
||||||
|
|
||||||
|
@ -1054,7 +1033,7 @@ GST_START_TEST (test_xmp_parsing)
|
||||||
if (test_data[i].result_size >= 0) {
|
if (test_data[i].result_size >= 0) {
|
||||||
fail_unless (list != NULL);
|
fail_unless (list != NULL);
|
||||||
|
|
||||||
result_size = gst_structure_n_fields ((GstStructure *) list);
|
result_size = gst_tag_list_n_tags (list);
|
||||||
fail_unless (result_size == test_data[i].result_size);
|
fail_unless (result_size == test_data[i].result_size);
|
||||||
|
|
||||||
/* check the taglist content */
|
/* check the taglist content */
|
||||||
|
|
|
@ -1081,7 +1081,7 @@ update_streams (PlaybackApp * app)
|
||||||
for (i = 0; i < app->n_video; i++) {
|
for (i = 0; i < app->n_video; i++) {
|
||||||
g_signal_emit_by_name (app->pipeline, "get-video-tags", i, &tags);
|
g_signal_emit_by_name (app->pipeline, "get-video-tags", i, &tags);
|
||||||
if (tags) {
|
if (tags) {
|
||||||
str = gst_structure_to_string ((GstStructure *) tags);
|
str = gst_tag_list_to_string (tags);
|
||||||
g_print ("video %d: %s\n", i, str);
|
g_print ("video %d: %s\n", i, str);
|
||||||
g_free (str);
|
g_free (str);
|
||||||
}
|
}
|
||||||
|
@ -1100,7 +1100,7 @@ update_streams (PlaybackApp * app)
|
||||||
for (i = 0; i < app->n_audio; i++) {
|
for (i = 0; i < app->n_audio; i++) {
|
||||||
g_signal_emit_by_name (app->pipeline, "get-audio-tags", i, &tags);
|
g_signal_emit_by_name (app->pipeline, "get-audio-tags", i, &tags);
|
||||||
if (tags) {
|
if (tags) {
|
||||||
str = gst_structure_to_string ((GstStructure *) tags);
|
str = gst_tag_list_to_string (tags);
|
||||||
g_print ("audio %d: %s\n", i, str);
|
g_print ("audio %d: %s\n", i, str);
|
||||||
g_free (str);
|
g_free (str);
|
||||||
}
|
}
|
||||||
|
@ -1123,7 +1123,7 @@ update_streams (PlaybackApp * app)
|
||||||
if (tags) {
|
if (tags) {
|
||||||
const GValue *value;
|
const GValue *value;
|
||||||
|
|
||||||
str = gst_structure_to_string ((GstStructure *) tags);
|
str = gst_tag_list_to_string (tags);
|
||||||
g_print ("text %d: %s\n", i, str);
|
g_print ("text %d: %s\n", i, str);
|
||||||
g_free (str);
|
g_free (str);
|
||||||
|
|
||||||
|
|
|
@ -1814,7 +1814,7 @@ update_streams (GstPipeline * pipeline)
|
||||||
for (i = 0; i < n_video; i++) {
|
for (i = 0; i < n_video; i++) {
|
||||||
g_signal_emit_by_name (pipeline, "get-video-tags", i, &tags);
|
g_signal_emit_by_name (pipeline, "get-video-tags", i, &tags);
|
||||||
if (tags) {
|
if (tags) {
|
||||||
str = gst_structure_to_string ((GstStructure *) tags);
|
str = gst_tag_list_to_string (tags);
|
||||||
g_print ("video %d: %s\n", i, str);
|
g_print ("video %d: %s\n", i, str);
|
||||||
g_free (str);
|
g_free (str);
|
||||||
}
|
}
|
||||||
|
@ -1831,7 +1831,7 @@ update_streams (GstPipeline * pipeline)
|
||||||
for (i = 0; i < n_audio; i++) {
|
for (i = 0; i < n_audio; i++) {
|
||||||
g_signal_emit_by_name (pipeline, "get-audio-tags", i, &tags);
|
g_signal_emit_by_name (pipeline, "get-audio-tags", i, &tags);
|
||||||
if (tags) {
|
if (tags) {
|
||||||
str = gst_structure_to_string ((GstStructure *) tags);
|
str = gst_tag_list_to_string (tags);
|
||||||
g_print ("audio %d: %s\n", i, str);
|
g_print ("audio %d: %s\n", i, str);
|
||||||
g_free (str);
|
g_free (str);
|
||||||
}
|
}
|
||||||
|
@ -1852,7 +1852,7 @@ update_streams (GstPipeline * pipeline)
|
||||||
if (tags) {
|
if (tags) {
|
||||||
const GValue *value;
|
const GValue *value;
|
||||||
|
|
||||||
str = gst_structure_to_string ((GstStructure *) tags);
|
str = gst_tag_list_to_string (tags);
|
||||||
g_print ("text %d: %s\n", i, str);
|
g_print ("text %d: %s\n", i, str);
|
||||||
g_free (str);
|
g_free (str);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue