Interface for representing video frame.
Check color format by using
getColorFormat()
.
Most used format is ImageFormat.YUV_420_888 which is I420 format that uses planar or semi-planar (but not fully interleaved) memory layout - do not assume continuity and use
use
yuvPlanes()
and
yuvStrides()
APIs to get correct start line of any plane.
NB: do not assume that ByteBuffers of
yuvPlanes()
are backed by Java's byte[] arrays! Most probably frame you receive via this API is natively allocated and NOT backed by Java array.
Use slow but secure
ByteBuffer.put(int, byte)
or better, your own native C++ processing via JNI.