From 644da4fc3cb3e9b63cbb27fe50ec56e0d5f9e1b7 Mon Sep 17 00:00:00 2001 From: Christian Schabesberger Date: Mon, 28 Jan 2019 15:43:21 +0100 Subject: [PATCH] add ogg as audioformat --- .../schabi/newpipe/extractor/MediaFormat.java | 25 ++++++++++--------- .../extractors/MediaCCCStreamExtractor.java | 2 ++ ...utubeStreamExtractorAgeRestrictedTest.java | 2 +- .../YoutubeStreamExtractorDefaultTest.java | 2 +- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/MediaFormat.java b/extractor/src/main/java/org/schabi/newpipe/extractor/MediaFormat.java index 21ead42c4..bb8366510 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/MediaFormat.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/MediaFormat.java @@ -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; diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCStreamExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCStreamExtractor.java index f26747d6a..5c9900236 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCStreamExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCStreamExtractor.java @@ -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); } diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorAgeRestrictedTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorAgeRestrictedTest.java index dbf8d6d61..8a91887af 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorAgeRestrictedTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorAgeRestrictedTest.java @@ -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); } } diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorDefaultTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorDefaultTest.java index 24e8b7fae..f4d8a3540 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorDefaultTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorDefaultTest.java @@ -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); } }