public void parse(String line, ParseState state) { lineParser.parse(line, state); Match match = ParseUtil.match(Constants.EXT_X_VERSION_PATTERN, line, getTag()); if (state.getCompatibilityVersion() != ParseState.NONE) { throw ParseException.create(ParseExceptionType.MULTIPLE_EXT_TAG_INSTANCES, getTag(), line); } int compatibilityVersion = ParseUtil.parseInt(match.Groups[1].Value, getTag()); if (compatibilityVersion < Playlist.MIN_COMPATIBILITY_VERSION) { throw ParseException.create(ParseExceptionType.INVALID_COMPATIBILITY_VERSION, getTag(), line); } if (compatibilityVersion > Constants.MAX_COMPATIBILITY_VERSION) { throw ParseException.create(ParseExceptionType.UNSUPPORTED_COMPATIBILITY_VERSION, getTag(), line); } state.setCompatibilityVersion(compatibilityVersion); }
public void parse(String line, ParseState state) { lineParser.parse(line, state); Match match = ParseUtil.match(Constants.EXT_X_MEDIA_SEQUENCE_PATTERN, line, getTag()); if (state.getMedia().mediaSequenceNumber != null) { throw ParseException.create(ParseExceptionType.MULTIPLE_EXT_TAG_INSTANCES, getTag(), line); } state.getMedia().mediaSequenceNumber = ParseUtil.parseInt(match.Groups[1].Value, getTag()); }
public void parse(String line, ParseState state) { lineParser.parse(line, state); Match match = ParseUtil.match(Constants.EXT_X_TARGETDURATION_PATTERN, line, getTag()); if (state.getMedia().targetDuration != null) { throw ParseException.create(ParseExceptionType.MULTIPLE_EXT_TAG_INSTANCES, getTag(), line); } state.getMedia().targetDuration = ParseUtil.parseInt(match.Groups[1].Value, getTag()); }
public void parse(Attribute attribute, MediaData.Builder builder, ParseState state) { String[] channelsStrings = ParseUtil.parseQuotedString(attribute.value).Split(Constants.LIST_SEPARATOR); if (channelsStrings.Length == 0 || channelsStrings[0].isEmpty()) { throw ParseException.create(ParseExceptionType.EMPTY_MEDIA_CHANNELS, tag: null, context: attribute.ToString()); } else { int channelsCount = ParseUtil.parseInt(channelsStrings[0]); builder.withChannels(channelsCount); } }
public override void parse(Attribute attribute, T builder, ParseState state) { builder.withAverageBandwidth(ParseUtil.parseInt(attribute.value, tag)); }