use of androidx.media3.extractor.metadata.MetadataInputBuffer in project media by androidx.
the class AppInfoTableDecoderTest method decode_failsIfArrayOffsetNonZero.
@Test
public void decode_failsIfArrayOffsetNonZero() {
AppInfoTableDecoder decoder = new AppInfoTableDecoder();
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 EventMessageDecoderTest 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 IcyDecoderTest method decode_failsIfBufferHasNoArray.
@Test
public void decode_failsIfBufferHasNoArray() {
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 SpliceInfoDecoderTest method decodeFailsIfBufferHasNoArray.
@Test
public void decodeFailsIfBufferHasNoArray() {
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 TestUtil method createMetadataInputBuffer.
/**
* Create a new {@link MetadataInputBuffer} and copy {@code data} into the backing {@link
* ByteBuffer}.
*/
public static MetadataInputBuffer createMetadataInputBuffer(byte[] data) {
MetadataInputBuffer buffer = new MetadataInputBuffer();
buffer.data = ByteBuffer.allocate(data.length).put(data);
buffer.data.flip();
return buffer;
}
Aggregations