public static void wipePS(ByteBuffer _in, ByteBuffer out, List<ByteBuffer> spsList, List<ByteBuffer> ppsList) {

        ByteBuffer dup = _in.duplicate();
        while (dup.hasRemaining()) {
            ByteBuffer buf = H264Utils.nextNALUnit(dup);
            if (buf == null)
                break;

            NALUnit nu = NALUnit.read(buf.duplicate());
            if (nu.type == NALUnitType.PPS) {
                if (ppsList != null)
                    ppsList.add(NIOUtils.duplicate(buf));
            } else if (nu.type == NALUnitType.SPS) {
                if (spsList != null)
                    spsList.add(NIOUtils.duplicate(buf));
            } else if (out != null) {
                out.putInt(1);
                out.put(buf);
            }
        }
        if (out != null)
            out.flip();
    }
public static void wipePS(ByteBuffer _in, ByteBuffer out, List<ByteBuffer> spsList, List<ByteBuffer> ppsList) {

        ByteBuffer dup = _in.duplicate();
        while (dup.hasRemaining()) {
            ByteBuffer buf = H264Utils.nextNALUnit(dup);
            if (buf == null)
                break;

            NALUnit nu = NALUnit.read(buf.duplicate());
            if (nu.type == NALUnitType.PPS) {
                if (ppsList != null)
                    ppsList.add(NIOUtils.duplicate(buf));
            } else if (nu.type == NALUnitType.SPS) {
                if (spsList != null)
                    spsList.add(NIOUtils.duplicate(buf));
            } else if (out != null) {
                out.putInt(1);
                out.put(buf);
            }
        }
        if (out != null)
            out.flip();
    }
public static void wipePS ( ByteBuffer _in , ByteBuffer out , List < ByteBuffer > spsList , List < ByteBuffer > ppsList ) { ByteBuffer dup = _in . duplicate ( ) ; while ( dup . hasRemaining ( ) ) { ByteBuffer buf = H264Utils . nextNALUnit ( dup ) ; if ( buf == null ) break ; NALUnit nu = NALUnit . read ( buf . duplicate ( ) ) ; if ( nu . type == NALUnitType . PPS ) { if ( ppsList != null ) ppsList . add ( NIOUtils . duplicate ( buf ) ) ; } else if ( nu . type == NALUnitType . SPS ) { if ( spsList != null ) spsList . add ( NIOUtils . duplicate ( buf ) ) ; } else if ( out != null ) { out . putInt ( 1 ) ; out . put ( buf ) ; } } if ( out != null ) out . flip ( ) ; }
Wipes AVC parameter sets ( SPS/PPS ) from the packet

@param in
AVC frame encoded in Annex B NAL unit format
@param out
Buffer where packet without PS will be put
@param spsList
Storage for leading SPS structures ( can be null, then all
leading SPSs are discarded ).
@param ppsList
Storage for leading PPS structures ( can be null, then all
leading PPSs are discarded ).
Wipes AVC parameter sets ( SPS / PPS ) from the packet