X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=nihav-core%2Fsrc%2Fmuxers%2Fmod.rs;h=6194f518c092e75e68493883470f2a3f76139159;hb=dcabdfd2eea01174f46548a8e2166ab88d0de96b;hp=e8a1afbcab46d871a4bf7244ffc086c993310751;hpb=f0081142878786d1a07c61e4df2d2a318609b478;p=nihav.git diff --git a/nihav-core/src/muxers/mod.rs b/nihav-core/src/muxers/mod.rs index e8a1afb..6194f51 100644 --- a/nihav-core/src/muxers/mod.rs +++ b/nihav-core/src/muxers/mod.rs @@ -2,6 +2,7 @@ pub use crate::frame::*; pub use crate::io::byteio::*; pub use crate::demuxers::{StreamManager, StreamIter}; +pub use crate::options::*; /// A list specifying general muxing errors. #[derive(Debug,Clone,Copy,PartialEq)] @@ -54,7 +55,7 @@ impl From for MuxerError { } /// A trait for muxing operations. -pub trait MuxCore<'a> { +pub trait MuxCore<'a>: NAOptionHandler { /// Prepares everything for packet muxing. fn create(&mut self, strmgr: &StreamManager) -> MuxerResult<()>; /// Queues a packet for muxing. @@ -110,6 +111,18 @@ impl<'a> Muxer<'a> { } } +impl<'a> NAOptionHandler for Muxer<'a> { + fn get_supported_options(&self) -> &[NAOptionDefinition] { + self.mux.get_supported_options() + } + fn set_options(&mut self, options: &[NAOption]) { + self.mux.set_options(options); + } + fn query_option_value(&self, name: &str) -> Option { + self.mux.query_option_value(name) + } +} + /// The trait for creating muxers. pub trait MuxerCreator { /// Creates new muxer instance that will use `ByteWriter` for output. @@ -151,4 +164,8 @@ impl RegisteredMuxers { } None } + /// Provides an iterator over currently registered muxers. + pub fn iter(&self) -> std::slice::Iter<&MuxerCreator> { + self.muxes.iter() + } }