Get or query the capabilities in pad-added callback

jmz jmzheng at gmail.com
Mon Mar 19 06:42:05 UTC 2018


Hi,

In "Basic tutorial 3: Dynamic pipelines"
https://gstreamer.freedesktop.org/documentation/tutorials/basic/dynamic-pipelines.html
the pad-added callback checks the new pad's type with the following lines of
code.

  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: http://gstreamer-devel.966125.n4.nabble.com/


More information about the gstreamer-devel mailing list