예제 #1
0
 public void addPps(List<ByteBuffer> ppsList) {
   for (ByteBuffer byteBuffer : ppsList) {
     ByteBuffer dup = byteBuffer.duplicate();
     unescapeNAL(dup);
     PictureParameterSet p = PictureParameterSet.read(dup);
     pps.put(p.pic_parameter_set_id, p);
   }
 }
예제 #2
0
 public void addSps(List<ByteBuffer> spsList) {
   for (ByteBuffer byteBuffer : spsList) {
     ByteBuffer dup = byteBuffer.duplicate();
     unescapeNAL(dup);
     SeqParameterSet s = SeqParameterSet.read(dup);
     sps.put(s.seq_parameter_set_id, s);
   }
 }
예제 #3
0
    public Frame decodeFrame(List<ByteBuffer> nalUnits, byte[][] buffer) {
      Frame result = null;

      for (ByteBuffer nalUnit : nalUnits) {
        NALUnit marker = NALUnit.read(nalUnit);

        unescapeNAL(nalUnit);

        switch (marker.type) {
          case NON_IDR_SLICE:
          case IDR_SLICE:
            if (result == null) {
              if (sps.size() == 0 || pps.size() == 0) {
                Logger.warn("Skipping frame as no SPS/PPS have been seen so far...");
                return null;
              }
              result = init(buffer, nalUnit, marker);
            }
            decoder.decode(nalUnit, marker);
            break;
          case SPS:
            SeqParameterSet _sps = SeqParameterSet.read(nalUnit);
            sps.put(_sps.seq_parameter_set_id, _sps);
            break;
          case PPS:
            PictureParameterSet _pps = PictureParameterSet.read(nalUnit);
            pps.put(_pps.pic_parameter_set_id, _pps);
            break;
          default:
        }
      }

      filter.deblockFrame(result);

      updateReferences(result);

      return result;
    }