}
/* Check the new pad's type */
- new_pad_caps = gst_pad_query_caps (new_pad, NULL);
+ new_pad_caps = gst_pad_get_current_caps (new_pad);
new_pad_struct = gst_caps_get_structure (new_pad_caps, 0);
new_pad_type = gst_structure_get_name (new_pad_struct);
if (!g_str_has_prefix (new_pad_type, "audio/x-raw")) {
}
/* Check the new pad's type */
- new_pad_caps = gst_pad_query_caps (new_pad, NULL);
+ new_pad_caps = gst_pad_get_current_caps (new_pad);
new_pad_struct = gst_caps_get_structure (new_pad_caps, 0);
new_pad_type = gst_structure_get_name (new_pad_struct);
if (!g_str_has_prefix (new_pad_type, "audio/x-raw")) {
``` c
/* Check the new pad's type */
-new_pad_caps = gst_pad_query_caps (new_pad, NULL);
+new_pad_caps = gst_pad_get_current_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);
if (!g_str_has_prefix (new_pad_type, "audio/x-raw")) {
`audioconvert` linked with an `autoaudiosink`), and we will not be able
to link it to a pad producing video, for example.
-`gst_pad_query_caps()` retrieves the *capabilities* of the pad (this is,
-the kind of data it supports), wrapped in a `GstCaps` structure. A pad
-can offer many capabilities, and hence `GstCaps` can contain many
-`GstStructure`, each representing a different capability.
+`gst_pad_get_current_caps()` retrieves the current *capabilities* of the pad
+(that is, the kind of data it currently outputs), wrapped in a `GstCaps`
+structure. All possible caps a pad can support can be queried with
+`gst_pad_query_caps()`. A pad can offer many capabilities, and hence `GstCaps`
+can contain many `GstStructure`, each representing a different capability. The
+current caps on a pad will always have a single `GstStructure` and represent a
+single media format, or if there are no current caps yet `NULL` will be
+returned.
Since, in this case, we know that the pad we want only had one
capability (audio), we retrieve the first `GstStructure` with