[gst-devel] request pad issue

Wim Taymans wim.taymans at gmail.com
Wed Oct 22 17:52:13 CEST 2008


On Wed, 2008-10-22 at 17:19 +0200, Zoltan Seress wrote:
> 
> Hi!
> I have already had a look at tee, but at first sight it didn't seem so
> simple. Then I will give a second look.
> 
> I ran into a problem.
> 
> static GstStaticPadTemplate hikvision_src_template =
> GST_STATIC_PAD_TEMPLATE ("src%d",
>     GST_PAD_SRC,
>     GST_PAD_REQUEST,
>     GST_STATIC_CAPS_ANY);
> 
> base_init:
> gst_element_class_add_pad_template (element_class,
> gst_static_pad_template_get (&hikvision_src_template));
> 
> class_init:
> gstelement_class->request_new_pad = GST_DEBUG_FUNCPTR
> (gst_hikvision_src_request_new_pad);
> 
> static GstPad *
> gst_hikvision_src_request_new_pad (GstElement * element,
> GstPadTemplate * templ,
>     const gchar * unused)
> {
>     GstPad *srcpad;
>     gchar *name;
>     GstHikvisionSrc *hiksrc;
>     GstElementClass *klass;
>     
>     //g_return_val_if_fail (templ != NULL, NULL);
>     //g_return_val_if_fail (GST_HIKVISION_SRC (element), NULL);
>     
>     hiksrc = GST_HIKVISION_SRC (element);
>     klass = GST_ELEMENT_GET_CLASS (element);
> 
>     name = g_strdup_printf ("src%d", hiksrc->pad_counter++);
>     fprintf(stderr, "name: %s", name);
>     srcpad = gst_pad_new_from_template (templ, name);
>     g_free (name);
> 
>     gst_element_add_pad (element, srcpad);
>     
>     return srcpad;    
> }
> 
> If I do the request pad creation, I am given the following error
> message:
> 
> ** (gst-launch-0.10:24734): CRITICAL **: gst_base_src_init: assertion
> `pad_template != NULL' failed

You can't currently add request pads to basesrc. You will need to extend
your source from GstElement and copy the relevant basesrc code.

Wim

> 
> Although GST_DEBUG says that src0 is created and was succesfully
> linked with the sinkpad of the next element in the pipeline.
> 
> 
> If I define the pad template like this:
> 
> static GstStaticPadTemplate hikvision_src_template =
> GST_STATIC_PAD_TEMPLATE ("src",
>     GST_PAD_SRC,
>     GST_PAD_REQUEST,
>     GST_STATIC_CAPS_ANY);
> 
> And use it in the new_request_pad function like this:
> 
> srcpad = gst_pad_new_from_template (templ, "src");
> 
> In this case, there is no problem, but I need more pads with specific
> names. What can be the solution?
> 
> Thanks,
> Zoli
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________ gstreamer-devel mailing list gstreamer-devel at lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gstreamer-devel





More information about the gstreamer-devel mailing list