本文整理汇总了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);
}
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
}
示例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);
}
示例11: seek
@Override
public void seek(long position, long timeUs) {
synchronizedHeaderData = 0;
basisTimeUs = C.TIME_UNSET;
samplesRead = 0;
sampleBytesRemaining = 0;
}
示例12: reset
/**
* Resets the instance to its initial state.
*/
public void reset() {
lastSampleTimestamp = C.TIME_UNSET;
}
示例13: clearResumePosition
/**
* 清除进度
***/
private void clearResumePosition() {
resumeWindow = C.INDEX_UNSET;
resumePosition = C.TIME_UNSET;
}
示例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);
}
示例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);
}