use of androidx.media3.extractor.metadata.MetadataInputBuffer in project media by androidx.
the class EventSampleStreamTest method setUp.
@Before
public void setUp() {
formatHolder = new FormatHolder();
inputBuffer = new MetadataInputBuffer();
eventMessageEncoder = new EventMessageEncoder();
}
use of androidx.media3.extractor.metadata.MetadataInputBuffer in project media by androidx.
the class Id3DecoderTest method createMetadataInputBuffer.
/**
* Create a new {@link MetadataInputBuffer} and copy {@code data} into the backing {@link
* ByteBuffer}.
*/
// TODO(internal b/161804035): Use TestUtils when it's available in a dependency we can use here.
private static MetadataInputBuffer createMetadataInputBuffer(byte[] data) {
MetadataInputBuffer buffer = new MetadataInputBuffer();
buffer.data = ByteBuffer.allocate(data.length).put(data);
buffer.data.flip();
return buffer;
}
use of androidx.media3.extractor.metadata.MetadataInputBuffer in project media by androidx.
the class Id3DecoderTest method decodeFailsIfBufferHasNoArray.
@Test
public void decodeFailsIfBufferHasNoArray() {
Id3Decoder decoder = new Id3Decoder();
MetadataInputBuffer buffer = createMetadataInputBuffer(createByteArray(1, 2, 3));
buffer.data = buffer.data.asReadOnlyBuffer();
assertThrows(IllegalArgumentException.class, () -> decoder.decode(buffer));
}
use of androidx.media3.extractor.metadata.MetadataInputBuffer in project media by androidx.
the class Id3DecoderTest method decodeFailsIfArrayOffsetNonZero.
@Test
public void decodeFailsIfArrayOffsetNonZero() {
Id3Decoder decoder = new Id3Decoder();
MetadataInputBuffer buffer = createMetadataInputBuffer(createByteArray(1, 2, 3));
buffer.data.position(1);
buffer.data = buffer.data.slice();
assertThrows(IllegalArgumentException.class, () -> decoder.decode(buffer));
}
use of androidx.media3.extractor.metadata.MetadataInputBuffer in project media by androidx.
the class Id3DecoderTest method decodeFailsIfPositionNonZero.
@Test
public void decodeFailsIfPositionNonZero() {
Id3Decoder decoder = new Id3Decoder();
MetadataInputBuffer buffer = createMetadataInputBuffer(createByteArray(1, 2, 3));
buffer.data.position(1);
assertThrows(IllegalArgumentException.class, () -> decoder.decode(buffer));
}
Aggregations