pub struct DemuxLimits { /* private fields */ }Expand description
What one demux session may spend: on any single packet, on any single attachment, and on every attachment in the file together.
Handed to FfmpegDemuxer::open_with
rather than set afterwards, because the attachment budget is spent
during the open — every attachment payload is captured before the
first timed packet is read, which is what makes the demux tier’s
delivery contract true by construction.
Implementations§
Source§impl DemuxLimits
impl DemuxLimits
Sourcepub const fn new() -> Self
pub const fn new() -> Self
The defaults: PacketLimits::new,
DEFAULT_MAX_ATTACHMENT_BYTES and
DEFAULT_MAX_TOTAL_ATTACHMENT_BYTES.
Sourcepub const fn max_probe_bytes(&self) -> u64
pub const fn max_probe_bytes(&self) -> u64
The ceiling on bytes libavformat may read while probing and analysing a container.
§What this bounds, and what it does not
Bounded: the total bytes libavformat is handed during
avformat_open_input and avformat_find_stream_info. It reaches
two ways — as probesize and formatprobesize, which every
entrypoint sets before the open, and, on the reader entrypoint, as
a hard byte meter on the AVIOContext itself: past the budget the
reader answers an I/O error, so the parser gets nothing more
whatever it asks for.
Not bounded: allocation amplification inside a parser. A
container can describe, in a handful of bytes, a structure whose
in-memory form is much larger, and nothing outside libavformat can
see that happen. What this seat guarantees is that the input to
that amplification is finite and small; bounding its output is the
substrate’s own hardening territory, and FFmpeg has its own
max_streams / max_index_size / max_picture_buffer seats for
exactly that — Self::max_streams sets the first of them.
Not bounded on the path entrypoint: the byte meter needs an
AVIOContext this crate owns, and a path is opened by
libavformat’s own protocol layer. probesize and
formatprobesize still apply there; the hard meter does not.
A caller who wants the meter on a file can open it as a reader.
Sourcepub const fn max_streams(&self) -> u32
pub const fn max_streams(&self) -> u32
The ceiling on streams a container may declare. See
Self::max_probe_bytes for why a seat inside libavformat is
worth setting at all.
Sourcepub const fn with_max_probe_bytes(self, value: u64) -> Self
pub const fn with_max_probe_bytes(self, value: u64) -> Self
Sets the probe-read ceiling (consuming builder).
Sourcepub const fn with_max_streams(self, value: u32) -> Self
pub const fn with_max_streams(self, value: u32) -> Self
Sets the declared-stream ceiling (consuming builder).
Sourcepub const fn packet(&self) -> PacketLimits
pub const fn packet(&self) -> PacketLimits
The per-packet budget timed packets are checked against.
Sourcepub const fn max_attachment_bytes(&self) -> usize
pub const fn max_attachment_bytes(&self) -> usize
Most bytes one attachment may carry.
Sourcepub const fn max_total_attachment_bytes(&self) -> usize
pub const fn max_total_attachment_bytes(&self) -> usize
Most bytes every attachment in the file may carry together.
Sourcepub const fn max_codec_parameter_bytes(&self) -> usize
pub const fn max_codec_parameter_bytes(&self) -> usize
Most heap bytes one stream’s codec parameters may hold —
extradata, coded_side_data and a custom channel map together.
Sourcepub const fn max_total_codec_parameter_bytes(&self) -> usize
pub const fn max_total_codec_parameter_bytes(&self) -> usize
Most heap bytes every stream’s codec parameters may hold together.
Sourcepub const fn with_packet(self, value: PacketLimits) -> Self
pub const fn with_packet(self, value: PacketLimits) -> Self
Sets the per-packet budget (consuming builder).
Sourcepub const fn with_max_attachment_bytes(self, value: usize) -> Self
pub const fn with_max_attachment_bytes(self, value: usize) -> Self
Sets the per-attachment ceiling (consuming builder).
Sourcepub const fn with_max_total_attachment_bytes(self, value: usize) -> Self
pub const fn with_max_total_attachment_bytes(self, value: usize) -> Self
Sets the whole-file attachment budget (consuming builder).
Sourcepub const fn with_max_codec_parameter_bytes(self, value: usize) -> Self
pub const fn with_max_codec_parameter_bytes(self, value: usize) -> Self
Sets the per-stream codec-parameter ceiling (consuming builder).
Sourcepub const fn with_max_total_codec_parameter_bytes(self, value: usize) -> Self
pub const fn with_max_total_codec_parameter_bytes(self, value: usize) -> Self
Sets the whole-file codec-parameter budget (consuming builder).
Sourcepub const fn set_packet(&mut self, value: PacketLimits) -> &mut Self
pub const fn set_packet(&mut self, value: PacketLimits) -> &mut Self
Sets the per-packet budget in place.
Sourcepub const fn set_max_attachment_bytes(&mut self, value: usize) -> &mut Self
pub const fn set_max_attachment_bytes(&mut self, value: usize) -> &mut Self
Sets the per-attachment ceiling in place.
Sourcepub const fn set_max_total_attachment_bytes(
&mut self,
value: usize,
) -> &mut Self
pub const fn set_max_total_attachment_bytes( &mut self, value: usize, ) -> &mut Self
Sets the whole-file attachment budget in place.
Sourcepub const fn set_max_codec_parameter_bytes(&mut self, value: usize) -> &mut Self
pub const fn set_max_codec_parameter_bytes(&mut self, value: usize) -> &mut Self
Sets the per-stream codec-parameter ceiling in place.
Sourcepub const fn set_max_total_codec_parameter_bytes(
&mut self,
value: usize,
) -> &mut Self
pub const fn set_max_total_codec_parameter_bytes( &mut self, value: usize, ) -> &mut Self
Sets the whole-file codec-parameter budget in place.
Trait Implementations§
Source§impl Clone for DemuxLimits
impl Clone for DemuxLimits
Source§fn clone(&self) -> DemuxLimits
fn clone(&self) -> DemuxLimits
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more