src/main/java/org/jcodec/codecs/mpeg12/MPEGES.java
public MPEGPacket getFrame() throws IOException {

        while (curMarker != 0x100 && curMarker != 0x1b3 && skipToMarker())
            ;

        List<ByteBuffer> buffers = new ArrayList<ByteBuffer>();
        // Reading to the frame header, sequence header, sequence header
        // extensions and group header go in here
        while (curMarker != 0x100 && !done)
            readToNextMarkerBuffers(buffers);

        // Reading the frame header
        readToNextMarkerBuffers(buffers);

        // Reading the slices, will stop on encounter of a frame header of the
        // next frame or a sequence header
        while (curMarker != 0x100 && curMarker != 0x1b3 && !done)
            readToNextMarkerBuffers(buffers);

        ByteBuffer dup = NIOUtils.combineBuffers(buffers);
        PictureHeader ph = MPEGDecoder.getPictureHeader(dup.duplicate());
        
        return dup.hasRemaining() ? new MPEGPacket(dup, 0, 90000, 0, frameNo++,
                ph.picture_coding_type <= MPEGConst.IntraCoded ? FrameType.KEY : FrameType.INTER, null) : null;
    }
public MPEGPacket getFrame() throws IOException {

        while (curMarker != 0x100 && curMarker != 0x1b3 && skipToMarker())
            ;

        List<ByteBuffer> buffers = new ArrayList<ByteBuffer>();
        // Reading to the frame header, sequence header, sequence header
        // extensions and group header go in here
        while (curMarker != 0x100 && !done)
            readToNextMarkerBuffers(buffers);

        // Reading the frame header
        readToNextMarkerBuffers(buffers);

        // Reading the slices, will stop on encounter of a frame header of the
        // next frame or a sequence header
        while (curMarker != 0x100 && curMarker != 0x1b3 && !done)
            readToNextMarkerBuffers(buffers);

        ByteBuffer dup = NIOUtils.combineBuffers(buffers);
        PictureHeader ph = MPEGDecoder.getPictureHeader(dup.duplicate());
        
        return dup.hasRemaining() ? new MPEGPacket(dup, 0, 90000, 0, frameNo++,
                ph.picture_coding_type <= MPEGConst.IntraCoded ? FrameType.KEY : FrameType.INTER, null) : null;
    }
Reads one MPEG1/2 video frame from MPEG1/2 elementary stream.

@return A packet with a video frame or null at the end of stream.
@throws IOException