+2005-11-16 Thomas Vander Stichele <thomas at apestaart dot org>
+
+ * gst/gstpad.c: (gst_pad_new_from_static_template):
+ * gst/gstpad.h:
+ add gst_pad_new_from_static_template functions
+ * gst/check/gstcheck.c: (gst_check_setup_src_pad),
+ (gst_check_setup_sink_pad):
+ * gst/elements/gsttee.c: (gst_tee_init):
+ and use them
+
2005-11-16 Wim Taymans <wim@fluendo.com>
* gst/gstpad.c: (gst_pad_pause_task):
- Removed warning, it's not realy an error either.
+ Removed warning, it's not really an error either.
2005-11-16 Wim Taymans <wim@fluendo.com>
*/
GstPad *
gst_check_setup_src_pad (GstElement * element,
- GstStaticPadTemplate * srctemplate, GstCaps * caps)
+ GstStaticPadTemplate * template, GstCaps * caps)
{
GstPad *srcpad, *sinkpad;
GST_DEBUG_OBJECT (element, "setting up sending pad");
/* sending pad */
- srcpad =
- gst_pad_new_from_template (gst_static_pad_template_get (srctemplate),
- "src");
+ srcpad = gst_pad_new_from_static_template (template, "src");
fail_if (srcpad == NULL, "Could not create a srcpad");
ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 1);
GST_DEBUG_OBJECT (element, "setting up receiving pad");
/* receiving pad */
- sinkpad =
- gst_pad_new_from_template (gst_static_pad_template_get (template),
- "sink");
+ sinkpad = gst_pad_new_from_static_template (template, "sink");
fail_if (sinkpad == NULL, "Could not create a sinkpad");
srcpad = gst_element_get_pad (element, "src");
static void
gst_tee_init (GstTee * tee, GstTeeClass * g_class)
{
- GstPadTemplate *templ = gst_static_pad_template_get (&sinktemplate);
-
- tee->sinkpad = gst_pad_new_from_template (templ, "sink");
- gst_object_unref (templ);
+ tee->sinkpad = gst_pad_new_from_static_template (&sinktemplate, "sink");
gst_pad_set_setcaps_function (tee->sinkpad,
GST_DEBUG_FUNCPTR (gst_pad_proxy_setcaps));
gst_pad_set_getcaps_function (tee->sinkpad,
}
/**
+ * gst_pad_new_from_static_template:
+ * @templ: the #GstStaticPadTemplate to use
+ * @name: the name of the element
+ *
+ * Creates a new pad with the given name from the given static template.
+ * If name is NULL, a guaranteed unique name (across all pads)
+ * will be assigned.
+ * This function makes a copy of the name so you can safely free the name.
+ *
+ * Returns: a new #GstPad, or NULL in case of an error.
+ */
+GstPad *
+gst_pad_new_from_static_template (GstStaticPadTemplate * templ,
+ const gchar * name)
+{
+ GstPad *pad;
+ GstPadTemplate *template;
+
+ template = gst_static_pad_template_get (templ);
+ pad = gst_pad_new_from_template (template, name);
+ gst_object_unref (template);
+ return pad;
+}
+
+/**
* gst_pad_get_direction:
* @pad: a #GstPad to get the direction of.
*
/* creating pads */
GstPad* gst_pad_new (const gchar *name, GstPadDirection direction);
GstPad* gst_pad_new_from_template (GstPadTemplate *templ, const gchar *name);
+GstPad* gst_pad_new_from_static_template (GstStaticPadTemplate *templ, const gchar *name);
+
/**
* gst_pad_get_name:
*/
GstPad *
gst_check_setup_src_pad (GstElement * element,
- GstStaticPadTemplate * srctemplate, GstCaps * caps)
+ GstStaticPadTemplate * template, GstCaps * caps)
{
GstPad *srcpad, *sinkpad;
GST_DEBUG_OBJECT (element, "setting up sending pad");
/* sending pad */
- srcpad =
- gst_pad_new_from_template (gst_static_pad_template_get (srctemplate),
- "src");
+ srcpad = gst_pad_new_from_static_template (template, "src");
fail_if (srcpad == NULL, "Could not create a srcpad");
ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 1);
GST_DEBUG_OBJECT (element, "setting up receiving pad");
/* receiving pad */
- sinkpad =
- gst_pad_new_from_template (gst_static_pad_template_get (template),
- "sink");
+ sinkpad = gst_pad_new_from_static_template (template, "sink");
fail_if (sinkpad == NULL, "Could not create a sinkpad");
srcpad = gst_element_get_pad (element, "src");
static void
gst_tee_init (GstTee * tee, GstTeeClass * g_class)
{
- GstPadTemplate *templ = gst_static_pad_template_get (&sinktemplate);
-
- tee->sinkpad = gst_pad_new_from_template (templ, "sink");
- gst_object_unref (templ);
+ tee->sinkpad = gst_pad_new_from_static_template (&sinktemplate, "sink");
gst_pad_set_setcaps_function (tee->sinkpad,
GST_DEBUG_FUNCPTR (gst_pad_proxy_setcaps));
gst_pad_set_getcaps_function (tee->sinkpad,