Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,6 @@ private void setDefaultCaptureRequest(final CaptureRequest.Builder request,
}
if (hasAutoExposure()) {
request.set(CaptureRequest.CONTROL_AE_MODE, mAutoExposureMode);
if (trigger) {
request.set(CaptureRequest.CONTROL_AE_PRECAPTURE_TRIGGER, CameraMetadata.CONTROL_AE_PRECAPTURE_TRIGGER_START);
}
}
setWhiteBalance(request);
// LightがONの場合は、CONTROL_AE_MODEをCONTROL_AE_MODE_ONにする。
Expand Down Expand Up @@ -459,18 +456,16 @@ public synchronized void stopPreview() throws CameraWrapperException {
close();
}
}

public synchronized void startRecording(final Surface recordingSurface,
final boolean isResume) throws CameraWrapperException {
if (mIsRecording && !isResume) {
throw new CameraWrapperException("recording is started already.");
}
mIsRecording = true;
mRecordingSurface = recordingSurface;
if (mCameraDevice != null) {
close();
}

try {

CameraDevice cameraDevice = openCamera();
CameraCaptureSession captureSession = createCaptureSession(cameraDevice);
CaptureRequest.Builder request = cameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_RECORD);
Expand Down Expand Up @@ -541,6 +536,7 @@ public synchronized void takeStillImage(final Surface stillImageSurface) throws
CaptureRequest.Builder request = cameraDevice.createCaptureRequest(template);
request.addTarget(stillImageSurface);
setDefaultCaptureRequest(request);
request.set(CaptureRequest.CONTROL_AF_TRIGGER, CameraMetadata.CONTROL_AF_TRIGGER_CANCEL);
mCaptureSession.capture(request.build(), new CameraCaptureSession.CaptureCallback() {
@Override
public void onCaptureStarted(@NonNull CameraCaptureSession session, @NonNull CaptureRequest request, long timestamp, long frameNumber) {
Expand Down Expand Up @@ -684,10 +680,12 @@ private void onCaptureResult(final CaptureResult result, final boolean isComplet
}
if (!mIsAeReady) {
Integer aeState = result.get(CaptureResult.CONTROL_AE_STATE);
if (DEBUG) {
Log.d(TAG, "prepareCapture: onCaptureCompleted: aeState=" + aeState);
}
mIsAeReady = aeState == null
|| aeState == CaptureResult.CONTROL_AE_STATE_CONVERGED
|| aeState == CaptureRequest.CONTROL_AE_STATE_FLASH_REQUIRED
|| aeState == CaptureRequest.CONTROL_AE_STATE_PRECAPTURE;
|| aeState == CaptureRequest.CONTROL_AE_STATE_FLASH_REQUIRED;
}
mIsCaptureReady |= isCompleted;
if (DEBUG) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.CountDownLatch;


public class Camera2Recorder extends AbstractCamera2Recorder implements HostDevicePhotoRecorder, HostDeviceStreamRecorder {
Expand Down Expand Up @@ -582,10 +583,12 @@ private long registerVideoThumbnail(final File videoFile, final long videoId) {
Log.d(TAG, "Stored thumbnail file: path=" + thumbnailFilePath);
}
ContentValues values = new ContentValues();
values.put(MediaStore.Video.Thumbnails.DATA, thumbnailFilePath);
values.put(MediaStore.Video.Thumbnails.DATA, videoFilePath);
values.put(MediaStore.Video.Thumbnails.WIDTH, thumbnail.getWidth());
values.put(MediaStore.Video.Thumbnails.HEIGHT, thumbnail.getHeight());
values.put(MediaStore.Video.Thumbnails.KIND, kind);
values.put(MediaStore.Video.Media.MIME_TYPE, "image/jpeg");

values.put(MediaStore.Video.Thumbnails.VIDEO_ID, videoId);
ContentResolver resolver = getContext().getApplicationContext().getContentResolver();
Uri uri = resolver.insert(MediaStore.Video.Thumbnails.EXTERNAL_CONTENT_URI, values);
Expand All @@ -606,12 +609,7 @@ private long registerVideoThumbnail(final File videoFile, final long videoId) {
return -1;
}
return Long.parseLong(id);
} catch (IOException e) {
if (DEBUG) {
Log.e(TAG, "Failed to store video thumbnail by FileManager: videoFilePath=" + videoFilePath, e);
}
return -1;
} catch (NumberFormatException e) {
} catch (IOException | NumberFormatException e) {
if (DEBUG) {
Log.e(TAG, "Failed to parse thumbnail ID as long type: videoFilePath=" + videoFilePath);
}
Expand Down