From bc3c7aa05e426408d7b26a560c75ef2595816c32 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 4 Jan 2012 10:33:27 +0100 Subject: [PATCH] tests: make tests compile --- tests/check/elements/amrnbenc.c | 4 ++-- tests/check/elements/mpeg2dec.c | 4 ++-- tests/check/elements/x264enc.c | 10 +++++++--- tests/check/elements/xingmux.c | 24 +++++++++++++----------- tests/check/generic/states.c | 4 ++-- 5 files changed, 26 insertions(+), 20 deletions(-) diff --git a/tests/check/elements/amrnbenc.c b/tests/check/elements/amrnbenc.c index 72dc766184..e73fc06c9b 100644 --- a/tests/check/elements/amrnbenc.c +++ b/tests/check/elements/amrnbenc.c @@ -62,8 +62,8 @@ setup_amrnbenc (void) GST_DEBUG ("setup_amrnbenc"); amrnbenc = gst_check_setup_element ("amrnbenc"); - srcpad = gst_check_setup_src_pad (amrnbenc, &srctemplate, NULL); - sinkpad = gst_check_setup_sink_pad (amrnbenc, &sinktemplate, NULL); + srcpad = gst_check_setup_src_pad (amrnbenc, &srctemplate); + sinkpad = gst_check_setup_sink_pad (amrnbenc, &sinktemplate); gst_pad_set_active (srcpad, TRUE); gst_pad_set_active (sinkpad, TRUE); diff --git a/tests/check/elements/mpeg2dec.c b/tests/check/elements/mpeg2dec.c index 7bcf36e0d3..e69983f9c8 100644 --- a/tests/check/elements/mpeg2dec.c +++ b/tests/check/elements/mpeg2dec.c @@ -1345,8 +1345,8 @@ setup_mpeg2dec () GST_DEBUG ("setup_mpeg2dec"); mpeg2dec = gst_check_setup_element ("mpeg2dec"); - mysrcpad = gst_check_setup_src_pad (mpeg2dec, &srctemplate, NULL); - mysinkpad = gst_check_setup_sink_pad (mpeg2dec, &sinktemplate, NULL); + mysrcpad = gst_check_setup_src_pad (mpeg2dec, &srctemplate); + mysinkpad = gst_check_setup_sink_pad (mpeg2dec, &sinktemplate); gst_pad_set_active (mysrcpad, TRUE); gst_pad_set_active (mysinkpad, TRUE); diff --git a/tests/check/elements/x264enc.c b/tests/check/elements/x264enc.c index d83580e305..041a2ea15f 100644 --- a/tests/check/elements/x264enc.c +++ b/tests/check/elements/x264enc.c @@ -58,8 +58,8 @@ setup_x264enc (void) GST_DEBUG ("setup_x264enc"); x264enc = gst_check_setup_element ("x264enc"); - mysrcpad = gst_check_setup_src_pad (x264enc, &srctemplate, NULL); - mysinkpad = gst_check_setup_sink_pad (x264enc, &sinktemplate, NULL); + mysrcpad = gst_check_setup_src_pad (x264enc, &srctemplate); + mysinkpad = gst_check_setup_sink_pad (x264enc, &sinktemplate); gst_pad_set_active (mysrcpad, TRUE); gst_pad_set_active (mysinkpad, TRUE); @@ -231,6 +231,7 @@ GST_END_TEST; GstCaps *pad_caps; +#if 0 GstCaps * getcaps_test (GstPad * pad, GstCaps * filter) { @@ -239,6 +240,7 @@ getcaps_test (GstPad * pad, GstCaps * filter) else return gst_caps_intersect (pad_caps, filter); } +#endif GST_START_TEST (test_profile_in_caps) { @@ -251,7 +253,9 @@ GST_START_TEST (test_profile_in_caps) pad_caps = gst_caps_from_string (MPEG_CAPS_STRING); x264enc = setup_x264enc (); - gst_pad_set_getcaps_function (mysinkpad, getcaps_test); + gst_pad_set_caps (mysinkpad, pad_caps); + gst_pad_use_fixed_caps (mysinkpad); + srcpad = gst_element_get_static_pad (x264enc, "src"); sinkpad = gst_element_get_static_pad (x264enc, "sink"); fail_unless (gst_element_set_state (x264enc, diff --git a/tests/check/elements/xingmux.c b/tests/check/elements/xingmux.c index db1dbe88fa..d217077586 100644 --- a/tests/check/elements/xingmux.c +++ b/tests/check/elements/xingmux.c @@ -89,9 +89,8 @@ GST_START_TEST (test_xing_remux) "could not set to playing"); inbuffer = gst_buffer_new_and_alloc (sizeof (test_xing)); - memcpy (GST_BUFFER_DATA (inbuffer), test_xing, sizeof (test_xing)); + gst_buffer_fill (inbuffer, 0, test_xing, sizeof (test_xing)); - gst_buffer_set_caps (inbuffer, GST_PAD_CAPS (mysrcpad)); ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); /* pushing gives away my reference ... */ @@ -103,27 +102,30 @@ GST_START_TEST (test_xing_remux) verify_data = test_xing; for (it = buffers; it != NULL; it = it->next) { GstBuffer *outbuffer = (GstBuffer *) it->data; + gsize size; + guint8 *data; + + data = gst_buffer_map (outbuffer, &size, NULL, GST_MAP_READ); if (it == buffers) { gint j; /* Empty Xing header, should be the same as input data until the "Xing" marker * and zeroes afterwards. */ - fail_unless (memcmp (test_xing, GST_BUFFER_DATA (outbuffer), 25) == 0); - for (j = 26; j < GST_BUFFER_SIZE (outbuffer); j++) - fail_unless (GST_BUFFER_DATA (outbuffer)[j] == 0); - verify_data += GST_BUFFER_SIZE (outbuffer); + fail_unless (memcmp (data, test_xing, 25) == 0); + for (j = 26; j < size; j++) + fail_unless (data[j] == 0); + verify_data += size; } else if (it->next != NULL) { /* Should contain the raw MP3 data without changes */ - fail_unless (memcmp (verify_data, GST_BUFFER_DATA (outbuffer), - GST_BUFFER_SIZE (outbuffer)) == 0); - verify_data += GST_BUFFER_SIZE (outbuffer); + fail_unless (memcmp (data, verify_data, size) == 0); + verify_data += size; } else { /* Last buffer is the rewrite of the first buffer and should be exactly the same * as the old Xing header we had */ - fail_unless (memcmp (test_xing, GST_BUFFER_DATA (outbuffer), - GST_BUFFER_SIZE (outbuffer)) == 0); + fail_unless (memcmp (test_xing, data, size) == 0); } + gst_buffer_unmap (outbuffer, data, size); } /* cleanup */ diff --git a/tests/check/generic/states.c b/tests/check/generic/states.c index 4d80acce67..f60333abcb 100644 --- a/tests/check/generic/states.c +++ b/tests/check/generic/states.c @@ -45,7 +45,7 @@ setup () ignorelist = g_strsplit (STATE_IGNORE_ELEMENTS, " ", 0); } - plugins = gst_registry_get_plugin_list (gst_registry_get_default ()); + plugins = gst_registry_get_plugin_list (gst_registry_get ()); for (p = plugins; p; p = p->next) { GstPlugin *plugin = p->data; @@ -54,7 +54,7 @@ setup () continue; features = - gst_registry_get_feature_list_by_plugin (gst_registry_get_default (), + gst_registry_get_feature_list_by_plugin (gst_registry_get (), gst_plugin_get_name (plugin)); for (f = features; f; f = f->next) { -- 2.34.1