From 343a59ecb05378c762181bccbec02a2ed15100e4 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Tue, 14 Mar 2023 11:12:43 +0100 Subject: [PATCH] adapt to freshly-introduced encoder capabilities --- src/main.rs | 4 ++++ src/null.rs | 1 + 2 files changed, 5 insertions(+) diff --git a/src/main.rs b/src/main.rs index 41a4a92..409c677 100644 --- a/src/main.rs +++ b/src/main.rs @@ -707,6 +707,10 @@ println!("can't generate default channel map for {} channels", dainfo.channels); fn encode_frame(dst_id: u32, encoder: &mut Box, cvt: &mut OutputConvert, frm: NAFrameRef, scale_opts: &[(String, String)]) -> bool { let buf = frm.get_buffer(); let cbuf = if let NABufferType::None = buf { + if (encoder.get_capabilities() & ENC_CAPS_SKIPFRAME) == 0 { + println!("encoder does not support skip frames, skipping"); + return true; + } buf } else { match cvt { diff --git a/src/null.rs b/src/null.rs index 3e9b813..eece63b 100644 --- a/src/null.rs +++ b/src/null.rs @@ -16,6 +16,7 @@ impl NAEncoder for NullEncoder { fn negotiate_format(&self, encinfo: &EncodeParameters) -> EncoderResult { Ok(*encinfo) } + fn get_capabilities(&self) -> u64 { 0 } fn init(&mut self, stream_id: u32, encinfo: EncodeParameters) -> EncoderResult { let stype = match encinfo.format { NACodecTypeInfo::Audio(_) => StreamType::Audio, -- 2.39.5