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

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

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

Util.ceilDivide介绍

[英]Divides a numerator by a denominator, returning the ceiled result.
[中]将分子除以分母,返回经过计算的结果。

代码示例

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

@Override
public int getSegmentCount(long periodDurationUs) {
 if (segmentTimeline != null) {
  return segmentTimeline.size();
 } else if (periodDurationUs != C.TIME_UNSET) {
  long durationUs = (duration * C.MICROS_PER_SECOND) / timescale;
  return (int) Util.ceilDivide(periodDurationUs, durationUs);
 } else {
  return DashSegmentIndex.INDEX_UNBOUNDED;
 }
}

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

/**
 * Given viewport dimensions and video dimensions, computes the maximum size of the video as it
 * will be rendered to fit inside of the viewport.
 */
private static Point getMaxVideoSizeInViewport(boolean orientationMayChange, int viewportWidth,
  int viewportHeight, int videoWidth, int videoHeight) {
 if (orientationMayChange && (videoWidth > videoHeight) != (viewportWidth > viewportHeight)) {
  // Rotation is allowed, and the video will be larger in the rotated viewport.
  int tempViewportWidth = viewportWidth;
  viewportWidth = viewportHeight;
  viewportHeight = tempViewportWidth;
 }
 if (videoWidth * viewportHeight >= videoHeight * viewportWidth) {
  // Horizontal letter-boxing along top and bottom.
  return new Point(viewportWidth, Util.ceilDivide(viewportWidth * videoHeight, videoWidth));
 } else {
  // Vertical letter-boxing along edges.
  return new Point(Util.ceilDivide(viewportHeight * videoWidth, videoHeight), viewportHeight);
 }
}

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

maxPixels = Util.ceilDivide(width, 16) * Util.ceilDivide(height, 16) * 16 * 16;
minCompressionRatio = 2;
break;

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

@Override
public synchronized void trim() {
 int targetAllocationCount = Util.ceilDivide(targetBufferSize, individualAllocationSize);
 int targetAvailableCount = Math.max(0, targetAllocationCount - allocatedCount);
 if (targetAvailableCount >= availableCount) {

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

rechunkedSampleCount += Util.ceilDivide(chunkSampleCount, maxSampleCount);

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

longEdgePx = Util.ceilDivide(longEdgePx, 16) * 16;
shortEdgePx = Util.ceilDivide(shortEdgePx, 16) * 16;
if (longEdgePx * shortEdgePx <= MediaCodecUtil.maxH264DecodableFrameSize()) {
 return new Point(isVerticalVideo ? shortEdgePx : longEdgePx,

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

/**
 * Returns the smallest video size greater than or equal to a specified size that also satisfies
 * the {@link MediaCodec}'s width and height alignment requirements.
 * <p>
 * Must not be called if the device SDK version is less than 21.
 *
 * @param width Width in pixels.
 * @param height Height in pixels.
 * @return The smallest video size greater than or equal to the specified size that also satisfies
 *     the {@link MediaCodec}'s width and height alignment requirements, or null if not a video
 *     codec.
 */
@TargetApi(21)
public Point alignVideoSizeV21(int width, int height) {
 if (capabilities == null) {
  logNoSupport("align.caps");
  return null;
 }
 VideoCapabilities videoCapabilities = capabilities.getVideoCapabilities();
 if (videoCapabilities == null) {
  logNoSupport("align.vCaps");
  return null;
 }
 int widthAlignment = videoCapabilities.getWidthAlignment();
 int heightAlignment = videoCapabilities.getHeightAlignment();
 return new Point(Util.ceilDivide(width, widthAlignment) * widthAlignment,
   Util.ceilDivide(height, heightAlignment) * heightAlignment);
}

相关文章