• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2016 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.google.android.exoplayer2.extractor.mkv;
17 
18 import com.google.android.exoplayer2.ParserException;
19 import com.google.android.exoplayer2.extractor.ExtractorInput;
20 import java.io.IOException;
21 
22 /**
23  * Event-driven EBML reader that delivers events to an {@link EbmlProcessor}.
24  *
25  * <p>EBML can be summarized as a binary XML format somewhat similar to Protocol Buffers. It was
26  * originally designed for the Matroska container format. More information about EBML and Matroska
27  * is available <a href="http://www.matroska.org/technical/specs/index.html">here</a>.
28  */
29 /* package */ interface EbmlReader {
30 
31   /**
32    * Initializes the extractor with an {@link EbmlProcessor}.
33    *
34    * @param processor An {@link EbmlProcessor} to process events.
35    */
init(EbmlProcessor processor)36   void init(EbmlProcessor processor);
37 
38   /**
39    * Resets the state of the reader.
40    * <p>
41    * Subsequent calls to {@link #read(ExtractorInput)} will start reading a new EBML structure
42    * from scratch.
43    */
reset()44   void reset();
45 
46   /**
47    * Reads from an {@link ExtractorInput}, invoking an event callback if possible.
48    *
49    * @param input The {@link ExtractorInput} from which data should be read.
50    * @return True if data can continue to be read. False if the end of the input was encountered.
51    * @throws ParserException If parsing fails.
52    * @throws IOException If an error occurs reading from the input.
53    */
read(ExtractorInput input)54   boolean read(ExtractorInput input) throws IOException;
55 }
56