-
@RequiresApi(value = Build.VERSION_CODES.LOLLIPOP) public class Snapshot2PictureRecorder extends SnapshotGlPictureRecorder
Wraps SnapshotGlPictureRecorder for Camera2. Camera2 engine supports metering for snapshots and we expect for them to correctly fire flash as well. The first idea, and in theory, the most correct one, was to set CONTROL_CAPTURE_INTENT to CONTROL_CAPTURE_INTENT_STILL_CAPTURE. According to documentation, this will automatically trigger the flash if parameters says so. In fact this is what happens, but it is a very fast flash that only lasts for 1 or 2 frames. It's not easy to call super.take() at the exact time so that we capture the frame that was lit. I have tried by comparing getTimestamp and SENSOR_TIMESTAMP to identify the correct frame. These timestamps match, but the frame is not the correct one. So what we do here is ignore the CONTROL_CAPTURE_INTENT and instead open the torch, if requested to do so. Then wait for exposure to settle again and finally take a snapshot. I'd still love to use the capture intent instead of this, but was not able yet.
-
-
Constructor Summary
Constructors Constructor Description Snapshot2PictureRecorder(PictureResult.Stub stub, Camera2Engine engine, RendererCameraPreview preview, AspectRatio outputRatio)
-
Method Summary
Modifier and Type Method Description voidtake()Takes a picture. -
-
Constructor Detail
-
Snapshot2PictureRecorder
Snapshot2PictureRecorder(PictureResult.Stub stub, Camera2Engine engine, RendererCameraPreview preview, AspectRatio outputRatio)
-
-
Method Detail
-
take
void take()
Takes a picture.
-
-
-
-