check: Add new API to set up pads from non-static pad templates

This commit is contained in:
Sebastian Dröge 2014-04-15 12:58:59 +02:00
parent 3e340ea655
commit 917a033d04
3 changed files with 90 additions and 4 deletions

View file

@ -82,9 +82,13 @@ LIBGSTCHECK_EXPORTED_FUNCS = \
gst_check_setup_events \ gst_check_setup_events \
gst_check_setup_events_with_stream_id \ gst_check_setup_events_with_stream_id \
gst_check_setup_sink_pad \ gst_check_setup_sink_pad \
gst_check_setup_sink_pad_from_template \
gst_check_setup_sink_pad_by_name \ gst_check_setup_sink_pad_by_name \
gst_check_setup_sink_pad_by_name_from_templ \
gst_check_setup_src_pad \ gst_check_setup_src_pad \
gst_check_setup_src_pad_from_template \
gst_check_setup_src_pad_by_name \ gst_check_setup_src_pad_by_name \
gst_check_setup_src_pad_by_name_from_template \
gst_check_teardown_element \ gst_check_teardown_element \
gst_check_teardown_pad_by_name \ gst_check_teardown_pad_by_name \
gst_check_teardown_sink_pad \ gst_check_teardown_sink_pad \

View file

@ -262,11 +262,48 @@ gst_check_setup_src_pad (GstElement * element, GstStaticPadTemplate * tmpl)
GstPad * GstPad *
gst_check_setup_src_pad_by_name (GstElement * element, gst_check_setup_src_pad_by_name (GstElement * element,
GstStaticPadTemplate * tmpl, const gchar * name) GstStaticPadTemplate * tmpl, const gchar * name)
{
GstPadTemplate *ptmpl = gst_static_pad_template_get (tmpl);
GstPad *srcpad;
srcpad =
gst_check_setup_src_pad_by_name_from_template (element, ptmpl, "sink");
gst_object_unref (ptmpl);
return srcpad;
}
/**
* gst_check_setup_src_pad_from_template:
* @element: element to setup pad on
* @tmpl: pad template
*
* Returns: (transfer full): a new pad
*/
GstPad *
gst_check_setup_src_pad_from_template (GstElement * element,
GstPadTemplate * tmpl)
{
return gst_check_setup_src_pad_by_name_from_template (element, tmpl, "sink");
}
/**
* gst_check_setup_src_pad_by_name_from_template:
* @element: element to setup pad on
* @tmpl: pad template
* @name: name
*
* Returns: (transfer full): a new pad
*/
GstPad *
gst_check_setup_src_pad_by_name_from_template (GstElement * element,
GstPadTemplate * tmpl, const gchar * name)
{ {
GstPad *srcpad, *sinkpad; GstPad *srcpad, *sinkpad;
/* sending pad */ /* sending pad */
srcpad = gst_pad_new_from_static_template (tmpl, "src"); srcpad = gst_pad_new_from_template (tmpl, "src");
GST_DEBUG_OBJECT (element, "setting up sending pad %p", srcpad); GST_DEBUG_OBJECT (element, "setting up sending pad %p", srcpad);
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);
@ -348,11 +385,48 @@ gst_check_setup_sink_pad (GstElement * element, GstStaticPadTemplate * tmpl)
GstPad * GstPad *
gst_check_setup_sink_pad_by_name (GstElement * element, gst_check_setup_sink_pad_by_name (GstElement * element,
GstStaticPadTemplate * tmpl, const gchar * name) GstStaticPadTemplate * tmpl, const gchar * name)
{
GstPadTemplate *ptmpl = gst_static_pad_template_get (tmpl);
GstPad *sinkpad;
sinkpad =
gst_check_setup_sink_pad_by_name_from_template (element, ptmpl, "src");
gst_object_unref (ptmpl);
return sinkpad;
}
/**
* gst_check_setup_sink_pad_from_template:
* @element: element to setup pad on
* @tmpl: pad template
*
* Returns: (transfer full): a new pad
*/
GstPad *
gst_check_setup_sink_pad_from_template (GstElement * element,
GstPadTemplate * tmpl)
{
return gst_check_setup_sink_pad_by_name_from_template (element, tmpl, "src");
}
/**
* gst_check_setup_sink_pad_by_name_from_template:
* @element: element to setup pad on
* @tmpl: pad template
* @name: name
*
* Returns: (transfer full): a new pad
*/
GstPad *
gst_check_setup_sink_pad_by_name_from_template (GstElement * element,
GstPadTemplate * tmpl, const gchar * name)
{ {
GstPad *srcpad, *sinkpad; GstPad *srcpad, *sinkpad;
/* receiving pad */ /* receiving pad */
sinkpad = gst_pad_new_from_static_template (tmpl, "sink"); sinkpad = gst_pad_new_from_template (tmpl, "sink");
GST_DEBUG_OBJECT (element, "setting up receiving pad %p", sinkpad); GST_DEBUG_OBJECT (element, "setting up receiving pad %p", sinkpad);
fail_if (sinkpad == NULL, "Could not create a sinkpad"); fail_if (sinkpad == NULL, "Could not create a sinkpad");

View file

@ -73,10 +73,20 @@ GstElement *gst_check_setup_element (const gchar * factory);
void gst_check_teardown_element (GstElement * element); void gst_check_teardown_element (GstElement * element);
GstPad *gst_check_setup_src_pad (GstElement * element, GstPad *gst_check_setup_src_pad (GstElement * element,
GstStaticPadTemplate * tmpl); GstStaticPadTemplate * tmpl);
GstPad *gst_check_setup_src_pad_from_template (GstElement * element,
GstPadTemplate * tmpl);
GstPad * gst_check_setup_src_pad_by_name (GstElement * element, GstPad * gst_check_setup_src_pad_by_name (GstElement * element,
GstStaticPadTemplate * tmpl, const gchar *name); GstStaticPadTemplate * tmpl, const gchar *name);
GstPad * gst_check_setup_src_pad_by_name_from_template (GstElement * element,
GstPadTemplate * tmpl, const gchar *name);
GstPad *gst_check_setup_sink_pad (GstElement * element,
GstStaticPadTemplate * tmpl);
GstPad *gst_check_setup_sink_pad_from_template (GstElement * element,
GstPadTemplate * tmpl);
GstPad * gst_check_setup_sink_pad_by_name (GstElement * element, GstPad * gst_check_setup_sink_pad_by_name (GstElement * element,
GstStaticPadTemplate * tmpl, const gchar *name); GstStaticPadTemplate * tmpl, const gchar *name);
GstPad * gst_check_setup_sink_pad_by_name_from_template (GstElement * element,
GstPadTemplate * tmpl, const gchar *name);
void gst_check_teardown_pad_by_name (GstElement * element, const gchar *name); void gst_check_teardown_pad_by_name (GstElement * element, const gchar *name);
void gst_check_teardown_src_pad (GstElement * element); void gst_check_teardown_src_pad (GstElement * element);
void gst_check_drop_buffers (void); void gst_check_drop_buffers (void);
@ -88,8 +98,6 @@ void gst_check_element_push_buffer_list (const gchar * element_name,
void gst_check_element_push_buffer (const gchar * element_name, void gst_check_element_push_buffer (const gchar * element_name,
GstBuffer * buffer_in, GstCaps * caps_in, GstBuffer * buffer_out, GstBuffer * buffer_in, GstCaps * caps_in, GstBuffer * buffer_out,
GstCaps *caps_out); GstCaps *caps_out);
GstPad *gst_check_setup_sink_pad (GstElement * element,
GstStaticPadTemplate * tmpl);
void gst_check_teardown_sink_pad (GstElement * element); void gst_check_teardown_sink_pad (GstElement * element);
void gst_check_abi_list (GstCheckABIStruct list[], gboolean have_abi_sizes); void gst_check_abi_list (GstCheckABIStruct list[], gboolean have_abi_sizes);
gint gst_check_run_suite (Suite * suite, const gchar * name, gint gst_check_run_suite (Suite * suite, const gchar * name,