From: Kostya Shishkov Date: Fri, 5 Jun 2020 13:59:28 +0000 (+0200) Subject: copy encoding parameters from the reference when negotiating the format X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=d722ffe95d298490b0ebb3278d6749b7cf59e4fb;p=nihav.git copy encoding parameters from the reference when negotiating the format --- diff --git a/nihav-commonfmt/src/codecs/cinepakenc.rs b/nihav-commonfmt/src/codecs/cinepakenc.rs index d40f504..10e0a36 100644 --- a/nihav-commonfmt/src/codecs/cinepakenc.rs +++ b/nihav-commonfmt/src/codecs/cinepakenc.rs @@ -873,7 +873,7 @@ impl NAEncoder for CinepakEncoder { NACodecTypeInfo::Video(vinfo) => { let pix_fmt = if vinfo.format == GRAY_FORMAT { GRAY_FORMAT } else { YUV420_FORMAT }; let outinfo = NAVideoInfo::new((vinfo.width + 3) & !3, (vinfo.height + 3) & !3, true, pix_fmt); - let mut ofmt = EncodeParameters::default(); + let mut ofmt = *encinfo; ofmt.format = NACodecTypeInfo::Video(outinfo); Ok(ofmt) } diff --git a/nihav-ms/src/codecs/msadpcm.rs b/nihav-ms/src/codecs/msadpcm.rs index de6f447..e6e995b 100644 --- a/nihav-ms/src/codecs/msadpcm.rs +++ b/nihav-ms/src/codecs/msadpcm.rs @@ -320,7 +320,7 @@ impl NAEncoder for MSADPCMEncoder { if (outinfo.channels == 1) && ((outinfo.block_len & 1) == 1) { outinfo.block_len += 1; } - let mut ofmt = EncodeParameters::default(); + let mut ofmt = *encinfo; ofmt.format = NACodecTypeInfo::Audio(outinfo); return Ok(ofmt); } diff --git a/nihav-ms/src/codecs/msvideo1enc.rs b/nihav-ms/src/codecs/msvideo1enc.rs index 6ddae64..f842297 100644 --- a/nihav-ms/src/codecs/msvideo1enc.rs +++ b/nihav-ms/src/codecs/msvideo1enc.rs @@ -410,7 +410,7 @@ impl NAEncoder for MSVideo1Encoder { NACodecTypeInfo::Audio(_) => return Err(EncoderError::FormatError), NACodecTypeInfo::Video(vinfo) => { let outinfo = NAVideoInfo::new((vinfo.width + 3) & !3, (vinfo.height + 3) & !3, true, RGB555_FORMAT); - let mut ofmt = EncodeParameters::default(); + let mut ofmt = *encinfo; ofmt.format = NACodecTypeInfo::Video(outinfo); Ok(ofmt) }