pub struct FormatRegistry { /* private fields */ }Expand description
Holds every container format known to a running engine.
Implementations§
Source§impl FormatRegistry
impl FormatRegistry
pub fn new() -> FormatRegistry
pub fn register(&mut self, format: Format)
Sourcepub fn register_seekable_demuxer(
&mut self,
name: &'static str,
factory: SeekableDemuxerFactory,
)
pub fn register_seekable_demuxer( &mut self, name: &'static str, factory: SeekableDemuxerFactory, )
Give the format named name a demuxer that takes a SeekInput. Used
by open_demuxer_seekable when the caller
has a seekable source; the plain Format::demuxer still serves pipes
and sockets.
pub fn by_name(&self, name: &str) -> Option<&Format>
Sourcepub fn by_extension(&self, ext: &str) -> Option<&Format>
pub fn by_extension(&self, ext: &str) -> Option<&Format>
Find a format whose extension list contains ext (case-insensitive,
no leading dot). The cheap “guess by filename” path; probe
inspects content instead.
Sourcepub fn probe(&self, data: &[u8]) -> Option<&Format>
pub fn probe(&self, data: &[u8]) -> Option<&Format>
Identify a format by sniffing a byte prefix: the registered format whose
probe returns the highest positive score wins. Returns
None if nothing recognizes the data.
Sourcepub fn open_demuxer(&self, name: &str, input: Input) -> Result<Box<dyn Demuxer>>
pub fn open_demuxer(&self, name: &str, input: Input) -> Result<Box<dyn Demuxer>>
Open a demuxer for the format named name.
Sourcepub fn open_demuxer_seekable(
&self,
name: &str,
input: SeekInput,
) -> Result<Box<dyn Demuxer>>
pub fn open_demuxer_seekable( &self, name: &str, input: SeekInput, ) -> Result<Box<dyn Demuxer>>
Open a demuxer over a seekable input: the format’s seek-aware demuxer if
it registered one, otherwise its plain streaming demuxer (a seekable
source is still a byte stream). Callers that hold a file should prefer
this — it is what lets MP4 read only moov instead of the whole file.
Sourcepub fn register_seekable_muxer(
&mut self,
name: &'static str,
factory: SeekableMuxerFactory,
)
pub fn register_seekable_muxer( &mut self, name: &'static str, factory: SeekableMuxerFactory, )
Give the format named name a muxer that takes a SeekOutput. Used
by open_muxer_seekable when the caller
writes to something seekable; the plain Format::muxer still serves
pipes and sockets.
Sourcepub fn open_muxer_seekable(
&self,
name: &str,
output: SeekOutput,
) -> Result<Box<dyn Muxer>>
pub fn open_muxer_seekable( &self, name: &str, output: SeekOutput, ) -> Result<Box<dyn Muxer>>
Open a muxer over a seekable output: the format’s seek-aware muxer if it registered one, otherwise its plain muxer (a seekable sink is still a byte sink). Callers writing a file should prefer this – it is what lets MP4/Matroska/AVI/WAV stream instead of buffering the whole output.
Sourcepub fn open_muxer(&self, name: &str, output: Output) -> Result<Box<dyn Muxer>>
pub fn open_muxer(&self, name: &str, output: Output) -> Result<Box<dyn Muxer>>
Open a muxer for the format named name.