[gst-devel] request pad issue

Zoltan Seress gatesofdarkness at gmail.com
Wed Oct 22 17:19:21 CEST 2008


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

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20081022/8fe28464/attachment.htm>


More information about the gstreamer-devel mailing list