Search in sources :

Example 1 with EventMessageEncoder

use of com.google.android.exoplayer2.metadata.emsg.EventMessageEncoder in project ExoPlayer by google.

the class EventMessageEncoderTest method encodeDecodeEventStream.

@Test
public void encodeDecodeEventStream() throws IOException {
    byte[] encodedByteArray = new EventMessageEncoder().encode(DECODED_MESSAGE);
    MetadataInputBuffer buffer = createMetadataInputBuffer(encodedByteArray);
    EventMessageDecoder decoder = new EventMessageDecoder();
    Metadata metadata = decoder.decode(buffer);
    assertThat(metadata.length()).isEqualTo(1);
    assertThat(metadata.get(0)).isEqualTo(DECODED_MESSAGE);
}
Also used : MetadataInputBuffer(com.google.android.exoplayer2.metadata.MetadataInputBuffer) Metadata(com.google.android.exoplayer2.metadata.Metadata) Test(org.junit.Test)

Example 2 with EventMessageEncoder

use of com.google.android.exoplayer2.metadata.emsg.EventMessageEncoder in project ExoPlayer by google.

the class EventSampleStreamTest method setUp.

@Before
public void setUp() {
    formatHolder = new FormatHolder();
    inputBuffer = new MetadataInputBuffer();
    eventMessageEncoder = new EventMessageEncoder();
}
Also used : MetadataInputBuffer(com.google.android.exoplayer2.metadata.MetadataInputBuffer) FormatHolder(com.google.android.exoplayer2.FormatHolder) EventMessageEncoder(com.google.android.exoplayer2.metadata.emsg.EventMessageEncoder) Before(org.junit.Before)

Example 3 with EventMessageEncoder

use of com.google.android.exoplayer2.metadata.emsg.EventMessageEncoder in project ExoPlayer by google.

the class EventMessageEncoderTest method encodeDecodeEventMessage_durationNotSet.

// https://github.com/google/ExoPlayer/issues/9123
@Test
public void encodeDecodeEventMessage_durationNotSet() {
    EventMessage originalMessage = new EventMessage("urn:test", "456", C.TIME_UNSET, 99, new byte[] { 7, 8, 9 });
    byte[] encodedMessage = new EventMessageEncoder().encode(originalMessage);
    EventMessage decodedMessage = new EventMessageDecoder().decode(new ParsableByteArray(encodedMessage));
    assertThat(decodedMessage).isEqualTo(originalMessage);
}
Also used : ParsableByteArray(com.google.android.exoplayer2.util.ParsableByteArray) Test(org.junit.Test)

Aggregations

MetadataInputBuffer (com.google.android.exoplayer2.metadata.MetadataInputBuffer)2 Test (org.junit.Test)2 FormatHolder (com.google.android.exoplayer2.FormatHolder)1 Metadata (com.google.android.exoplayer2.metadata.Metadata)1 EventMessageEncoder (com.google.android.exoplayer2.metadata.emsg.EventMessageEncoder)1 ParsableByteArray (com.google.android.exoplayer2.util.ParsableByteArray)1 Before (org.junit.Before)1