com.google.android.exoplayer2.util.Util.scaleLargeTimestamp()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(159)

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

Util.scaleLargeTimestamp介绍

[英]Scales a large timestamp.

Logically, scaling consists of a multiplication followed by a division. The actual operations performed are designed to minimize the probability of overflow.
[中]缩放一个大的时间戳。
从逻辑上讲,缩放由乘法和除法组成。执行的实际操作旨在将溢出概率降至最低。

代码示例

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

/**
 * Returns the presentation time offset, in microseconds.
 */
public long getPresentationTimeOffsetUs() {
 return Util.scaleLargeTimestamp(presentationTimeOffset, C.MICROS_PER_SECOND, timescale);
}

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

public StreamElement(String baseUri, String chunkTemplate, int type, String subType,
  long timescale, String name, int maxWidth, int maxHeight, int displayWidth,
  int displayHeight, String language, Format[] formats, List<Long> chunkStartTimes,
  long lastChunkDuration) {
 this(
   baseUri,
   chunkTemplate,
   type,
   subType,
   timescale,
   name,
   maxWidth,
   maxHeight,
   displayWidth,
   displayHeight,
   language,
   formats,
   chunkStartTimes,
   Util.scaleLargeTimestamps(chunkStartTimes, C.MICROS_PER_SECOND, timescale),
   Util.scaleLargeTimestamp(lastChunkDuration, C.MICROS_PER_SECOND, timescale));
}

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

