Class Presentation.Builder
- java.lang.Object
-
- com.google.android.exoplayer2.transformer.Presentation.Builder
-
- Enclosing class:
- Presentation
public static final class Presentation.Builder extends Object
A builder forPresentation
instances.
-
-
Constructor Summary
Constructors Constructor Description Builder()
Creates a builder with default values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Presentation
build()
Presentation.Builder
setAspectRatio(float aspectRatio, @com.google.android.exoplayer2.transformer.Presentation.Layout int layout)
Sets the aspect ratio (width/height ratio) for the output frame.Presentation.Builder
setCrop(float left, float right, float bottom, float top)
Crops a smaller (or larger frame), per normalized device coordinates (NDC), where the input frame corresponds to the square ranging from -1 to 1 on the x and y axes.Presentation.Builder
setResolution(int height)
Sets the output resolution using the output height.
-
-
-
Method Detail
-
setResolution
public Presentation.Builder setResolution(int height)
Sets the output resolution using the output height.The default value,
C.LENGTH_UNSET
, corresponds to using the same height as the input. Output width of the displayed frame will scale to preserve the frame's aspect ratio after other transformations.For example, a 1920x1440 frame can be scaled to 640x480 by calling
setResolution(480)
.- Parameters:
height
- The output height of the displayed frame, in pixels.- Returns:
- This builder.
-
setCrop
public Presentation.Builder setCrop(float left, float right, float bottom, float top)
Crops a smaller (or larger frame), per normalized device coordinates (NDC), where the input frame corresponds to the square ranging from -1 to 1 on the x and y axes.left
andbottom
default to -1, andright
andtop
default to 1, which corresponds to not applying any crop. To crop to a smaller subset of the input frame, use values between -1 and 1. To crop to a larger frame, use values below -1 and above 1.Width and height values set may be rescaled by
setResolution(int)
, which is applied after cropping changes.Only one of
setCrop
orsetAspectRatio(float, int)
can be called for onePresentation
.- Parameters:
left
- The left edge of the output frame, in NDC. Must be less thanright
.right
- The right edge of the output frame, in NDC. Must be greater thanleft
.bottom
- The bottom edge of the output frame, in NDC. Must be less thantop
.top
- The top edge of the output frame, in NDC. Must be greater thanbottom
.- Returns:
- This builder.
-
setAspectRatio
public Presentation.Builder setAspectRatio(float aspectRatio, @com.google.android.exoplayer2.transformer.Presentation.Layout int layout)
Sets the aspect ratio (width/height ratio) for the output frame.Resizes a frame's width or height to conform to an
aspectRatio
, given aPresentation.Layout
.aspectRatio
defaults toC.LENGTH_UNSET
, which corresponds to the same aspect ratio as the input frame.layout
defaults toPresentation.LAYOUT_SCALE_TO_FIT
Width and height values set may be rescaled by
setResolution(int)
, which is applied after aspect ratio changes.Only one of
setCrop(float, float, float, float)
orsetAspectRatio
can be called for onePresentation
.- Parameters:
aspectRatio
- The aspect ratio (width/height ratio) of the output frame. Must be positive.- Returns:
- This builder.
-
build
public Presentation build()
-
-