add ogg as audioformat

This commit is contained in:
Christian Schabesberger 2019-01-28 15:43:21 +01:00
parent 14e1ccdb86
commit 644da4fc3c
4 changed files with 17 additions and 14 deletions

View File

@ -30,20 +30,21 @@ public enum MediaFormat {
//video and audio combined formats
// id name suffix mime type
MPEG_4 (0x0, "MPEG-4", "mp4", "video/mp4"),
v3GPP (0x1, "3GPP", "3gp", "video/3gpp"),
WEBM (0x2, "WebM", "webm", "video/webm"),
v3GPP (0x10, "3GPP", "3gp", "video/3gpp"),
WEBM (0x20, "WebM", "webm", "video/webm"),
// audio formats
M4A (0x3, "m4a", "m4a", "audio/mp4"),
WEBMA (0x4, "WebM", "webm", "audio/webm"),
MP3 (0x5, "MP3", "mp3", "audio/mpeg"),
OPUS (0x6, "opus", "opus", "audio/opus"),
M4A (0x100, "m4a", "m4a", "audio/mp4"),
WEBMA (0x200, "WebM", "webm", "audio/webm"),
MP3 (0x300, "MP3", "mp3", "audio/mpeg"),
OPUS (0x400, "opus", "opus", "audio/opus"),
OGG (0x500, "ogg", "ogg", "audio/ogg"),
// subtitles formats
VTT (0x7, "WebVTT", "vtt", "text/vtt"),
TTML (0x8, "Timed Text Markup Language", "ttml", "application/ttml+xml"),
TRANSCRIPT1 (0x9, "TranScript v1", "srv1", "text/xml"),
TRANSCRIPT2 (0xA, "TranScript v2", "srv2", "text/xml"),
TRANSCRIPT3 (0xB, "TranScript v3", "srv3", "text/xml"),
SRT (0xC, "SubRip file format", "srt", "text/srt");
VTT (0x1000, "WebVTT", "vtt", "text/vtt"),
TTML (0x2000, "Timed Text Markup Language", "ttml", "application/ttml+xml"),
TRANSCRIPT1 (0x3000, "TranScript v1", "srv1", "text/xml"),
TRANSCRIPT2 (0x4000, "TranScript v2", "srv2", "text/xml"),
TRANSCRIPT3 (0x5000, "TranScript v3", "srv3", "text/xml"),
SRT (0x6000, "SubRip file format", "srt", "text/srt");
public final int id;
public final String name;

View File

@ -146,6 +146,8 @@ public class MediaCCCStreamExtractor extends StreamExtractor {
mediaFormat = MediaFormat.WEBM;
} else if(mimeType.endsWith("mp4")) {
mediaFormat = MediaFormat.MPEG_4;
} else if(mimeType.endsWith("ogg")){
mediaFormat = MediaFormat.OGG;
} else {
throw new ExtractionException("Unknown media format: " + mimeType);
}

View File

@ -117,7 +117,7 @@ public class YoutubeStreamExtractorAgeRestrictedTest {
s.getUrl().contains(HTTPS));
assertTrue(s.resolution.length() > 0);
assertTrue(Integer.toString(s.getFormatId()),
0 <= s.getFormatId() && s.getFormatId() <= 4);
0 <= s.getFormatId() && s.getFormatId() <= 0x100);
}
}

View File

@ -135,7 +135,7 @@ public class YoutubeStreamExtractorDefaultTest {
assertIsSecureUrl(s.url);
assertTrue(s.resolution.length() > 0);
assertTrue(Integer.toString(s.getFormatId()),
0 <= s.getFormatId() && s.getFormatId() <= 4);
0 <= s.getFormatId() && s.getFormatId() <= 0x100);
}
}