mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-03 14:08:56 +00:00
tests/check/elements/: Don't use gst_element_get_pad(), it's a bad, bad method.
Original commit message from CVS: * tests/check/elements/avimux.c: (setup_src_pad), (teardown_src_pad): * tests/check/elements/icydemux.c: (icydemux_found_pad), (GST_START_TEST): * tests/check/elements/matroskamux.c: (setup_src_pad), (teardown_src_pad), (setup_sink_pad), (teardown_sink_pad): * tests/check/elements/videocrop.c: (video_crop_get_test_caps), (GST_START_TEST): * tests/check/elements/wavpackparse.c: (wavpackparse_found_pad), (setup_wavpackparse), (cleanup_wavpackparse): Don't use gst_element_get_pad(), it's a bad, bad method.
This commit is contained in:
parent
487b784b4f
commit
707191104d
6 changed files with 33 additions and 15 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
||||||
|
2008-05-21 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||||
|
|
||||||
|
* tests/check/elements/avimux.c: (setup_src_pad),
|
||||||
|
(teardown_src_pad):
|
||||||
|
* tests/check/elements/icydemux.c: (icydemux_found_pad),
|
||||||
|
(GST_START_TEST):
|
||||||
|
* tests/check/elements/matroskamux.c: (setup_src_pad),
|
||||||
|
(teardown_src_pad), (setup_sink_pad), (teardown_sink_pad):
|
||||||
|
* tests/check/elements/videocrop.c: (video_crop_get_test_caps),
|
||||||
|
(GST_START_TEST):
|
||||||
|
* tests/check/elements/wavpackparse.c: (wavpackparse_found_pad),
|
||||||
|
(setup_wavpackparse), (cleanup_wavpackparse):
|
||||||
|
Don't use gst_element_get_pad(), it's a bad, bad method.
|
||||||
|
|
||||||
2008-05-21 Wim Taymans <wim.taymans@collabora.co.uk>
|
2008-05-21 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||||
|
|
||||||
* ext/gconf/gstgconfaudiosrc.c: (gst_gconf_audio_src_reset),
|
* ext/gconf/gstgconfaudiosrc.c: (gst_gconf_audio_src_reset),
|
||||||
|
|
|
@ -65,7 +65,8 @@ setup_src_pad (GstElement * element,
|
||||||
fail_if (srcpad == NULL, "Could not create a srcpad");
|
fail_if (srcpad == NULL, "Could not create a srcpad");
|
||||||
ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 1);
|
ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 1);
|
||||||
|
|
||||||
sinkpad = gst_element_get_pad (element, sinkname);
|
if (!(sinkpad = gst_element_get_static_pad (element, sinkname)))
|
||||||
|
sinkpad = gst_element_get_request_pad (element, sinkname);
|
||||||
fail_if (sinkpad == NULL, "Could not get sink pad from %s",
|
fail_if (sinkpad == NULL, "Could not get sink pad from %s",
|
||||||
GST_ELEMENT_NAME (element));
|
GST_ELEMENT_NAME (element));
|
||||||
/* references are owned by: 1) us, 2) avimux, 3) collect pads */
|
/* references are owned by: 1) us, 2) avimux, 3) collect pads */
|
||||||
|
@ -92,7 +93,8 @@ teardown_src_pad (GstElement * element, gchar * sinkname)
|
||||||
/* hm, avimux uses _00 as suffixes for padnames */
|
/* hm, avimux uses _00 as suffixes for padnames */
|
||||||
padname = g_strdup (sinkname);
|
padname = g_strdup (sinkname);
|
||||||
memcpy (strchr (padname, '%'), "00", 2);
|
memcpy (strchr (padname, '%'), "00", 2);
|
||||||
sinkpad = gst_element_get_pad (element, padname);
|
if (!(sinkpad = gst_element_get_static_pad (element, padname)))
|
||||||
|
sinkpad = gst_element_get_request_pad (element, padname);
|
||||||
g_free (padname);
|
g_free (padname);
|
||||||
/* pad refs held by 1) avimux 2) collectpads and 3) us (through _get) */
|
/* pad refs held by 1) avimux 2) collectpads and 3) us (through _get) */
|
||||||
ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 3);
|
ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 3);
|
||||||
|
|
|
@ -81,7 +81,7 @@ icydemux_found_pad (GstElement * src, GstPad * pad, gpointer data)
|
||||||
/* sinkpad = gst_check_setup_sink_pad (icydemux, &sinktemplate, NULL); */
|
/* sinkpad = gst_check_setup_sink_pad (icydemux, &sinktemplate, NULL); */
|
||||||
sinkpad = gst_pad_new_from_static_template (&sinktemplate, "sink");
|
sinkpad = gst_pad_new_from_static_template (&sinktemplate, "sink");
|
||||||
fail_if (sinkpad == NULL, "Couldn't create sinkpad");
|
fail_if (sinkpad == NULL, "Couldn't create sinkpad");
|
||||||
srcpad = gst_element_get_pad (icydemux, "src");
|
srcpad = gst_element_get_static_pad (icydemux, "src");
|
||||||
fail_if (srcpad == NULL, "Failed to get srcpad from icydemux");
|
fail_if (srcpad == NULL, "Failed to get srcpad from icydemux");
|
||||||
gst_pad_set_chain_function (sinkpad, gst_check_chain_func);
|
gst_pad_set_chain_function (sinkpad, gst_check_chain_func);
|
||||||
fail_unless (gst_pad_link (srcpad, sinkpad) == GST_PAD_LINK_OK,
|
fail_unless (gst_pad_link (srcpad, sinkpad) == GST_PAD_LINK_OK,
|
||||||
|
@ -206,12 +206,12 @@ GST_START_TEST (test_first_buf_offset_when_merged_for_typefinding)
|
||||||
push_data (buf1, G_N_ELEMENTS (buf1), icy_caps, 0);
|
push_data (buf1, G_N_ELEMENTS (buf1), icy_caps, 0);
|
||||||
|
|
||||||
/* one byte isn't really enough for typefinding, can't have a srcpad yet */
|
/* one byte isn't really enough for typefinding, can't have a srcpad yet */
|
||||||
fail_unless (gst_element_get_pad (icydemux, "src") == NULL);
|
fail_unless (gst_element_get_static_pad (icydemux, "src") == NULL);
|
||||||
|
|
||||||
push_data (buf2, G_N_ELEMENTS (buf2), icy_caps, -1);
|
push_data (buf2, G_N_ELEMENTS (buf2), icy_caps, -1);
|
||||||
|
|
||||||
/* should have been enough to create a audio/x-musepack source pad .. */
|
/* should have been enough to create a audio/x-musepack source pad .. */
|
||||||
icy_srcpad = gst_element_get_pad (icydemux, "src");
|
icy_srcpad = gst_element_get_static_pad (icydemux, "src");
|
||||||
fail_unless (icy_srcpad != NULL);
|
fail_unless (icy_srcpad != NULL);
|
||||||
gst_object_unref (icy_srcpad);
|
gst_object_unref (icy_srcpad);
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,8 @@ setup_src_pad (GstElement * element,
|
||||||
ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 1);
|
ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 1);
|
||||||
gst_pad_set_active (srcpad, TRUE);
|
gst_pad_set_active (srcpad, TRUE);
|
||||||
|
|
||||||
sinkpad = gst_element_get_pad (element, "audio_%d");
|
if (!(sinkpad = gst_element_get_static_pad (element, "audio_%d")))
|
||||||
|
sinkpad = gst_element_get_request_pad (element, "audio_%d");
|
||||||
fail_if (sinkpad == NULL, "Could not get sink pad from %s",
|
fail_if (sinkpad == NULL, "Could not get sink pad from %s",
|
||||||
GST_ELEMENT_NAME (element));
|
GST_ELEMENT_NAME (element));
|
||||||
/* references are owned by: 1) us, 2) matroskamux, 3) collect pads */
|
/* references are owned by: 1) us, 2) matroskamux, 3) collect pads */
|
||||||
|
@ -90,7 +91,8 @@ teardown_src_pad (GstElement * element)
|
||||||
GstPad *srcpad, *sinkpad;
|
GstPad *srcpad, *sinkpad;
|
||||||
|
|
||||||
/* clean up floating src pad */
|
/* clean up floating src pad */
|
||||||
sinkpad = gst_element_get_pad (element, "audio_0");
|
if (!(sinkpad = gst_element_get_static_pad (element, "audio_0")))
|
||||||
|
sinkpad = gst_element_get_request_pad (element, "audio_0");
|
||||||
ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 2);
|
ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 2);
|
||||||
srcpad = gst_pad_get_peer (sinkpad);
|
srcpad = gst_pad_get_peer (sinkpad);
|
||||||
|
|
||||||
|
@ -120,7 +122,7 @@ setup_sink_pad (GstElement * element, GstStaticPadTemplate * template,
|
||||||
fail_if (sinkpad == NULL, "Could not create a sinkpad");
|
fail_if (sinkpad == NULL, "Could not create a sinkpad");
|
||||||
gst_pad_set_active (sinkpad, TRUE);
|
gst_pad_set_active (sinkpad, TRUE);
|
||||||
|
|
||||||
srcpad = gst_element_get_pad (element, "src");
|
srcpad = gst_element_get_static_pad (element, "src");
|
||||||
fail_if (srcpad == NULL, "Could not get source pad from %s",
|
fail_if (srcpad == NULL, "Could not get source pad from %s",
|
||||||
GST_ELEMENT_NAME (element));
|
GST_ELEMENT_NAME (element));
|
||||||
if (caps)
|
if (caps)
|
||||||
|
@ -141,7 +143,7 @@ teardown_sink_pad (GstElement * element)
|
||||||
GstPad *srcpad, *sinkpad;
|
GstPad *srcpad, *sinkpad;
|
||||||
|
|
||||||
/* clean up floating sink pad */
|
/* clean up floating sink pad */
|
||||||
srcpad = gst_element_get_pad (element, "src");
|
srcpad = gst_element_get_static_pad (element, "src");
|
||||||
sinkpad = gst_pad_get_peer (srcpad);
|
sinkpad = gst_pad_get_peer (srcpad);
|
||||||
gst_pad_unlink (srcpad, sinkpad);
|
gst_pad_unlink (srcpad, sinkpad);
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ video_crop_get_test_caps (GstElement * videocrop)
|
||||||
GList *list = NULL;
|
GList *list = NULL;
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
srcpad = gst_element_get_pad (videocrop, "src");
|
srcpad = gst_element_get_static_pad (videocrop, "src");
|
||||||
fail_unless (srcpad != NULL);
|
fail_unless (srcpad != NULL);
|
||||||
allowed_caps = gst_pad_get_pad_template_caps (srcpad);
|
allowed_caps = gst_pad_get_pad_template_caps (srcpad);
|
||||||
fail_unless (allowed_caps != NULL);
|
fail_unless (allowed_caps != NULL);
|
||||||
|
@ -464,7 +464,7 @@ GST_START_TEST (test_passthrough)
|
||||||
|
|
||||||
g_object_set (ctx.src, "num-buffers", 1, NULL);
|
g_object_set (ctx.src, "num-buffers", 1, NULL);
|
||||||
|
|
||||||
srcpad = gst_element_get_pad (ctx.src, "src");
|
srcpad = gst_element_get_static_pad (ctx.src, "src");
|
||||||
fail_unless (srcpad != NULL);
|
fail_unless (srcpad != NULL);
|
||||||
gst_pad_add_buffer_probe (srcpad, G_CALLBACK (buffer_probe_cb), &gen_buf);
|
gst_pad_add_buffer_probe (srcpad, G_CALLBACK (buffer_probe_cb), &gen_buf);
|
||||||
gst_object_unref (srcpad);
|
gst_object_unref (srcpad);
|
||||||
|
|
|
@ -76,7 +76,7 @@ wavpackparse_found_pad (GstElement * src, GstPad * pad, gpointer data)
|
||||||
|
|
||||||
mysinkpad = gst_pad_new_from_static_template (&sinktemplate, "sink");
|
mysinkpad = gst_pad_new_from_static_template (&sinktemplate, "sink");
|
||||||
fail_if (mysinkpad == NULL, "Couldn't create sinkpad");
|
fail_if (mysinkpad == NULL, "Couldn't create sinkpad");
|
||||||
srcpad = gst_element_get_pad (wavpackparse, "src");
|
srcpad = gst_element_get_static_pad (wavpackparse, "src");
|
||||||
fail_if (srcpad == NULL, "Failed to get srcpad from wavpackparse");
|
fail_if (srcpad == NULL, "Failed to get srcpad from wavpackparse");
|
||||||
gst_pad_set_chain_function (mysinkpad, gst_check_chain_func);
|
gst_pad_set_chain_function (mysinkpad, gst_check_chain_func);
|
||||||
fail_unless (gst_pad_link (srcpad, mysinkpad) == GST_PAD_LINK_OK,
|
fail_unless (gst_pad_link (srcpad, mysinkpad) == GST_PAD_LINK_OK,
|
||||||
|
@ -98,7 +98,7 @@ setup_wavpackparse ()
|
||||||
mysrcpad = gst_pad_new_from_static_template (&srctemplate, "src");
|
mysrcpad = gst_pad_new_from_static_template (&srctemplate, "src");
|
||||||
fail_if (mysrcpad == NULL, "Could not create srcpad");
|
fail_if (mysrcpad == NULL, "Could not create srcpad");
|
||||||
|
|
||||||
sinkpad = gst_element_get_pad (wavpackparse, "sink");
|
sinkpad = gst_element_get_static_pad (wavpackparse, "sink");
|
||||||
fail_if (sinkpad == NULL, "Failed to get sinkpad from wavpackparse");
|
fail_if (sinkpad == NULL, "Failed to get sinkpad from wavpackparse");
|
||||||
fail_unless (gst_pad_link (mysrcpad, sinkpad) == GST_PAD_LINK_OK,
|
fail_unless (gst_pad_link (mysrcpad, sinkpad) == GST_PAD_LINK_OK,
|
||||||
"Failed to link pads");
|
"Failed to link pads");
|
||||||
|
@ -126,14 +126,14 @@ cleanup_wavpackparse ()
|
||||||
gst_element_set_bus (wavpackparse, NULL);
|
gst_element_set_bus (wavpackparse, NULL);
|
||||||
gst_object_unref (GST_OBJECT (bus));
|
gst_object_unref (GST_OBJECT (bus));
|
||||||
|
|
||||||
sinkpad = gst_element_get_pad (wavpackparse, "sink");
|
sinkpad = gst_element_get_static_pad (wavpackparse, "sink");
|
||||||
fail_if (sinkpad == NULL, "Failed to get sinkpad from wavpackparse");
|
fail_if (sinkpad == NULL, "Failed to get sinkpad from wavpackparse");
|
||||||
fail_unless (gst_pad_unlink (mysrcpad, sinkpad), "Failed to unlink pads");
|
fail_unless (gst_pad_unlink (mysrcpad, sinkpad), "Failed to unlink pads");
|
||||||
gst_pad_set_caps (mysrcpad, NULL);
|
gst_pad_set_caps (mysrcpad, NULL);
|
||||||
gst_object_unref (sinkpad);
|
gst_object_unref (sinkpad);
|
||||||
gst_object_unref (mysrcpad);
|
gst_object_unref (mysrcpad);
|
||||||
|
|
||||||
srcpad = gst_element_get_pad (wavpackparse, "src");
|
srcpad = gst_element_get_static_pad (wavpackparse, "src");
|
||||||
fail_if (srcpad == NULL, "Failed to get srcpad from wavpackparse");
|
fail_if (srcpad == NULL, "Failed to get srcpad from wavpackparse");
|
||||||
fail_unless (gst_pad_unlink (srcpad, mysinkpad), "Failed to unlink pads");
|
fail_unless (gst_pad_unlink (srcpad, mysinkpad), "Failed to unlink pads");
|
||||||
gst_pad_set_caps (mysinkpad, NULL);
|
gst_pad_set_caps (mysinkpad, NULL);
|
||||||
|
|
Loading…
Reference in a new issue