当前位置: 首页>>代码示例>>Java>>正文


Java C.UNKNOWN_TIME_US属性代码示例

本文整理汇总了Java中com.google.android.exoplayer.C.UNKNOWN_TIME_US属性的典型用法代码示例。如果您正苦于以下问题:Java C.UNKNOWN_TIME_US属性的具体用法?Java C.UNKNOWN_TIME_US怎么用?Java C.UNKNOWN_TIME_US使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.google.android.exoplayer.C的用法示例。


在下文中一共展示了C.UNKNOWN_TIME_US属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getLastExtractedPositionUs

private long getLastExtractedPositionUs() {
    long lastExtractedPositionUs = Long.MAX_VALUE;
    for (long value : mLastExtractedPositionUsMap.values()) {
        lastExtractedPositionUs = Math.min(lastExtractedPositionUs, value);
    }
    if (lastExtractedPositionUs == Long.MAX_VALUE) {
        lastExtractedPositionUs = C.UNKNOWN_TIME_US;
    }
    return lastExtractedPositionUs;
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:10,代码来源:ExoPlayerSampleExtractor.java

示例2: parseTrak

/**
 * Parses a trak atom (defined in 14496-12).
 *
 * @param trak Atom to parse.
 * @param mvhd Movie header atom, used to get the timescale.
 * @return A {@link Track} instance, or {@code null} if the track's type isn't supported.
 */
public static Track parseTrak(Atom.ContainerAtom trak, Atom.LeafAtom mvhd) {
  Atom.ContainerAtom mdia = trak.getContainerAtomOfType(Atom.TYPE_mdia);
  int trackType = parseHdlr(mdia.getLeafAtomOfType(Atom.TYPE_hdlr).data);
  if (trackType != Track.TYPE_AUDIO && trackType != Track.TYPE_VIDEO
      && trackType != Track.TYPE_TEXT && trackType != Track.TYPE_SUBTITLE) {
    return null;
  }

  Pair<Integer, Long> header = parseTkhd(trak.getLeafAtomOfType(Atom.TYPE_tkhd).data);
  int id = header.first;
  long duration = header.second;
  long movieTimescale = parseMvhd(mvhd.data);
  long durationUs;
  if (duration == -1) {
    durationUs = C.UNKNOWN_TIME_US;
  } else {
    durationUs = Util.scaleLargeTimestamp(duration, C.MICROS_PER_SECOND, movieTimescale);
  }
  Atom.ContainerAtom stbl = mdia.getContainerAtomOfType(Atom.TYPE_minf)
      .getContainerAtomOfType(Atom.TYPE_stbl);

  long mediaTimescale = parseMdhd(mdia.getLeafAtomOfType(Atom.TYPE_mdhd).data);
  StsdDataHolder stsdData = parseStsd(stbl.getLeafAtomOfType(Atom.TYPE_stsd).data, durationUs);
  return stsdData.mediaFormat == null ? null
      : new Track(id, trackType, mediaTimescale, durationUs, stsdData.mediaFormat,
          stsdData.trackEncryptionBoxes, stsdData.nalUnitLengthFieldLength);
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:34,代码来源:AtomParsers.java

示例3: getPeriodDurationUs

private static long getPeriodDurationUs(MediaPresentationDescription manifest, int index) {
  long durationMs = manifest.getPeriodDuration(index);
  if (durationMs == -1) {
    return C.UNKNOWN_TIME_US;
  } else {
    return durationMs * 1000;
  }
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:8,代码来源:DashChunkSource.java

示例4: buildSeekMap

/**
 * Builds a {@link SeekMap} from the recently gathered Cues information.
 *
 * @return The built {@link SeekMap}. May be {@link SeekMap#UNSEEKABLE} if cues information was
 *     missing or incomplete.
 */
private SeekMap buildSeekMap() {
  if (segmentContentPosition == UNKNOWN || durationUs == C.UNKNOWN_TIME_US
      || cueTimesUs == null || cueTimesUs.size() == 0
      || cueClusterPositions == null || cueClusterPositions.size() != cueTimesUs.size()) {
    // Cues information is missing or incomplete.
    cueTimesUs = null;
    cueClusterPositions = null;
    return SeekMap.UNSEEKABLE;
  }
  int cuePointsSize = cueTimesUs.size();
  int[] sizes = new int[cuePointsSize];
  long[] offsets = new long[cuePointsSize];
  long[] durationsUs = new long[cuePointsSize];
  long[] timesUs = new long[cuePointsSize];
  for (int i = 0; i < cuePointsSize; i++) {
    timesUs[i] = cueTimesUs.get(i);
    offsets[i] = segmentContentPosition + cueClusterPositions.get(i);
  }
  for (int i = 0; i < cuePointsSize - 1; i++) {
    sizes[i] = (int) (offsets[i + 1] - offsets[i]);
    durationsUs[i] = timesUs[i + 1] - timesUs[i];
  }
  sizes[cuePointsSize - 1] =
      (int) (segmentContentPosition + segmentContentSize - offsets[cuePointsSize - 1]);
  durationsUs[cuePointsSize - 1] = durationUs - timesUs[cuePointsSize - 1];
  cueTimesUs = null;
  cueClusterPositions = null;
  return new ChunkIndex(sizes, offsets, durationsUs, timesUs);
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:35,代码来源:WebmExtractor.java

示例5: adaptiveTrack

@Override
public void adaptiveTrack(MediaPresentationDescription manifest, int periodIndex,
    int adaptationSetIndex, int[] representationIndices) {
  if (adaptiveFormatEvaluator == null) {
    Log.w(TAG, "Skipping adaptive track (missing format evaluator)");
    return;
  }
  AdaptationSet adaptationSet = manifest.getPeriod(periodIndex).adaptationSets.get(
      adaptationSetIndex);
  int maxWidth = 0;
  int maxHeight = 0;
  Format maxHeightRepresentationFormat = null;
  Format[] representationFormats = new Format[representationIndices.length];
  for (int i = 0; i < representationFormats.length; i++) {
    Format format = adaptationSet.representations.get(representationIndices[i]).format;
    if (maxHeightRepresentationFormat == null || format.height > maxHeight) {
      maxHeightRepresentationFormat = format;
    }
    maxWidth = Math.max(maxWidth, format.width);
    maxHeight = Math.max(maxHeight, format.height);
    representationFormats[i] = format;
  }
  Arrays.sort(representationFormats, new DecreasingBandwidthComparator());
  long trackDurationUs = live ? C.UNKNOWN_TIME_US : manifest.duration * 1000;
  String mediaMimeType = getMediaMimeType(maxHeightRepresentationFormat);
  if (mediaMimeType == null) {
    Log.w(TAG, "Skipped adaptive track (unknown media mime type)");
    return;
  }
  MediaFormat trackFormat = getTrackFormat(adaptationSet.type, maxHeightRepresentationFormat,
      mediaMimeType, trackDurationUs);
  if (trackFormat == null) {
    Log.w(TAG, "Skipped adaptive track (unknown media format)");
    return;
  }
  tracks.add(new ExposedTrack(trackFormat.copyAsAdaptive(null), adaptationSetIndex,
      representationFormats, maxWidth, maxHeight));
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:38,代码来源:DashChunkSource.java

示例6: parseHeaderExtension

private void parseHeaderExtension() {
  pesScratch.setPosition(0);
  timeUs = C.UNKNOWN_TIME_US;
  if (ptsFlag) {
    pesScratch.skipBits(4); // '0010' or '0011'
    long pts = (long) pesScratch.readBits(3) << 30;
    pesScratch.skipBits(1); // marker_bit
    pts |= pesScratch.readBits(15) << 15;
    pesScratch.skipBits(1); // marker_bit
    pts |= pesScratch.readBits(15);
    pesScratch.skipBits(1); // marker_bit
    if (!seenFirstDts && dtsFlag) {
      pesScratch.skipBits(4); // '0011'
      long dts = (long) pesScratch.readBits(3) << 30;
      pesScratch.skipBits(1); // marker_bit
      dts |= pesScratch.readBits(15) << 15;
      pesScratch.skipBits(1); // marker_bit
      dts |= pesScratch.readBits(15);
      pesScratch.skipBits(1); // marker_bit
      // Subsequent PES packets may have earlier presentation timestamps than this one, but they
      // should all be greater than or equal to this packet's decode timestamp. We feed the
      // decode timestamp to the adjuster here so that in the case that this is the first to be
      // fed, the adjuster will be able to compute an offset to apply such that the adjusted
      // presentation timestamps of all future packets are non-negative.
      ptsTimestampAdjuster.adjustTimestamp(dts);
      seenFirstDts = true;
    }
    timeUs = ptsTimestampAdjuster.adjustTimestamp(pts);
  }
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:30,代码来源:TsExtractor.java

示例7: parseTrak

/**
 * Parses a trak atom (defined in 14496-12).
 *
 * @param trak Atom to parse.
 * @param mvhd Movie header atom, used to get the timescale.
 * @param duration The duration in units of the timescale declared in the mvhd atom, or -1 if the
 *     duration should be parsed from the tkhd atom.
 * @param isQuickTime True for QuickTime media. False otherwise.
 * @return A {@link Track} instance, or {@code null} if the track's type isn't supported.
 */
public static Track parseTrak(Atom.ContainerAtom trak, Atom.LeafAtom mvhd, long duration,
    boolean isQuickTime) {
  Atom.ContainerAtom mdia = trak.getContainerAtomOfType(Atom.TYPE_mdia);
  int trackType = parseHdlr(mdia.getLeafAtomOfType(Atom.TYPE_hdlr).data);
  if (trackType != Track.TYPE_soun && trackType != Track.TYPE_vide && trackType != Track.TYPE_text
      && trackType != Track.TYPE_sbtl && trackType != Track.TYPE_subt) {
    return null;
  }

  TkhdData tkhdData = parseTkhd(trak.getLeafAtomOfType(Atom.TYPE_tkhd).data);
  if (duration == -1) {
    duration = tkhdData.duration;
  }
  long movieTimescale = parseMvhd(mvhd.data);
  long durationUs;
  if (duration == -1) {
    durationUs = C.UNKNOWN_TIME_US;
  } else {
    durationUs = Util.scaleLargeTimestamp(duration, C.MICROS_PER_SECOND, movieTimescale);
  }
  Atom.ContainerAtom stbl = mdia.getContainerAtomOfType(Atom.TYPE_minf)
      .getContainerAtomOfType(Atom.TYPE_stbl);

  Pair<Long, String> mdhdData = parseMdhd(mdia.getLeafAtomOfType(Atom.TYPE_mdhd).data);
  StsdData stsdData = parseStsd(stbl.getLeafAtomOfType(Atom.TYPE_stsd).data, tkhdData.id,
      durationUs, tkhdData.rotationDegrees, mdhdData.second, isQuickTime);
  Pair<long[], long[]> edtsData = parseEdts(trak.getContainerAtomOfType(Atom.TYPE_edts));
  return stsdData.mediaFormat == null ? null
      : new Track(tkhdData.id, trackType, mdhdData.first, movieTimescale, durationUs,
          stsdData.mediaFormat, stsdData.trackEncryptionBoxes, stsdData.nalUnitLengthFieldLength,
          edtsData.first, edtsData.second);
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:42,代码来源:AtomParsers.java

示例8: isSeekable

@Override
public boolean isSeekable() {
  return durationUs != C.UNKNOWN_TIME_US;
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:4,代码来源:ConstantBitrateSeeker.java

示例9: clearPendingSample

private void clearPendingSample() {
  sampleHolder.timeUs = C.UNKNOWN_TIME_US;
  sampleHolder.clearData();
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:4,代码来源:Eia608TrackRenderer.java

示例10: maybeStartLoading

private void maybeStartLoading() {
  if (loadingFinished || loader.isLoading()) {
    return;
  }

  if (currentLoadableException != null) {
    if (isCurrentLoadableExceptionFatal()) {
      return;
    }
    Assertions.checkState(loadable != null);
    long elapsedMillis = SystemClock.elapsedRealtime() - currentLoadableExceptionTimestamp;
    if (elapsedMillis >= getRetryDelayMillis(currentLoadableExceptionCount)) {
      currentLoadableException = null;
      if (!prepared) {
        // We don't know whether we're playing an on-demand or a live stream. For a live stream
        // we need to load from the start, as outlined below. Since we might be playing a live
        // stream, play it safe and load from the start.
        for (int i = 0; i < sampleQueues.size(); i++) {
          sampleQueues.valueAt(i).clear();
        }
        loadable = createLoadableFromStart();
      } else if (!seekMap.isSeekable()) {
        // We're playing a non-seekable stream. Assume it's live, and therefore that the data at
        // the uri is a continuously shifting window of the latest available media. For this case
        // there's no way to continue loading from where a previous load finished, and hence it's
        // necessary to load from the start whenever commencing a new load.
        for (int i = 0; i < sampleQueues.size(); i++) {
          sampleQueues.valueAt(i).clear();
        }
        loadable = createLoadableFromStart();
        // To avoid introducing a discontinuity, we shift the sample timestamps so that they will
        // continue from the current downstream position.
        pendingNextSampleUs = downstreamPositionUs;
        havePendingNextSampleUs = true;
      } else {
        // We're playing a seekable on-demand stream. Resume the current loadable, which will
        // request data starting from the point it left off.
      }
      extractedSampleCountAtStartOfLoad = extractedSampleCount;
      loader.startLoading(loadable, this);
    }
    return;
  }

  // We're not retrying, so we're either starting a playback or responding to an explicit seek.
  // In both cases sampleTimeOffsetUs should be reset to zero, and any pending adjustment to
  // sample timestamps should be discarded.
  sampleTimeOffsetUs = 0;
  havePendingNextSampleUs = false;

  if (!prepared) {
    loadable = createLoadableFromStart();
  } else {
    Assertions.checkState(isPendingReset());
    if (maxTrackDurationUs != C.UNKNOWN_TIME_US && pendingResetPositionUs >= maxTrackDurationUs) {
      loadingFinished = true;
      pendingResetPositionUs = NO_RESET_PENDING;
      return;
    }
    loadable = createLoadableFromPositionUs(pendingResetPositionUs);
    pendingResetPositionUs = NO_RESET_PENDING;
  }
  extractedSampleCountAtStartOfLoad = extractedSampleCount;
  loader.startLoading(loadable, this);
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:65,代码来源:ExtractorSampleSource.java

示例11: ConstantBitrateSeeker

public ConstantBitrateSeeker(long firstFramePosition, int bitrate, long inputLength) {
  this.firstFramePosition = firstFramePosition;
  this.bitrate = bitrate;
  durationUs = inputLength == C.LENGTH_UNBOUNDED ? C.UNKNOWN_TIME_US : getTimeUs(inputLength);
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:5,代码来源:ConstantBitrateSeeker.java

示例12: scaleTimecodeToUs

private long scaleTimecodeToUs(long unscaledTimecode) throws ParserException {
  if (timecodeScale == C.UNKNOWN_TIME_US) {
    throw new ParserException("Can't scale timecode prior to timecodeScale being set.");
  }
  return Util.scaleLargeTimestamp(unscaledTimecode, timecodeScale, 1000);
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:6,代码来源:WebmExtractor.java

示例13: isSamplePending

private boolean isSamplePending() {
  return sampleHolder.timeUs != C.UNKNOWN_TIME_US;
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:3,代码来源:Eia608TrackRenderer.java

示例14: setMediaPlaylist

private void setMediaPlaylist(int variantIndex, HlsMediaPlaylist mediaPlaylist) {
  variantLastPlaylistLoadTimesMs[variantIndex] = SystemClock.elapsedRealtime();
  variantPlaylists[variantIndex] = mediaPlaylist;
  live |= mediaPlaylist.live;
  durationUs = live ? C.UNKNOWN_TIME_US : mediaPlaylist.durationUs;
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:6,代码来源:HlsChunkSource.java

示例15: TagPayloadReader

/**
 * @param output A {@link TrackOutput} to which samples should be written.
 */
protected TagPayloadReader(TrackOutput output) {
  this.output = output;
  this.durationUs = C.UNKNOWN_TIME_US;
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:7,代码来源:TagPayloadReader.java


注:本文中的com.google.android.exoplayer.C.UNKNOWN_TIME_US属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。