Back to Exoplayer

BaseGlShaderProgram (ExoPlayer library)

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

latest13.9 KB
Original Source

Package com.google.android.exoplayer2.effect

Class BaseGlShaderProgram

  • java.lang.Object

    • com.google.android.exoplayer2.effect.BaseGlShaderProgram
  • All Implemented Interfaces:GlShaderProgramDirect Known Subclasses:SingleFrameGlShaderProgram


[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public abstract classBaseGlShaderProgramextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")implements[GlShaderProgram](GlShaderProgram.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.

A base implementation of GlShaderProgram.

BaseGlShaderProgram manages an output texture pool, whose size is configurable on construction. An implementation should manage a GLSL shader program for processing frames. Override drawFrame(int, long) to customize drawing. Implementations generally copy input pixels into an output frame, with changes to pixels specific to the implementation.

BaseShaderProgram implementations can produce any number of output frames per input frame with the same presentation timestamp. SingleFrameGlShaderProgram can be used to implement a GlShaderProgram that produces exactly one output frame per input frame.

All methods in this class must be called on the thread that owns the OpenGL context.

Nested Class Summary

- 

Nested classes/interfaces inherited from interface com.google.android.exoplayer2.effect.GlShaderProgram

GlShaderProgram.ErrorListener, GlShaderProgram.InputListener, GlShaderProgram.OutputListener

Field Summary

Fields | Modifier and Type | Field | Description | | --- | --- | --- | | protected GlShaderProgram.InputListener | inputListener | Deprecated. |

Constructor Summary

Constructors | Constructor | Description | | --- | --- | | BaseGlShaderProgram​(boolean useHdr, int texturePoolCapacity) | Deprecated.

Creates a BaseGlShaderProgram instance. |

Method Summary

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

Configures the instance based on the input dimensions. | | abstract void | drawFrame​(int inputTexId, long presentationTimeUs) | Deprecated.

Draws one frame. | | void | flush() | Deprecated.

Flushes the GlShaderProgram. | | void | queueInputFrame​(GlTextureInfo inputTexture, long presentationTimeUs) | Deprecated.

Processes an input frame if possible. | | void | release() | Deprecated.

Releases all resources. | | void | releaseOutputFrame​(GlTextureInfo outputTexture) | Deprecated.

Notifies the GlShaderProgram that the frame on the given output texture is no longer used and can be overwritten. | | void | setErrorListener​(Executor errorListenerExecutor, GlShaderProgram.ErrorListener errorListener) | Deprecated.

Sets the GlShaderProgram.ErrorListener. | | void | setGlObjectsProvider​(GlObjectsProvider glObjectsProvider) | Deprecated.

Sets the GlObjectsProvider. | | void | setInputListener​(GlShaderProgram.InputListener inputListener) | Deprecated.

Sets the GlShaderProgram.InputListener. | | void | setOutputListener​(GlShaderProgram.OutputListener outputListener) | Deprecated.

Sets the GlShaderProgram.OutputListener. | | void | signalEndOfCurrentInputStream() | Deprecated.

Notifies the GlShaderProgram that no further input frames belonging to the current input stream will be queued. |

- 

Methods inherited from class java.lang.Object

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

Field Detail

- 

inputListener

protected[GlShaderProgram.InputListener](GlShaderProgram.InputListener.html "interface in com.google.android.exoplayer2.effect")inputListener

Deprecated.

Constructor Detail

- 

BaseGlShaderProgram

public BaseGlShaderProgram​(boolean useHdr,
                           int texturePoolCapacity)

Deprecated.

Creates a BaseGlShaderProgram instance. Parameters:useHdr - Whether input textures come from an HDR source. If true, colors will be in linear RGB BT.2020. If false, colors will be in linear RGB BT.709.texturePoolCapacity - The capacity of the texture pool. For example, if implementing a texture cache, the size should be the number of textures to cache.

Method Detail

- 

configure

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

Deprecated.

Configures the instance based on the input dimensions.

This method must be called before drawing the first frame and before drawing subsequent frames with different input dimensions.

Parameters:inputWidth - The input width, in pixels.inputHeight - The input height, in pixels.Returns:The output width and height of frames processed through drawFrame(int, long).Throws:VideoFrameProcessingException - If an error occurs while configuring.

- 

drawFrame

public abstract void drawFrame​(int inputTexId,
                               long presentationTimeUs)
                        throws[VideoFrameProcessingException](../util/VideoFrameProcessingException.html "class in com.google.android.exoplayer2.util")

Deprecated.

Draws one frame.

This method may only be called after the shader program has been configured. The caller is responsible for focussing the correct render target before calling this method.

A minimal implementation should tell OpenGL to use its shader program, bind the shader program's vertex attributes and uniforms, and issue a drawing command.

Parameters:inputTexId - Identifier of a 2D OpenGL texture containing the input frame.presentationTimeUs - The presentation timestamp of the current frame, in microseconds.Throws:VideoFrameProcessingException - If an error occurs while processing or drawing the frame.

- 

setInputListener

public void setInputListener​([GlShaderProgram.InputListener](GlShaderProgram.InputListener.html "interface in com.google.android.exoplayer2.effect")inputListener)

Deprecated.

Description copied from interface: GlShaderProgram

Sets the GlShaderProgram.InputListener.

The GlShaderProgram.InputListener should be invoked on the thread that owns the parent OpenGL context. For example, DefaultVideoFrameProcessor invokes the GlShaderProgram.InputListener methods on its internal thread.

Specified by:setInputListener in interface GlShaderProgram

- 

setOutputListener

public void setOutputListener​([GlShaderProgram.OutputListener](GlShaderProgram.OutputListener.html "interface in com.google.android.exoplayer2.effect")outputListener)

Deprecated.

Description copied from interface: GlShaderProgram

Sets the GlShaderProgram.OutputListener.

The GlShaderProgram.OutputListener should be invoked on the thread that owns the parent OpenGL context. For example, DefaultVideoFrameProcessor invokes the GlShaderProgram.OutputListener methods on its internal thread.

Specified by:setOutputListener in interface GlShaderProgram

- 

setErrorListener

public void setErrorListener​([Executor](https://developer.android.com/reference/java/util/concurrent/Executor.html "class or interface in java.util.concurrent")errorListenerExecutor,[GlShaderProgram.ErrorListener](GlShaderProgram.ErrorListener.html "interface in com.google.android.exoplayer2.effect")errorListener)

Deprecated.

Description copied from interface: GlShaderProgram

Sets the GlShaderProgram.ErrorListener.

The GlShaderProgram.ErrorListener is invoked on the provided Executor.

Specified by:setErrorListener in interface GlShaderProgram

- 

setGlObjectsProvider

public void setGlObjectsProvider​([GlObjectsProvider](../util/GlObjectsProvider.html "interface in com.google.android.exoplayer2.util")glObjectsProvider)

Deprecated.

Description copied from interface: GlShaderProgram

Sets the GlObjectsProvider.

This method should not be called after any of the frame processing methods.

Specified by:setGlObjectsProvider in interface GlShaderProgram

- 

queueInputFrame

public void queueInputFrame​([GlTextureInfo](../util/GlTextureInfo.html "class in com.google.android.exoplayer2.util")inputTexture,
                            long presentationTimeUs)

Deprecated.

Description copied from interface: GlShaderProgram

Processes an input frame if possible.

The GlShaderProgram owns the accepted frame until it calls GlShaderProgram.InputListener.onInputFrameProcessed(GlTextureInfo). The caller should not overwrite or release the texture before the GlShaderProgram has finished processing it.

This method must only be called when the GlShaderProgram can accept an input frame.

Specified by:queueInputFrame in interface GlShaderProgramParameters:inputTexture - A GlTextureInfo describing the texture containing the input frame.presentationTimeUs - The presentation timestamp of the input frame, in microseconds.

- 

releaseOutputFrame

public void releaseOutputFrame​([GlTextureInfo](../util/GlTextureInfo.html "class in com.google.android.exoplayer2.util")outputTexture)

Deprecated.

Description copied from interface: GlShaderProgram

Notifies the GlShaderProgram that the frame on the given output texture is no longer used and can be overwritten. Specified by:releaseOutputFrame in interface GlShaderProgram

- 

signalEndOfCurrentInputStream

public void signalEndOfCurrentInputStream()

Deprecated.

Description copied from interface: GlShaderProgram

Notifies the GlShaderProgram that no further input frames belonging to the current input stream will be queued.

Input frames that are queued after this method is called belong to a different input stream.

Specified by:signalEndOfCurrentInputStream in interface GlShaderProgram

- 

flush

@CallSuper
public void flush()

Deprecated.

Description copied from interface: GlShaderProgram

Flushes the GlShaderProgram.

The GlShaderProgram should reclaim the ownership of its allocated textures, notify its GlShaderProgram.InputListener about the flush event, and report its availability if necessary.

Specified by:flush in interface GlShaderProgram

- 

release

@CallSuper
public void release()
             throws[VideoFrameProcessingException](../util/VideoFrameProcessingException.html "class in com.google.android.exoplayer2.util")

Deprecated.

Description copied from interface: GlShaderProgram

Releases all resources. Specified by:release in interface GlShaderProgramThrows:VideoFrameProcessingException - If an error occurs while releasing resources.