use of org.taktik.mpegts.MTSPacket in project alliance by codice.
the class H262Test method testIDRFrameCount.
@Test
public void testIDRFrameCount() throws Exception {
EmbeddedChannel channel = new EmbeddedChannel(new MTSPacketToPESPacketDecoder(), new PESPacketToApplicationDataDecoder(), new DecodedStreamDataHandler(packetBuffer));
InputStream inputStream = getInputStream("/Closed_Caption_EIA_MPEG2.ts");
byte[] buffer = new byte[TS_SIZE];
int c;
while ((c = inputStream.read(buffer)) != -1) {
if (c == TS_SIZE) {
ResettableMTSSource src = MTSSources.from(ByteSource.wrap(buffer));
MTSPacket packet = null;
try {
packet = src.nextPacket();
} catch (IOException e) {
LOGGER.debug("unable to parse mpegst packet", e);
}
if (packet != null) {
channel.writeInbound(packet);
}
}
}
verify(packetBuffer, times(37)).frameComplete(PacketBuffer.FrameType.IDR);
}
use of org.taktik.mpegts.MTSPacket in project alliance by codice.
the class MTSPacketToPESPacketDecoderTest method testDecode.
/**
* This test sends MTSPackets to the decoder so that the decoder outputs one video pes packet.
*
* @throws Exception
*/
@Test
public void testDecode() throws Exception {
MpegTsDecoder mpegTsDecoder = mock(MpegTsDecoder.class);
MTSPacketToPESPacketDecoder decoder = new MTSPacketToPESPacketDecoder(mpegTsDecoder);
MTSPacket mtsPacket = mock(MTSPacket.class);
EmbeddedChannel channel = new EmbeddedChannel(decoder);
channel.writeInbound(mtsPacket);
NettyUtility.read(channel);
verify(mpegTsDecoder).read(eq(mtsPacket), anyObject());
}
Aggregations