diff options
-rw-r--r-- | core/java/android/hardware/Camera.java | 30 | ||||
-rw-r--r-- | include/camera/CameraParameters.h | 19 | ||||
-rw-r--r-- | libs/camera/CameraParameters.cpp | 1 | ||||
-rw-r--r-- | services/camera/libcameraservice/CameraService.cpp | 5 |
4 files changed, 50 insertions, 5 deletions
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java index bc45945..63f2244 100644 --- a/core/java/android/hardware/Camera.java +++ b/core/java/android/hardware/Camera.java @@ -1468,6 +1468,7 @@ public class Camera { private static final String KEY_MAX_NUM_DETECTED_FACES_HW = "max-num-detected-faces-hw"; private static final String KEY_MAX_NUM_DETECTED_FACES_SW = "max-num-detected-faces-sw"; private static final String KEY_RECORDING_HINT = "recording-hint"; + private static final String KEY_VIDEO_SNAPSHOT_SUPPORTED = "video-snapshot-supported"; // Parameter key suffix for supported values. private static final String SUPPORTED_VALUES_SUFFIX = "-values"; @@ -3210,6 +3211,35 @@ public class Camera { set(KEY_RECORDING_HINT, hint ? TRUE : FALSE); } + /** + * Returns true if video snapshot is supported. That is, applications + * can call {@link #takePicture(Camera.ShutterCallback, + * Camera.PictureCallback, Camera.PictureCallback, Camera.PictureCallback)} + * during recording. Applications do not need to call {@link + * #startPreview()} after taking a picture. The preview will be still + * active. Other than that, taking a picture during recording is + * identical to taking a picture normally. All settings and methods + * related to takePicture work identically. Ex: {@link + * #getPictureSize()}, {@link #getSupportedPictureSizes()}, {@link + * #setJpegQuality(int)}, {@link #setRotation(int)}, and etc. The + * picture will have an EXIF header. {@link #FLASH_MODE_AUTO} and {@link + * #FLASH_MODE_ON} also still work, but the video will record the flash. + * + * Applications can set shutter callback as null to avoid the shutter + * sound. It is also recommended to set raw picture and post view + * callbacks to null to avoid the interrupt of preview display. + * + * Field-of-view of the recorded video may be different from that of the + * captured pictures. + * + * @return true if video snapshot is supported. + * @hide + */ + public boolean isVideoSnapshotSupported() { + String str = get(KEY_VIDEO_SNAPSHOT_SUPPORTED); + return TRUE.equals(str); + } + // Splits a comma delimited string to an ArrayList of String. // Return null if the passing string is null or the size is 0. private ArrayList<String> split(String str) { diff --git a/include/camera/CameraParameters.h b/include/camera/CameraParameters.h index 6c91dfc..4a4bcfb 100644 --- a/include/camera/CameraParameters.h +++ b/include/camera/CameraParameters.h @@ -495,6 +495,25 @@ public: // Example value: "true" or "false". Read/write. static const char KEY_RECORDING_HINT[]; + // Returns true if video snapshot is supported. That is, applications + // can call Camera.takePicture during recording. Applications do not need to + // call Camera.startPreview after taking a picture. The preview will be + // still active. Other than that, taking a picture during recording is + // identical to taking a picture normally. All settings and methods related + // to takePicture work identically. Ex: KEY_PICTURE_SIZE, + // KEY_SUPPORTED_PICTURE_SIZES, KEY_JPEG_QUALITY, KEY_ROTATION, and etc. + // The picture will have an EXIF header. FLASH_MODE_AUTO and FLASH_MODE_ON + // also still work, but the video will record the flash. + // + // Applications can set shutter callback as null to avoid the shutter + // sound. It is also recommended to set raw picture and post view callbacks + // to null to avoid the interrupt of preview display. + // + // Field-of-view of the recorded video may be different from that of the + // captured pictures. + // Example value: "true" or "false". Read only. + static const char KEY_VIDEO_SNAPSHOT_SUPPORTED[]; + // Value for KEY_ZOOM_SUPPORTED or KEY_SMOOTH_ZOOM_SUPPORTED. static const char TRUE[]; static const char FALSE[]; diff --git a/libs/camera/CameraParameters.cpp b/libs/camera/CameraParameters.cpp index 0eb5d50..0dcab6b 100644 --- a/libs/camera/CameraParameters.cpp +++ b/libs/camera/CameraParameters.cpp @@ -87,6 +87,7 @@ const char CameraParameters::KEY_PREFERRED_PREVIEW_SIZE_FOR_VIDEO[] = "preferred const char CameraParameters::KEY_MAX_NUM_DETECTED_FACES_HW[] = "max-num-detected-faces-hw"; const char CameraParameters::KEY_MAX_NUM_DETECTED_FACES_SW[] = "max-num-detected-faces-sw"; const char CameraParameters::KEY_RECORDING_HINT[] = "recording-hint"; +const char CameraParameters::KEY_VIDEO_SNAPSHOT_SUPPORTED[] = "video-snapshot-supported"; const char CameraParameters::TRUE[] = "true"; const char CameraParameters::FALSE[] = "false"; diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp index e193be0..b178fd9 100644 --- a/services/camera/libcameraservice/CameraService.cpp +++ b/services/camera/libcameraservice/CameraService.cpp @@ -769,11 +769,6 @@ status_t CameraService::Client::takePicture(int msgType) { status_t result = checkPidAndHardware(); if (result != NO_ERROR) return result; - if (mHardware->recordingEnabled()) { - LOGE("Cannot take picture during recording."); - return INVALID_OPERATION; - } - if ((msgType & CAMERA_MSG_RAW_IMAGE) && (msgType & CAMERA_MSG_RAW_IMAGE_NOTIFY)) { LOGE("CAMERA_MSG_RAW_IMAGE and CAMERA_MSG_RAW_IMAGE_NOTIFY" |