]> git.nihav.org Git - nihav-encoder.git/blobdiff - src/null.rs
use u32::MAX instead of deprecated std::u32::MAX
[nihav-encoder.git] / src / null.rs
index eceef40874c788c7a81b83d69a0122ba8673bc20..f9e5ed8c068272c283d7835287f0f592f6f50608 100644 (file)
@@ -16,6 +16,7 @@ impl NAEncoder for NullEncoder {
     fn negotiate_format(&self, encinfo: &EncodeParameters) -> EncoderResult<EncodeParameters> {
         Ok(*encinfo)
     }
+    fn get_capabilities(&self) -> u64 { 0 }
     fn init(&mut self, stream_id: u32, encinfo: EncodeParameters) -> EncoderResult<NAStreamRef> {
         let stype = match encinfo.format {
                 NACodecTypeInfo::Audio(_) => StreamType::Audio,
@@ -23,7 +24,7 @@ impl NAEncoder for NullEncoder {
                 NACodecTypeInfo::None => StreamType::Data,
             };
         let info = NACodecInfo::new("null", encinfo.format, None);
-        let mut stream = NAStream::new(stype, stream_id, info, encinfo.tb_num, encinfo.tb_den);
+        let mut stream = NAStream::new(stype, stream_id, info, encinfo.tb_num, encinfo.tb_den, 0);
         stream.set_num(stream_id as usize);
         let stream = stream.into_ref();
         self.stream = Some(stream.clone());
@@ -54,18 +55,15 @@ fn get_encoder() -> Box<dyn NAEncoder + Send> {
     Box::new(NullEncoder::new())
 }
 
-pub const NULL_ENCODER: EncoderInfo = EncoderInfo { name: "null", get_encoder: get_encoder };
+pub const NULL_ENCODER: EncoderInfo = EncoderInfo { name: "null", get_encoder };
 
+#[derive(Default)]
 struct NullMuxer<'a> {
     bw:             PhantomData<&'a mut ByteWriter<'a>>,
 }
 
 impl<'a> NullMuxer<'a> {
-    fn new(_bw: &'a mut ByteWriter<'a>) -> Self {
-        Self {
-            bw: PhantomData::default(),
-        }
-    }
+    fn new(_bw: &'a mut ByteWriter<'a>) -> Self { Self::default() }
 }
 
 impl<'a> MuxCore<'a> for NullMuxer<'a> {
@@ -97,6 +95,7 @@ impl MuxerCreator for NullMuxerCreator {
     }
     fn get_name(&self) -> &'static str { "null" }
     fn get_capabilities(&self) -> MuxerCapabilities { MuxerCapabilities::Universal }
+    fn get_quirks(&self) -> MuxerQuirks { MuxerQuirks(MUX_QUIRK_UNSYNC) }
 }
 
 pub const NULL_MUXER: &dyn MuxerCreator = &NullMuxerCreator{};