Esempio n. 1
0
                public void parse(Attribute attribute, EncryptionData.Builder builder, ParseState state)
                {
                    EncryptionMethod method = EncryptionMethod.fromValue(attribute.value);

                    if (method == null)
                    {
                        throw ParseException.create(ParseExceptionType.INVALID_ENCRYPTION_METHOD, tag: null, context: attribute.ToString());
                    }
                    else
                    {
                        builder.withMethod(method);
                    }
                }
Esempio n. 2
0
 public void parse(Attribute attribute, StartData.Builder builder, ParseState state)
 {
     builder.withPrecise(ParseUtil.parseYesNo(attribute));
 }
Esempio n. 3
0
            public void parse(String line, ParseState state)
            {
                lineParser.parse(line, state);

                // deprecated
            }
 public override void parse(Attribute attribute, T builder, ParseState state)
 {
     // deprecated
 }
Esempio n. 5
0
 public void parse(Attribute attribute, StartData.Builder builder, ParseState state)
 {
     builder.withTimeOffset(ParseUtil.parseFloat(attribute.value));
 }
Esempio n. 6
0
                public void parse(Attribute attribute, EncryptionData.Builder builder, ParseState state)
                {
                    String[]   versionStrings = ParseUtil.parseQuotedString(attribute.value).Split(Constants.LIST_SEPARATOR);
                    List <int> versions       = new List <int>();

                    foreach (String version in versionStrings)
                    {
                        try
                        {
                            versions.Add(Int32.Parse(version));
                        }
                        catch (FormatException)
                        {
                            throw ParseException.create(ParseExceptionType.INVALID_KEY_FORMAT_VERSIONS, tag: null, context: attribute.ToString());
                        }
                    }

                    builder.withKeyFormatVersions(versions);
                }
Esempio n. 7
0
        public override Playlist parse()
        {
            validateAvailable();

            ParseState state           = new ParseState(mEncoding);
            LineParser playlistParser  = new PlaylistLineParser();
            LineParser trackLineParser = new TrackLineParser();

            try
            {
                while (mScanner.hasNext())
                {
                    String line = mScanner.next();
                    checkWhitespace(line);

                    if (line.Length == 0 || isComment(line))
                    {
                        continue;
                    }
                    else
                    {
                        if (isExtTag(line))
                        {
                            String tagKey = getExtTagKey(line);
                            mExtTagParsers.TryGetValue(tagKey, out IExtTagParser tagParser);

                            if (tagParser == null)
                            {
                                //To support forward compatibility, when parsing Playlists, Clients
                                //MUST:
                                //o  ignore any unrecognized tags.
                                if (mParsingMode.allowUnknownTags)
                                {
                                    tagParser = ExtLineParser.EXT_UNKNOWN_HANDLER;
                                }
                                else
                                {
                                    throw ParseException.create(ParseExceptionType.UNSUPPORTED_EXT_TAG_DETECTED, tagKey, line);
                                }
                            }

                            tagParser.parse(line, state);

                            if (state.isMedia() && state.getMedia().endOfList)
                            {
                                break;
                            }
                        }
                        else if (state.isMaster())
                        {
                            playlistParser.parse(line, state);
                        }
                        else if (state.isMedia())
                        {
                            trackLineParser.parse(line, state);
                        }
                        else
                        {
                            throw ParseException.create(ParseExceptionType.UNKNOWN_PLAYLIST_TYPE, line);
                        }
                    }
                }

                Playlist           playlist   = state.buildPlaylist();
                PlaylistValidation validation = PlaylistValidation.from(playlist, mParsingMode);

                if (validation.isValid())
                {
                    return(playlist);
                }
                else
                {
                    throw new PlaylistException(mScanner.getInput(), validation.getErrors());
                }
            }
            catch (ParseException exception)
            {
                exception.setInput(mScanner.getInput());
                throw exception;
            }
        }
 public override void parse(Attribute attribute, T builder, ParseState state)
 {
     builder.withAverageBandwidth(ParseUtil.parseInt(attribute.value, tag));
 }
 public override void parse(Attribute attribute, T builder, ParseState state)
 {
     builder.withResolution(ParseUtil.parseResolution(attribute.value, tag));
 }
Esempio n. 10
0
 public void parse(Attribute attribute, StreamInfo.Builder builder, ParseState state)
 {
     builder.withSubtitles(ParseUtil.parseQuotedString(attribute.value));
 }
Esempio n. 11
0
 public abstract void parse(Attribute attribute, T builder, ParseState state);
Esempio n. 12
0
 public void parse(Attribute attribute, IFrameStreamInfo.Builder builder, ParseState state)
 {
     builder.withUri(ParseUtil.parseQuotedString(attribute.value));
 }
Esempio n. 13
0
 public void parse(Attribute attribute, MediaData.Builder builder, ParseState state)
 {
     builder.withForced(ParseUtil.parseYesNo(attribute));
 }
Esempio n. 14
0
 public void parse(Attribute attribute, MediaData.Builder builder, ParseState state)
 {
     builder.withAssociatedLanguage(ParseUtil.parseQuotedString(attribute.value));
 }
Esempio n. 15
0
                public void parse(Attribute attribute, EncryptionData.Builder builder, ParseState state)
                {
                    List <Byte> initializationVector = ParseUtil.parseHexadecimal(attribute.value);

                    if ((initializationVector.Count != Constants.IV_SIZE) &&
                        (initializationVector.Count != Constants.IV_SIZE_ALTERNATIVE))
                    {
                        throw ParseException.create(ParseExceptionType.INVALID_IV_SIZE, tag: null, context: attribute.ToString());
                    }

                    builder.withInitializationVector(initializationVector);
                }
Esempio n. 16
0
 public override void parse(Attribute attribute, T builder, ParseState state)
 {
     builder.withFrameRate(ParseUtil.parseFloat(attribute.value, tag));
 }
Esempio n. 17
0
 public void parse(Attribute attribute, EncryptionData.Builder builder, ParseState state)
 {
     builder.withKeyFormat(ParseUtil.parseQuotedString(attribute.value));
 }
Esempio n. 18
0
 public override void parse(Attribute attribute, T builder, ParseState state)
 {
     builder.withVideo(ParseUtil.parseQuotedString(attribute.value, tag));
 }
Esempio n. 19
0
 public void parse(Attribute attribute, MapInfo.Builder builder, ParseState state)
 {
     builder.withUri(ParseUtil.decodeUri(ParseUtil.parseQuotedString(attribute.value), state.encoding));
 }
Esempio n. 20
0
 public void parse(String line, ParseState state)
 {
     state.unknownTags.Add(line);
 }