Search in sources :

Example 1 with CommentHeader

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]);
}
Also used : ParsableByteArray(com.google.android.exoplayer2.util.ParsableByteArray)

Example 2 with CommentHeader

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);
}
Also used : ParsableByteArray(com.google.android.exoplayer2.util.ParsableByteArray) CommentHeader(com.google.android.exoplayer2.extractor.VorbisUtil.CommentHeader)

Example 3 with CommentHeader

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");
}
Also used : ParsableByteArray(com.google.android.exoplayer2.util.ParsableByteArray) Test(org.junit.Test)

Aggregations

ParsableByteArray (com.google.android.exoplayer2.util.ParsableByteArray)3 CommentHeader (com.google.android.exoplayer2.extractor.VorbisUtil.CommentHeader)1 Test (org.junit.Test)1