Class RenderCallbackAdapter
- All Implemented Interfaces:
RenderCallback
If you simply want access to the native memory buffer you should consider implementing RenderCallback
directly rather than using this class.
This is probably not the most efficient implementation possible of a render callback, ideally the native video data would be written directly to some other construct (like a texture).
Having said that, the supplied buffer could be a buffer direct from an image raster, in which case it should be quite quick.
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a new render callback.RenderCallbackAdapter(int[] buffer) Create a new render callback. -
Method Summary
Modifier and TypeMethodDescriptionfinal voiddisplay(MediaPlayer mediaPlayer, ByteBuffer[] nativeBuffers, BufferFormat bufferFormat) Call-back when ready to display a video frame.final voidsetBuffer(int[] buffer) Set the buffer to use for the video frame data.
-
Constructor Details
-
RenderCallbackAdapter
public RenderCallbackAdapter(int[] buffer) Create a new render callback.The caller must ensure the supplied data buffer is large enough to hold the video frame data.
- Parameters:
buffer- video data buffer
-
RenderCallbackAdapter
public RenderCallbackAdapter()Create a new render callback.The video frame buffer must subsequently by set via
setBuffer(int[]).
-
-
Method Details
-
setBuffer
public final void setBuffer(int[] buffer) Set the buffer to use for the video frame data.The caller must ensure the supplied data buffer is large enough to hold the video frame data.
- Parameters:
buffer- buffer
-
display
public final void display(MediaPlayer mediaPlayer, ByteBuffer[] nativeBuffers, BufferFormat bufferFormat) Description copied from interface:RenderCallbackCall-back when ready to display a video frame.Implementations of this method must execute as quickly as possible.
- Specified by:
displayin interfaceRenderCallback- Parameters:
mediaPlayer- media player to which the event relatesnativeBuffers- video data for one framebufferFormat- information about the format of the buffer used
-