summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjunjiez <junjiez@codeaurora.org>2019-09-11 16:10:01 +0800
committerGerrit - the friendly Code Review server <code-review@localhost>2019-10-16 19:29:51 -0700
commit416558c5d8a2a36d78788e9c6772c943b2ccdcbc (patch)
treefaaed2da17d522428be1455b13afb74ae3e72a5d /src
parent240a5a28559c5fd2e5fc54ec5bd77d73bcf9e9ea (diff)
downloadandroid_packages_apps_Snap-416558c5d8a2a36d78788e9c6772c943b2ccdcbc.tar.gz
android_packages_apps_Snap-416558c5d8a2a36d78788e9c6772c943b2ccdcbc.tar.bz2
android_packages_apps_Snap-416558c5d8a2a36d78788e9c6772c943b2ccdcbc.zip
SnapdraongCamera:Filter HEIF size
Filter unsupported HEIF size according to the capabilities of heic encoder to avoid codec error. Change-Id: If68f517f768d04c27f1bd52def4d8fb492b74842 CRs-Fixed: 2525250
Diffstat (limited to 'src')
-rwxr-xr-xsrc/com/android/camera/SettingsManager.java46
1 files changed, 42 insertions, 4 deletions
diff --git a/src/com/android/camera/SettingsManager.java b/src/com/android/camera/SettingsManager.java
index 253108603..88fe2ec53 100755
--- a/src/com/android/camera/SettingsManager.java
+++ b/src/com/android/camera/SettingsManager.java
@@ -1670,10 +1670,26 @@ public class SettingsManager implements ListMenu.SettingsListener {
res.add(getSupportedQcfaDimension(cameraId));
}
+ VideoCapabilities heifCap = null;
+ if (isHeifEnabled) {
+ MediaCodecList list = new MediaCodecList(MediaCodecList.REGULAR_CODECS);
+ for (MediaCodecInfo info :list.getCodecInfos()) {
+ if (info.isEncoder() && info.getName().contains("heic")){
+ heifCap = info.getCapabilitiesForType(
+ MediaFormat.MIMETYPE_IMAGE_ANDROID_HEIC).getVideoCapabilities();
+ Log.d(TAG,"supported heif height range ="+heifCap.getSupportedHeights().toString() +
+ " width range ="+heifCap.getSupportedWidths().toString());
+ }
+ }
+ }
+
if (sizes != null) {
for (int i = 0; i < sizes.length; i++) {
- if (isHeifEnabled && (Math.min(sizes[i].getWidth(),sizes[i].getHeight()) < 512)) {
- continue;
+ if (isHeifEnabled && heifCap != null ){
+ if (!heifCap.getSupportedWidths().contains(sizes[i].getWidth()) ||
+ !heifCap.getSupportedHeights().contains(sizes[i].getHeight())){
+ continue;
+ }
}
if (isDeepportrait &&
(Math.min(sizes[i].getWidth(),sizes[i].getHeight()) < 720 ||
@@ -1686,8 +1702,15 @@ public class SettingsManager implements ListMenu.SettingsListener {
}
Size[] highResSizes = map.getHighResolutionOutputSizes(ImageFormat.JPEG);
+
if (highResSizes != null) {
for (int i = 0; i < highResSizes.length; i++) {
+ if (isHeifEnabled && heifCap != null) {
+ if (!heifCap.getSupportedWidths().contains(highResSizes[i].getWidth()) ||
+ !heifCap.getSupportedHeights().contains(highResSizes[i].getHeight())){
+ continue;
+ }
+ }
res.add(highResSizes[i].toString());
}
}
@@ -1735,10 +1758,25 @@ public class SettingsManager implements ListMenu.SettingsListener {
CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
Size[] sizes = map.getOutputSizes(MediaRecorder.class);
boolean isHeifEnabled = getSavePictureFormat() == HEIF_FORMAT;
+ VideoCapabilities heifCap = null;
+ if (isHeifEnabled) {
+ MediaCodecList list = new MediaCodecList(MediaCodecList.REGULAR_CODECS);
+ for (MediaCodecInfo info :list.getCodecInfos()) {
+ if (info.isEncoder() && info.getName().contains("heic")){
+ heifCap = info.getCapabilitiesForType(
+ MediaFormat.MIMETYPE_IMAGE_ANDROID_HEIC).getVideoCapabilities();
+ Log.d(TAG,"supported heif height range ="+heifCap.getSupportedHeights().toString() +
+ " width range ="+heifCap.getSupportedWidths().toString());
+ }
+ }
+ }
List<String> res = new ArrayList<>();
for (int i = 0; i < sizes.length; i++) {
- if (isHeifEnabled && (Math.min(sizes[i].getWidth(),sizes[i].getHeight()) < 512)) {
- continue;
+ if (isHeifEnabled && heifCap != null ){
+ if (!heifCap.getSupportedWidths().contains(sizes[i].getWidth()) ||
+ !heifCap.getSupportedHeights().contains(sizes[i].getHeight())){
+ continue;
+ }
}
if (CameraSettings.VIDEO_QUALITY_TABLE.containsKey(sizes[i].toString())) {
Integer profile = CameraSettings.VIDEO_QUALITY_TABLE.get(sizes[i].toString());