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 void
display
(MediaPlayer mediaPlayer, ByteBuffer[] nativeBuffers, BufferFormat bufferFormat, int displayWidth, int displayHeight) Call-back when ready to display a video frame.final void
lock
(MediaPlayer mediaPlayer) Lock the video buffer prior to receiving a new frame.final void
setBuffer
(int[] buffer) Set the buffer to use for the video frame data.final void
unlock
(MediaPlayer mediaPlayer) Unlock the video buffer after receiving a frame.
-
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
-
lock
Description copied from interface:RenderCallback
Lock the video buffer prior to receiving a new frame.Implementations of this method must execute as quickly as possible.
- Specified by:
lock
in interfaceRenderCallback
- Parameters:
mediaPlayer
- media player to which the event relates
-
display
public final void display(MediaPlayer mediaPlayer, ByteBuffer[] nativeBuffers, BufferFormat bufferFormat, int displayWidth, int displayHeight) Description copied from interface:RenderCallback
Call-back when ready to display a video frame.Implementations of this method must execute as quickly as possible.
- Specified by:
display
in interfaceRenderCallback
- Parameters:
mediaPlayer
- media player to which the event relatesnativeBuffers
- video data for one framebufferFormat
- information about the format of the buffer useddisplayWidth
- pixel width of the video, may be different from buffer widthdisplayHeight
- pixel height of the video, may be different from buffer height
-
unlock
Description copied from interface:RenderCallback
Unlock the video buffer after receiving a frame.Implementations of this method must execute as quickly as possible.
- Specified by:
unlock
in interfaceRenderCallback
- Parameters:
mediaPlayer
- media player to which the event relates
-