コード例 #1
0
ファイル: ExtTagParser.java プロジェクト: boniface/open-m3u8
        @Override
        public void parse(String line, ParseState state) throws ParseException {
          super.parse(line, state);

          final Matcher matcher = match(Constants.EXT_X_VERSION_PATTERN, line);

          if (state.getCompatibilityVersion() != ParseState.NONE) {
            throw ParseException.create(
                ParseExceptionType.MULTIPLE_EXT_TAG_INSTANCES, getTag(), line);
          }

          final int compatibilityVersion = ParseUtil.parseInt(matcher.group(1), 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);
        }
コード例 #2
0
        @Override
        public void parse(String line, ParseState state) throws ParseException {
          super.parse(line, state);

          final Matcher matcher = match(Constants.EXT_X_MEDIA_SEQUENCE_PATTERN, line);

          if (state.getMedia().mediaSequenceNumber != null) {
            throw ParseException.create(
                ParseExceptionType.MULTIPLE_EXT_TAG_INSTANCES, getTag(), line);
          }

          state.getMedia().mediaSequenceNumber = ParseUtil.parseInt(matcher.group(1), getTag());
        }
コード例 #3
0
        @Override
        public void parse(String line, ParseState state) throws ParseException {
          super.parse(line, state);

          final Matcher matcher = match(Constants.EXT_X_TARGETDURATION_PATTERN, line);

          if (state.getMedia().targetDuration != null) {
            throw ParseException.create(
                ParseExceptionType.MULTIPLE_EXT_TAG_INSTANCES, getTag(), line);
          }

          state.getMedia().targetDuration = ParseUtil.parseInt(matcher.group(1), getTag());
        }