]> git.nihav.org Git - nihav.git/commitdiff
rawvideoenc: suggest YUV during format negotiation
authorKostya Shishkov <kostya.shishkov@gmail.com>
Fri, 16 Jun 2023 16:07:39 +0000 (18:07 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Fri, 16 Jun 2023 16:07:39 +0000 (18:07 +0200)
nihav-commonfmt/src/codecs/rawvideoenc.rs

index 8847520829f0a328466f15700ee619dfddf1eb6d..c7285e668ec60be719afdb2287a066b283bbc58f 100644 (file)
@@ -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),
         }
     }