[YouTube] Add support for automatic dubbed and secondary tracks

This commit is contained in:
AudricV 2024-10-26 20:32:39 +02:00
parent abba78cf9d
commit 8a3350f79d
No known key found for this signature in database
GPG Key ID: DA92EC7905614198
3 changed files with 20 additions and 3 deletions

View File

@ -1720,9 +1720,12 @@ public final class YoutubeParsingHelper {
case "original":
return AudioTrackType.ORIGINAL;
case "dubbed":
case "dubbed-auto":
return AudioTrackType.DUBBED;
case "descriptive":
return AudioTrackType.DESCRIPTIVE;
case "secondary":
return AudioTrackType.SECONDARY;
default:
return null;
}

View File

@ -325,6 +325,8 @@ public final class YoutubeDashManifestCreatorsUtils {
case DESCRIPTIVE:
return "description";
default:
// Secondary track types do not seem to have a dedicated role in the DASH
// specification, so use alternate for them
return "alternate";
}
}

View File

@ -1,12 +1,13 @@
package org.schabi.newpipe.extractor.stream;
/**
* An enum representing the track type of an {@link AudioStream} extracted by a {@link
* An enum representing the track type of {@link AudioStream}s extracted by a {@link
* StreamExtractor}.
*/
public enum AudioTrackType {
/**
* An original audio track of the video.
* An original audio track of a video.
*/
ORIGINAL,
@ -20,6 +21,7 @@ public enum AudioTrackType {
/**
* A descriptive audio track.
*
* <p>
* 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
@ -29,5 +31,15 @@ public enum AudioTrackType {
* @see <a href="https://en.wikipedia.org/wiki/Audio_description">
* https://en.wikipedia.org/wiki/Audio_description</a>
*/
DESCRIPTIVE
DESCRIPTIVE,
/**
* A secondary audio track.
*
* <p>
* A secondary audio track can be an alternate audio track from the original language of a
* video or an alternate language.
* </p>
*/
SECONDARY
}