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


Java C.TIME_UNSET属性代码示例

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


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

示例1: getContentProgress

@Override
public VideoProgressUpdate getContentProgress() {
  if (player == null) {
    return lastContentProgress;
  } else if (pendingContentPositionMs != C.TIME_UNSET) {
    sentPendingContentPositionMs = true;
    return new VideoProgressUpdate(pendingContentPositionMs, contentDurationMs);
  } else if (fakeContentProgressElapsedRealtimeMs != C.TIME_UNSET) {
    long elapsedSinceEndMs = SystemClock.elapsedRealtime() - fakeContentProgressElapsedRealtimeMs;
    long fakePositionMs = fakeContentProgressOffsetMs + elapsedSinceEndMs;
    return new VideoProgressUpdate(fakePositionMs, contentDurationMs);
  } else if (playingAd || contentDurationMs == C.TIME_UNSET) {
    return VideoProgressUpdate.VIDEO_TIME_NOT_READY;
  } else {
    return new VideoProgressUpdate(player.getCurrentPosition(), contentDurationMs);
  }
}
 
开发者ID:yangchaojiang,项目名称:yjPlay,代码行数:17,代码来源:ImaAdsLoader.java

示例2: getWindow

@Override
public Window getWindow(int windowIndex, Window window, boolean setIds,
    long defaultPositionProjectionUs) {
  window = timeline.getWindow(0, window, setIds, defaultPositionProjectionUs);
  window.durationUs = endUs != C.TIME_UNSET ? endUs - startUs : C.TIME_UNSET;
  if (window.defaultPositionUs != C.TIME_UNSET) {
    window.defaultPositionUs = Math.max(window.defaultPositionUs, startUs);
    window.defaultPositionUs = endUs == C.TIME_UNSET ? window.defaultPositionUs
        : Math.min(window.defaultPositionUs, endUs);
    window.defaultPositionUs -= startUs;
  }
  long startMs = C.usToMs(startUs);
  if (window.presentationStartTimeMs != C.TIME_UNSET) {
    window.presentationStartTimeMs += startMs;
  }
  if (window.windowStartTimeMs != C.TIME_UNSET) {
    window.windowStartTimeMs += startMs;
  }
  return window;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:20,代码来源:ClippingMediaSource.java

示例3: updateLeftTime

private void updateLeftTime() {
    if (!isConnected || !isAttachedToWindow) {
        leftTime.setVisibility(GONE);
        return;
    }
    if (isControllerVisible()) {
        return;
    }
    long duration = player == null ? 0 : player.getDuration();
    long position = player == null ? 0 : player.getCurrentPosition();
    if (duration == C.TIME_UNSET) {
        return;
    }
    leftTime.setVisibility(VISIBLE);
    leftTime.setText(stringForTime(duration - position));
    leftTime.postDelayed(updateTimeAction, 1000);
}
 
开发者ID:mingdroid,项目名称:tumbviewer,代码行数:17,代码来源:CommonExoPlayerView.java

示例4: ExtractorMediaPeriod

/**
 * @param uri The {@link Uri} of the media stream.
 * @param dataSource The data source to read the media.
 * @param extractors The extractors to use to read the data source.
 * @param minLoadableRetryCount The minimum number of times to retry if a loading error occurs.
 * @param eventHandler A handler for events. May be null if delivery of events is not required.
 * @param eventListener A listener of events. May be null if delivery of events is not required.
 * @param sourceListener A listener to notify when the timeline has been loaded.
 * @param allocator An {@link Allocator} from which to obtain media buffer allocations.
 * @param customCacheKey A custom key that uniquely identifies the original stream. Used for cache
 *     indexing. May be null.
 */
public ExtractorMediaPeriod(Uri uri, DataSource dataSource, Extractor[] extractors,
    int minLoadableRetryCount, Handler eventHandler,
    ExtractorMediaSource.EventListener eventListener, MediaSource.Listener sourceListener,
    Allocator allocator, String customCacheKey) {
  this.uri = uri;
  this.dataSource = dataSource;
  this.minLoadableRetryCount = minLoadableRetryCount;
  this.eventHandler = eventHandler;
  this.eventListener = eventListener;
  this.sourceListener = sourceListener;
  this.allocator = allocator;
  this.customCacheKey = customCacheKey;
  loader = new Loader("Loader:ExtractorMediaPeriod");
  extractorHolder = new ExtractorHolder(extractors, this);
  loadCondition = new ConditionVariable();
  maybeFinishPrepareRunnable = new Runnable() {
    @Override
    public void run() {
      maybeFinishPrepare();
    }
  };
  onContinueLoadingRequestedRunnable = new Runnable() {
    @Override
    public void run() {
      if (!released) {
        callback.onContinueLoadingRequested(ExtractorMediaPeriod.this);
      }
    }
  };
  handler = new Handler();

  pendingResetPositionUs = C.TIME_UNSET;
  sampleQueues = new SparseArray<>();
  length = C.LENGTH_UNSET;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:47,代码来源:ExtractorMediaPeriod.java

示例5: Mp3Extractor

/**
 * Constructs a new {@link Mp3Extractor}.
 *
 * @param flags Flags that control the extractor's behavior.
 * @param forcedFirstSampleTimestampUs A timestamp to force for the first sample, or
 *     {@link C#TIME_UNSET} if forcing is not required.
 */
public Mp3Extractor(@Flags int flags, long forcedFirstSampleTimestampUs) {
  this.flags = flags;
  this.forcedFirstSampleTimestampUs = forcedFirstSampleTimestampUs;
  scratch = new ParsableByteArray(SCRATCH_LENGTH);
  synchronizedHeader = new MpegAudioHeader();
  gaplessInfoHolder = new GaplessInfoHolder();
  basisTimeUs = C.TIME_UNSET;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:15,代码来源:Mp3Extractor.java

示例6: getProgressTime

public static String getProgressTime(long timeMs, boolean remaining) {
    if (timeMs == C.TIME_UNSET) {
        timeMs = 0;
    }
    long totalSeconds = (timeMs + 500) / 1000;
    long seconds = totalSeconds % 60;
    long minutes = (totalSeconds / 60) % 60;
    long hours = totalSeconds / 3600;
    formatBuilder.setLength(0);
    String time = hours > 0 ? formatter.format(FORMAT_HOURS, hours, minutes, seconds).toString()
            : formatter.format(FORMAT_MINUTES, minutes, seconds).toString();
    return remaining && timeMs != 0 ? "-" + time : time;
}
 
开发者ID:Tubitv,项目名称:TubiPlayer,代码行数:13,代码来源:Utils.java

示例7: getDurationRemainingSec

private static long getDurationRemainingSec(Map<String, String> keyStatus, String property) {
  if (keyStatus != null) {
    try {
      String value = keyStatus.get(property);
      if (value != null) {
        return Long.parseLong(value);
      }
    } catch (NumberFormatException e) {
      // do nothing.
    }
  }
  return C.TIME_UNSET;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:13,代码来源:WidevineUtil.java

示例8: parseTrak

/**
 * Parses a trak atom (defined in 14496-12).
 *
 * @param trak Atom to decode.
 * @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
 *     {@link C#TIME_UNSET} if the duration should be parsed from the tkhd atom.
 * @param drmInitData {@link DrmInitData} to be included in the format.
 * @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,
    DrmInitData drmInitData, boolean isQuickTime) throws ParserException {
  Atom.ContainerAtom mdia = trak.getContainerAtomOfType(Atom.TYPE_mdia);
  int trackType = parseHdlr(mdia.getLeafAtomOfType(Atom.TYPE_hdlr).data);
  if (trackType == C.TRACK_TYPE_UNKNOWN) {
    return null;
  }

  TkhdData tkhdData = parseTkhd(trak.getLeafAtomOfType(Atom.TYPE_tkhd).data);
  if (duration == C.TIME_UNSET) {
    duration = tkhdData.duration;
  }
  long movieTimescale = parseMvhd(mvhd.data);
  long durationUs;
  if (duration == C.TIME_UNSET) {
    durationUs = C.TIME_UNSET;
  } 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,
      tkhdData.rotationDegrees, mdhdData.second, drmInitData, isQuickTime);
  Pair<long[], long[]> edtsData = parseEdts(trak.getContainerAtomOfType(Atom.TYPE_edts));
  return stsdData.format == null ? null
      : new Track(tkhdData.id, trackType, mdhdData.first, movieTimescale, durationUs,
          stsdData.format, stsdData.requiredSampleTransformation, stsdData.trackEncryptionBoxes,
          stsdData.nalUnitLengthFieldLength, edtsData.first, edtsData.second);
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:42,代码来源:AtomParsers.java

示例9: flushCodec

protected void flushCodec() throws ExoPlaybackException {
  codecHotswapDeadlineMs = C.TIME_UNSET;
  inputIndex = C.INDEX_UNSET;
  outputIndex = C.INDEX_UNSET;
  waitingForFirstSyncFrame = true;
  waitingForKeys = false;
  shouldSkipOutputBuffer = false;
  decodeOnlyPresentationTimestamps.clear();
  codecNeedsAdaptationWorkaroundBuffer = false;
  shouldSkipAdaptationWorkaroundOutputBuffer = false;
  if (codecNeedsFlushWorkaround || (codecNeedsEosFlushWorkaround && codecReceivedEos)) {
    releaseCodec();
    maybeInitCodec();
  } else if (codecReinitializationState != REINITIALIZATION_STATE_NONE) {
    // We're already waiting to release and re-initialize the codec. Since we're now flushing,
    // there's no need to wait any longer.
    releaseCodec();
    maybeInitCodec();
  } else {
    // We can flush and re-use the existing decoder.
    codec.flush();
    codecReceivedBuffers = false;
  }
  if (codecReconfigured && format != null) {
    // Any reconfiguration data that we send shortly before the flush may be discarded. We
    // avoid this issue by sending reconfiguration data following every flush.
    codecReconfigurationState = RECONFIGURATION_STATE_WRITE_PENDING;
  }
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:29,代码来源:MediaCodecRenderer.java

示例10: fastForward

private void fastForward() {
    if (fastForwardMs <= 0) {
        return;
    }
    long durationMs = player.getDuration();
    long seekPositionMs = player.getCurrentPosition() + fastForwardMs;
    if (durationMs != C.TIME_UNSET) {
        seekPositionMs = Math.min(seekPositionMs, durationMs);
    }
    seekTo(seekPositionMs);
}
 
开发者ID:yangchaojiang,项目名称:yjPlay,代码行数:11,代码来源:PlaybackControlView.java

示例11: seek

@Override
public void seek(long position, long timeUs) {
  synchronizedHeaderData = 0;
  basisTimeUs = C.TIME_UNSET;
  samplesRead = 0;
  sampleBytesRemaining = 0;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:7,代码来源:Mp3Extractor.java

示例12: reset

/**
 * Resets the instance to its initial state.
 */
public void reset() {
  lastSampleTimestamp = C.TIME_UNSET;
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:6,代码来源:TimestampAdjuster.java

示例13: clearResumePosition

/**
 * 清除进度
 ***/
private void clearResumePosition() {
    resumeWindow = C.INDEX_UNSET;
    resumePosition = C.TIME_UNSET;
}
 
开发者ID:yangchaojiang,项目名称:yjPlay,代码行数:7,代码来源:ExoUserPlayer.java

示例14: parseFromSection

static SpliceInsertCommand parseFromSection(ParsableByteArray sectionData,
    long ptsAdjustment, TimestampAdjuster timestampAdjuster) {
  long spliceEventId = sectionData.readUnsignedInt();
  // splice_event_cancel_indicator(1), reserved(7).
  boolean spliceEventCancelIndicator = (sectionData.readUnsignedByte() & 0x80) != 0;
  boolean outOfNetworkIndicator = false;
  boolean programSpliceFlag = false;
  boolean spliceImmediateFlag = false;
  long programSplicePts = C.TIME_UNSET;
  List<ComponentSplice> componentSplices = Collections.emptyList();
  int uniqueProgramId = 0;
  int availNum = 0;
  int availsExpected = 0;
  boolean autoReturn = false;
  long duration = C.TIME_UNSET;
  if (!spliceEventCancelIndicator) {
    int headerByte = sectionData.readUnsignedByte();
    outOfNetworkIndicator = (headerByte & 0x80) != 0;
    programSpliceFlag = (headerByte & 0x40) != 0;
    boolean durationFlag = (headerByte & 0x20) != 0;
    spliceImmediateFlag = (headerByte & 0x10) != 0;
    if (programSpliceFlag && !spliceImmediateFlag) {
      programSplicePts = TimeSignalCommand.parseSpliceTime(sectionData, ptsAdjustment);
    }
    if (!programSpliceFlag) {
      int componentCount = sectionData.readUnsignedByte();
      componentSplices = new ArrayList<>(componentCount);
      for (int i = 0; i < componentCount; i++) {
        int componentTag = sectionData.readUnsignedByte();
        long componentSplicePts = C.TIME_UNSET;
        if (!spliceImmediateFlag) {
          componentSplicePts = TimeSignalCommand.parseSpliceTime(sectionData, ptsAdjustment);
        }
        componentSplices.add(new ComponentSplice(componentTag, componentSplicePts,
            timestampAdjuster.adjustTsTimestamp(componentSplicePts)));
      }
    }
    if (durationFlag) {
      long firstByte = sectionData.readUnsignedByte();
      autoReturn = (firstByte & 0x80) != 0;
      duration = ((firstByte & 0x01) << 32) | sectionData.readUnsignedInt();
    }
    uniqueProgramId = sectionData.readUnsignedShort();
    availNum = sectionData.readUnsignedByte();
    availsExpected = sectionData.readUnsignedByte();
  }
  return new SpliceInsertCommand(spliceEventId, spliceEventCancelIndicator, outOfNetworkIndicator,
      programSpliceFlag, spliceImmediateFlag, programSplicePts,
      timestampAdjuster.adjustTsTimestamp(programSplicePts), componentSplices, autoReturn,
      duration, uniqueProgramId, availNum, availsExpected);
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:51,代码来源:SpliceInsertCommand.java

示例15: parseFromSection

private static Event parseFromSection(ParsableByteArray sectionData) {
  long spliceEventId = sectionData.readUnsignedInt();
  // splice_event_cancel_indicator(1), reserved(7).
  boolean spliceEventCancelIndicator = (sectionData.readUnsignedByte() & 0x80) != 0;
  boolean outOfNetworkIndicator = false;
  boolean programSpliceFlag = false;
  long utcSpliceTime = C.TIME_UNSET;
  ArrayList<ComponentSplice> componentSplices = new ArrayList<>();
  int uniqueProgramId = 0;
  int availNum = 0;
  int availsExpected = 0;
  boolean autoReturn = false;
  long duration = C.TIME_UNSET;
  if (!spliceEventCancelIndicator) {
    int headerByte = sectionData.readUnsignedByte();
    outOfNetworkIndicator = (headerByte & 0x80) != 0;
    programSpliceFlag = (headerByte & 0x40) != 0;
    boolean durationFlag = (headerByte & 0x20) != 0;
    if (programSpliceFlag) {
      utcSpliceTime = sectionData.readUnsignedInt();
    }
    if (!programSpliceFlag) {
      int componentCount = sectionData.readUnsignedByte();
      componentSplices = new ArrayList<>(componentCount);
      for (int i = 0; i < componentCount; i++) {
        int componentTag = sectionData.readUnsignedByte();
        long componentUtcSpliceTime = sectionData.readUnsignedInt();
        componentSplices.add(new ComponentSplice(componentTag, componentUtcSpliceTime));
      }
    }
    if (durationFlag) {
      long firstByte = sectionData.readUnsignedByte();
      autoReturn = (firstByte & 0x80) != 0;
      duration = ((firstByte & 0x01) << 32) | sectionData.readUnsignedInt();
    }
    uniqueProgramId = sectionData.readUnsignedShort();
    availNum = sectionData.readUnsignedByte();
    availsExpected = sectionData.readUnsignedByte();
  }
  return new Event(spliceEventId, spliceEventCancelIndicator, outOfNetworkIndicator,
      programSpliceFlag, componentSplices, utcSpliceTime, autoReturn, duration, uniqueProgramId,
      availNum, availsExpected);
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:43,代码来源:SpliceScheduleCommand.java


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