Java Code Examples for com.google.android.exoplayer2.extractor.ExtractorOutput#track()

The following examples show how to use com.google.android.exoplayer2.extractor.ExtractorOutput#track() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UserDataReader.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
public void createTracks(
    ExtractorOutput extractorOutput, TsPayloadReader.TrackIdGenerator idGenerator) {
  for (int i = 0; i < outputs.length; i++) {
    idGenerator.generateNewId();
    TrackOutput output = extractorOutput.track(idGenerator.getTrackId(), C.TRACK_TYPE_TEXT);
    Format channelFormat = closedCaptionFormats.get(i);
    String channelMimeType = channelFormat.sampleMimeType;
    Assertions.checkArgument(
        MimeTypes.APPLICATION_CEA608.equals(channelMimeType)
            || MimeTypes.APPLICATION_CEA708.equals(channelMimeType),
        "Invalid closed caption mime type provided: " + channelMimeType);
    output.format(
        Format.createTextSampleFormat(
            idGenerator.getFormatId(),
            channelMimeType,
            /* codecs= */ null,
            /* bitrate= */ Format.NO_VALUE,
            channelFormat.selectionFlags,
            channelFormat.language,
            channelFormat.accessibilityChannel,
            /* drmInitData= */ null,
            Format.OFFSET_SAMPLE_RELATIVE,
            channelFormat.initializationData));
    outputs[i] = output;
  }
}
 
Example 2
Source File: SeiReader.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
public void createTracks(ExtractorOutput extractorOutput, TrackIdGenerator idGenerator) {
  for (int i = 0; i < outputs.length; i++) {
    idGenerator.generateNewId();
    TrackOutput output = extractorOutput.track(idGenerator.getTrackId(), C.TRACK_TYPE_TEXT);
    Format channelFormat = closedCaptionFormats.get(i);
    String channelMimeType = channelFormat.sampleMimeType;
    Assertions.checkArgument(MimeTypes.APPLICATION_CEA608.equals(channelMimeType)
        || MimeTypes.APPLICATION_CEA708.equals(channelMimeType),
        "Invalid closed caption mime type provided: " + channelMimeType);
    String formatId = channelFormat.id != null ? channelFormat.id : idGenerator.getFormatId();
    output.format(
        Format.createTextSampleFormat(
            formatId,
            channelMimeType,
            /* codecs= */ null,
            /* bitrate= */ Format.NO_VALUE,
            channelFormat.selectionFlags,
            channelFormat.language,
            channelFormat.accessibilityChannel,
            /* drmInitData= */ null,
            Format.OFFSET_SAMPLE_RELATIVE,
            channelFormat.initializationData));
    outputs[i] = output;
  }
}
 
Example 3
Source File: H265Reader.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void createTracks(ExtractorOutput extractorOutput, TrackIdGenerator idGenerator) {
  idGenerator.generateNewId();
  formatId = idGenerator.getFormatId();
  output = extractorOutput.track(idGenerator.getTrackId(), C.TRACK_TYPE_VIDEO);
  sampleReader = new SampleReader(output);
  seiReader.createTracks(extractorOutput, idGenerator);
}
 
Example 4
Source File: WavExtractor.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void init(ExtractorOutput output) {
  extractorOutput = output;
  trackOutput = output.track(0, C.TRACK_TYPE_AUDIO);
  wavHeader = null;
  output.endTracks();
}
 
Example 5
Source File: H265Reader.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void createTracks(ExtractorOutput extractorOutput, TrackIdGenerator idGenerator) {
  idGenerator.generateNewId();
  formatId = idGenerator.getFormatId();
  output = extractorOutput.track(idGenerator.getTrackId(), C.TRACK_TYPE_VIDEO);
  sampleReader = new SampleReader(output);
  seiReader.createTracks(extractorOutput, idGenerator);
}
 
Example 6
Source File: RawCcExtractor.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
@Override
public void init(ExtractorOutput output) {
  output.seekMap(new SeekMap.Unseekable(C.TIME_UNSET));
  trackOutput = output.track(0, C.TRACK_TYPE_TEXT);
  output.endTracks();
  trackOutput.format(format);
}
 
Example 7
Source File: SpliceInfoSectionReader.java    From K-Sonic with MIT License 5 votes vote down vote up
@Override
public void init(TimestampAdjuster timestampAdjuster, ExtractorOutput extractorOutput,
    TsPayloadReader.TrackIdGenerator idGenerator) {
  this.timestampAdjuster = timestampAdjuster;
  idGenerator.generateNewId();
  output = extractorOutput.track(idGenerator.getTrackId(), C.TRACK_TYPE_METADATA);
  output.format(Format.createSampleFormat(idGenerator.getFormatId(), MimeTypes.APPLICATION_SCTE35,
      null, Format.NO_VALUE, null));
}
 
