Class BaseGlShaderProgram
- java.lang.Object
-
- com.google.android.exoplayer2.effect.BaseGlShaderProgram
-
- All Implemented Interfaces:
GlShaderProgram
- Direct Known Subclasses:
SingleFrameGlShaderProgram
@Deprecated public abstract class BaseGlShaderProgram extends Object implements GlShaderProgram
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 ofGlShaderProgram.BaseGlShaderProgrammanages an output texture pool, whose size is configurable on construction. An implementation should manage a GLSL shader program for processing frames. OverridedrawFrame(int, long)to customize drawing. Implementations generally copy input pixels into an output frame, with changes to pixels specific to the implementation.BaseShaderProgramimplementations can produce any number of output frames per input frame with the same presentation timestamp.SingleFrameGlShaderProgramcan be used to implement aGlShaderProgramthat 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.InputListenerinputListenerDeprecated.
-
Constructor Summary
Constructors Constructor Description BaseGlShaderProgram(boolean useHdr, int texturePoolCapacity)Deprecated.Creates aBaseGlShaderPrograminstance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description abstract Sizeconfigure(int inputWidth, int inputHeight)Deprecated.Configures the instance based on the input dimensions.abstract voiddrawFrame(int inputTexId, long presentationTimeUs)Deprecated.Draws one frame.voidflush()Deprecated.Flushes theGlShaderProgram.voidqueueInputFrame(GlTextureInfo inputTexture, long presentationTimeUs)Deprecated.Processes an input frame if possible.voidrelease()Deprecated.Releases all resources.voidreleaseOutputFrame(GlTextureInfo outputTexture)Deprecated.Notifies theGlShaderProgramthat the frame on the given output texture is no longer used and can be overwritten.voidsetErrorListener(Executor errorListenerExecutor, GlShaderProgram.ErrorListener errorListener)Deprecated.Sets theGlShaderProgram.ErrorListener.voidsetGlObjectsProvider(GlObjectsProvider glObjectsProvider)Deprecated.Sets theGlObjectsProvider.voidsetInputListener(GlShaderProgram.InputListener inputListener)Deprecated.Sets theGlShaderProgram.InputListener.voidsetOutputListener(GlShaderProgram.OutputListener outputListener)Deprecated.Sets theGlShaderProgram.OutputListener.voidsignalEndOfCurrentInputStream()Deprecated.Notifies theGlShaderProgramthat no further input frames belonging to the current input stream will be queued.
-
-
-
Field Detail
-
inputListener
protected GlShaderProgram.InputListener inputListener
Deprecated.
-
-
Constructor Detail
-
BaseGlShaderProgram
public BaseGlShaderProgram(boolean useHdr, int texturePoolCapacity)Deprecated.Creates aBaseGlShaderPrograminstance.- Parameters:
useHdr- Whether input textures come from an HDR source. Iftrue, colors will be in linear RGB BT.2020. Iffalse, 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 configure(int inputWidth, int inputHeight) throws VideoFrameProcessingException
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 VideoFrameProcessingExceptionDeprecated.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 inputListener)
Deprecated.Description copied from interface:GlShaderProgramSets theGlShaderProgram.InputListener.The
GlShaderProgram.InputListenershould be invoked on the thread that owns the parent OpenGL context. For example,DefaultVideoFrameProcessorinvokes theGlShaderProgram.InputListenermethods on its internal thread.- Specified by:
setInputListenerin interfaceGlShaderProgram
-
setOutputListener
public void setOutputListener(GlShaderProgram.OutputListener outputListener)
Deprecated.Description copied from interface:GlShaderProgramSets theGlShaderProgram.OutputListener.The
GlShaderProgram.OutputListenershould be invoked on the thread that owns the parent OpenGL context. For example,DefaultVideoFrameProcessorinvokes theGlShaderProgram.OutputListenermethods on its internal thread.- Specified by:
setOutputListenerin interfaceGlShaderProgram
-
setErrorListener
public void setErrorListener(Executor errorListenerExecutor, GlShaderProgram.ErrorListener errorListener)
Deprecated.Description copied from interface:GlShaderProgramSets theGlShaderProgram.ErrorListener.The
GlShaderProgram.ErrorListeneris invoked on the providedExecutor.- Specified by:
setErrorListenerin interfaceGlShaderProgram
-
setGlObjectsProvider
public void setGlObjectsProvider(GlObjectsProvider glObjectsProvider)
Deprecated.Description copied from interface:GlShaderProgramSets theGlObjectsProvider.This method should not be called after any of the frame processing methods.
- Specified by:
setGlObjectsProviderin interfaceGlShaderProgram
-
queueInputFrame
public void queueInputFrame(GlTextureInfo inputTexture, long presentationTimeUs)
Deprecated.Description copied from interface:GlShaderProgramProcesses an input frame if possible.The
GlShaderProgramowns the accepted frame until it callsGlShaderProgram.InputListener.onInputFrameProcessed(GlTextureInfo). The caller should not overwrite or release the texture before theGlShaderProgramhas finished processing it.This method must only be called when the
GlShaderProgramcan accept an input frame.- Specified by:
queueInputFramein interfaceGlShaderProgram- Parameters:
inputTexture- AGlTextureInfodescribing the texture containing the input frame.presentationTimeUs- The presentation timestamp of the input frame, in microseconds.
-
releaseOutputFrame
public void releaseOutputFrame(GlTextureInfo outputTexture)
Deprecated.Description copied from interface:GlShaderProgramNotifies theGlShaderProgramthat the frame on the given output texture is no longer used and can be overwritten.- Specified by:
releaseOutputFramein interfaceGlShaderProgram
-
signalEndOfCurrentInputStream
public void signalEndOfCurrentInputStream()
Deprecated.Description copied from interface:GlShaderProgramNotifies theGlShaderProgramthat 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:
signalEndOfCurrentInputStreamin interfaceGlShaderProgram
-
flush
@CallSuper public void flush()
Deprecated.Description copied from interface:GlShaderProgramFlushes theGlShaderProgram.The
GlShaderProgramshould reclaim the ownership of its allocated textures, notify itsGlShaderProgram.InputListenerabout the flush event, and report its availability if necessary.- Specified by:
flushin interfaceGlShaderProgram
-
release
@CallSuper public void release() throws VideoFrameProcessingExceptionDeprecated.Description copied from interface:GlShaderProgramReleases all resources.- Specified by:
releasein interfaceGlShaderProgram- Throws:
VideoFrameProcessingException- If an error occurs while releasing resources.
-
-