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)]
/// A specialised `Result` type for muxing operations.
pub type MuxerResult<T> = Result<T, MuxerError>;
+/// 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<ByteIOError> 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.
}
}
+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<NAValue> {
+ self.mux.query_option_value(name)
+ }
+}
+
/// The trait for creating muxers.
pub trait MuxerCreator {
/// Creates new muxer instance that will use `ByteWriter` for output.
fn new_muxer<'a>(&self, bw: &'a mut ByteWriter<'a>) -> Box<dyn MuxCore<'a> + '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.
}
None
}
+ /// Provides an iterator over currently registered muxers.
+ pub fn iter(&self) -> std::slice::Iter<&MuxerCreator> {
+ self.muxes.iter()
+ }
}