Skip to content

Commit

Permalink
drivers: video: introduce buffer flags for fragmented frames
Browse files Browse the repository at this point in the history
Video buffers did not precise whether they contained a whole frame,
or a fragment of a frame.

Adding a flag struct as well as a total frame field allows video
devices to tell whether they produced

- a complete frame (with VIDEO_BUF_EOF and no VIDEO_BUF_FRAG),
- a partial frame (with VIDEO_BUF_FRAG),
- a last frame (with VIDEO_BUF_EOF),

The video devices that do not support fragmentation currently ignore
this flag.

As discussed in zephyrproject-rtos#66994 and zephyrproject-rtos#72827.

Co-authored-by: Lee <admin@arducam.com>
Co-authored-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
Signed-off-by: Josuah Demangeon <me@josuah.net>
  • Loading branch information
3 people committed Aug 8, 2024
1 parent d590c18 commit fe3d207
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions include/zephyr/drivers/video.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ struct video_caps {
uint8_t min_vbuf_count;
};

/**
* @brief video_frame_fragmented_status enum
*
* Indicates the receiving status of fragmented frames.
*/
#define VIDEO_BUF_FRAG BIT(0)
#define VIDEO_BUF_EOF BIT(1)

/**
* @struct video_buffer
* @brief Video buffer structure
Expand All @@ -116,6 +124,10 @@ struct video_buffer {
* endpoints.
*/
uint32_t timestamp;
/** frame length for fragmented frames. */
uint32_t bytesframe;
/** receiving status for fragmented frames. */
uint32_t flags;
};

/**
Expand Down

0 comments on commit fe3d207

Please sign in to comment.