From 01f5e2b73280a33d24d2681ac96df6cb169b778b Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Wed, 25 Mar 2026 18:44:52 +0100 Subject: [PATCH] nihav_registry: add functions for MOV fourcc look-up --- nihav-registry/src/register.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/nihav-registry/src/register.rs b/nihav-registry/src/register.rs index 917ad10..dcb2103 100644 --- a/nihav-registry/src/register.rs +++ b/nihav-registry/src/register.rs @@ -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::*; -- 2.39.5