Skip to content

Commit

Permalink
ioctl: add bitflags for buffer flags
Browse files Browse the repository at this point in the history
  • Loading branch information
Gnurou committed Dec 26, 2023
1 parent f2589bb commit acc87cf
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions lib/src/ioctl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ use std::ffi::CStr;
use std::ffi::FromBytesWithNulError;
use std::fmt::Debug;

use bitflags::bitflags;
use nix::errno::Errno;

use crate::bindings;
Expand Down Expand Up @@ -218,6 +219,29 @@ impl<'a> V4l2BufferPlane<'a> {
}
}

bitflags! {
#[derive(Clone, Copy, Debug)]
/// `flags` member of `struct `v4l2_buffer`.
pub struct BufferFlags: u32 {
const MAPPED = bindings::V4L2_BUF_FLAG_MAPPED;
const QUEUED = bindings::V4L2_BUF_FLAG_QUEUED;
const DONE = bindings::V4L2_BUF_FLAG_DONE;
const ERROR = bindings::V4L2_BUF_FLAG_ERROR;
const KEYFRAME = bindings::V4L2_BUF_FLAG_KEYFRAME;
const PFRAME = bindings::V4L2_BUF_FLAG_PFRAME;
const BFRAME = bindings::V4L2_BUF_FLAG_BFRAME;
const TIMECODE = bindings::V4L2_BUF_FLAG_TIMECODE;
const PREPARED = bindings::V4L2_BUF_FLAG_PREPARED;
const NO_CACHE_INVALIDATE = bindings::V4L2_BUF_FLAG_NO_CACHE_CLEAN;
const NO_CACHE_CLEAN = bindings::V4L2_BUF_FLAG_NO_CACHE_INVALIDATE;
const LAST = bindings::V4L2_BUF_FLAG_LAST;
const TIMESTAMP_MONOTONIC = bindings::V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
const TIMESTAMP_COPY = bindings::V4L2_BUF_FLAG_TIMESTAMP_COPY;
const TSTAMP_SRC_EOF = bindings::V4L2_BUF_FLAG_TSTAMP_SRC_EOF;
const TSTAMP_SRC_SOE = bindings::V4L2_BUF_FLAG_TSTAMP_SRC_SOE;
}
}

/// A completely owned v4l2_buffer, where the pointer to planes is meaningless and fixed up when
/// needed.
///
Expand Down

0 comments on commit acc87cf

Please sign in to comment.