Pass initialization parameters to section readers
Unlike with PesReaders, sections don't have a standard way of providing timestmaps or even generating tracks. We need to pass this information so that readers decide what to do with it. Issue:#726 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=137162494
This commit is contained in:
parent
1809836c21
commit
0b8e9754ca
@ -207,6 +207,12 @@ public final class TsExtractorTest extends InstrumentationTestCase {
|
||||
|
||||
private int consumedSdts;
|
||||
|
||||
@Override
|
||||
public void init(TimestampAdjuster timestampAdjuster, ExtractorOutput extractorOutput,
|
||||
TrackIdGenerator idGenerator) {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void consume(ParsableByteArray sectionData) {
|
||||
// table_id(8), section_syntax_indicator(1), reserved_future_use(1), reserved(2),
|
||||
|
@ -15,6 +15,10 @@
|
||||
*/
|
||||
package com.google.android.exoplayer2.extractor.ts;
|
||||
|
||||
import com.google.android.exoplayer2.extractor.ExtractorOutput;
|
||||
import com.google.android.exoplayer2.extractor.TimestampAdjuster;
|
||||
import com.google.android.exoplayer2.extractor.TrackOutput;
|
||||
import com.google.android.exoplayer2.extractor.ts.TsPayloadReader.TrackIdGenerator;
|
||||
import com.google.android.exoplayer2.util.ParsableByteArray;
|
||||
|
||||
/**
|
||||
@ -22,6 +26,17 @@ import com.google.android.exoplayer2.util.ParsableByteArray;
|
||||
*/
|
||||
public interface SectionPayloadReader {
|
||||
|
||||
/**
|
||||
* Initializes the section payload reader.
|
||||
*
|
||||
* @param timestampAdjuster A timestamp adjuster for offsetting and scaling sample timestamps.
|
||||
* @param extractorOutput The {@link ExtractorOutput} that receives the extracted data.
|
||||
* @param idGenerator A {@link PesReader.TrackIdGenerator} that generates unique track ids for the
|
||||
* {@link TrackOutput}s.
|
||||
*/
|
||||
void init(TimestampAdjuster timestampAdjuster, ExtractorOutput extractorOutput,
|
||||
TrackIdGenerator idGenerator);
|
||||
|
||||
/**
|
||||
* Called by a {@link SectionReader} when a full section is received.
|
||||
*
|
||||
|
@ -43,8 +43,7 @@ public final class SectionReader implements TsPayloadReader {
|
||||
@Override
|
||||
public void init(TimestampAdjuster timestampAdjuster, ExtractorOutput extractorOutput,
|
||||
TrackIdGenerator idGenerator) {
|
||||
// TODO: Injectable section readers might want to generate metadata tracks.
|
||||
// Do nothing.
|
||||
reader.init(timestampAdjuster, extractorOutput, idGenerator);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -65,8 +65,6 @@ public final class TsExtractor implements Extractor {
|
||||
public static final int TS_STREAM_TYPE_H265 = 0x24;
|
||||
public static final int TS_STREAM_TYPE_ID3 = 0x15;
|
||||
|
||||
private static final String TAG = "TsExtractor";
|
||||
|
||||
private static final int TS_PACKET_SIZE = 188;
|
||||
private static final int TS_SYNC_BYTE = 0x47; // First byte of each TS packet.
|
||||
private static final int TS_PAT_PID = 0;
|
||||
@ -274,6 +272,12 @@ public final class TsExtractor implements Extractor {
|
||||
patScratch = new ParsableBitArray(new byte[4]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(TimestampAdjuster timestampAdjuster, ExtractorOutput extractorOutput,
|
||||
TrackIdGenerator idGenerator) {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void consume(ParsableByteArray sectionData) {
|
||||
// table_id(8), section_syntax_indicator(1), '0'(1), reserved(2), section_length(12),
|
||||
@ -316,6 +320,12 @@ public final class TsExtractor implements Extractor {
|
||||
this.pid = pid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(TimestampAdjuster timestampAdjuster, ExtractorOutput extractorOutput,
|
||||
TrackIdGenerator idGenerator) {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void consume(ParsableByteArray sectionData) {
|
||||
// table_id(8), section_syntax_indicator(1), '0'(1), reserved(2), section_length(12),
|
||||
|
@ -99,9 +99,10 @@ public interface TsPayloadReader {
|
||||
/**
|
||||
* Initializes the payload reader.
|
||||
*
|
||||
* @param timestampAdjuster
|
||||
* @param extractorOutput
|
||||
* @param idGenerator
|
||||
* @param timestampAdjuster A timestamp adjuster for offsetting and scaling sample timestamps.
|
||||
* @param extractorOutput The {@link ExtractorOutput} that receives the extracted data.
|
||||
* @param idGenerator A {@link PesReader.TrackIdGenerator} that generates unique track ids for the
|
||||
* {@link TrackOutput}s.
|
||||
*/
|
||||
void init(TimestampAdjuster timestampAdjuster, ExtractorOutput extractorOutput,
|
||||
TrackIdGenerator idGenerator);
|
||||
|
Loading…
x
Reference in New Issue
Block a user