From d722ffe95d298490b0ebb3278d6749b7cf59e4fb Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Fri, 5 Jun 2020 15:59:28 +0200 Subject: [PATCH] copy encoding parameters from the reference when negotiating the format --- nihav-commonfmt/src/codecs/cinepakenc.rs | 2 +- nihav-ms/src/codecs/msadpcm.rs | 2 +- nihav-ms/src/codecs/msvideo1enc.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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) } -- 2.39.5