13#ifndef ZEPHYR_INCLUDE_MPIPE_MPIPE_STRUCTURE_H_
14#define ZEPHYR_INCLUDE_MPIPE_MPIPE_STRUCTURE_H_
153#define MPIPE_STRUCTURE_FLAG_ANY BIT(0)
167#define MPIPE_FRAME_INTERVAL_FROM_FPS(fps) DIV_ROUND_CLOSEST(USEC_PER_SEC, (fps))
193#define MPIPE_STRUCTURE_FIELD_COUNT(field_id, value) 1 +
194#define MPIPE_STRUCTURE_FIELD_ID(field_id, value) (field_id),
195#define MPIPE_STRUCTURE_FIELD_VALUE(field_id, value) value,
220#define MPIPE_STRUCTURE_DEFINE(name, media, fields) \
221 BUILD_ASSERT((fields(MPIPE_STRUCTURE_FIELD_COUNT) 0) <= CONFIG_MPIPE_STRUCTURE_MAX_FIELDS, \
222 #name " has more fields than CONFIG_MPIPE_STRUCTURE_MAX_FIELDS"); \
223 static const struct mpipe_structure name = { \
224 .media_type_id = (media), \
226 .num_fields = fields(MPIPE_STRUCTURE_FIELD_COUNT) 0, \
227 .ids = {fields(MPIPE_STRUCTURE_FIELD_ID)}, \
228 .values = {fields(MPIPE_STRUCTURE_FIELD_VALUE)}, \
mpipe_caps_field
Caps field identifiers.
Definition mpipe_structure.h:115
const struct mpipe_value * mpipe_structure_get_value(const struct mpipe_structure *structure, uint8_t field_id)
Get the value of a field in an Capability Structure.
int mpipe_structure_init(struct mpipe_structure *structure, uint8_t media_type_id)
Initialize an Capability Structure.
int mpipe_structure_copy_field(const struct mpipe_structure *src, struct mpipe_structure *dst, uint8_t field_id)
Copy a field from one Capability Structure to another.
int mpipe_structure_clear(struct mpipe_structure *structure)
Empty an Capability Structure, dropping every field it carries.
int mpipe_structure_remove_field(struct mpipe_structure *structure, uint8_t field_id)
Remove a field from an Capability Structure.
bool mpipe_structure_is_fixed(const struct mpipe_structure *structure)
Check if an Capability Structure is fixed.
mpipe_media_type
Media type a capability describes.
Definition mpipe_structure.h:68
int mpipe_structure_append_value(struct mpipe_structure *structure, uint8_t field_id, const struct mpipe_value *value)
Append a field to an Capability Structure from caller-owned storage.
int mpipe_structure_init_any(struct mpipe_structure *structure)
Initialize a structure that constrains nothing.
int mpipe_structure_fixate(const struct mpipe_structure *src, struct mpipe_structure *out)
Fixate a structure into caller-provided storage.
bool mpipe_structure_is_any(const struct mpipe_structure *structure)
Check whether a structure constrains nothing.
int mpipe_structure_init_fields(struct mpipe_structure *structure, uint8_t media_type_id,...)
Initialize an Capability Structure with a media type and a list of fields.
int mpipe_structure_intersect(const struct mpipe_structure *struct1, const struct mpipe_structure *struct2, struct mpipe_structure *out)
Intersect two structures into caller-provided storage.
bool mpipe_structure_is_empty(const struct mpipe_structure *structure)
Check whether an Capability Structure matches nothing.
void mpipe_structure_print(const struct mpipe_structure *structure)
Print an Capability Structure.
@ MPIPE_CAPS_FRAME_INTERVAL
Time covered by one frame, in microseconds, MPIPE_TYPE_UINT.
Definition mpipe_structure.h:138
@ MPIPE_CAPS_BITWIDTH
Sample size in bits (audio), MPIPE_TYPE_UINT.
Definition mpipe_structure.h:125
@ MPIPE_CAPS_END
One past the last field identifier.
Definition mpipe_structure.h:144
@ MPIPE_CAPS_NUM_OF_CHANNEL
Number of channels (audio), MPIPE_TYPE_UINT.
Definition mpipe_structure.h:127
@ MPIPE_CAPS_INTERLEAVED
Layout of the channels within a buffer (audio), MPIPE_TYPE_BOOLEAN: true for interleaved (LRLRLRLR),...
Definition mpipe_structure.h:132
@ MPIPE_CAPS_IMAGE_HEIGHT
Image height in pixels, MPIPE_TYPE_UINT.
Definition mpipe_structure.h:121
@ MPIPE_CAPS_SAMPLE_RATE
Sampling frequency in Hz (audio), MPIPE_TYPE_UINT.
Definition mpipe_structure.h:123
@ MPIPE_CAPS_IMAGE_WIDTH
Image width in pixels, MPIPE_TYPE_UINT.
Definition mpipe_structure.h:119
@ MPIPE_CAPS_PIXEL_FORMAT
Pixel format, as a VIDEO_PIX_FMT_* fourcc, MPIPE_TYPE_UINT.
Definition mpipe_structure.h:117
@ MPIPE_MEDIA_END
One past the last media type; not itself a usable media type.
Definition mpipe_structure.h:76
@ MPIPE_MEDIA_UNKNOWN
Unknown media type, what a structure constraining nothing carries.
Definition mpipe_structure.h:70
@ MPIPE_MEDIA_AUDIO_PCM
Audio in PCM format.
Definition mpipe_structure.h:72
@ MPIPE_MEDIA_VIDEO
Video, including raw, bayer and compressed formats.
Definition mpipe_structure.h:74
Value: one typed scalar or range inside a capability.
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Fixed-size container holding the fields of one capability.
Definition mpipe_structure.h:179
uint8_t media_type_id
Media type of the structure, see mpipe_media_type.
Definition mpipe_structure.h:181
uint8_t num_fields
Number of slots in use at the front of ids and values.
Definition mpipe_structure.h:185
uint8_t ids[CONFIG_MPIPE_STRUCTURE_MAX_FIELDS]
Field identifier held by each slot, see mpipe_caps_field.
Definition mpipe_structure.h:187
struct mpipe_value values[CONFIG_MPIPE_STRUCTURE_MAX_FIELDS]
Value held by each slot.
Definition mpipe_structure.h:189
uint8_t flags
Structure flags, see MPIPE_STRUCTURE_FLAG_ANY.
Definition mpipe_structure.h:183
Value structure.
Definition mpipe_value.h:78