From 65e165af495b5499f2a9096f6f832e40f1e33cc0 Mon Sep 17 00:00:00 2001 From: asonix Date: Sun, 7 Jan 2024 10:01:50 -0600 Subject: [PATCH] Set default audio codecs if none are specified --- src/formats/video.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/formats/video.rs b/src/formats/video.rs index f743274..dc66050 100644 --- a/src/formats/video.rs +++ b/src/formats/video.rs @@ -156,10 +156,13 @@ const fn webm_audio( Some(WebmAudioCodec::Vorbis), !matches!(provided, Some(WebmAudioCodec::Vorbis)), ), - _ => (provided, false), + _ => match provided { + Some(codec) => (Some(codec), false), + None => (Some(WebmAudioCodec::Opus), true), + }, } } else { - (None, false) + (None, true) } } @@ -175,10 +178,13 @@ const fn mp4_audio( Some(Mp4AudioCodec::Aac), !matches!(provided, Some(Mp4AudioCodec::Aac)), ), - _ => (provided, false), + _ => match provided { + Some(codec) => (Some(codec), false), + None => (Some(Mp4AudioCodec::Aac), true), + }, } } else { - (None, false) + (None, true) } }