Usage procedure
// App developer applies processing when acquiring image data
private Camera.PreviewCallback mPreviewCB = new
Camera.PreviewCallback() {
@Override
public void onPreviewFrame(byte data[], Camera camera) {
// Register the buffer to be used
camera.addCallbackBuffer(mPreviewData);
}
};
// Register the buffer to be used
camera.addCallbackBuffer(mPreviewData);
//Register the callback method at the optimal time
camera.setPreviewCallbackWithBuffer(mPreviewCB);
Remarks
You need to reserve the buffer region from the application.
This provides high-speed processing when compared to setPreviewCallback or
setOneShotPreviewCallback by securing and opening the memory.
The application developer needs to describe the buffer management process.
Specifically, the following processes are necessary.
Register the buffer to be used in addCallbackBuffer described later.
Calculate the size of the buffer to be registered as the width x height x byte
per 1pixel. The width and the height should both be higher than their
respective resolutions.
Each time onPreviewFrame is called, you need to re-register the buffer.
If no buffer is registered, the frame is corrupted and is not called by the
callback method.
You can register multiple buffers.
MOVERIO Pro Developer's Guide (Rev.1.4)
Log.d(TAG, "Save preview image");
synchronized (lockObject) {
savePreviewData(data);
}
94