Merge "Add video stabilization control to Camera parameters." into ics-mr0
This commit is contained in:
committed by
Android (Google) Code Review
commit
0a27359280
@ -1464,6 +1464,8 @@ public class Camera {
|
|||||||
private static final String KEY_MAX_NUM_DETECTED_FACES_SW = "max-num-detected-faces-sw";
|
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_RECORDING_HINT = "recording-hint";
|
||||||
private static final String KEY_VIDEO_SNAPSHOT_SUPPORTED = "video-snapshot-supported";
|
private static final String KEY_VIDEO_SNAPSHOT_SUPPORTED = "video-snapshot-supported";
|
||||||
|
private static final String KEY_VIDEO_STABILIZATION = "video-stabilization";
|
||||||
|
private static final String KEY_VIDEO_STABILIZATION_SUPPORTED = "video-stabilization-supported";
|
||||||
|
|
||||||
// Parameter key suffix for supported values.
|
// Parameter key suffix for supported values.
|
||||||
private static final String SUPPORTED_VALUES_SUFFIX = "-values";
|
private static final String SUPPORTED_VALUES_SUFFIX = "-values";
|
||||||
@ -2443,7 +2445,7 @@ public class Camera {
|
|||||||
*
|
*
|
||||||
* @param value new white balance.
|
* @param value new white balance.
|
||||||
* @see #getWhiteBalance()
|
* @see #getWhiteBalance()
|
||||||
* @see #setAutoWhiteBalanceLock()
|
* @see #setAutoWhiteBalanceLock(boolean)
|
||||||
*/
|
*/
|
||||||
public void setWhiteBalance(String value) {
|
public void setWhiteBalance(String value) {
|
||||||
set(KEY_WHITE_BALANCE, value);
|
set(KEY_WHITE_BALANCE, value);
|
||||||
@ -3208,6 +3210,59 @@ public class Camera {
|
|||||||
return TRUE.equals(str);
|
return TRUE.equals(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>Enables and disables video stabilization. Use
|
||||||
|
* {@link #isVideoStabilizationSupported} to determine if calling this
|
||||||
|
* method is valid.</p>
|
||||||
|
*
|
||||||
|
* <p>Video stabilization reduces the shaking due to the motion of the
|
||||||
|
* camera in both the preview stream and in recorded videos, including
|
||||||
|
* data received from the preview callback. It does not reduce motion
|
||||||
|
* blur in images captured with
|
||||||
|
* {@link Camera#takePicture takePicture}.</p>
|
||||||
|
*
|
||||||
|
* <p>Video stabilization can be enabled and disabled while preview or
|
||||||
|
* recording is active, but toggling it may cause a jump in the video
|
||||||
|
* stream that may be undesirable in a recorded video.</p>
|
||||||
|
*
|
||||||
|
* @param toggle Set to true to enable video stabilization, and false to
|
||||||
|
* disable video stabilization.
|
||||||
|
* @see #isVideoStabilizationSupported()
|
||||||
|
* @see #getVideoStabilization()
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public void setVideoStabilization(boolean toggle) {
|
||||||
|
set(KEY_VIDEO_STABILIZATION, toggle ? TRUE : FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current state of video stabilization. See
|
||||||
|
* {@link #setVideoStabilization} for details of video stabilization.
|
||||||
|
*
|
||||||
|
* @return true if video stabilization is enabled
|
||||||
|
* @see #isVideoStabilizationSupported()
|
||||||
|
* @see #setVideoStabilization(boolean)
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public boolean getVideoStabilization() {
|
||||||
|
String str = get(KEY_VIDEO_STABILIZATION);
|
||||||
|
return TRUE.equals(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if video stabilization is supported. See
|
||||||
|
* {@link #setVideoStabilization} for details of video stabilization.
|
||||||
|
*
|
||||||
|
* @return true if video stabilization is supported
|
||||||
|
* @see #setVideoStabilization(boolean)
|
||||||
|
* @see #getVideoStabilization()
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public boolean isVideoStabilizationSupported() {
|
||||||
|
String str = get(KEY_VIDEO_STABILIZATION_SUPPORTED);
|
||||||
|
return TRUE.equals(str);
|
||||||
|
}
|
||||||
|
|
||||||
// Splits a comma delimited string to an ArrayList of String.
|
// Splits a comma delimited string to an ArrayList of String.
|
||||||
// Return null if the passing string is null or the size is 0.
|
// Return null if the passing string is null or the size is 0.
|
||||||
private ArrayList<String> split(String str) {
|
private ArrayList<String> split(String str) {
|
||||||
|
@ -504,6 +504,25 @@ public:
|
|||||||
// Example value: "true" or "false". Read only.
|
// Example value: "true" or "false". Read only.
|
||||||
static const char KEY_VIDEO_SNAPSHOT_SUPPORTED[];
|
static const char KEY_VIDEO_SNAPSHOT_SUPPORTED[];
|
||||||
|
|
||||||
|
// The state of the video stabilization. If set to true, both the
|
||||||
|
// preview stream and the recorded video stream are stabilized by
|
||||||
|
// the camera. Only valid to set if KEY_VIDEO_STABILIZATION_SUPPORTED is
|
||||||
|
// set to true.
|
||||||
|
//
|
||||||
|
// The value of this key can be changed any time the camera is
|
||||||
|
// open. If preview or recording is active, it is acceptable for
|
||||||
|
// there to be a slight video glitch when video stabilization is
|
||||||
|
// toggled on and off.
|
||||||
|
//
|
||||||
|
// This only stabilizes video streams (between-frames stabilization), and
|
||||||
|
// has no effect on still image capture.
|
||||||
|
static const char KEY_VIDEO_STABILIZATION[];
|
||||||
|
|
||||||
|
// Returns true if video stabilization is supported. That is, applications
|
||||||
|
// can set KEY_VIDEO_STABILIZATION to true and have a stabilized preview
|
||||||
|
// stream and record stabilized videos.
|
||||||
|
static const char KEY_VIDEO_STABILIZATION_SUPPORTED[];
|
||||||
|
|
||||||
// Value for KEY_ZOOM_SUPPORTED or KEY_SMOOTH_ZOOM_SUPPORTED.
|
// Value for KEY_ZOOM_SUPPORTED or KEY_SMOOTH_ZOOM_SUPPORTED.
|
||||||
static const char TRUE[];
|
static const char TRUE[];
|
||||||
static const char FALSE[];
|
static const char FALSE[];
|
||||||
|
@ -88,6 +88,8 @@ const char CameraParameters::KEY_MAX_NUM_DETECTED_FACES_HW[] = "max-num-detected
|
|||||||
const char CameraParameters::KEY_MAX_NUM_DETECTED_FACES_SW[] = "max-num-detected-faces-sw";
|
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_RECORDING_HINT[] = "recording-hint";
|
||||||
const char CameraParameters::KEY_VIDEO_SNAPSHOT_SUPPORTED[] = "video-snapshot-supported";
|
const char CameraParameters::KEY_VIDEO_SNAPSHOT_SUPPORTED[] = "video-snapshot-supported";
|
||||||
|
const char CameraParameters::KEY_VIDEO_STABILIZATION[] = "video-stabilization";
|
||||||
|
const char CameraParameters::KEY_VIDEO_STABILIZATION_SUPPORTED[] = "video-stabilization-supported";
|
||||||
|
|
||||||
const char CameraParameters::TRUE[] = "true";
|
const char CameraParameters::TRUE[] = "true";
|
||||||
const char CameraParameters::FALSE[] = "false";
|
const char CameraParameters::FALSE[] = "false";
|
||||||
|
Reference in New Issue
Block a user