Search code examples
gstreamerpad

Gstreamer: How to link a request pad (sink) and static pad (source)


Trying to do the linking for tee to a queue. Here is what i do in the program codes

Program snippets /// create the tee pad template tee_src_pad_template = gst_element_class_get_pad_template (GST_ELEMENT_GET_CLASS (tee), "src_%u");

if(!tee_src_pad_template)
    g_print("thread Live: no tee_src_pad_template \n");

/// request the 2 pad
tee_pad = gst_element_request_pad (tee,
                                   tee_src_pad_template,
                                   NULL,
                                   NULL);
queue_pad = gst_element_get_static_pad (queue, "sink");

/// verify the object is created
if(!tee_pad)
    g_print(" no tee_pad \n");

if(!queue_pad)
    g_print("no queue_pad \n");

/// link the pads together
GstPadLinkReturn  ret  = gst_pad_link (tee_stream_pad, queue_stream_pad);
g_print(" Link return %d \n", ret);

The program compiles but there is error at the link pad stage, the value returned is -4

 Link return -4

Check out on the meaning of GstPadLinkReturn value. Just wonder what causes the following

GST_PAD_LINK_NOFORMAT (-4) – pads do not have common format

And what does it mean they do not have common format? Aren't they neutral linkers?

Regards


Solution

  • Manage to figure out the common problem as I linked the wrong element type

    GST_PAD_LINK_NOFORMAT (-4) – pads do not have common format
    

    means exactly what it is, that the pads type is compatible