X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=nihav-core%2Fsrc%2Fmuxers%2Fmod.rs;h=9f40d54424349bd8c1914e31f1f0d9bb36220212;hb=dc80f48ea3097c891b159667ea239d3c20c78bc8;hp=ba6f780081297c52b8c7e9eade5dfc7db16ada25;hpb=a92964d593be4ebf96706842c02b428d68325b8d;p=nihav.git diff --git a/nihav-core/src/muxers/mod.rs b/nihav-core/src/muxers/mod.rs index ba6f780..9f40d54 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)] @@ -28,12 +29,33 @@ pub enum MuxerError { /// A specialised `Result` type for muxing operations. pub type MuxerResult = Result; +/// Muxer capabilities. +#[derive(Clone,Copy,Debug,PartialEq)] +pub enum MuxerCapabilities { + /// Muxer accepts single video stream with certain codec. + /// + /// Codec name `"any"` means various codecs are supported. + SingleVideo(&'static str), + /// Muxer accepts single audio stream with certain codec. + /// + /// Codec name `"any"` means various codecs are supported. + SingleAudio(&'static str), + /// Muxer accepts single video stream and single audio stream with defined codecs. + SingleVideoAndAudio(&'static str, &'static str), + /// Muxer accepts only video streams but can mux several video streams. + OnlyVideo, + /// Muxer accepts only audio streams but can mux several video streams.. + OnlyAudio, + /// Muxer accepts variable amount of streams of any type. + Universal, +} + impl From for MuxerError { fn from(_: ByteIOError) -> Self { MuxerError::IOError } } /// 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. @@ -95,6 +117,8 @@ pub trait MuxerCreator { fn new_muxer<'a>(&self, bw: &'a mut ByteWriter<'a>) -> Box + 'a>; /// Returns the name of current muxer creator (equal to the container name it can create). fn get_name(&self) -> &'static str; + /// Returns muxer capabilities for the current muxer. + fn get_capabilities(&self) -> MuxerCapabilities; } /// Creates muxer for a provided bytestream writer.