long durationUs = Util.scaleLargeTimestamp(duration, C.MICROS_PER_SECOND, track.timescale);
  && timestamps.length >= 2) {
 long editStartTime = track.editListMediaTimes[0];
 long editEndTime = editStartTime + Util.scaleLargeTimestamp(track.editListDurations[0],
   track.timescale, track.movieTimescale);
 if (canApplyEditWithGaplessInfo(timestamps, duration, editStartTime, editEndTime)) {
  long paddingTimeUnits = duration - editEndTime;
  long encoderDelay = Util.scaleLargeTimestamp(editStartTime - timestamps[0],
    track.format.sampleRate, track.timescale);
  long encoderPadding = Util.scaleLargeTimestamp(paddingTimeUnits,
    track.format.sampleRate, track.timescale);
  if ((encoderDelay != 0 || encoderPadding != 0) && encoderDelay <= Integer.MAX_VALUE
   Util.scaleLargeTimestampsInPlace(timestamps, C.MICROS_PER_SECOND, track.timescale);
   long editedDurationUs =
     Util.scaleLargeTimestamp(
       track.editListDurations[0], C.MICROS_PER_SECOND, track.movieTimescale);
   return new TrackSampleTable(
 for (int i = 0; i < timestamps.length; i++) {
  timestamps[i] =
    Util.scaleLargeTimestamp(
      timestamps[i] - editStartTime, C.MICROS_PER_SECOND, track.timescale);
   Util.scaleLargeTimestamp(duration - editStartTime, C.MICROS_PER_SECOND, track.timescale);
 return new TrackSampleTable(
   track, offsets, sizes, maximumSize, timestamps, flags, durationUs);

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

/**
 * Returns the specified duration scaled to take into account the speedup factor of this instance,
 * in the same units as {@code duration}.
 *
 * @param duration The duration to scale taking into account speedup.
 * @return The specified duration scaled to take into account speedup, in the same units as
 *     {@code duration}.
 */
public long scaleDurationForSpeedup(long duration) {
 if (outputBytes >= MIN_BYTES_FOR_SPEEDUP_CALCULATION) {
  return outputSampleRateHz == sampleRateHz
    ? Util.scaleLargeTimestamp(duration, inputBytes, outputBytes)
    : Util.scaleLargeTimestamp(duration, inputBytes * outputSampleRateHz,
      outputBytes * sampleRateHz);
 } else {
  return (long) ((double) speed * duration);
 }
}

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

/** @see DashSegmentIndex#getTimeUs(long) */
public final long getSegmentTimeUs(long sequenceNumber) {
 long unscaledSegmentTime;
 if (segmentTimeline != null) {
  unscaledSegmentTime =
    segmentTimeline.get((int) (sequenceNumber - startNumber)).startTime
      - presentationTimeOffset;
 } else {
  unscaledSegmentTime = (sequenceNumber - startNumber) * duration;
 }
 return Util.scaleLargeTimestamp(unscaledSegmentTime, C.MICROS_PER_SECOND, timescale);
}

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

private long scaleTimecodeToUs(long unscaledTimecode) throws ParserException {
 if (timecodeScale == C.TIME_UNSET) {
  throw new ParserException("Can't scale timecode prior to timecodeScale being set.");
 }
 return Util.scaleLargeTimestamp(unscaledTimecode, timecodeScale, 1000);
}

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

/**
 * Represents a StreamIndex element.
 */
public static class StreamElement {
 private static final String URL_PLACEHOLDER_START_TIME_1 = "{start time}";
 private static final String URL_PLACEHOLDER_START_TIME_2 = "{start_time}";
 private static final String URL_PLACEHOLDER_BITRATE_1 = "{bitrate}";
 private static final String URL_PLACEHOLDER_BITRATE_2 = "{Bitrate}";
 public final int type;
 public final String subType;
 public final long timescale;
 public final String name;
 public final int maxWidth;
 public final int maxHeight;
 public final int displayWidth;
 public final int displayHeight;
 public final String language;
 public final Format[] formats;
 public final int chunkCount;
 private final String baseUri;
 private final String chunkTemplate;
 private final List<Long> chunkStartTimes;
 private final long[] chunkStartTimesUs;
 private final long lastChunkDurationUs;
 public StreamElement(String baseUri, String chunkTemplate, int type, String subType,

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

writeNullTerminatedString(dataOutputStream, nonNullValue);
writeUnsignedInt(dataOutputStream, timescale);
long presentationTime = Util.scaleLargeTimestamp(eventMessage.presentationTimeUs,
  timescale, C.MICROS_PER_SECOND);
writeUnsignedInt(dataOutputStream, presentationTime);
long duration = Util.scaleLargeTimestamp(eventMessage.durationMs, timescale, 1000);
writeUnsignedInt(dataOutputStream, duration);
writeUnsignedInt(dataOutputStream, eventMessage.id);

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

@SuppressWarnings("ByteBufferBackingArray")
@Override
public Metadata decode(MetadataInputBuffer inputBuffer) {
 ByteBuffer buffer = inputBuffer.data;
 byte[] data = buffer.array();
 int size = buffer.limit();
 ParsableByteArray emsgData = new ParsableByteArray(data, size);
 String schemeIdUri = Assertions.checkNotNull(emsgData.readNullTerminatedString());
 String value = Assertions.checkNotNull(emsgData.readNullTerminatedString());
 long timescale = emsgData.readUnsignedInt();
 long presentationTimeUs = Util.scaleLargeTimestamp(emsgData.readUnsignedInt(),
   C.MICROS_PER_SECOND, timescale);
 long durationMs = Util.scaleLargeTimestamp(emsgData.readUnsignedInt(), 1000, timescale);
 long id = emsgData.readUnsignedInt();
 byte[] messageData = Arrays.copyOfRange(data, emsgData.getPosition(), size);
 return new Metadata(new EventMessage(schemeIdUri, value, durationMs, id, messageData,
   presentationTimeUs));
}

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

long duration = parseLong(xpp, "duration", C.TIME_UNSET);
long presentationTime = parseLong(xpp, "presentationTime", 0);
long durationMs = Util.scaleLargeTimestamp(duration, 1000, timescale);
long presentationTimesUs = Util.scaleLargeTimestamp(presentationTime, C.MICROS_PER_SECOND,
  timescale);
String messageData = parseString(xpp, "messageData", null);

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

long durationUs = Util.scaleLargeTimestamp(frameCount, samplesPerFrame * C.MICROS_PER_SECOND,
  sampleRate);
if ((flags & 0x06) != 0x06) {

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

edtsOffset = Util.scaleLargeTimestamp(track.editListMediaTimes[0], 1000, track.timescale);
  Util.scaleLargeTimestamp(cumulativeTime, 1000, timescale) - edtsOffset;
sampleSizeTable[i] = sampleSize;
sampleIsSyncFrameTable[i] = ((sampleFlags >> 16) & 0x1) == 0

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

Util.scaleLargeTimestamp(atom.readUnsignedInt(), C.MICROS_PER_SECOND, timescale);

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

long durationUs = Util.scaleLargeTimestamp(numFrames,
  C.MICROS_PER_SECOND * (sampleRate >= 32000 ? 1152 : 576), sampleRate);
int entryCount = frame.readUnsignedShort();

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

offset += atom.readUnsignedLongToLong();
long earliestPresentationTimeUs = Util.scaleLargeTimestamp(earliestPresentationTime,
  C.MICROS_PER_SECOND, timescale);
 timeUs = Util.scaleLargeTimestamp(time, C.MICROS_PER_SECOND, timescale);
 durationsUs[i] = timeUs - timesUs[i];

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

durationUs = C.TIME_UNSET;
} else {
 durationUs = Util.scaleLargeTimestamp(duration, C.MICROS_PER_SECOND, movieTimescale);

相关文章