]> git.nihav.org Git - nihav.git/commitdiff
nihav_registry: add functions for MOV fourcc look-up
authorKostya Shishkov <kostya.shishkov@gmail.com>
Wed, 25 Mar 2026 17:44:52 +0000 (18:44 +0100)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Wed, 25 Mar 2026 17:44:52 +0000 (18:44 +0100)
nihav-registry/src/register.rs

index 917ad107f5a69f3f267e9ff9a5c8cadf8bb97dc9..dcb21038803059874d20d0cb48af041bcb9af37b 100644 (file)
@@ -556,6 +556,22 @@ pub fn find_codec_from_mov_audio_fourcc(fcc: &[u8;4]) -> Option<&'static str> {
     None
 }
 
+/// Returns FOURCC (used in MOV format) for provided video codec name.
+pub fn find_mov_video_fourcc(codecname: &str) -> Option<[u8; 4]> {
+    for (fourcc, name) in MOV_VIDEO_CODEC_REGISTER.iter() {
+        if *name == codecname { return Some(**fourcc); }
+    }
+    None
+}
+
+/// Returns FOURCC (used in MOV format) for provided audio codec name.
+pub fn find_mov_audio_fourcc(codecname: &str) -> Option<[u8; 4]> {
+    for (fourcc, name) in MOV_AUDIO_CODEC_REGISTER.iter() {
+        if *name == codecname { return Some(**fourcc); }
+    }
+    None
+}
+
 #[cfg(test)]
 mod test {
     use super::*;