- callbackBuffer
- the buffer to add to the queue. The size of the buffer must match the values described above.
Adds a pre-allocated buffer to the preview callback buffer queue. Applications can add one or more buffers to the queue. When a preview frame arrives and there is still at least one available buffer, the buffer will be used and removed from the queue. Then preview callback is invoked with the buffer. If a frame arrives and there is no buffer left, the frame is discarded. Applications should add buffers back when they finish processing the data in them.
For formats besides YV12, the size of the buffer is determined by multiplying the preview image width, height, and bytes per pixel. The width and height can be read from NoType:android/hardware/Camera$Parameters;Href=../../../reference/android/hardware/Camera.Parameters.html#getPreviewSize(). Bytes per pixel can be computed from Android.Graphics.ImageFormat.GetBitsPerPixel(Android.Graphics.ImageFormatType) / 8, using the image format from NoType:android/hardware/Camera$Parameters;Href=../../../reference/android/hardware/Camera.Parameters.html#getPreviewFormat().
If using the Android.Graphics.ImageFormat.Yv12 format, the size can be calculated using the equations listed in NoType:android/hardware/Camera$Parameters;Href=../../../reference/android/hardware/Camera.Parameters.html#setPreviewFormat(int).
This method is only necessary when Camera.SetPreviewCallbackWithBuffer(.IPreviewCallback) is used. When Camera.SetPreviewCallback(.IPreviewCallback) or Camera.SetOneShotPreviewCallback(.IPreviewCallback) are used, buffers are automatically allocated. When a supplied buffer is too small to hold the preview frame data, preview callback will return null and the buffer will be removed from the buffer queue.