Skip to content

Commit

Permalink
ioctl/qbuf: add set_timestamp method
Browse files Browse the repository at this point in the history
Add a set_timestamp method for QBuffer struct
receiving the second and microsecond values.
This setter allows crate users to initialize
a QBuffer instance while being unaware of the
underlying type for the timestamp member.

Signed-off-by: Albert Esteve <aesteve@redhat.com>
  • Loading branch information
aesteve-rh authored and Gnurou committed Sep 28, 2023
1 parent 532c316 commit 110fd77
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/src/ioctl/qbuf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ impl<H: PlaneHandle> Default for QBuffer<H> {
}

impl<H: PlaneHandle> QBuffer<H> {
pub fn set_timestamp(mut self, sec: i64, usec: i64) -> Self {
self.timestamp = TimeVal::new(sec, usec);
self
}

fn fill_common_v4l2_data(&self, v4l2_buf: &mut bindings::v4l2_buffer) {
v4l2_buf.memory = H::Memory::MEMORY_TYPE as u32;
v4l2_buf.flags = self.flags.bits();
Expand Down

0 comments on commit 110fd77

Please sign in to comment.