In my android application, I need to get each frame that is returned by the android.hardware.camera2, make some processing with it's data and only then display it on the surfacetexture. This question is similar to mine, but it didn't help me: Camera preview image data processing with Android L and Camera2 API
I've tried to get the frame from here (as suggested in the answer to the question):
private final ImageReader.OnImageAvailableListener mOnImageAvailableListener
= new ImageReader.OnImageAvailableListener() {
@Override
public void onImageAvailable(ImageReader reader) {
Log.d("Img", "onImageAvailable");
mBackgroundHandler.post(new ImageSaver(reader.acquireNextImage(), mFile));
}
};
This was not useful, as the callback is called only after the user performed capture of image. And I don't need it only on capture, I need to get each frame that is sent to the camerapreview surface. I wonder, maybe the farme can be taken here (from the texture):
public void onSurfaceTextureUpdated(SurfaceTexture texture) {
Log.d("Img", "onSurfaceTextureUpdated");
}
If yes, how?
I'm using this sample from google, as a basis: