Ejemplo n.º 1
0
        public override int probe(MemoryStream data)
        {
            bool avalidSps = false, avalidPps = false, avalidSh = false;

            foreach (var nalUnit in Utility.splitFrame(data.duplicate()))
            {
                NALUnit marker = NALUnit.read(nalUnit);
                if (marker.type == NALUnitType.IDR_SLICE || marker.type == NALUnitType.NON_IDR_SLICE)
                {
                    BitReader reader = new BitReader(nalUnit);
                    avalidSh = validSh(new SliceHeaderReader().readPart1(reader));
                    break;
                }
                else if (marker.type == NALUnitType.SPS)
                {
                    avalidSps = validSps(SeqParameterSet.read(nalUnit));
                }
                else if (marker.type == NALUnitType.PPS)
                {
                    avalidPps = validPps(PictureParameterSet.read(nalUnit));
                }
            }

            return((avalidSh ? 60 : 0) + (avalidSps ? 20 : 0) + (avalidPps ? 20 : 0));
        }
Ejemplo n.º 2
0
        public static PictureParameterSet readPPS(System.IO.MemoryStream data)
        {
            System.IO.MemoryStream input = data.duplicate();
            Utility.unescapeNAL(input);
            PictureParameterSet pps = PictureParameterSet.read(input);

            return(pps);
        }
Ejemplo n.º 3
0
 public void addPps(List <MemoryStream> ppsList)
 {
     foreach (var byteBuffer in ppsList)
     {
         MemoryStream dup = byteBuffer.duplicate();
         Utility.unescapeNAL(dup);
         PictureParameterSet p = PictureParameterSet.read(dup);
         pps.Add(p.pic_parameter_set_id, p);
     }
 }
Ejemplo n.º 4
0
            public Frame decodeFrame(List <MemoryStream> nalUnits, int[][] buffer)
            {
                Frame result = null;

                foreach (var nalUnit in nalUnits)
                {
                    NALUnit marker = NALUnit.read(nalUnit);

                    Utility.unescapeNAL(nalUnit);

                    switch (marker.type.getValue())
                    {
                    case 1:
                    case 5:
                        if (result == null)
                        {
                            result = init(buffer, nalUnit, marker);
                        }
                        decoder.decode(nalUnit, marker);
                        break;

                    case 8:
                        SeqParameterSet _sps = SeqParameterSet.read(nalUnit);
                        vdecoder.sps.Add(_sps.seq_parameter_set_id, _sps);
                        break;

                    case 7:
                        PictureParameterSet _pps = PictureParameterSet.read(nalUnit);
                        vdecoder.pps.Add(_pps.pic_parameter_set_id, _pps);
                        break;

                    default:
                        break;
                    }
                }

                filter.deblockFrame(result);

                updateReferences(result);

                return(result);
            }