pub struct VideoDecoder { /* private fields */ }Expand description
Video decoder with hardware acceleration support.
Implementations§
Source§impl VideoDecoder
impl VideoDecoder
Sourcepub fn new<P: AsRef<Path>>(path: P, hw_accel: HwAccel) -> VideoResult<Self>
pub fn new<P: AsRef<Path>>(path: P, hw_accel: HwAccel) -> VideoResult<Self>
Create a new video decoder and start decoding.
Automatically attempts hardware acceleration and falls back to software with a diagnostic warning if the hardware path cannot be set up.
Sourcepub fn next_frame(&self) -> Option<VideoFrame>
pub fn next_frame(&self) -> Option<VideoFrame>
Get the next decoded frame (non-blocking).
Sourcepub fn metadata(&self) -> &VideoMetadata
pub fn metadata(&self) -> &VideoMetadata
Get video metadata.
Sourcepub fn decoder_info(&self) -> DecoderInfo
pub fn decoder_info(&self) -> DecoderInfo
Get decoder information for diagnostics (reflects the backend actually in use).
Sourcepub fn hw_accel_in_use(&self) -> HwAccel
pub fn hw_accel_in_use(&self) -> HwAccel
The hardware backend currently in use by the decode thread. The decode thread reports the real backend shortly after startup (it may fall back from a requested hw backend to software), so this polls briefly until the report lands.
Sourcepub fn seek(&self, timestamp: Duration)
pub fn seek(&self, timestamp: Duration)
Seek the underlying stream to a timestamp. Frames already queued are
stale after the seek, so call VideoDecoder::drain afterwards.
Sourcepub fn is_video_file<P: AsRef<Path>>(path: P) -> bool
pub fn is_video_file<P: AsRef<Path>>(path: P) -> bool
Check if this file is a supported video format.
Trait Implementations§
Source§impl Drop for VideoDecoder
impl Drop for VideoDecoder
Source§impl VideoSource for VideoDecoder
impl VideoSource for VideoDecoder
Source§fn metadata(&self) -> &VideoMetadata
fn metadata(&self) -> &VideoMetadata
Source§fn decoder_info(&self) -> DecoderInfo
fn decoder_info(&self) -> DecoderInfo
Source§fn next_frame(&self) -> Option<VideoFrame>
fn next_frame(&self) -> Option<VideoFrame>
Source§fn is_video_file(path: &Path) -> bool
fn is_video_file(path: &Path) -> bool
Auto Trait Implementations§
impl !RefUnwindSafe for VideoDecoder
impl !UnwindSafe for VideoDecoder
impl Freeze for VideoDecoder
impl Send for VideoDecoder
impl Sync for VideoDecoder
impl Unpin for VideoDecoder
impl UnsafeUnpin for VideoDecoder
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.