Mark CC subtitle track as CC & grab normal subtitles and CC when using -m audio (#141)

This commit is contained in:
ByteDream 2023-04-17 18:14:54 +02:00
parent c0e2df4804
commit 847c6a1abc
4 changed files with 38 additions and 26 deletions

View file

@ -242,10 +242,16 @@ async fn get_format(
}
};
let subtitles: Vec<Subtitle> = archive
let subtitles: Vec<(Subtitle, bool)> = archive
.subtitle
.iter()
.filter_map(|s| stream.subtitles.get(s).cloned())
.filter_map(|s| {
stream
.subtitles
.get(s)
.cloned()
.map(|l| (l, single_format.audio == Locale::ja_JP))
})
.collect();
format_pairs.push((single_format, video.clone(), audio, subtitles.clone()));
@ -278,9 +284,6 @@ async fn get_format(
subtitles: format_pairs
.iter()
.flat_map(|(_, _, _, subtitles)| subtitles.clone())
.map(|s| (s.locale.clone(), s))
.collect::<HashMap<Locale, Subtitle>>()
.into_values()
.collect(),
}),
MergeBehavior::Auto => {