diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2023-06-16 18:07:39 +0200 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2023-06-16 18:07:39 +0200 |
commit | e9aa1a76a93164b2997251d0c28bd98ebd4e8f66 (patch) | |
tree | a00e2dbb227e088ec25f3c6c3e8e12322f185cb4 | |
parent | f9c76c79e1f04372a09ee6c19d1ee1b625306dd9 (diff) | |
download | nihav-e9aa1a76a93164b2997251d0c28bd98ebd4e8f66.tar.gz |
rawvideoenc: suggest YUV during format negotiation
-rw-r--r-- | nihav-commonfmt/src/codecs/rawvideoenc.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/nihav-commonfmt/src/codecs/rawvideoenc.rs b/nihav-commonfmt/src/codecs/rawvideoenc.rs index 8847520..c7285e6 100644 --- a/nihav-commonfmt/src/codecs/rawvideoenc.rs +++ b/nihav-commonfmt/src/codecs/rawvideoenc.rs @@ -23,7 +23,15 @@ impl NAEncoder for RawEncoder { ..Default::default() }) }, - NACodecTypeInfo::Video(_) => Ok(*encinfo), + NACodecTypeInfo::Video(_) => { + let mut new_info = *encinfo; + if let NACodecTypeInfo::Video(ref mut vinfo) = new_info.format { + if !vinfo.format.model.is_yuv() { + vinfo.format = YUV420_FORMAT; + } + } + Ok(new_info) + }, NACodecTypeInfo::Audio(_) => Err(EncoderError::FormatError), } } |