Search in sources :

Example 1 with KlvDecoder

use of org.codice.ddf.libs.klv.KlvDecoder in project alliance by codice.

the class MetadataPacketTest method testSynchronousMetadataPacketMetadataAccessUnitTooShort.

@Test
public void testSynchronousMetadataPacketMetadataAccessUnitTooShort() throws Exception {
    final byte[] pesPacketBytes = new byte[] { 0x00, 0x00, 0x01, (byte) 0xFC, 0x00, 0x0C, (byte) 0x85, (byte) 0x80, 0x05, 0x27, 0x19, 0x2B, 0x33, (byte) 0x91, 0x01, 0x01, 0x01, 0x00 };
    final SynchronousMetadataPacket packet = new SynchronousMetadataPacket(pesPacketBytes, MPSUtils.readPESHeader(ByteBuffer.wrap(pesPacketBytes), 0), new KlvDecoder(Stanag4609TransportStreamParser.UAS_DATALINK_LOCAL_SET_CONTEXT));
    assertThat(packet.decodeKLV(), nullValue());
}
Also used : KlvDecoder(org.codice.ddf.libs.klv.KlvDecoder) Test(org.junit.Test)

Example 2 with KlvDecoder

use of org.codice.ddf.libs.klv.KlvDecoder in project alliance by codice.

the class MetadataPacketTest method testWrongChecksum.

@Test(expected = KlvDecodingException.class)
public void testWrongChecksum() throws Exception {
    final byte[] pesPacketBytes = new byte[] { 0x00, 0x00, 0x01, (byte) 0xBD, 0x00, 0x18, (byte) 0x85, (byte) 0x00, 0x00, 0x06, 0x0E, 0x2B, 0x34, 0x02, 0x0B, 0x01, 0x01, 0x0E, 0x01, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x04, 0x01, 0x02, 0x4C, 0x52 };
    final AsynchronousMetadataPacket packet = new AsynchronousMetadataPacket(pesPacketBytes, MPSUtils.readPESHeader(ByteBuffer.wrap(pesPacketBytes), 0), new KlvDecoder(Stanag4609TransportStreamParser.UAS_DATALINK_LOCAL_SET_CONTEXT));
    packet.decodeKLV();
}
Also used : KlvDecoder(org.codice.ddf.libs.klv.KlvDecoder) Test(org.junit.Test)

Example 3 with KlvDecoder

use of org.codice.ddf.libs.klv.KlvDecoder in project alliance by codice.

the class MetadataPacketTest method testAsynchronousMetadataPacket.

@Test
public void testAsynchronousMetadataPacket() throws Exception {
    final byte[] pesPacketBytes = new byte[] { 0x00, 0x00, 0x01, (byte) 0xBD, 0x00, 0x18, (byte) 0x85, (byte) 0x00, 0x00, 0x06, 0x0E, 0x2B, 0x34, 0x02, 0x0B, 0x01, 0x01, 0x0E, 0x01, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x04, 0x01, 0x02, 0x4C, 0x51 };
    final AsynchronousMetadataPacket packet = new AsynchronousMetadataPacket(pesPacketBytes, MPSUtils.readPESHeader(ByteBuffer.wrap(pesPacketBytes), 0), new KlvDecoder(Stanag4609TransportStreamParser.UAS_DATALINK_LOCAL_SET_CONTEXT));
    final DecodedKLVMetadataPacket decodedPacket = packet.decodeKLV();
    verifyDecodedKLV(decodedPacket);
    assertThat(decodedPacket.getPresentationTimestamp(), is(lessThan(0L)));
}
Also used : KlvDecoder(org.codice.ddf.libs.klv.KlvDecoder) Test(org.junit.Test)

Example 4 with KlvDecoder

use of org.codice.ddf.libs.klv.KlvDecoder in project alliance by codice.

the class MetadataPacketTest method testChecksumMissingUASDatalinkLocalSet.

@Test(expected = KlvDecodingException.class)
public void testChecksumMissingUASDatalinkLocalSet() throws Exception {
    final byte[] pesPacketBytes = new byte[] { 0x00, 0x00, 0x01, (byte) 0xBD, 0x00, 0x18, (byte) 0x85, (byte) 0x00, 0x00, 0x06, 0x0E, 0x2B, 0x34, 0x02, 0x0B, 0x01, 0x01, 0x0E, 0x01, 0x03, 0x01, 0x01, 0x00, 0x00, 0x01, 0x04, 0x01, 0x02, 0x4C, 0x52 };
    final AsynchronousMetadataPacket packet = new AsynchronousMetadataPacket(pesPacketBytes, MPSUtils.readPESHeader(ByteBuffer.wrap(pesPacketBytes), 0), new KlvDecoder(Stanag4609TransportStreamParser.UAS_DATALINK_LOCAL_SET_CONTEXT));
    packet.decodeKLV();
}
Also used : KlvDecoder(org.codice.ddf.libs.klv.KlvDecoder) Test(org.junit.Test)

Example 5 with KlvDecoder

use of org.codice.ddf.libs.klv.KlvDecoder in project alliance by codice.

the class MetadataPacketTest method testMissingChecksum.

@Test(expected = KlvDecodingException.class)
public void testMissingChecksum() throws Exception {
    final byte[] pesPacketBytes = new byte[] { 0x00, 0x00, 0x01, (byte) 0xBD, 0x00, 0x18, (byte) 0x85, (byte) 0x00, 0x00, 0x06, 0x0E, 0x2B, 0x34, 0x02, 0x0B, 0x01, 0x01, 0x0E, 0x01, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x04, 0x06, 0x02, 0x01, 0x01 };
    final AsynchronousMetadataPacket packet = new AsynchronousMetadataPacket(pesPacketBytes, MPSUtils.readPESHeader(ByteBuffer.wrap(pesPacketBytes), 0), new KlvDecoder(Stanag4609TransportStreamParser.UAS_DATALINK_LOCAL_SET_CONTEXT));
    packet.decodeKLV();
}
Also used : KlvDecoder(org.codice.ddf.libs.klv.KlvDecoder) Test(org.junit.Test)

Aggregations

KlvDecoder (org.codice.ddf.libs.klv.KlvDecoder)8 Test (org.junit.Test)7 KlvContext (org.codice.ddf.libs.klv.KlvContext)1 KlvDataElement (org.codice.ddf.libs.klv.KlvDataElement)1 KlvLocalSet (org.codice.ddf.libs.klv.data.set.KlvLocalSet)1 MPSDemuxer (org.jcodec.containers.mps.MPSDemuxer)1