Skip to main content

x264_next/
picture.rs

1use x264::*;
2
3/// Output information about an encoded frame.
4pub struct Picture {
5    raw: x264_picture_t,
6}
7
8impl Picture {
9    /// Whether the picture is a keyframe.
10    pub fn keyframe(&self) -> bool {
11        self.raw.b_keyframe != 0
12    }
13
14    /// The presentation timestamp.
15    pub fn pts(&self) -> i64 {
16        self.raw.i_pts
17    }
18
19    /// The decoding timestamp.
20    pub fn dts(&self) -> i64 {
21        self.raw.i_dts
22    }
23
24    #[doc(hidden)]
25    pub unsafe fn from_raw(raw: x264_picture_t) -> Self {
26        Self { raw }
27    }
28}