X-Git-Url: https://git.nihav.org/?a=blobdiff_plain;f=nihav-commonfmt%2Fsrc%2Fcodecs%2Fcinepakenc.rs;h=8273de0197a8755914560af7ce6464189f315c7e;hb=8c3f822a3224477463989f8be27c46d70e257579;hp=ff86a524e4044781da66bf45543c161ac6792133;hpb=c6f14420748b317feab6576ee6bdb4f9af24675e;p=nihav.git diff --git a/nihav-commonfmt/src/codecs/cinepakenc.rs b/nihav-commonfmt/src/codecs/cinepakenc.rs index ff86a52..8273de0 100644 --- a/nihav-commonfmt/src/codecs/cinepakenc.rs +++ b/nihav-commonfmt/src/codecs/cinepakenc.rs @@ -958,6 +958,7 @@ impl NAEncoder for CinepakEncoder { } } } + fn get_capabilities(&self) -> u64 { 0 } fn init(&mut self, stream_id: u32, encinfo: EncodeParameters) -> EncoderResult { match encinfo.format { NACodecTypeInfo::None => Err(EncoderError::FormatError), @@ -999,6 +1000,12 @@ impl NAEncoder for CinepakEncoder { fn encode(&mut self, frm: &NAFrame) -> EncoderResult<()> { let buf = frm.get_buffer(); if let Some(ref vbuf) = buf.get_vbuf() { + if self.nstrips == 0 { + let (w, h) = vbuf.get_dimensions(0); + self.nstrips = ((((w * h) >> 4) + 1200) / 2400).max(1).min(3); + let strip_h = ((h + self.nstrips - 1) / self.nstrips + 3) & !3; + self.nstrips = (h + strip_h - 1) / strip_h; + } let cur_strips = self.v1_cb.len(); if cur_strips != self.nstrips { self.frmcount = 0;