use of com.google.android.exoplayer2.metadata.vorbis.VorbisComment in project ExoPlayer by google.
the class FlacMetadataReaderTest method readMetadataBlock_vorbisCommentBlock_updatesStreamMetadata.
@Test
public void readMetadataBlock_vorbisCommentBlock_updatesStreamMetadata() throws Exception {
ExtractorInput input = buildExtractorInput("media/flac/bear_with_vorbis_comments.flac");
// Skip to Vorbis comment block.
input.skipFully(640);
FlacStreamMetadataHolder metadataHolder = new FlacStreamMetadataHolder(buildStreamMetadata());
long originalSampleRate = metadataHolder.flacStreamMetadata.sampleRate;
FlacMetadataReader.readMetadataBlock(input, metadataHolder);
assertThat(metadataHolder.flacStreamMetadata).isNotNull();
// Check that metadata passed has not been erased.
assertThat(metadataHolder.flacStreamMetadata.sampleRate).isEqualTo(originalSampleRate);
Metadata metadata = metadataHolder.flacStreamMetadata.getMetadataCopyWithAppendedEntriesFrom(null);
assertThat(metadata).isNotNull();
VorbisComment vorbisComment = (VorbisComment) metadata.get(0);
assertThat(vorbisComment.key).isEqualTo("TITLE");
assertThat(vorbisComment.value).isEqualTo("test title");
}
Aggregations