Java Code Examples for com.google.android.exoplayer2.Format#equals()

The following examples show how to use com.google.android.exoplayer2.Format#equals() . 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: HlsSampleStreamWrapper.java    From K-Sonic with MIT License 6 votes vote down vote up
int readData(int group, FormatHolder formatHolder, DecoderInputBuffer buffer,
    boolean requireFormat) {
  if (isPendingReset()) {
    return C.RESULT_NOTHING_READ;
  }

  while (mediaChunks.size() > 1 && finishedReadingChunk(mediaChunks.getFirst())) {
    mediaChunks.removeFirst();
  }
  HlsMediaChunk currentChunk = mediaChunks.getFirst();
  Format trackFormat = currentChunk.trackFormat;
  if (!trackFormat.equals(downstreamTrackFormat)) {
    eventDispatcher.downstreamFormatChanged(trackType, trackFormat,
        currentChunk.trackSelectionReason, currentChunk.trackSelectionData,
        currentChunk.startTimeUs);
  }
  downstreamTrackFormat = trackFormat;

  return sampleQueues.valueAt(group).readData(formatHolder, buffer, requireFormat,
      loadingFinished, lastSeekPositionUs);
}
 
Example 2
Source File: ChunkSampleStream.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
private void maybeNotifyPrimaryTrackFormatChanged(int mediaChunkReadIndex) {
  BaseMediaChunk currentChunk = mediaChunks.get(mediaChunkReadIndex);
  Format trackFormat = currentChunk.trackFormat;
  if (!trackFormat.equals(primaryDownstreamTrackFormat)) {
    eventDispatcher.downstreamFormatChanged(primaryTrackType, trackFormat,
        currentChunk.trackSelectionReason, currentChunk.trackSelectionData,
        currentChunk.startTimeUs);
  }
  primaryDownstreamTrackFormat = trackFormat;
}
 
Example 3
Source File: ChunkSampleStream.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private void maybeNotifyPrimaryTrackFormatChanged(int mediaChunkReadIndex) {
  BaseMediaChunk currentChunk = mediaChunks.get(mediaChunkReadIndex);
  Format trackFormat = currentChunk.trackFormat;
  if (!trackFormat.equals(primaryDownstreamTrackFormat)) {
    eventDispatcher.downstreamFormatChanged(primaryTrackType, trackFormat,
        currentChunk.trackSelectionReason, currentChunk.trackSelectionData,
        currentChunk.startTimeUs);
  }
  primaryDownstreamTrackFormat = trackFormat;
}
 
Example 4
Source File: ChunkSampleStream.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private void maybeNotifyPrimaryTrackFormatChanged(int mediaChunkReadIndex) {
  BaseMediaChunk currentChunk = mediaChunks.get(mediaChunkReadIndex);
  Format trackFormat = currentChunk.trackFormat;
  if (!trackFormat.equals(primaryDownstreamTrackFormat)) {
    eventDispatcher.downstreamFormatChanged(primaryTrackType, trackFormat,
        currentChunk.trackSelectionReason, currentChunk.trackSelectionData,
        currentChunk.startTimeUs);
  }
  primaryDownstreamTrackFormat = trackFormat;
}
 
Example 5
Source File: ChunkSampleStream.java    From K-Sonic with MIT License 5 votes vote down vote up
private void discardDownstreamMediaChunks(int primaryStreamReadIndex) {
  while (mediaChunks.size() > 1
      && mediaChunks.get(1).getFirstSampleIndex(0) <= primaryStreamReadIndex) {
    mediaChunks.removeFirst();
  }
  BaseMediaChunk currentChunk = mediaChunks.getFirst();
  Format trackFormat = currentChunk.trackFormat;
  if (!trackFormat.equals(primaryDownstreamTrackFormat)) {
    eventDispatcher.downstreamFormatChanged(primaryTrackType, trackFormat,
        currentChunk.trackSelectionReason, currentChunk.trackSelectionData,
        currentChunk.startTimeUs);
  }
  primaryDownstreamTrackFormat = trackFormat;
}
 
Example 6
Source File: ChunkSampleStream.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private void maybeNotifyPrimaryTrackFormatChanged(int mediaChunkReadIndex) {
  BaseMediaChunk currentChunk = mediaChunks.get(mediaChunkReadIndex);
  Format trackFormat = currentChunk.trackFormat;
  if (!trackFormat.equals(primaryDownstreamTrackFormat)) {
    eventDispatcher.downstreamFormatChanged(primaryTrackType, trackFormat,
        currentChunk.trackSelectionReason, currentChunk.trackSelectionData,
        currentChunk.startTimeUs);
  }
  primaryDownstreamTrackFormat = trackFormat;
}
 
Example 7
Source File: ChunkSampleStream.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private void maybeNotifyPrimaryTrackFormatChanged(int mediaChunkReadIndex) {
  BaseMediaChunk currentChunk = mediaChunks.get(mediaChunkReadIndex);
  Format trackFormat = currentChunk.trackFormat;
  if (!trackFormat.equals(primaryDownstreamTrackFormat)) {
    eventDispatcher.downstreamFormatChanged(primaryTrackType, trackFormat,
        currentChunk.trackSelectionReason, currentChunk.trackSelectionData,
        currentChunk.startTimeUs);
  }
  primaryDownstreamTrackFormat = trackFormat;
}