use of android.hardware.camera2.params.StreamConfigurationMap in project platform_frameworks_base by android.
the class StaticMetadata method getAvailableMinFrameDurationsForFormatChecked.
/**
* Get available minimal frame durations for a given format.
*
* @param format One of the format from {@link ImageFormat}.
* @return HashMap of minimal frame durations for different sizes, empty HashMap
* if availableMinFrameDurations is null.
*/
public HashMap<Size, Long> getAvailableMinFrameDurationsForFormatChecked(int format) {
HashMap<Size, Long> minDurationMap = new HashMap<Size, Long>();
Key<StreamConfigurationMap> key = CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP;
StreamConfigurationMap config = getValueFromKeyNonNull(key);
if (config == null) {
return minDurationMap;
}
for (Size size : getAvailableSizesForFormatChecked(format, StreamDirection.Output)) {
long minFrameDuration = config.getOutputMinFrameDuration(format, size);
if (minFrameDuration != 0) {
minDurationMap.put(new Size(size.getWidth(), size.getHeight()), minFrameDuration);
}
}
return minDurationMap;
}
use of android.hardware.camera2.params.StreamConfigurationMap in project platform_frameworks_base by android.
the class StaticMetadata method getValidOutputFormatsForInput.
/**
* Get valid output formats for a given input format.
*
* @param inputFormat The input format used to produce the output images.
* @return The output formats for the given input format, empty array if
* no available format is found.
*/
public int[] getValidOutputFormatsForInput(int inputFormat) {
Key<StreamConfigurationMap> key = CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP;
StreamConfigurationMap config = getValueFromKeyNonNull(key);
if (config == null) {
return new int[0];
}
return config.getValidOutputFormatsForInput(inputFormat);
}
use of android.hardware.camera2.params.StreamConfigurationMap in project cameraview by google.
the class Camera2 method collectCameraInfo.
/**
* <p>Collects some information from {@link #mCameraCharacteristics}.</p>
* <p>This rewrites {@link #mPreviewSizes}, {@link #mPictureSizes}, and optionally,
* {@link #mAspectRatio}.</p>
*/
private void collectCameraInfo() {
StreamConfigurationMap map = mCameraCharacteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
if (map == null) {
throw new IllegalStateException("Failed to get configuration map: " + mCameraId);
}
mPreviewSizes.clear();
for (android.util.Size size : map.getOutputSizes(mPreview.getOutputClass())) {
mPreviewSizes.add(new Size(size.getWidth(), size.getHeight()));
}
mPictureSizes.clear();
collectPictureSizes(mPictureSizes, map);
if (!mPreviewSizes.ratios().contains(mAspectRatio)) {
mAspectRatio = mPreviewSizes.ratios().iterator().next();
}
}
use of android.hardware.camera2.params.StreamConfigurationMap in project platform_frameworks_base by android.
the class CameraDeviceImpl method checkInputConfiguration.
private void checkInputConfiguration(InputConfiguration inputConfig) {
if (inputConfig != null) {
StreamConfigurationMap configMap = mCharacteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
int[] inputFormats = configMap.getInputFormats();
boolean validFormat = false;
for (int format : inputFormats) {
if (format == inputConfig.getFormat()) {
validFormat = true;
}
}
if (validFormat == false) {
throw new IllegalArgumentException("input format " + inputConfig.getFormat() + " is not valid");
}
boolean validSize = false;
Size[] inputSizes = configMap.getInputSizes(inputConfig.getFormat());
for (Size s : inputSizes) {
if (inputConfig.getWidth() == s.getWidth() && inputConfig.getHeight() == s.getHeight()) {
validSize = true;
}
}
if (validSize == false) {
throw new IllegalArgumentException("input size " + inputConfig.getWidth() + "x" + inputConfig.getHeight() + " is not valid");
}
}
}
use of android.hardware.camera2.params.StreamConfigurationMap in project platform_frameworks_base by android.
the class CameraMetadataNative method getStreamConfigurationMap.
private StreamConfigurationMap getStreamConfigurationMap() {
StreamConfiguration[] configurations = getBase(CameraCharacteristics.SCALER_AVAILABLE_STREAM_CONFIGURATIONS);
StreamConfigurationDuration[] minFrameDurations = getBase(CameraCharacteristics.SCALER_AVAILABLE_MIN_FRAME_DURATIONS);
StreamConfigurationDuration[] stallDurations = getBase(CameraCharacteristics.SCALER_AVAILABLE_STALL_DURATIONS);
StreamConfiguration[] depthConfigurations = getBase(CameraCharacteristics.DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS);
StreamConfigurationDuration[] depthMinFrameDurations = getBase(CameraCharacteristics.DEPTH_AVAILABLE_DEPTH_MIN_FRAME_DURATIONS);
StreamConfigurationDuration[] depthStallDurations = getBase(CameraCharacteristics.DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS);
HighSpeedVideoConfiguration[] highSpeedVideoConfigurations = getBase(CameraCharacteristics.CONTROL_AVAILABLE_HIGH_SPEED_VIDEO_CONFIGURATIONS);
ReprocessFormatsMap inputOutputFormatsMap = getBase(CameraCharacteristics.SCALER_AVAILABLE_INPUT_OUTPUT_FORMATS_MAP);
int[] capabilities = getBase(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES);
boolean listHighResolution = false;
for (int capability : capabilities) {
if (capability == CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE) {
listHighResolution = true;
break;
}
}
return new StreamConfigurationMap(configurations, minFrameDurations, stallDurations, depthConfigurations, depthMinFrameDurations, depthStallDurations, highSpeedVideoConfigurations, inputOutputFormatsMap, listHighResolution);
}
Aggregations