Interface GlTextureProcessor
-
- All Known Implementing Classes:
SingleFrameGlTextureProcessor
public interface GlTextureProcessor
Processes frames from one OpenGL 2D texture to another.The
GlTextureProcessor
consumes input frames it accepts viaqueueInputFrame(TextureInfo, long)
and surrenders each texture back to the caller via its listener once the texture's contents have been processed.The
GlTextureProcessor
produces output frames asynchronously and notifies its owner when they are available via its listener. TheGlTextureProcessor
instance's owner must surrender the texture back to theGlTextureProcessor
viareleaseOutputFrame(TextureInfo)
when it has finished processing it.GlTextureProcessor
implementations can choose to produce output frames before receiving input frames or process several input frames before producing an output frame. However,GlTextureProcessor
implementations cannot assume that they will receive more than one input frame at a time, so they must process each input frame they accept even if they cannot produce output yet.The methods in this interface must be called on the thread that owns the parent OpenGL context. If the implementation uses another OpenGL context, e.g., on another thread, it must configure it to share data with the context of thread the interface methods are called on.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
GlTextureProcessor.ErrorListener
Listener for frame processing errors.static interface
GlTextureProcessor.InputListener
Listener for input-related frame processing events.static interface
GlTextureProcessor.OutputListener
Listener for output-related frame processing events.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
queueInputFrame(TextureInfo inputTexture, long presentationTimeUs)
Processes an input frame if possible.void
release()
Releases all resources.void
releaseOutputFrame(TextureInfo outputTexture)
Notifies the texture processor that the frame on the given output texture is no longer used and can be overwritten.void
setErrorListener(GlTextureProcessor.ErrorListener errorListener)
Sets theGlTextureProcessor.ErrorListener
.void
setInputListener(GlTextureProcessor.InputListener inputListener)
Sets theGlTextureProcessor.InputListener
.void
setOutputListener(GlTextureProcessor.OutputListener outputListener)
Sets theGlTextureProcessor.OutputListener
.void
signalEndOfCurrentInputStream()
Notifies theGlTextureProcessor
that no further input frames belonging to the current input stream will be queued.
-
-
-
Method Detail
-
setInputListener
void setInputListener(GlTextureProcessor.InputListener inputListener)
Sets theGlTextureProcessor.InputListener
.
-
setOutputListener
void setOutputListener(GlTextureProcessor.OutputListener outputListener)
Sets theGlTextureProcessor.OutputListener
.
-
setErrorListener
void setErrorListener(GlTextureProcessor.ErrorListener errorListener)
Sets theGlTextureProcessor.ErrorListener
.
-
queueInputFrame
void queueInputFrame(TextureInfo inputTexture, long presentationTimeUs)
Processes an input frame if possible.The
GlTextureProcessor
owns the accepted frame until it callsGlTextureProcessor.InputListener.onInputFrameProcessed(TextureInfo)
. The caller should not overwrite or release the texture before theGlTextureProcessor
has finished processing it.This method must only be called when the
GlTextureProcessor
can accept an input frame.- Parameters:
inputTexture
- ATextureInfo
describing the texture containing the input frame.presentationTimeUs
- The presentation timestamp of the input frame, in microseconds.
-
releaseOutputFrame
void releaseOutputFrame(TextureInfo outputTexture)
Notifies the texture processor that the frame on the given output texture is no longer used and can be overwritten.
-
signalEndOfCurrentInputStream
void signalEndOfCurrentInputStream()
Notifies theGlTextureProcessor
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, so presentation timestamps may reset to start from a smaller presentation timestamp than the last frame of the previous input stream.
-
release
void release() throws FrameProcessingException
Releases all resources.- Throws:
FrameProcessingException
- If an error occurs while releasing resources.
-
-