Skip to main content

DemuxInput

Struct DemuxInput 

Source
pub struct DemuxInput { /* private fields */ }
Expand description

A container opened for reading with only the named demuxers, only the file protocol, and an interrupt callback.

The context is read through Deref but cannot be moved out, since FFmpeg points at the input’s interrupt state:

ⓘ
let stolen = std::mem::replace(&mut *demux, other);
drop(demux);

Implementations§

Source§

impl DemuxInput

Source

pub fn interrupt_when(&self, check: impl Fn() -> bool + Send + Sync + 'static)

Makes blocking I/O on this input stop with AVERROR_EXIT once check returns true.

Source

pub fn best_stream( &self, media_type: AVMediaType, ) -> Result<Option<usize>, RsmpegError>

The AVStream index of the best decodable stream of media_type, never an attached picture such as cover art.

None when no stream of the type can be decoded; the input’s other streams still may.

§Errors

Any other av_find_best_stream failure.

Source

pub fn read_packet(&mut self) -> Result<Option<AVPacket>, RsmpegError>

The next packet in file order, or None at the end of the file.

§Errors

The FFmpeg read failure, or AVERROR_EXIT when interrupted.

Source

pub fn seek( &mut self, stream_index: i32, timestamp: i64, flags: i32, ) -> Result<(), RsmpegError>

Seeks to the key frame at timestamp (stream_index -1 for AV_TIME_BASE units).

§Errors

The FFmpeg seek failure, or AVERROR_EXIT when interrupted.

Source

pub fn discard_all_but(&mut self, index: usize)

Has the demuxer discard every stream but index (mov then skips their bytes entirely).

Source

pub fn keep_only(&mut self, kept: &[usize])

Self::discard_all_but for several streams.

Methods from Deref<Target = AVFormatContextInput>§

Source

pub fn as_ptr(&self) -> *const AVFormatContext

Source

pub fn find_best_stream( &self, media_type: i32, ) -> Result<Option<(usize, AVCodecRef<'static>)>, RsmpegError>

Return the stream index and stream decoder if there is any “best” stream. “best” means the most likely what the user wants.

Source

pub fn streams(&'stream self) -> &'stream [AVStreamRef<'stream>]

Return slice of AVStreamRef.

Source

pub fn iformat(&'stream self) -> AVInputFormatRef<'stream>

Source

pub fn metadata(&'stream self) -> Option<AVDictionaryRef<'stream>>

Get metadata of the ffi::AVFormatContext in crate::avutil::AVDictionary. demuxing: set by libavformat in avformat_open_input() muxing: may be set by the caller before avformat_write_header()

Trait Implementations§

Source§

impl Deref for DemuxInput

Source§

type Target = AVFormatContextInput

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.