diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2023-03-14 11:12:43 +0100 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2023-03-14 11:12:43 +0100 |
commit | 343a59ecb05378c762181bccbec02a2ed15100e4 (patch) | |
tree | 8b888fb5de8da103a83d898cdcdbc14beda40ae1 | |
parent | 908ba48cf95994308dcd669c9b730c6b5934b401 (diff) | |
download | nihav-encoder-343a59ecb05378c762181bccbec02a2ed15100e4.tar.gz |
adapt to freshly-introduced encoder capabilities
-rw-r--r-- | src/main.rs | 4 | ||||
-rw-r--r-- | src/null.rs | 1 |
2 files changed, 5 insertions, 0 deletions
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<dyn NAEncoder>, 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<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, |