Trait frame_source::FrameDataSource

source ·
pub trait FrameDataSource {
    // Required methods
    fn width(&self) -> u32;
    fn height(&self) -> u32;
    fn frame0_time(&self) -> Option<DateTime<FixedOffset>>;
    fn skip_n_frames(&mut self, n_frames: usize) -> Result<()>;
    fn estimate_luminance_range(&mut self) -> Result<(u16, u16)>;
    fn has_timestamps(&self) -> bool;
    fn timestamp_source(&self) -> &str;
    fn iter<'a>(
        &'a mut self
    ) -> Box<dyn Iterator<Item = Result<FrameData>> + 'a>;

    // Provided methods
    fn camera_name(&self) -> Option<&str> { ... }
    fn gamma(&self) -> Option<f32> { ... }
}
Expand description

A source of FrameData

The frame0_time method return value is an Option because we want to be able to parse sources without an absolute time for the first frame, such as normal MP4 video files. Similarly, we do not have a len method indicating number of frames because some sources (e.g. an .h264 file) do not store how many frames they have but rather must be parsed from beginning to end.

Required Methods§

source

fn width(&self) -> u32

Get the width of the source images, in pixels.

source

fn height(&self) -> u32

Get the height of the source images, in pixels.

source

fn frame0_time(&self) -> Option<DateTime<FixedOffset>>

Get the timestamp of the first frame.

Note that (in case they can differ), this is the time of the first frame rather than the creation time in the metadata.

source

fn skip_n_frames(&mut self, n_frames: usize) -> Result<()>

Set source to skip the first N frames.

Note that this resets frame0_time accordingly.

source

fn estimate_luminance_range(&mut self) -> Result<(u16, u16)>

Scan over the input images and estimate the luminance range

Returns Ok<(min, max)> when successful.

source

fn has_timestamps(&self) -> bool

Whether timestamps are available.

If no timestamp is available, the frame “timestamp” with contain a fraction of completeness.

source

fn timestamp_source(&self) -> &str

A string describing the source of the timestamp data

source

fn iter<'a>(&'a mut self) -> Box<dyn Iterator<Item = Result<FrameData>> + 'a>

Get an iterator over all frames.

Provided Methods§

source

fn camera_name(&self) -> Option<&str>

source

fn gamma(&self) -> Option<f32>

Implementors§