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

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

本文整理了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

  1. @Override
  2. public int getSegmentCount(long periodDurationUs) {
  3. if (segmentTimeline != null) {
  4. return segmentTimeline.size();
  5. } else if (periodDurationUs != C.TIME_UNSET) {
  6. long durationUs = (duration * C.MICROS_PER_SECOND) / timescale;
  7. return (int) Util.ceilDivide(periodDurationUs, durationUs);
  8. } else {
  9. return DashSegmentIndex.INDEX_UNBOUNDED;
  10. }
  11. }

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

  1. /**
  2. * Given viewport dimensions and video dimensions, computes the maximum size of the video as it
  3. * will be rendered to fit inside of the viewport.
  4. */
  5. private static Point getMaxVideoSizeInViewport(boolean orientationMayChange, int viewportWidth,
  6. int viewportHeight, int videoWidth, int videoHeight) {
  7. if (orientationMayChange && (videoWidth > videoHeight) != (viewportWidth > viewportHeight)) {
  8. // Rotation is allowed, and the video will be larger in the rotated viewport.
  9. int tempViewportWidth = viewportWidth;
  10. viewportWidth = viewportHeight;
  11. viewportHeight = tempViewportWidth;
  12. }
  13. if (videoWidth * viewportHeight >= videoHeight * viewportWidth) {
  14. // Horizontal letter-boxing along top and bottom.
  15. return new Point(viewportWidth, Util.ceilDivide(viewportWidth * videoHeight, videoWidth));
  16. } else {
  17. // Vertical letter-boxing along edges.
  18. return new Point(Util.ceilDivide(viewportHeight * videoWidth, videoHeight), viewportHeight);
  19. }
  20. }

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

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

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

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

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

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

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

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

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

  1. /**
  2. * Returns the smallest video size greater than or equal to a specified size that also satisfies
  3. * the {@link MediaCodec}'s width and height alignment requirements.
  4. * <p>
  5. * Must not be called if the device SDK version is less than 21.
  6. *
  7. * @param width Width in pixels.
  8. * @param height Height in pixels.
  9. * @return The smallest video size greater than or equal to the specified size that also satisfies
  10. * the {@link MediaCodec}'s width and height alignment requirements, or null if not a video
  11. * codec.
  12. */
  13. @TargetApi(21)
  14. public Point alignVideoSizeV21(int width, int height) {
  15. if (capabilities == null) {
  16. logNoSupport("align.caps");
  17. return null;
  18. }
  19. VideoCapabilities videoCapabilities = capabilities.getVideoCapabilities();
  20. if (videoCapabilities == null) {
  21. logNoSupport("align.vCaps");
  22. return null;
  23. }
  24. int widthAlignment = videoCapabilities.getWidthAlignment();
  25. int heightAlignment = videoCapabilities.getHeightAlignment();
  26. return new Point(Util.ceilDivide(width, widthAlignment) * widthAlignment,
  27. Util.ceilDivide(height, heightAlignment) * heightAlignment);
  28. }

相关文章