pub struct CarrierDemuxer<C: FfmpegCarrier> { /* private fields */ }Expand description
mediadecode::demuxer::Demuxer impl wrapping ffmpeg::format::context::Input.
Construction is deliberately not on the trait — see Self::open
and Self::open_reader.
Implementations§
Source§impl CarrierDemuxer<View>
impl CarrierDemuxer<View>
Sourcepub fn open<P: AsRef<Path> + ?Sized>(path: &P) -> Result<Self, DemuxError>
pub fn open<P: AsRef<Path> + ?Sized>(path: &P) -> Result<Self, DemuxError>
Opens a container from a filesystem path.
Runs avformat_open_input followed by
avformat_find_stream_info, then builds the track table and
captures every attachment payload.
Call ffmpeg_next::init once before the first open if you
want FFmpeg’s logging and network protocols configured;
probing a local container does not require it.
Sourcepub fn open_with<P: AsRef<Path> + ?Sized>(
path: &P,
limits: DemuxLimits,
) -> Result<Self, DemuxError>
pub fn open_with<P: AsRef<Path> + ?Sized>( path: &P, limits: DemuxLimits, ) -> Result<Self, DemuxError>
Self::open, with the session’s resource budgets named.
The budgets are taken at open rather than through a
with_* builder because the attachment half of them is spent
here: every attachment payload is captured during this call.
Sourcepub fn open_reader<R: Read + Seek + Send + 'static>(
reader: R,
url: Option<&str>,
) -> Result<Self, DemuxError>
pub fn open_reader<R: Read + Seek + Send + 'static>( reader: R, url: Option<&str>, ) -> Result<Self, DemuxError>
Opens a container from any Read + Seek source.
Sourcepub fn open_reader_with<R: Read + Seek + Send + 'static>(
reader: R,
url: Option<&str>,
limits: DemuxLimits,
) -> Result<Self, DemuxError>
pub fn open_reader_with<R: Read + Seek + Send + 'static>( reader: R, url: Option<&str>, limits: DemuxLimits, ) -> Result<Self, DemuxError>
Self::open_reader, with the session’s budgets named.
Sourcepub const fn limits(&self) -> DemuxLimits
pub const fn limits(&self) -> DemuxLimits
The budgets this session was opened with.
Sourcepub const fn format(&self) -> Option<&ContainerFormat>
pub const fn format(&self) -> Option<&ContainerFormat>
What the container IS, as libavformat identified it from the bytes — the demuxer it chose, with the short names that demuxer handles and its description.
Decided during the open and fixed for the life of the session, so this answers the same thing at any point and costs nothing to ask.
None only where libavformat left iformat null or its name
is not readable text; neither happens on a session that
opened successfully.
Nothing here looked at a path. A file’s extension is a
claim about its bytes, and this is a reading of them — which
is what makes the answer usable on a content-addressed row,
where the same bytes under two names are one content. See
ContainerFormat for what the
demuxer’s name does and does not narrow to.
Source§impl CarrierDemuxer<Owned>
impl CarrierDemuxer<Owned>
Sourcepub fn open<P: AsRef<Path> + ?Sized>(path: &P) -> Result<Self, DemuxError>
pub fn open<P: AsRef<Path> + ?Sized>(path: &P) -> Result<Self, DemuxError>
Opens a container from a filesystem path.
Runs avformat_open_input followed by
avformat_find_stream_info, then builds the track table and
captures every attachment payload.
Call ffmpeg_next::init once before the first open if you
want FFmpeg’s logging and network protocols configured;
probing a local container does not require it.
Sourcepub fn open_with<P: AsRef<Path> + ?Sized>(
path: &P,
limits: DemuxLimits,
) -> Result<Self, DemuxError>
pub fn open_with<P: AsRef<Path> + ?Sized>( path: &P, limits: DemuxLimits, ) -> Result<Self, DemuxError>
Self::open, with the session’s resource budgets named.
The budgets are taken at open rather than through a
with_* builder because the attachment half of them is spent
here: every attachment payload is captured during this call.
Sourcepub fn open_reader<R: Read + Seek + Send + 'static>(
reader: R,
url: Option<&str>,
) -> Result<Self, DemuxError>
pub fn open_reader<R: Read + Seek + Send + 'static>( reader: R, url: Option<&str>, ) -> Result<Self, DemuxError>
Opens a container from any Read + Seek source.
Sourcepub fn open_reader_with<R: Read + Seek + Send + 'static>(
reader: R,
url: Option<&str>,
limits: DemuxLimits,
) -> Result<Self, DemuxError>
pub fn open_reader_with<R: Read + Seek + Send + 'static>( reader: R, url: Option<&str>, limits: DemuxLimits, ) -> Result<Self, DemuxError>
Self::open_reader, with the session’s budgets named.
Sourcepub const fn limits(&self) -> DemuxLimits
pub const fn limits(&self) -> DemuxLimits
The budgets this session was opened with.
Sourcepub const fn format(&self) -> Option<&ContainerFormat>
pub const fn format(&self) -> Option<&ContainerFormat>
What the container IS, as libavformat identified it from the bytes — the demuxer it chose, with the short names that demuxer handles and its description.
Decided during the open and fixed for the life of the session, so this answers the same thing at any point and costs nothing to ask.
None only where libavformat left iformat null or its name
is not readable text; neither happens on a session that
opened successfully.
Nothing here looked at a path. A file’s extension is a
claim about its bytes, and this is a reading of them — which
is what makes the answer usable on a content-addressed row,
where the same bytes under two names are one content. See
ContainerFormat for what the
demuxer’s name does and does not narrow to.
Trait Implementations§
Source§impl Demuxer for CarrierDemuxer<View>
impl Demuxer for CarrierDemuxer<View>
Source§fn tracks(&self) -> &[TrackArc<TrackInfo<Ffmpeg>>]
fn tracks(&self) -> &[TrackArc<TrackInfo<Ffmpeg>>]
The track table, held for the life of the session.
Reading it takes nothing away — clone the handles worth
keeping. Arc is the carrier because
CodecTicket mirrors an
AVCodecParameters into owned Rust, which is what makes a
row Send + Sync and a table shareable across tasks.
Source§fn chapters(&self) -> &[Chapter<Ffmpeg>]
fn chapters(&self) -> &[Chapter<Ffmpeg>]
The container’s chapter table, in the order
AVFormatContext.chapters holds it, mirrored at open and
held for the life of the session.
Empty where the file declares no chapters — which is the provided answer too, so the override changes nothing for a container that has none.
Nothing is repaired. A chapter whose end precedes its
start, and one whose end libavformat left at its
no-timestamp sentinel because the file declared none, are
mirrored exactly as written; see Chapter for why this
layer reports rather than clamps.
Source§fn next_packet(
&mut self,
) -> Result<Option<DemuxedPacket<Ffmpeg, Self::Buffer>>, DemuxError>
fn next_packet( &mut self, ) -> Result<Option<DemuxedPacket<Ffmpeg, Self::Buffer>>, DemuxError>
Pulls the next packet.
A refusal that another attempt could survive costs no
packet. av_read_frame advances the container, so a
conversion that then fails on an allocation would otherwise
drop bytes nothing can ask for again. Such a packet is parked
instead, and this method re-attempts it before reading
another — so a caller who pulls again loses nothing. A refusal
about the packet itself is not parked: retrying a malformed
packet forever would be worse than passing it by.
Source§type Buffer = <View as FfmpegCarrier>::Buffer
type Buffer = <View as FfmpegCarrier>::Buffer
Source§type TrackHandle = Arc<TrackInfo<Ffmpeg>>
type TrackHandle = Arc<TrackInfo<Ffmpeg>>
Source§type Error = DemuxError
type Error = DemuxError
Source§impl Demuxer for CarrierDemuxer<Owned>
impl Demuxer for CarrierDemuxer<Owned>
Source§fn tracks(&self) -> &[TrackArc<TrackInfo<Ffmpeg>>]
fn tracks(&self) -> &[TrackArc<TrackInfo<Ffmpeg>>]
The track table, held for the life of the session.
Reading it takes nothing away — clone the handles worth
keeping. Arc is the carrier because
CodecTicket mirrors an
AVCodecParameters into owned Rust, which is what makes a
row Send + Sync and a table shareable across tasks.
Source§fn chapters(&self) -> &[Chapter<Ffmpeg>]
fn chapters(&self) -> &[Chapter<Ffmpeg>]
The container’s chapter table, in the order
AVFormatContext.chapters holds it, mirrored at open and
held for the life of the session.
Empty where the file declares no chapters — which is the provided answer too, so the override changes nothing for a container that has none.
Nothing is repaired. A chapter whose end precedes its
start, and one whose end libavformat left at its
no-timestamp sentinel because the file declared none, are
mirrored exactly as written; see Chapter for why this
layer reports rather than clamps.
Source§fn next_packet(
&mut self,
) -> Result<Option<DemuxedPacket<Ffmpeg, Self::Buffer>>, DemuxError>
fn next_packet( &mut self, ) -> Result<Option<DemuxedPacket<Ffmpeg, Self::Buffer>>, DemuxError>
Pulls the next packet.
A refusal that another attempt could survive costs no
packet. av_read_frame advances the container, so a
conversion that then fails on an allocation would otherwise
drop bytes nothing can ask for again. Such a packet is parked
instead, and this method re-attempts it before reading
another — so a caller who pulls again loses nothing. A refusal
about the packet itself is not parked: retrying a malformed
packet forever would be worse than passing it by.