mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-28 19:20:35 +00:00
libs/gst/check/gstcheck.*: Also setup request pads and allow setup pads by name (#537812)
Original commit message from CVS: * libs/gst/check/gstcheck.c: * libs/gst/check/gstcheck.h: Also setup request pads and allow setup pads by name (#537812) API: gst_check_setup_src_pad_by_name API: gst_check_setup_sink_pad_by_name
This commit is contained in:
parent
fdca1e654d
commit
46b1c45181
3 changed files with 42 additions and 6 deletions
|
@ -1,3 +1,11 @@
|
|||
2008-06-21 Thijs Vermeir <thijsvermeir@gmail.com>
|
||||
|
||||
* libs/gst/check/gstcheck.c:
|
||||
* libs/gst/check/gstcheck.h:
|
||||
Also setup request pads and allow setup pads by name (#537812)
|
||||
API: gst_check_setup_src_pad_by_name
|
||||
API: gst_check_setup_sink_pad_by_name
|
||||
|
||||
2008-06-20 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* tests/check/gst/gstbuffer.c:
|
||||
|
|
|
@ -261,6 +261,18 @@ gst_check_teardown_element (GstElement * element)
|
|||
GstPad *
|
||||
gst_check_setup_src_pad (GstElement * element,
|
||||
GstStaticPadTemplate * template, GstCaps * caps)
|
||||
{
|
||||
GstPad *srcpad;
|
||||
|
||||
srcpad = gst_check_setup_src_pad_by_name (element, template, "sink");
|
||||
if (caps)
|
||||
fail_unless (gst_pad_set_caps (srcpad, caps), "could not set caps on pad");
|
||||
return srcpad;
|
||||
}
|
||||
|
||||
GstPad *
|
||||
gst_check_setup_src_pad_by_name (GstElement * element,
|
||||
GstStaticPadTemplate * template, gchar * name)
|
||||
{
|
||||
GstPad *srcpad, *sinkpad;
|
||||
|
||||
|
@ -270,12 +282,12 @@ gst_check_setup_src_pad (GstElement * element,
|
|||
fail_if (srcpad == NULL, "Could not create a srcpad");
|
||||
ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 1);
|
||||
|
||||
sinkpad = gst_element_get_static_pad (element, "sink");
|
||||
sinkpad = gst_element_get_static_pad (element, name);
|
||||
if (sinkpad == NULL)
|
||||
sinkpad = gst_element_get_request_pad (element, name);
|
||||
fail_if (sinkpad == NULL, "Could not get sink pad from %s",
|
||||
GST_ELEMENT_NAME (element));
|
||||
ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 2);
|
||||
if (caps)
|
||||
fail_unless (gst_pad_set_caps (srcpad, caps), "could not set caps on pad");
|
||||
fail_unless (gst_pad_link (srcpad, sinkpad) == GST_PAD_LINK_OK,
|
||||
"Could not link source and %s sink pads", GST_ELEMENT_NAME (element));
|
||||
gst_object_unref (sinkpad); /* because we got it higher up */
|
||||
|
@ -315,6 +327,18 @@ gst_check_teardown_src_pad (GstElement * element)
|
|||
GstPad *
|
||||
gst_check_setup_sink_pad (GstElement * element, GstStaticPadTemplate * template,
|
||||
GstCaps * caps)
|
||||
{
|
||||
GstPad *sinkpad;
|
||||
|
||||
sinkpad = gst_check_setup_sink_pad_by_name (element, template, "src");
|
||||
if (caps)
|
||||
fail_unless (gst_pad_set_caps (sinkpad, caps), "Could not set pad caps");
|
||||
return sinkpad;
|
||||
}
|
||||
|
||||
GstPad *
|
||||
gst_check_setup_sink_pad_by_name (GstElement * element,
|
||||
GstStaticPadTemplate * template, gchar * name)
|
||||
{
|
||||
GstPad *srcpad, *sinkpad;
|
||||
|
||||
|
@ -323,11 +347,11 @@ gst_check_setup_sink_pad (GstElement * element, GstStaticPadTemplate * template,
|
|||
GST_DEBUG_OBJECT (element, "setting up receiving pad %p", sinkpad);
|
||||
fail_if (sinkpad == NULL, "Could not create a sinkpad");
|
||||
|
||||
srcpad = gst_element_get_static_pad (element, "src");
|
||||
srcpad = gst_element_get_static_pad (element, name);
|
||||
if (srcpad == NULL)
|
||||
srcpad = gst_element_get_request_pad (element, name);
|
||||
fail_if (srcpad == NULL, "Could not get source pad from %s",
|
||||
GST_ELEMENT_NAME (element));
|
||||
if (caps)
|
||||
fail_unless (gst_pad_set_caps (sinkpad, caps), "Could not set pad caps");
|
||||
gst_pad_set_chain_function (sinkpad, gst_check_chain_func);
|
||||
|
||||
GST_DEBUG_OBJECT (element, "Linking element src pad and receiving sink pad");
|
||||
|
|
|
@ -73,6 +73,10 @@ GstElement *gst_check_setup_element (const gchar * factory);
|
|||
void gst_check_teardown_element (GstElement * element);
|
||||
GstPad *gst_check_setup_src_pad (GstElement * element,
|
||||
GstStaticPadTemplate * template, GstCaps * caps);
|
||||
GstPad * gst_check_setup_src_pad_by_name (GstElement * element,
|
||||
GstStaticPadTemplate * template, gchar *name);
|
||||
GstPad * gst_check_setup_sink_pad_by_name (GstElement * element,
|
||||
GstStaticPadTemplate * template, gchar *name);
|
||||
void gst_check_teardown_src_pad (GstElement * element);
|
||||
void gst_check_drop_buffers ();
|
||||
void gst_check_caps_equal (GstCaps * caps1, GstCaps * caps2);
|
||||
|
|
Loading…
Reference in a new issue