Back to Exoplayer

Presentation (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/effect/Presentation.html

latest10.6 KB
Original Source

Package com.google.android.exoplayer2.effect

Class Presentation

  • java.lang.Object

    • com.google.android.exoplayer2.effect.Presentation
  • All Implemented Interfaces:GlEffect, GlMatrixTransformation, MatrixTransformation, Effect


[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classPresentationextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")implements[MatrixTransformation](MatrixTransformation.html "interface in com.google.android.exoplayer2.effect")

Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.

Controls how a frame is presented with options to set the output resolution and choose how to map the input pixels onto the output frame geometry (for example, by stretching the input frame to match the specified output frame, or fitting the input frame using letterboxing).

The background color of the output frame will be black, with alpha = 0 if applicable.

Nested Class Summary

Nested Classes | Modifier and Type | Class | Description | | --- | --- | --- | | static interface | Presentation.Layout | Deprecated.

Strategies controlling the layout of input pixels in the output frame. |

Field Summary

Fields | Modifier and Type | Field | Description | | --- | --- | --- | | static int | LAYOUT_SCALE_TO_FIT | Deprecated.

Empty pixels added above and below the input frame (for letterboxing), or to the left and right of the input frame (for pillarboxing), until the desired aspect ratio is achieved. | | static int | LAYOUT_SCALE_TO_FIT_WITH_CROP | Deprecated.

Pixels cropped from the input frame, until the desired aspect ratio is achieved. | | static int | LAYOUT_STRETCH_TO_FIT | Deprecated.

Frame stretched larger on the x or y axes to fit the desired aspect ratio. |

Method Summary

All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description | | --- | --- | --- | | Size | configure​(int inputWidth, int inputHeight) | Deprecated.

Configures the input and output dimensions. | | static Presentation | createForAspectRatio​(float aspectRatio, @com.google.android.exoplayer2.effect.Presentation.Layout int layout) | Deprecated.

Creates a new Presentation instance. | | static Presentation | createForHeight​(int height) | Deprecated.

Creates a new Presentation instance. | | static Presentation | createForWidthAndHeight​(int width, int height, @com.google.android.exoplayer2.effect.Presentation.Layout int layout) | Deprecated.

Creates a new Presentation instance. | | Matrix | getMatrix​(long presentationTimeUs) | Deprecated.

Returns the 3x3 transformation Matrix to apply to the frame with the given timestamp. | | boolean | isNoOp​(int inputWidth, int inputHeight) | Deprecated.

Returns whether a GlEffect applies no change at every timestamp. |

- 

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

- 

Methods inherited from interface com.google.android.exoplayer2.effect.GlMatrixTransformation

toGlShaderProgram

- 

Methods inherited from interface com.google.android.exoplayer2.effect.MatrixTransformation

getGlMatrixArray

Field Detail

- 

LAYOUT_SCALE_TO_FIT

public static final int LAYOUT_SCALE_TO_FIT

Deprecated.

Empty pixels added above and below the input frame (for letterboxing), or to the left and right of the input frame (for pillarboxing), until the desired aspect ratio is achieved. All input frame pixels will be within the output frame.

When applying:

  - letterboxing, the output width will default to the input width, and the output height will be scaled appropriately. 
  - pillarboxing, the output height will default to the input height, and the output width will be scaled appropriately. 

See Also:Constant Field Values

- 

LAYOUT_SCALE_TO_FIT_WITH_CROP

public static final int LAYOUT_SCALE_TO_FIT_WITH_CROP

Deprecated.

Pixels cropped from the input frame, until the desired aspect ratio is achieved. Pixels may be cropped either from the bottom and top, or from the left and right sides, of the input frame.

When cropping from the:

  - bottom and top, the output width will default to the input width, and the output height will be scaled appropriately. 
  - left and right, the output height will default to the input height, and the output width will be scaled appropriately. 

See Also:Constant Field Values

- 

LAYOUT_STRETCH_TO_FIT

public static final int LAYOUT_STRETCH_TO_FIT

Deprecated.

Frame stretched larger on the x or y axes to fit the desired aspect ratio.

When stretching to a:

  - taller aspect ratio, the output width will default to the input width, and the output height will be scaled appropriately. 
  - narrower aspect ratio, the output height will default to the input height, and the output width will be scaled appropriately. 

See Also:Constant Field Values

Method Detail

- 

createForAspectRatio

public static[Presentation](Presentation.html "class in com.google.android.exoplayer2.effect")createForAspectRatio​(@FloatRange(from=0.0,fromInclusive=false)
                                                float aspectRatio,
                                                @com.google.android.exoplayer2.effect.Presentation.Layout int layout)

Deprecated.

Creates a new Presentation instance.

The output frame will have the given aspect ratio (width/height ratio). Width or height will be resized to conform to this aspectRatio, given a Presentation.Layout.

Parameters:aspectRatio - The aspect ratio (width/height ratio) of the output frame. Must be positive.layout - The layout of the output frame.

- 

createForHeight

public static[Presentation](Presentation.html "class in com.google.android.exoplayer2.effect")createForHeight​(int height)

Deprecated.

Creates a new Presentation instance.

The output frame will have the given height. Width will scale to preserve the input aspect ratio. For example, a 1920x1440 video can be scaled to 640x480 by passing a height of 480.

Parameters:height - The height of the output frame, in pixels.

- 

createForWidthAndHeight

public static[Presentation](Presentation.html "class in com.google.android.exoplayer2.effect")createForWidthAndHeight​(int width,
                                                   int height,
                                                   @com.google.android.exoplayer2.effect.Presentation.Layout int layout)

Deprecated.

Creates a new Presentation instance.

The output frame will have the given width and height, given a Presentation.Layout.

Width and height must be positive integers representing the output frame's width and height.

Parameters:width - The width of the output frame, in pixels.height - The height of the output frame, in pixels.layout - The layout of the output frame.

- 

configure

public[Size](../util/Size.html "class in com.google.android.exoplayer2.util")configure​(int inputWidth,
                      int inputHeight)

Deprecated.

Description copied from interface: GlMatrixTransformation

Configures the input and output dimensions.

Must be called before GlMatrixTransformation.getGlMatrixArray(long).

Specified by:configure in interface GlMatrixTransformationParameters:inputWidth - The input frame width, in pixels.inputHeight - The input frame height, in pixels.Returns:The output frame width and height, in pixels.

- 

getMatrix

public[Matrix](https://developer.android.com/reference/android/graphics/Matrix.html "class or interface in android.graphics")getMatrix​(long presentationTimeUs)

Deprecated.

Description copied from interface: MatrixTransformation

Returns the 3x3 transformation Matrix to apply to the frame with the given timestamp. Specified by:getMatrix in interface MatrixTransformation

- 

isNoOp

public boolean isNoOp​(int inputWidth,
                      int inputHeight)

Deprecated.

Description copied from interface: GlEffect

Returns whether a GlEffect applies no change at every timestamp.

This can be used as a hint to skip this instance.

Specified by:isNoOp in interface GlEffectParameters:inputWidth - The input frame width, in pixels.inputHeight - The input frame height, in pixels.