com.google.android.exoplayer2.Format.createSampleFormat()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(111)

本文整理了Java中com.google.android.exoplayer2.Format.createSampleFormat()方法的一些代码示例,展示了Format.createSampleFormat()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Format.createSampleFormat()方法的具体详情如下:
包路径:com.google.android.exoplayer2.Format
类名称:Format
方法名:createSampleFormat

Format.createSampleFormat介绍

暂无

代码示例

代码示例来源:origin: google/ExoPlayer

private static void buildManifestEventTrackGroupInfos(List<EventStream> eventStreams,
  TrackGroup[] trackGroups, TrackGroupInfo[] trackGroupInfos, int existingTrackGroupCount) {
 for (int i = 0; i < eventStreams.size(); i++) {
  EventStream eventStream = eventStreams.get(i);
  Format format = Format.createSampleFormat(eventStream.id(), MimeTypes.APPLICATION_EMSG, null,
    Format.NO_VALUE, null);
  trackGroups[existingTrackGroupCount] = new TrackGroup(format);
  trackGroupInfos[existingTrackGroupCount++] = TrackGroupInfo.mpdEventTrack(i);
 }
}

代码示例来源:origin: google/ExoPlayer

@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));
}

代码示例来源:origin: google/ExoPlayer

cea608TrackGroupIndex);
if (eventMessageTrackGroupIndex != C.INDEX_UNSET) {
 Format format = Format.createSampleFormat(firstAdaptationSet.id + ":emsg",
   MimeTypes.APPLICATION_EMSG, null, Format.NO_VALUE, null);
 trackGroups[eventMessageTrackGroupIndex] = new TrackGroup(format);

代码示例来源:origin: google/ExoPlayer

@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));
}

代码示例来源:origin: google/ExoPlayer

Format.createSampleFormat(
  /* id= */ "ID3",
  MimeTypes.APPLICATION_ID3,

代码示例来源:origin: google/ExoPlayer

@Test
 public void testParcelable() {
  Format format1 = Format.createSampleFormat("1", MimeTypes.VIDEO_H264, 0);
  Format format2 = Format.createSampleFormat("2", MimeTypes.AUDIO_AAC, 0);
  Format format3 = Format.createSampleFormat("3", MimeTypes.VIDEO_H264, 0);

  TrackGroup trackGroup1 = new TrackGroup(format1, format2);
  TrackGroup trackGroup2 = new TrackGroup(format3);

  TrackGroupArray trackGroupArrayToParcel = new TrackGroupArray(trackGroup1, trackGroup2);

  Parcel parcel = Parcel.obtain();
  trackGroupArrayToParcel.writeToParcel(parcel, 0);
  parcel.setDataPosition(0);

  TrackGroupArray trackGroupArrayFromParcel = TrackGroupArray.CREATOR.createFromParcel(parcel);
  assertThat(trackGroupArrayFromParcel).isEqualTo(trackGroupArrayToParcel);

  parcel.recycle();
 }
}

代码示例来源:origin: google/ExoPlayer

@Override
public void consume(ParsableByteArray sectionData) {
 if (!formatDeclared) {
  if (timestampAdjuster.getTimestampOffsetUs() == C.TIME_UNSET) {
   // There is not enough information to initialize the timestamp adjuster.
   return;
  }
  output.format(Format.createSampleFormat(null, MimeTypes.APPLICATION_SCTE35,
    timestampAdjuster.getTimestampOffsetUs()));
  formatDeclared = true;
 }
 int sampleSize = sectionData.bytesLeft();
 output.sampleData(sectionData, sampleSize);
 output.sampleMetadata(timestampAdjuster.getLastAdjustedTimestampUs(), C.BUFFER_FLAG_KEY_FRAME,
   sampleSize, 0, null);
}

代码示例来源:origin: google/ExoPlayer

@Test
 public void testParcelable() {
  Format format1 = Format.createSampleFormat("1", MimeTypes.VIDEO_H264, 0);
  Format format2 = Format.createSampleFormat("2", MimeTypes.AUDIO_AAC, 0);

  TrackGroup trackGroupToParcel = new TrackGroup(format1, format2);

  Parcel parcel = Parcel.obtain();
  trackGroupToParcel.writeToParcel(parcel, 0);
  parcel.setDataPosition(0);

  TrackGroup trackGroupFromParcel = TrackGroup.CREATOR.createFromParcel(parcel);
  assertThat(trackGroupFromParcel).isEqualTo(trackGroupToParcel);

  parcel.recycle();
 }
}

代码示例来源:origin: google/ExoPlayer

@Override
public void createTracks(ExtractorOutput extractorOutput, TrackIdGenerator idGenerator) {
 idGenerator.generateNewId();
 formatId = idGenerator.getFormatId();
 output = extractorOutput.track(idGenerator.getTrackId(), C.TRACK_TYPE_AUDIO);
 if (exposeId3) {
  idGenerator.generateNewId();
  id3Output = extractorOutput.track(idGenerator.getTrackId(), C.TRACK_TYPE_METADATA);
  id3Output.format(Format.createSampleFormat(idGenerator.getFormatId(),
    MimeTypes.APPLICATION_ID3, null, Format.NO_VALUE, null));
 } else {
  id3Output = new DummyTrackOutput();
 }
}

代码示例来源:origin: google/ExoPlayer

language, out);
} else if (childAtomType == Atom.TYPE_camm) {
 out.format = Format.createSampleFormat(Integer.toString(trackId),
   MimeTypes.APPLICATION_CAMERA_MOTION, null, Format.NO_VALUE, null);

代码示例来源:origin: novoda/no-player

new Object[]{RENDERER_DECODER, AUDIO_UNHANDLED_FORMAT_ERROR, createRenderer(new AudioProcessor.UnhandledFormatException(0, 0, 0))},
new Object[]{RENDERER_DECODER, AUDIO_DECODER_ERROR, createRenderer(new AudioDecoderException("audio-decoder-exception"))},
new Object[]{RENDERER_DECODER, INITIALISATION_ERROR, createRenderer(new MediaCodecRenderer.DecoderInitializationException(Format.createSampleFormat("id", "sample-mimety[e", 0), new Throwable(), true, 0))},
new Object[]{RENDERER_DECODER, DECODING_SUBTITLE_ERROR, createRenderer(new SubtitleDecoderException("metadata-decoder-exception"))},

相关文章