pub struct FfmpegDecoder { /* private fields */ }Expand description
Decodes a video into Rgb8Image frames by pulling raw rgb24 from a system ffmpeg.
The mirror of FfmpegEncoder, and deliberately a pulling iterator rather than a callback:
the simulator consumes frames in pairs and needs to hold one back, which a push API makes awkward.
Implementations§
Source§impl FfmpegDecoder
impl FfmpegDecoder
Sourcepub fn open(path: &Path, scale: Option<(usize, usize)>) -> Result<Self>
pub fn open(path: &Path, scale: Option<(usize, usize)>) -> Result<Self>
Opens path for decoding. scale optionally resizes on the way out, which is far cheaper
than decoding at full resolution and downsampling afterwards.
pub fn info(&self) -> VideoInfo
Sourcepub fn next_frame(&mut self) -> Result<Option<Rgb8Image>>
pub fn next_frame(&mut self) -> Result<Option<Rgb8Image>>
Pulls the next frame, or None at the end of the stream.
A partial read at the end is treated as end-of-stream rather than an error: ffmpeg closing the pipe mid-frame is how a truncated source presents, and there is nothing useful to do with half a frame.
Trait Implementations§
Source§impl Drop for FfmpegDecoder
impl Drop for FfmpegDecoder
Auto Trait Implementations§
impl Freeze for FfmpegDecoder
impl RefUnwindSafe for FfmpegDecoder
impl Send for FfmpegDecoder
impl Sync for FfmpegDecoder
impl Unpin for FfmpegDecoder
impl UnsafeUnpin for FfmpegDecoder
impl UnwindSafe for FfmpegDecoder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more