From: Kostya Shishkov Date: Fri, 10 Mar 2023 17:23:23 +0000 (+0100) Subject: pass null frames to the encoder without attempting to convert them X-Git-Url: https://git.nihav.org/?p=nihav-encoder.git;a=commitdiff_plain;h=637e4d452eb37142ae456aee40ba150cb5d0c06a pass null frames to the encoder without attempting to convert them --- diff --git a/src/main.rs b/src/main.rs index 191a8a6..5e00cf0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -706,7 +706,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 = match cvt { + let cbuf = if let NABufferType::None = buf { + buf + } else { + match cvt { OutputConvert::None => buf, OutputConvert::Video(ref mut scaler, ref mut dbuf) => { let cur_ifmt = get_scale_fmt_from_pic(&buf); @@ -735,7 +738,8 @@ fn encode_frame(dst_id: u32, encoder: &mut Box, cvt: &mut OutputC } ret.unwrap() }, - }; + } + }; let cfrm = NAFrame::new(frm.get_time_information(), frm.frame_type, frm.key, frm.get_info(), cbuf); encoder.encode(&cfrm).unwrap(); true