Skip to content

Commit 644da4f

Browse files
committed
add ogg as audioformat
1 parent 14e1ccd commit 644da4f

4 files changed

Lines changed: 17 additions & 14 deletions

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/MediaFormat.java

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,21 @@ public enum MediaFormat {
3030
//video and audio combined formats
3131
// id name suffix mime type
3232
MPEG_4 (0x0, "MPEG-4", "mp4", "video/mp4"),
33-
v3GPP (0x1, "3GPP", "3gp", "video/3gpp"),
34-
WEBM (0x2, "WebM", "webm", "video/webm"),
33+
v3GPP (0x10, "3GPP", "3gp", "video/3gpp"),
34+
WEBM (0x20, "WebM", "webm", "video/webm"),
3535
// audio formats
36-
M4A (0x3, "m4a", "m4a", "audio/mp4"),
37-
WEBMA (0x4, "WebM", "webm", "audio/webm"),
38-
MP3 (0x5, "MP3", "mp3", "audio/mpeg"),
39-
OPUS (0x6, "opus", "opus", "audio/opus"),
36+
M4A (0x100, "m4a", "m4a", "audio/mp4"),
37+
WEBMA (0x200, "WebM", "webm", "audio/webm"),
38+
MP3 (0x300, "MP3", "mp3", "audio/mpeg"),
39+
OPUS (0x400, "opus", "opus", "audio/opus"),
40+
OGG (0x500, "ogg", "ogg", "audio/ogg"),
4041
// subtitles formats
41-
VTT (0x7, "WebVTT", "vtt", "text/vtt"),
42-
TTML (0x8, "Timed Text Markup Language", "ttml", "application/ttml+xml"),
43-
TRANSCRIPT1 (0x9, "TranScript v1", "srv1", "text/xml"),
44-
TRANSCRIPT2 (0xA, "TranScript v2", "srv2", "text/xml"),
45-
TRANSCRIPT3 (0xB, "TranScript v3", "srv3", "text/xml"),
46-
SRT (0xC, "SubRip file format", "srt", "text/srt");
42+
VTT (0x1000, "WebVTT", "vtt", "text/vtt"),
43+
TTML (0x2000, "Timed Text Markup Language", "ttml", "application/ttml+xml"),
44+
TRANSCRIPT1 (0x3000, "TranScript v1", "srv1", "text/xml"),
45+
TRANSCRIPT2 (0x4000, "TranScript v2", "srv2", "text/xml"),
46+
TRANSCRIPT3 (0x5000, "TranScript v3", "srv3", "text/xml"),
47+
SRT (0x6000, "SubRip file format", "srt", "text/srt");
4748

4849
public final int id;
4950
public final String name;

extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCStreamExtractor.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ public List<VideoStream> getVideoStreams() throws IOException, ExtractionExcepti
146146
mediaFormat = MediaFormat.WEBM;
147147
} else if(mimeType.endsWith("mp4")) {
148148
mediaFormat = MediaFormat.MPEG_4;
149+
} else if(mimeType.endsWith("ogg")){
150+
mediaFormat = MediaFormat.OGG;
149151
} else {
150152
throw new ExtractionException("Unknown media format: " + mimeType);
151153
}

extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorAgeRestrictedTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public void testGetVideoStreams() throws IOException, ExtractionException {
117117
s.getUrl().contains(HTTPS));
118118
assertTrue(s.resolution.length() > 0);
119119
assertTrue(Integer.toString(s.getFormatId()),
120-
0 <= s.getFormatId() && s.getFormatId() <= 4);
120+
0 <= s.getFormatId() && s.getFormatId() <= 0x100);
121121
}
122122
}
123123

extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorDefaultTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public void testGetVideoStreams() throws IOException, ExtractionException {
135135
assertIsSecureUrl(s.url);
136136
assertTrue(s.resolution.length() > 0);
137137
assertTrue(Integer.toString(s.getFormatId()),
138-
0 <= s.getFormatId() && s.getFormatId() <= 4);
138+
0 <= s.getFormatId() && s.getFormatId() <= 0x100);
139139
}
140140
}
141141

0 commit comments

Comments
 (0)