Definition of a buffer header and its associated API. Buffer headers are the basic element used to pass data and information between different parts of the system. They are passed to components via ports and sent back to the client using a callback mechanism.
#define MMAL_BUFFER_HEADER_FLAG_CODECSIDEINFO (1<<7) |
Signals a buffer containing side information
#define MMAL_BUFFER_HEADER_FLAG_CONFIG (1<<5) |
Signals a buffer containing some kind of config data for the component (e.g. codec config data)
#define MMAL_BUFFER_HEADER_FLAG_CORRUPTED (1<<9) |
Signals a buffer which contains data known to be corrupted
#define MMAL_BUFFER_HEADER_FLAG_DECODEONLY (1<<11) |
Signals the output buffer won't be used, just update reference frames
#define MMAL_BUFFER_HEADER_FLAG_DISCONTINUITY (1<<4) |
Signals a discontinuity in the stream of data (e.g. after a seek). Can be used for instance by a decoder to reset its state
#define MMAL_BUFFER_HEADER_FLAG_ENCRYPTED (1<<6) |
Signals an encrypted payload
#define MMAL_BUFFER_HEADER_FLAG_EOS (1<<0) |
Signals that the current payload is the end of the stream of data
Signals that the current payload contains only complete frames (1 or more)
#define MMAL_BUFFER_HEADER_FLAG_FRAME_END (1<<2) |
Signals that the end of the current payload ends a frame
#define MMAL_BUFFER_HEADER_FLAG_FRAME_START (1<<1) |
Signals that the start of the current payload starts a frame
#define MMAL_BUFFER_HEADER_FLAG_KEYFRAME (1<<3) |
Signals that the current payload is a keyframe (i.e. self decodable)
#define MMAL_BUFFER_HEADER_FLAG_TRANSMISSION_FAILED (1<<10) |
Signals that a buffer failed to be transmitted
#define MMAL_BUFFER_HEADER_FLAG_USER0 (1<<28) |
User flags - can be passed in and will get returned
#define MMAL_BUFFER_HEADER_FLAGS_SNAPSHOT (1<<8) |
Signals a buffer which is the snapshot/postview image from a stills capture
#define MMAL_BUFFER_HEADER_VIDEO_FLAG_DISPLAY_EXTERNAL (1<<3) |
Signals that the buffer should be displayed on external display if attached.
#define MMAL_BUFFER_HEADER_VIDEO_FLAG_INTERLACED (1<<0) |
Signals an interlaced video frame
#define MMAL_BUFFER_HEADER_VIDEO_FLAG_PROTECTED (1<<4) |
Signals that contents of the buffer requires copy protection.
#define MMAL_BUFFER_HEADER_VIDEO_FLAG_TOP_FIELD_FIRST (1<<2) |
Signals that the top field of the current interlaced frame should be displayed first
Buffer header pre-release callback. The callback is invoked just before a buffer is released back into a pool. This is used by clients who need to trigger additional actions before the buffer can finally be released (e.g. wait for a bulk transfer to complete).
The callback should return TRUE if the buffer release need to be post-poned.
- Parameters
-
header | buffer header about to be released |
userdata | user-specific data |
- Returns
- TRUE if the buffer should not be released
Definition of the buffer header structure. A buffer header does not directly carry the data to be passed to a component but instead it references the actual data using a pointer (and an associated length). It also contains an internal area which can be used to store command or metadata to be associated with the external data.
Acquire a buffer header. Acquiring a buffer header increases a reference counter on it and makes sure that the buffer header won't be recycled until all the references to it are gone. This is useful for instance if a component needs to return a buffer header but still needs access to it for some internal processing (e.g. reference frames in video codecs).
- Parameters
-
header | buffer header to acquire |
Lock the data buffer contained in the buffer header in memory. This call does nothing on all platforms except VideoCore where it is needed to pin a buffer in memory before any access to it.
- Parameters
-
header | buffer header to lock |
Unlock the data buffer contained in the buffer header. This call does nothing on all platforms except VideoCore where it is needed to un-pin a buffer in memory after any access to it.
- Parameters
-
header | buffer header to unlock |
Set a buffer header pre-release callback. If the callback is NULL, the buffer will be released back into the pool immediately as usual.
- Parameters
-
header | buffer header to associate callback with |
cb | pre-release callback to invoke |
userdata | user-specific data |
Release a buffer header. Releasing a buffer header will decrease its reference counter and when no more references are left, the buffer header will be recycled by calling its 'release' callback function.
If a pre-release callback is set (MMAL_BH_PRE_RELEASE_CB_T), this will be invoked before calling the buffer's release callback and potentially postpone buffer recycling. Once pre-release is complete the buffer header is recycled with mmal_buffer_header_release_continue.
- Parameters
-
header | buffer header to release |
Continue the buffer header release process. This should be called to complete buffer header recycling once all pre-release activity has been completed.
- Parameters
-
header | buffer header to release |
Replicate a buffer header into another one. Replicating a buffer header will not only do an exact copy of all the public fields of the buffer header (including data and alloc_size), but it will also acquire a reference to the source buffer header which will only be released once the replicate has been released.
- Parameters
-
dest | buffer header into which to replicate |
src | buffer header to use as the source for the replication |
- Returns
- MMAL_SUCCESS on success
Reset a buffer header. Resets all header variables to default values.
- Parameters
-
header | buffer header to reset |