diff options
Diffstat (limited to 'src/com/android/camera/SettingsManager.java')
-rwxr-xr-x | src/com/android/camera/SettingsManager.java | 73 |
1 files changed, 68 insertions, 5 deletions
diff --git a/src/com/android/camera/SettingsManager.java b/src/com/android/camera/SettingsManager.java index 253108603..532eae8ec 100755 --- a/src/com/android/camera/SettingsManager.java +++ b/src/com/android/camera/SettingsManager.java @@ -1091,6 +1091,9 @@ public class SettingsManager implements ListMenu.SettingsListener { filterVideoEncoderProfileOptions(); } else if (pref.getKey().equals(KEY_PICTURE_FORMAT)) { filterHeifSizeOptions(); + } else if (pref.getKey().equals(KEY_DIS) || + pref.getKey().equals(KEY_EIS_VALUE)) { + filterVideoEncoderOptions(); } } @@ -1670,10 +1673,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 +1705,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()); } } @@ -1709,7 +1735,12 @@ public class SettingsManager implements ListMenu.SettingsListener { public Size[] getSupportedOutputSize(int cameraId, Class cl) { StreamConfigurationMap map = mCharacteristics.get(cameraId).get( CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP); - return map.getOutputSizes(cl); + Size[] normal = map.getOutputSizes(cl); + Size[] high = map.getHighResolutionOutputSizes(ImageFormat.PRIVATE); + Size[] ret = new Size[normal.length+high.length]; + System.arraycopy(normal,0,ret,0,normal.length); + System.arraycopy(high,0,ret,normal.length,high.length); + return ret; } private List<String> getSupportedVideoDuration() { @@ -1735,10 +1766,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()); @@ -1941,6 +1987,23 @@ public class SettingsManager implements ListMenu.SettingsListener { } } } + + ListPreference videoQuality = mPreferenceGroup.findPreference(KEY_VIDEO_QUALITY); + String videoSize = videoQuality.getValue(); + int indexX = videoSize.indexOf('x'); + int width = Integer.parseInt(videoSize.substring(0, indexX)); + int height = Integer.parseInt(videoSize.substring(indexX + 1)); + // Video quality less than 720P + boolean isLess720P = width < 1280 && height < 720; + + ListPreference disPref = mPreferenceGroup.findPreference(KEY_DIS); + ListPreference eisPref = mPreferenceGroup.findPreference(KEY_EIS_VALUE); + if (isLess720P && + "on".equals(disPref.getValue()) && + !("disable".equals(eisPref.getValue()))) { + supported.remove("mpeg-4-sp"); + } + return supported; } |