Exemple #1
0
        NalUnitParser.ParserStateHandler ResolveHandler(byte arg)
        {
            var nalUnitType = (NalUnitType)(arg & 0x1f);

            switch (nalUnitType)
            {
                case NalUnitType.Sps:
                    _rbspDecoder.CompletionHandler = _configurator.ParseSpsBytes;
                    _currentParser = _rbspDecoder;
                    break;
                case NalUnitType.Pps:
                    _rbspDecoder.CompletionHandler = _configurator.ParsePpsBytes;
                    _currentParser = _rbspDecoder;
                    break;
                case NalUnitType.Slice:
                case NalUnitType.Dpa:
                case NalUnitType.Idr:
                    _rbspDecoder.CompletionHandler = _configurator.ParseSliceHeader;
                    _currentParser = _rbspDecoder;
                    break;
                //case NalUnitType.Aud:
                //    _rbspDecoder.CompletionHandler =_configurator.ParseAud;
                //    _currentParser = _rbspDecoder;
                //    break;
                case NalUnitType.Sei:
                    _rbspDecoder.CompletionHandler = _configurator.ParseSei;
                    _currentParser = _rbspDecoder;
                    break;
                default:
                    _currentParser = null;
                    return null;
            }

            if (null == _currentParser)
                return null;

            return _currentParser.Parse;
        }
        private NalUnitParser.ParserStateHandler ResolveHandler(byte arg)
        {
            switch ((int)arg & 31)
            {
            case 1:
            case 2:
            case 5:
                this._rbspDecoder.CompletionHandler = new Action <IList <byte> >(this._configurator.ParseSliceHeader);
                this._currentParser = (INalParser)this._rbspDecoder;
                break;

            case 6:
                this._rbspDecoder.CompletionHandler = new Action <IList <byte> >(this._configurator.ParseSei);
                this._currentParser = (INalParser)this._rbspDecoder;
                break;

            case 7:
                this._rbspDecoder.CompletionHandler = new Action <IList <byte> >(this._configurator.ParseSpsBytes);
                this._currentParser = (INalParser)this._rbspDecoder;
                break;

            case 8:
                this._rbspDecoder.CompletionHandler = new Action <IList <byte> >(this._configurator.ParsePpsBytes);
                this._currentParser = (INalParser)this._rbspDecoder;
                break;

            default:
                this._currentParser = (INalParser)null;
                return((NalUnitParser.ParserStateHandler)null);
            }
            if (null == this._currentParser)
            {
                return((NalUnitParser.ParserStateHandler)null);
            }
            return(new NalUnitParser.ParserStateHandler(this._currentParser.Parse));
        }