diff options
author | Surajit Podder <spodder@codeaurora.org> | 2015-07-29 11:49:23 +0530 |
---|---|---|
committer | Jaimin Bhise <jbhise@codeaurora.org> | 2015-10-29 13:57:46 -0700 |
commit | eb5b795a959c5e3e9ee7a6c5298766c4f28dcd95 (patch) | |
tree | fc36e8a5255251d59cfe3a5f51c87cf6be43a74d /src/com/android/camera/CameraSettings.java | |
parent | f38142af4d1b3c01a5d7fcea8b9b5b6056fdc7fa (diff) | |
download | android_packages_apps_Snap-eb5b795a959c5e3e9ee7a6c5298766c4f28dcd95.tar.gz android_packages_apps_Snap-eb5b795a959c5e3e9ee7a6c5298766c4f28dcd95.tar.bz2 android_packages_apps_Snap-eb5b795a959c5e3e9ee7a6c5298766c4f28dcd95.zip |
SnapdragonCamera: Add support for high-speed video recording
[1] Use combination of MediaRecorder.setCaptureRate and
setVideoFrameRate API to achieve HFR/HSR
------------------------------------------------------------
CaptureRate videoFrameRate Recorded-video
------------------------------------------------------------
120 30 slow-mo @30fps
120 120 high-speed-video @120fps
------------------------------------------------------------
Deprecate usage of custom fields added to media-profiles for
checking max-capabilities. Instead, introduce high-speed profiles
and advertize correct values (ersolution, fps) to indicate
target capabilities
TODO: check against high-speed profile to check if a given
{resolution, fps} is supported
Add conversion routines in CameraSettings to convert from
normal quality level to time-lapse/high-speed quality.
Also, add back 4KDCI and VGA support
Change-Id: Ic1d5ed8ef52348cab2383abe304056e0401f7069
Diffstat (limited to 'src/com/android/camera/CameraSettings.java')
-rw-r--r-- | src/com/android/camera/CameraSettings.java | 52 |
1 files changed, 48 insertions, 4 deletions
diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java index 99f866991..68069c009 100644 --- a/src/com/android/camera/CameraSettings.java +++ b/src/com/android/camera/CameraSettings.java @@ -276,19 +276,63 @@ public class CameraSettings { VIDEO_ENCODER_TABLE.put(MediaRecorder.VideoEncoder.MPEG_4_SP, "m4v"); //video qualities -// VIDEO_QUALITY_TABLE.put("4096x2160", CamcorderProfile.QUALITY_4kDCI); + VIDEO_QUALITY_TABLE.put("4096x2160", CamcorderProfile.QUALITY_4KDCI); VIDEO_QUALITY_TABLE.put("3840x2160", CamcorderProfile.QUALITY_2160P); VIDEO_QUALITY_TABLE.put("2560x1440", CamcorderProfile.QUALITY_QHD); VIDEO_QUALITY_TABLE.put("2048x1080", CamcorderProfile.QUALITY_2k); VIDEO_QUALITY_TABLE.put("1920x1080", CamcorderProfile.QUALITY_1080P); VIDEO_QUALITY_TABLE.put("1280x720", CamcorderProfile.QUALITY_720P); VIDEO_QUALITY_TABLE.put("720x480", CamcorderProfile.QUALITY_480P); -// VIDEO_QUALITY_TABLE.put("640x480", CamcorderProfile.QUALITY_VGA); + VIDEO_QUALITY_TABLE.put("640x480", CamcorderProfile.QUALITY_VGA); VIDEO_QUALITY_TABLE.put("352x288", CamcorderProfile.QUALITY_CIF); VIDEO_QUALITY_TABLE.put("320x240", CamcorderProfile.QUALITY_QVGA); VIDEO_QUALITY_TABLE.put("176x144", CamcorderProfile.QUALITY_QCIF); } + // Following maps help find a corresponding time-lapse or high-speed quality + // given a normal quality. + // Ideally, one should be able to traverse by offsetting +1000, +2000 respectively, + // But the profile values are messed-up in AOSP + private static final HashMap<Integer, Integer> + VIDEO_QUALITY_TO_TIMELAPSE = new HashMap<Integer, Integer>(); + static { + VIDEO_QUALITY_TO_TIMELAPSE.put(CamcorderProfile.QUALITY_LOW , CamcorderProfile.QUALITY_TIME_LAPSE_LOW ); + VIDEO_QUALITY_TO_TIMELAPSE.put(CamcorderProfile.QUALITY_HIGH , CamcorderProfile.QUALITY_TIME_LAPSE_HIGH ); + VIDEO_QUALITY_TO_TIMELAPSE.put(CamcorderProfile.QUALITY_QCIF , CamcorderProfile.QUALITY_TIME_LAPSE_QCIF ); + VIDEO_QUALITY_TO_TIMELAPSE.put(CamcorderProfile.QUALITY_CIF , CamcorderProfile.QUALITY_TIME_LAPSE_CIF ); + VIDEO_QUALITY_TO_TIMELAPSE.put(CamcorderProfile.QUALITY_480P , CamcorderProfile.QUALITY_TIME_LAPSE_480P ); + VIDEO_QUALITY_TO_TIMELAPSE.put(CamcorderProfile.QUALITY_720P , CamcorderProfile.QUALITY_TIME_LAPSE_720P ); + VIDEO_QUALITY_TO_TIMELAPSE.put(CamcorderProfile.QUALITY_1080P, CamcorderProfile.QUALITY_TIME_LAPSE_1080P); + VIDEO_QUALITY_TO_TIMELAPSE.put(CamcorderProfile.QUALITY_QVGA , CamcorderProfile.QUALITY_TIME_LAPSE_QVGA ); + VIDEO_QUALITY_TO_TIMELAPSE.put(CamcorderProfile.QUALITY_2160P, CamcorderProfile.QUALITY_TIME_LAPSE_2160P); + VIDEO_QUALITY_TO_TIMELAPSE.put(CamcorderProfile.QUALITY_VGA , CamcorderProfile.QUALITY_TIME_LAPSE_VGA ); + VIDEO_QUALITY_TO_TIMELAPSE.put(CamcorderProfile.QUALITY_4KDCI, CamcorderProfile.QUALITY_TIME_LAPSE_4KDCI); + } + + public static int getTimeLapseQualityFor(int quality) { + return VIDEO_QUALITY_TO_TIMELAPSE.get(quality); + } + + private static final HashMap<Integer, Integer> + VIDEO_QUALITY_TO_HIGHSPEED = new HashMap<Integer, Integer>(); + static { + VIDEO_QUALITY_TO_HIGHSPEED.put(CamcorderProfile.QUALITY_LOW , CamcorderProfile.QUALITY_HIGH_SPEED_LOW ); + VIDEO_QUALITY_TO_HIGHSPEED.put(CamcorderProfile.QUALITY_HIGH , CamcorderProfile.QUALITY_HIGH_SPEED_HIGH ); + VIDEO_QUALITY_TO_HIGHSPEED.put(CamcorderProfile.QUALITY_QCIF , -1 ); // does not exist + VIDEO_QUALITY_TO_HIGHSPEED.put(CamcorderProfile.QUALITY_CIF , CamcorderProfile.QUALITY_HIGH_SPEED_CIF ); + VIDEO_QUALITY_TO_HIGHSPEED.put(CamcorderProfile.QUALITY_480P , CamcorderProfile.QUALITY_HIGH_SPEED_480P ); + VIDEO_QUALITY_TO_HIGHSPEED.put(CamcorderProfile.QUALITY_720P , CamcorderProfile.QUALITY_HIGH_SPEED_720P ); + VIDEO_QUALITY_TO_HIGHSPEED.put(CamcorderProfile.QUALITY_1080P, CamcorderProfile.QUALITY_HIGH_SPEED_1080P); + VIDEO_QUALITY_TO_HIGHSPEED.put(CamcorderProfile.QUALITY_QVGA , -1 ); // does not exist + VIDEO_QUALITY_TO_HIGHSPEED.put(CamcorderProfile.QUALITY_2160P, CamcorderProfile.QUALITY_HIGH_SPEED_2160P); + VIDEO_QUALITY_TO_HIGHSPEED.put(CamcorderProfile.QUALITY_VGA , CamcorderProfile.QUALITY_HIGH_SPEED_VGA ); + VIDEO_QUALITY_TO_HIGHSPEED.put(CamcorderProfile.QUALITY_4KDCI, CamcorderProfile.QUALITY_HIGH_SPEED_4KDCI); + } + + public static int getHighSpeedQualityFor(int quality) { + return VIDEO_QUALITY_TO_HIGHSPEED.get(quality); + } + public CameraSettings(Activity activity, Parameters parameters, int cameraId, CameraInfo[] cameraInfo) { mContext = activity; @@ -1203,9 +1247,9 @@ public class CameraSettings { private static void getFineResolutionQuality(ArrayList<String> supported, int cameraId,Parameters parameters) { /* - if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_4kDCI)) { + if (CamcorderProfile.hasProfile(cameraId, CamcorderProfile.QUALITY_4KDCI)) { if (checkSupportedVideoQuality(parameters,4096,2160)) { - supported.add(Integer.toString(CamcorderProfile.QUALITY_4kDCI)); + supported.add(Integer.toString(CamcorderProfile.QUALITY_4KDCI)); } } */ |