/** * Initializes the extractor to output to the provided {@link SingleTrackOutput}, and configures * it to receive data from a new chunk. * * @param output The {@link SingleTrackOutput} that will receive the parsed data. */ public void init(SingleTrackOutput output) { this.output = output; if (!extractorInitialized) { extractor.init(this); extractorInitialized = true; } else { extractor.seek(); } }
/** * Reads from the provided {@link ExtractorInput}. * * @param input The {@link ExtractorInput} from which to read. * @return One of {@link Extractor#RESULT_CONTINUE} and {@link Extractor#RESULT_END_OF_INPUT}. * @throws IOException If an error occurred reading from the source. * @throws InterruptedException If the thread was interrupted. */ public int read(ExtractorInput input) throws IOException, InterruptedException { int result = extractor.read(input, null); Assertions.checkState(result != Extractor.RESULT_SEEK); return result; }
/** * Initializes the wrapper for use. * * @param allocator An allocator for obtaining allocations into which extracted data is written. */ public void init(Allocator allocator) { this.allocator = allocator; extractor.init(this); }
/** * Reads from the provided {@link ExtractorInput}. * * @param input The {@link ExtractorInput} from which to read. * @return One of {@link Extractor#RESULT_CONTINUE} and {@link Extractor#RESULT_END_OF_INPUT}. * @throws IOException If an error occurred reading from the source. * @throws InterruptedException If the thread was interrupted. */ public int read(ExtractorInput input) throws IOException, InterruptedException { int result = extractor.read(input, null); Assertions.checkState(result != Extractor.RESULT_SEEK); return result; }