g_warning ("can't find typefind element, decodebin will not work");
} else {
GstPad *pad, *gpad;
+ GstPadTemplate *pad_tmpl;
/* add the typefind element */
if (!gst_bin_add (GST_BIN (decode_bin), decode_bin->typefind)) {
/* get the sinkpad */
pad = gst_element_get_static_pad (decode_bin->typefind, "sink");
+ /* get the pad template */
+ pad_tmpl = gst_static_pad_template_get (&decoder_bin_sink_template);
+
/* ghost the sink pad to ourself */
- gpad = gst_ghost_pad_new_from_template ("sink", pad,
- gst_static_pad_template_get (&decoder_bin_sink_template));
+ gpad = gst_ghost_pad_new_from_template ("sink", pad, pad_tmpl);
gst_pad_set_active (gpad, TRUE);
gst_element_add_pad (GST_ELEMENT (decode_bin), gpad);
+ gst_object_unref (pad_tmpl);
gst_object_unref (pad);
/* connect a signal to find out when the typefind element found
} else {
GstPad *pad;
GstPad *gpad;
+ GstPadTemplate *pad_tmpl;
/* add the typefind element */
if (!gst_bin_add (GST_BIN (decode_bin), decode_bin->typefind)) {
/* get the sinkpad */
pad = gst_element_get_static_pad (decode_bin->typefind, "sink");
+ /* get the pad template */
+ pad_tmpl = gst_static_pad_template_get (&decoder_bin_sink_template);
+
/* ghost the sink pad to ourself */
- gpad = gst_ghost_pad_new_from_template ("sink", pad,
- gst_static_pad_template_get (&decoder_bin_sink_template));
+ gpad = gst_ghost_pad_new_from_template ("sink", pad, pad_tmpl);
gst_pad_set_active (gpad, TRUE);
gst_element_add_pad (GST_ELEMENT (decode_bin), gpad);
+ gst_object_unref (pad_tmpl);
gst_object_unref (pad);
/* connect a signal to find out when the typefind element found
gst_decode_pad_new (GstDecodeBin * dbin, GstPad * pad, GstDecodeChain * chain)
{
GstDecodePad *dpad;
+ GstPadTemplate *pad_tmpl;
GST_DEBUG_OBJECT (dbin, "making new decodepad");
+ pad_tmpl = gst_static_pad_template_get (&decoder_bin_src_template);
dpad =
g_object_new (GST_TYPE_DECODE_PAD, "direction", GST_PAD_DIRECTION (pad),
- "template", gst_static_pad_template_get (&decoder_bin_src_template),
+ "template", pad_tmpl,
NULL);
gst_ghost_pad_construct (GST_GHOST_PAD_CAST (dpad));
gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (dpad), pad);
dpad->chain = chain;
dpad->dbin = dbin;
+ gst_object_unref (pad_tmpl);
return dpad;
}
GstURIDecodeBin * decoder)
{
GstPad *newpad;
+ GstPadTemplate *pad_tmpl;
gchar *padname;
GST_DEBUG_OBJECT (element, "new decoded pad, name: <%s>. Last: %d",
decoder->numpads++;
GST_URI_DECODE_BIN_UNLOCK (decoder);
- newpad = gst_ghost_pad_new_from_template (padname, pad,
- gst_static_pad_template_get (&srctemplate));
+ pad_tmpl = gst_static_pad_template_get (&srctemplate);
+ newpad = gst_ghost_pad_new_from_template (padname, pad, pad_tmpl);
+ gst_object_unref (pad_tmpl);
g_free (padname);
/* store ref to the ghostpad so we can remove it */