use of com.google.android.exoplayer2.extractor.VorbisUtil.CommentHeader in project ExoPlayer by google.
the class VorbisUtilTest method testReadCommentHeader.
public void testReadCommentHeader() throws ParserException {
byte[] data = TestData.getCommentHeaderDataUTF8();
ParsableByteArray headerData = new ParsableByteArray(data, data.length);
VorbisUtil.CommentHeader commentHeader = VorbisUtil.readVorbisCommentHeader(headerData);
assertEquals("Xiph.Org libVorbis I 20120203 (Omnipresent)", commentHeader.vendor);
assertEquals(3, commentHeader.comments.length);
assertEquals("ALBUM=äö", commentHeader.comments[0]);
assertEquals("TITLE=A sample song", commentHeader.comments[1]);
assertEquals("ARTIST=Google", commentHeader.comments[2]);
}
use of com.google.android.exoplayer2.extractor.VorbisUtil.CommentHeader in project ExoPlayer by google.
the class FlacMetadataReader method readVorbisCommentMetadataBlock.
private static List<String> readVorbisCommentMetadataBlock(ExtractorInput input, int length) throws IOException {
ParsableByteArray scratch = new ParsableByteArray(length);
input.readFully(scratch.getData(), 0, length);
scratch.skipBytes(FlacConstants.METADATA_BLOCK_HEADER_SIZE);
CommentHeader commentHeader = VorbisUtil.readVorbisCommentHeader(scratch, /* hasMetadataHeader= */
false, /* hasFramingBit= */
false);
return Arrays.asList(commentHeader.comments);
}
use of com.google.android.exoplayer2.extractor.VorbisUtil.CommentHeader in project ExoPlayer by google.
the class VorbisUtilTest method readCommentHeader.
@Test
public void readCommentHeader() throws IOException {
byte[] data = TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), "media/binary/vorbis/comment_header");
ParsableByteArray headerData = new ParsableByteArray(data, data.length);
VorbisUtil.CommentHeader commentHeader = VorbisUtil.readVorbisCommentHeader(headerData);
assertThat(commentHeader.vendor).isEqualTo("Xiph.Org libVorbis I 20120203 (Omnipresent)");
assertThat(commentHeader.comments).hasLength(3);
assertThat(commentHeader.comments[0]).isEqualTo("ALBUM=äö");
assertThat(commentHeader.comments[1]).isEqualTo("TITLE=A sample song");
assertThat(commentHeader.comments[2]).isEqualTo("ARTIST=Google");
}
Aggregations