GStreamer Plugin Writer's Guide (0.10.12) | ||
---|---|---|
<<< Previous | Caps negotiation | Next >>> |
The simplest way in which to do caps negotiation is setting a fixed caps on a pad. After a fixed caps has been set, the pad can not be renegotiated from the outside. The only way to reconfigure the pad is for the element owning the pad to set a new fixed caps on the pad. Fixed caps is a setup property for pads, called when creating the pad:
[..] pad = gst_pad_new_from_template (..); gst_pad_use_fixed_caps (pad); [..] |
The fixed caps can then be set on the pad by calling gst_pad_set_caps ().
[..] caps = gst_caps_new_simple ("audio/x-raw-float", "width", G_TYPE_INT, 32, "endianness", G_TYPE_INT, G_BYTE_ORDER, "buffer-frames", G_TYPE_INT, <bytes-per-frame>, "rate", G_TYPE_INT, <samplerate>, "channels", G_TYPE_INT, <num-channels>, NULL); if (!gst_pad_set_caps (pad, caps)) { GST_ELEMENT_ERROR (element, CORE, NEGOTIATION, (NULL), ("Some debug information here")); return GST_FLOW_ERROR; } [..] |
Elements that could implement fixed caps (on their source pads) are, in general, all elements that are not renegotiatable. Examples include:
A typefinder, since the type found is part of the actual data stream and can thus not be re-negotiated.
Pretty much all demuxers, since the contained elementary data streams are defined in the file headers, and thus not renegotiatable.
Some decoders, where the format is embedded in the datastream and not part of the peercaps and where the decoder itself is not reconfigureable, too.
All other elements that need to be configured for the format should implement full caps negotiation, which will be explained in the next few sections.
<<< Previous | Home | Next >>> |
Caps negotiation | Up | Downstream caps negotiation |