1

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

user1538798
  • 1,075
  • 3
  • 17
  • 42

1 Answers1

0

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

user1538798
  • 1,075
  • 3
  • 17
  • 42
  • Ok, so how does one to get "compatible pad types" here? I have virtually the same code written as you started with. I'm not following how to link a tee pad to a queue pad. – BuvinJ Jun 06 '22 at 23:54
  • @BuvinJ I do not quite recall the answer...but do remember I have probably make a silly error... maybe i link a sink pad with a sink pad (using the wrong pad template..) ... or link to a wrong element (not a peer element).. something along the line....you can check the pad linking with gst_pad_can_link – user1538798 Jun 07 '22 at 02:56
  • Thanks for the response. I certainly understand not remembering all the details of something 6 months later! I assumed that not having a "common format" meant the "caps" don't align. Yet, it seemed that caps cannot be set on a queue? I did find, however, that I could use `gst_element_link` on those same tee and queue components (if I redesigned my code a bit), to avoid a call to `gst_pad_link`. That was confusing! I'm trying to move forward with my new approach, but wish I understood why my first failed. (I.e which closely resembles your post, and produced the same error) – BuvinJ Jun 07 '22 at 12:35
  • @buvinJ Maybe set the caps for the gst_element_request_pad? just throwing in ideas – user1538798 Jun 07 '22 at 14:41
  • Thanks for the suggestion! I did (sort of) solve the problem. I've come to believe that issue was that I had *downstream* elements with different caps. After unlinking some components which were bound to the other side of the queue, `gst_pad_link` worked between the tee the queue. I don't entirely understand why though. My best guess is that if the pipeline is going to fail *anywhere*, `gst_pad_link` is going to report an error? But that doesn't necessarily mean the two elements being *directly* linked are the incompatible pieces to the puzzle? – BuvinJ Jun 07 '22 at 14:53
  • @buvinj my guess is probably maybe caps negotiation went wrong... just thinking in your situation... probably read the log file or the dot diagram to see what went wrong – user1538798 Jun 08 '22 at 01:00