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.ts; 17 18 import com.google.android.exoplayer2.extractor.ExtractorOutput; 19 import com.google.android.exoplayer2.extractor.TrackOutput; 20 import com.google.android.exoplayer2.extractor.ts.TsPayloadReader.TrackIdGenerator; 21 import com.google.android.exoplayer2.util.ParsableByteArray; 22 import com.google.android.exoplayer2.util.TimestampAdjuster; 23 24 /** 25 * Reads section data. 26 */ 27 public interface SectionPayloadReader { 28 29 /** 30 * Initializes the section payload reader. 31 * 32 * @param timestampAdjuster A timestamp adjuster for offsetting and scaling sample timestamps. 33 * @param extractorOutput The {@link ExtractorOutput} that receives the extracted data. 34 * @param idGenerator A {@link PesReader.TrackIdGenerator} that generates unique track ids for the 35 * {@link TrackOutput}s. 36 */ init(TimestampAdjuster timestampAdjuster, ExtractorOutput extractorOutput, TrackIdGenerator idGenerator)37 void init(TimestampAdjuster timestampAdjuster, ExtractorOutput extractorOutput, 38 TrackIdGenerator idGenerator); 39 40 /** 41 * Called by a {@link SectionReader} when a full section is received. 42 * 43 * @param sectionData The data belonging to a section starting from the table_id. If 44 * section_syntax_indicator is set to '1', {@code sectionData} excludes the CRC_32 field. 45 * Otherwise, all bytes belonging to the table section are included. 46 */ consume(ParsableByteArray sectionData)47 void consume(ParsableByteArray sectionData); 48 49 } 50