Skip to main content

Mp4Reader

Struct Mp4Reader 

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

Reads MP4, MOV and M4A files: their tracks and each track’s packets, timed as FFmpeg’s MOV demuxer times them.

Implementations§

Source§

impl Mp4Reader

Source

pub fn open(path: &Path) -> Result<Self, DemuxError>

Opens the MP4 file at path.

§Errors

A file that cannot be read, has no moov, or breaks this layer’s limits.

Source

pub fn new<R: Read + Seek + Send + 'static>( source: R, ) -> Result<Self, DemuxError>

Reads an MP4 file from source.

§Errors

A source that cannot be read, has no moov, or breaks this layer’s limits.

Trait Implementations§

Source§

impl ContainerReader for Mp4Reader

Source§

fn tracks(&self) -> &[TrackInfo]

The tracks, in container order.
Source§

fn seek(&mut self, track: TrackId, pts: i64) -> Result<Option<i64>, DemuxError>

Positions track so its next packet is the latest keyframe whose presentation time is at or before pts, or its first packet when none is. Returns that keyframe’s pts; None for a track without packets. Read more
Source§

fn next_packet(&mut self, track: TrackId) -> Result<Option<Packet>, DemuxError>

The next packet of track in decode order; None at its end. Read more
Source§

fn file_duration(&self) -> Option<MediaTime>

The file’s own duration when its header states one apart from its tracks (a Matroska segment’s Duration), as FFmpeg reports it.
Source§

fn default_video(&self) -> Option<usize>

The index into Self::tracks of the default video track: the first enabled video track flagged default, else the first video track.
Source§

fn default_audio(&self) -> Option<usize>

The index into Self::tracks of the default audio track, by the same rule.
Source§

impl Debug for Mp4Reader

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Mp4Reader

§

impl !Sync for Mp4Reader

§

impl !UnwindSafe for Mp4Reader

§

impl Forget for Mp4Reader

§

impl Freeze for Mp4Reader
where *const dyn Source is !null: Freeze, PhantomData<dyn Source>: Freeze, *const u8 is !null: Freeze, PhantomData<TrackInfo>: Freeze, PhantomData<TrackState>: Freeze,

§

impl Move for Mp4Reader

§

impl Send for Mp4Reader
where BoxRaw<dyn Source>: Send, RawVecInner: Send, Bytes: Send,

§

impl Unpin for Mp4Reader
where Box<dyn Source>: Unpin, *const u8 is !null: Unpin, *const u8: Unpin, Align8<*mut ()>: Unpin, &'static Vtable: Unpin,

§

impl UnsafeUnpin for Mp4Reader

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<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.