Example 8
Source File: RawCcExtractor.java    From K-Sonic with MIT License 5 votes vote down vote up
@Override
public void init(ExtractorOutput output) {
  output.seekMap(new SeekMap.Unseekable(C.TIME_UNSET));
  trackOutput = output.track(0, C.TRACK_TYPE_TEXT);
  output.endTracks();
  trackOutput.format(format);
}
 
Example 9
Source File: Id3Reader.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
@Override
public void createTracks(ExtractorOutput extractorOutput, TrackIdGenerator idGenerator) {
  idGenerator.generateNewId();
  output = extractorOutput.track(idGenerator.getTrackId(), C.TRACK_TYPE_METADATA);
  output.format(Format.createSampleFormat(idGenerator.getFormatId(), MimeTypes.APPLICATION_ID3,
      null, Format.NO_VALUE, null));
}
 
Example 10
Source File: H264Reader.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void createTracks(ExtractorOutput extractorOutput, TrackIdGenerator idGenerator) {
  idGenerator.generateNewId();
  formatId = idGenerator.getFormatId();
  output = extractorOutput.track(idGenerator.getTrackId(), C.TRACK_TYPE_VIDEO);
  sampleReader = new SampleReader(output, allowNonIdrKeyframes, detectAccessUnits);
  seiReader.createTracks(extractorOutput, idGenerator);
}
 
Example 11
Source File: H265Reader.java    From K-Sonic with MIT License 5 votes vote down vote up
@Override
public void createTracks(ExtractorOutput extractorOutput, TrackIdGenerator idGenerator) {
  idGenerator.generateNewId();
  formatId = idGenerator.getFormatId();
  output = extractorOutput.track(idGenerator.getTrackId(), C.TRACK_TYPE_VIDEO);
  sampleReader = new SampleReader(output);
  seiReader.createTracks(extractorOutput, idGenerator);
}
 
Example 12
Source File: WavExtractor.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void init(ExtractorOutput output) {
  extractorOutput = output;
  trackOutput = output.track(0, C.TRACK_TYPE_AUDIO);
  wavHeader = null;
  output.endTracks();
}
 
Example 13
Source File: Ac3Reader.java    From K-Sonic with MIT License 4 votes vote down vote up
@Override
public void createTracks(ExtractorOutput extractorOutput, TrackIdGenerator generator) {
  generator.generateNewId();
  trackFormatId = generator.getFormatId();
  output = extractorOutput.track(generator.getTrackId(), C.TRACK_TYPE_AUDIO);
}
 
Example 14
Source File: Ac3Reader.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
@Override
public void createTracks(ExtractorOutput extractorOutput, TrackIdGenerator generator) {
  generator.generateNewId();
  trackFormatId = generator.getFormatId();
  output = extractorOutput.track(generator.getTrackId(), C.TRACK_TYPE_AUDIO);
}
 
Example 15
Source File: MpegAudioReader.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void createTracks(ExtractorOutput extractorOutput, TrackIdGenerator idGenerator) {
  idGenerator.generateNewId();
  formatId = idGenerator.getFormatId();
  output = extractorOutput.track(idGenerator.getTrackId(), C.TRACK_TYPE_AUDIO);
}
 
Example 16
Source File: LatmReader.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
@Override
public void createTracks(ExtractorOutput extractorOutput, TrackIdGenerator idGenerator) {
  idGenerator.generateNewId();
  output = extractorOutput.track(idGenerator.getTrackId(), C.TRACK_TYPE_AUDIO);
  formatId = idGenerator.getFormatId();
}
 
Example 17
Source File: LatmReader.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void createTracks(ExtractorOutput extractorOutput, TrackIdGenerator idGenerator) {
  idGenerator.generateNewId();
  output = extractorOutput.track(idGenerator.getTrackId(), C.TRACK_TYPE_AUDIO);
  formatId = idGenerator.getFormatId();
}
 
Example 18
Source File: DtsReader.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
@Override
public void createTracks(ExtractorOutput extractorOutput, TrackIdGenerator idGenerator) {
  idGenerator.generateNewId();
  formatId = idGenerator.getFormatId();
  output = extractorOutput.track(idGenerator.getTrackId(), C.TRACK_TYPE_AUDIO);
}
 
Example 19
Source File: DtsReader.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void createTracks(ExtractorOutput extractorOutput, TrackIdGenerator idGenerator) {
  idGenerator.generateNewId();
  formatId = idGenerator.getFormatId();
  output = extractorOutput.track(idGenerator.getTrackId(), C.TRACK_TYPE_AUDIO);
}
 
Example 20
Source File: DtsReader.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void createTracks(ExtractorOutput extractorOutput, TrackIdGenerator idGenerator) {
  idGenerator.generateNewId();
  formatId = idGenerator.getFormatId();
  output = extractorOutput.track(idGenerator.getTrackId(), C.TRACK_TYPE_AUDIO);
}