diff options
author | ByteHamster <info@bytehamster.com> | 2022-01-22 17:03:21 +0100 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2022-01-22 17:16:37 +0100 |
commit | 3b9dfb3c76a0004a5c7f7836214a1ed71a264683 (patch) | |
tree | eab0160f4a9e909c75232d03d21989bb154db554 /parser/media | |
parent | 49b6386a6d09e09abc5c01eabb056863cb86ce7f (diff) | |
download | AntennaPod-3b9dfb3c76a0004a5c7f7836214a1ed71a264683.zip |
Fix vorbis chapter parsing
Diffstat (limited to 'parser/media')
-rw-r--r-- | parser/media/src/main/java/de/danoeh/antennapod/parser/media/vorbis/VorbisCommentReader.java | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/parser/media/src/main/java/de/danoeh/antennapod/parser/media/vorbis/VorbisCommentReader.java b/parser/media/src/main/java/de/danoeh/antennapod/parser/media/vorbis/VorbisCommentReader.java index b4f87bd70..607172531 100644 --- a/parser/media/src/main/java/de/danoeh/antennapod/parser/media/vorbis/VorbisCommentReader.java +++ b/parser/media/src/main/java/de/danoeh/antennapod/parser/media/vorbis/VorbisCommentReader.java @@ -41,7 +41,7 @@ public abstract class VorbisCommentReader { public void readInputStream(InputStream input) throws VorbisCommentReaderException { try { - findIdentificationHeader(input); + skipIdentificationHeader(input); onVorbisCommentFound(); findOggPage(input); findCommentHeader(input); @@ -101,21 +101,20 @@ public abstract class VorbisCommentReader { /** * Looks for an identification header in the first page of the file. If an - * identification header is found, it will be skipped completely and the - * method will return true, otherwise false. + * identification header is found, it will be skipped completely */ - private void findIdentificationHeader(InputStream input) throws IOException { + private void skipIdentificationHeader(InputStream input) throws IOException { byte[] buffer = new byte[FIRST_OPUS_PAGE_LENGTH]; IOUtils.readFully(input, buffer); final byte[] oggIdentificationHeader = new byte[]{ PACKET_TYPE_IDENTIFICATION, 'v', 'o', 'r', 'b', 'i', 's' }; for (int i = 6; i < buffer.length; i++) { if (bufferMatches(buffer, oggIdentificationHeader, i)) { IOUtils.skip(input, FIRST_OGG_PAGE_LENGTH - FIRST_OPUS_PAGE_LENGTH); + return; } else if (bufferMatches(buffer, "OpusHead".getBytes(), i)) { return; } } - throw new IOException("No identification header found"); } private void findCommentHeader(InputStream input) throws IOException { |