Get or query the capabilities in pad-added callback

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Get or query the capabilities in pad-added callback


In "Basic tutorial 3: Dynamic pipelines"
the pad-added callback checks the new pad's type with the following lines of

  new_pad_caps = gst_pad_query_caps (new_pad, NULL);
  new_pad_struct = gst_caps_get_structure (new_pad_caps, 0);
  new_pad_type = gst_structure_get_name (new_pad_struct);

The capabilities of the new pad is retrieved using gst_pad_query_caps(). Can
we use gst_pad_get_current_caps() instead to get the current caps of the pad
as follows?

  new_pad_caps = gst_pad_get_current_caps (new_pad);

What is the difference between gst_pad_query_caps() and
gst_pad_get_current_caps()? It seems that getting the caps is more precise
than querying the caps.

Is it better to use gst_pad_get_current_caps() first and then
gst_pad_query_caps() when needed as in gstplaybin2.c?

  caps = gst_pad_get_current_caps (pad);
  if (!caps)
    caps = gst_pad_query_caps (pad, NULL);

Thanks and Regards

Sent from:
gstreamer-devel mailing list
[hidden email]