tests: improve tagmux tests

This commit is contained in:
Wim Taymans 2012-02-07 10:47:19 +01:00
parent 819865ea54
commit 412510d6ed
2 changed files with 18 additions and 62 deletions

View file

@ -235,33 +235,6 @@ got_buffer (GstElement * fakesink, GstBuffer * buf, GstPad * pad,
gst_buffer_unmap (buf, &map);
}
static void
demux_pad_added (GstElement * apedemux, GstPad * srcpad, GstBuffer ** p_outbuf)
{
GstElement *fakesink, *pipeline;
GstCaps *caps;
caps = gst_pad_get_current_caps (srcpad);
GST_LOG ("apedemux added source pad with caps %" GST_PTR_FORMAT, caps);
gst_caps_unref (caps);
pipeline = apedemux;
while (GST_OBJECT_PARENT (pipeline) != NULL)
pipeline = (GstElement *) GST_OBJECT_PARENT (pipeline);
fakesink = gst_element_factory_make ("fakesink", "fakesink");
g_assert (fakesink != NULL);
/* set up sink */
g_object_set (fakesink, "signal-handoffs", TRUE, NULL);
g_signal_connect (fakesink, "handoff", G_CALLBACK (got_buffer), p_outbuf);
gst_bin_add (GST_BIN (pipeline), fakesink);
gst_element_set_state (fakesink, GST_STATE_PLAYING);
fail_unless (gst_element_link (apedemux, fakesink));
}
static void
test_taglib_apev2mux_check_output_buffer (GstBuffer * buf)
{
@ -283,7 +256,7 @@ test_taglib_apev2mux_with_tags (GstTagList * tags, guint32 mask)
{
GstMessage *msg;
GstTagList *tags_read = NULL;
GstElement *pipeline, *apev2mux, *apedemux, *fakesrc;
GstElement *pipeline, *apev2mux, *apedemux, *fakesrc, *fakesink;
GstBus *bus;
guint64 offset;
GstBuffer *outbuf = NULL;
@ -300,18 +273,23 @@ test_taglib_apev2mux_with_tags (GstTagList * tags, guint32 mask)
apedemux = gst_element_factory_make ("apedemux", "apedemux");
g_assert (apedemux != NULL);
fakesink = gst_element_factory_make ("fakesink", "fakesink");
g_assert (fakesink != NULL);
/* set up sink */
outbuf = NULL;
g_signal_connect (apedemux, "pad-added",
G_CALLBACK (demux_pad_added), &outbuf);
g_object_set (fakesink, "signal-handoffs", TRUE, NULL);
g_signal_connect (fakesink, "handoff", G_CALLBACK (got_buffer), &outbuf);
gst_bin_add (GST_BIN (pipeline), fakesrc);
gst_bin_add (GST_BIN (pipeline), apev2mux);
gst_bin_add (GST_BIN (pipeline), apedemux);
gst_bin_add (GST_BIN (pipeline), fakesink);
gst_tag_setter_merge_tags (GST_TAG_SETTER (apev2mux), tags,
GST_TAG_MERGE_APPEND);
gst_element_link_many (fakesrc, apev2mux, apedemux, NULL);
gst_element_link_many (fakesrc, apev2mux, apedemux, fakesink, NULL);
/* set up source */
g_object_set (fakesrc, "signal-handoffs", TRUE, "can-activate-pull", FALSE,

View file

@ -321,33 +321,6 @@ got_buffer (GstElement * fakesink, GstBuffer * buf, GstPad * pad,
gst_buffer_unmap (buf, &map);
}
static void
demux_pad_added (GstElement * id3demux, GstPad * srcpad, GstBuffer ** p_outbuf)
{
GstElement *fakesink, *pipeline;
GstCaps *caps;
caps = gst_pad_get_current_caps (srcpad);
GST_LOG ("id3demux added source pad with caps %" GST_PTR_FORMAT, caps);
gst_caps_unref (caps);
pipeline = id3demux;
while (GST_OBJECT_PARENT (pipeline) != NULL)
pipeline = (GstElement *) GST_OBJECT_PARENT (pipeline);
fakesink = gst_element_factory_make ("fakesink", "fakesink");
g_assert (fakesink != NULL);
/* set up sink */
g_object_set (fakesink, "signal-handoffs", TRUE, NULL);
g_signal_connect (fakesink, "handoff", G_CALLBACK (got_buffer), p_outbuf);
gst_bin_add (GST_BIN (pipeline), fakesink);
gst_element_set_state (fakesink, GST_STATE_PLAYING);
fail_unless (gst_element_link (id3demux, fakesink));
}
static void
test_taglib_id3mux_check_output_buffer (GstBuffer * buf)
{
@ -377,7 +350,7 @@ test_taglib_id3mux_with_tags (GstTagList * tags, guint32 mask)
{
GstMessage *msg;
GstTagList *tags_read = NULL;
GstElement *pipeline, *id3mux, *id3demux, *fakesrc, *identity;
GstElement *pipeline, *id3mux, *id3demux, *fakesrc, *identity, *fakesink;
GstBus *bus;
guint64 offset;
GstBuffer *outbuf = NULL;
@ -399,19 +372,24 @@ test_taglib_id3mux_with_tags (GstTagList * tags, guint32 mask)
id3demux = gst_element_factory_make ("id3demux", "id3demux");
g_assert (id3demux != NULL);
fakesink = gst_element_factory_make ("fakesink", "fakesink");
g_assert (fakesink != NULL);
/* set up sink */
outbuf = NULL;
g_signal_connect (id3demux, "pad-added",
G_CALLBACK (demux_pad_added), &outbuf);
g_object_set (fakesink, "signal-handoffs", TRUE, NULL);
g_signal_connect (fakesink, "handoff", G_CALLBACK (got_buffer), &outbuf);
gst_bin_add (GST_BIN (pipeline), fakesrc);
gst_bin_add (GST_BIN (pipeline), id3mux);
gst_bin_add (GST_BIN (pipeline), identity);
gst_bin_add (GST_BIN (pipeline), id3demux);
gst_bin_add (GST_BIN (pipeline), fakesink);
gst_tag_setter_merge_tags (GST_TAG_SETTER (id3mux), tags,
GST_TAG_MERGE_APPEND);
gst_element_link_many (fakesrc, id3mux, identity, id3demux, NULL);
gst_element_link_many (fakesrc, id3mux, identity, id3demux, fakesink, NULL);
/* set up source */
g_object_set (fakesrc, "signal-handoffs", TRUE, "can-activate-pull", FALSE,