feat: add audio track types

This commit is contained in:
ThetaDev 2023-05-11 16:00:29 +02:00
parent 3a75ed8610
commit 86775ea95b
9 changed files with 1480 additions and 399 deletions

View file

@ -342,14 +342,14 @@ pub enum VideoFormat {
pub struct AudioTrack {
/// Track ID (e.g. `en.0`)
pub id: String,
/// 2/3 letter language code (e.g. `en`)
///
/// Extracted from the track ID
/// Language code (e.g. `en-US`, `de`)
pub lang: Option<String>,
/// Language name (e.g. "English")
pub lang_name: String,
/// True if this is the default audio track
pub is_default: bool,
/// Audio track type (e.g. *Original*, *Dubbed*)
pub track_type: Option<AudioTrackType>,
}
/// Audio file type
@ -363,6 +363,25 @@ pub enum AudioFormat {
Webm,
}
/// Audio track type
#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[serde(rename_all = "snake_case")]
#[non_exhaustive]
pub enum AudioTrackType {
/// An original audio track of the video
Original,
/// An audio track with the original voices replaced, typically in a different language
Dubbed,
/// A descriptive audio track
///
/// A descriptive audio track is an audio track in which descriptions of visual elements of
/// a video are added to the original audio, with the goal to make a video more accessible to
/// blind and visually impaired people.
///
/// See <https://en.wikipedia.org/wiki/Audio_description>
Descriptive,
}
/// YouTube provides subtitles in different formats.
///
/// srv1 (XML) is the default format, to request a different format you have