From dc80f48ea3097c891b159667ea239d3c20c78bc8 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Sun, 31 May 2020 15:18:42 +0200 Subject: [PATCH] make muxers handle options --- nihav-commonfmt/src/muxers/avi.rs | 6 ++++++ nihav-commonfmt/src/muxers/wav.rs | 6 ++++++ nihav-core/src/muxers/mod.rs | 3 ++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/nihav-commonfmt/src/muxers/avi.rs b/nihav-commonfmt/src/muxers/avi.rs index ac13cb2..9b83296 100644 --- a/nihav-commonfmt/src/muxers/avi.rs +++ b/nihav-commonfmt/src/muxers/avi.rs @@ -288,6 +288,12 @@ impl<'a> MuxCore<'a> for AVIMuxer<'a> { } } +impl<'a> NAOptionHandler for AVIMuxer<'a> { + fn get_supported_options(&self) -> &[NAOptionDefinition] { &[] } + fn set_options(&mut self, _options: &[NAOption]) { } + fn query_option_value(&self, _name: &str) -> Option { None } +} + pub struct AVIMuxerCreator {} impl MuxerCreator for AVIMuxerCreator { diff --git a/nihav-commonfmt/src/muxers/wav.rs b/nihav-commonfmt/src/muxers/wav.rs index a11bb2a..3512317 100644 --- a/nihav-commonfmt/src/muxers/wav.rs +++ b/nihav-commonfmt/src/muxers/wav.rs @@ -98,6 +98,12 @@ impl<'a> MuxCore<'a> for WAVMuxer<'a> { } } +impl<'a> NAOptionHandler for WAVMuxer<'a> { + fn get_supported_options(&self) -> &[NAOptionDefinition] { &[] } + fn set_options(&mut self, _options: &[NAOption]) { } + fn query_option_value(&self, _name: &str) -> Option { None } +} + pub struct WAVMuxerCreator {} impl MuxerCreator for WAVMuxerCreator { diff --git a/nihav-core/src/muxers/mod.rs b/nihav-core/src/muxers/mod.rs index e8a1afb..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)] @@ -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. -- 2.30.2