Merge "Camera: Enable camera extension latency range queries" into sc-dev am: 373fafb24b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14106875 Change-Id: I35c331e5679d0dba6e765122e6e1461a57d4b59c
This commit is contained in:
@@ -18038,6 +18038,7 @@ package android.hardware.camera2 {
|
||||
}
|
||||
|
||||
public final class CameraExtensionCharacteristics {
|
||||
method @Nullable public android.util.Range<java.lang.Long> getEstimatedCaptureLatencyRange(int, @NonNull android.util.Size, int);
|
||||
method @NonNull public <T> java.util.List<android.util.Size> getExtensionSupportedSizes(int, @NonNull Class<T>);
|
||||
method @NonNull public java.util.List<android.util.Size> getExtensionSupportedSizes(int, int);
|
||||
method @NonNull public java.util.List<java.lang.Integer> getSupportedExtensions();
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package android.hardware.camera2;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -33,6 +34,7 @@ import android.annotation.IntDef;
|
||||
import android.annotation.NonNull;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
import android.util.Range;
|
||||
import android.util.Size;
|
||||
|
||||
import java.util.HashSet;
|
||||
@@ -566,4 +568,47 @@ public final class CameraExtensionCharacteristics {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the estimated capture latency range in milliseconds for the
|
||||
* target capture resolution during the calls to {@link CameraExtensionSession#capture}. This
|
||||
* includes the time spent processing the multi-frame capture request along with any additional
|
||||
* time for encoding of the processed buffer if necessary.
|
||||
*
|
||||
* @param extension the extension type
|
||||
* @param captureOutputSize size of the capture output surface. If it is not in the supported
|
||||
* output sizes, maximum capture output size is used for the estimation
|
||||
* @param format device-specific extension output format
|
||||
* @return the range of estimated minimal and maximal capture latency in milliseconds
|
||||
* or null if no capture latency info can be provided
|
||||
*
|
||||
* @throws IllegalArgumentException in case of format different from {@link ImageFormat#JPEG} /
|
||||
* {@link ImageFormat#YUV_420_888}; or unsupported extension.
|
||||
*/
|
||||
public @Nullable Range<Long> getEstimatedCaptureLatencyRange(@Extension int extension,
|
||||
@NonNull Size captureOutputSize, @ImageFormat.Format int format) {
|
||||
switch (format) {
|
||||
case ImageFormat.YUV_420_888:
|
||||
case ImageFormat.JPEG:
|
||||
//No op
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unsupported format: " + format);
|
||||
}
|
||||
|
||||
long clientId = registerClient(mContext);
|
||||
if (clientId < 0) {
|
||||
throw new IllegalArgumentException("Unsupported extensions");
|
||||
}
|
||||
|
||||
try {
|
||||
if (!isExtensionSupported(mCameraId, extension, mChars)) {
|
||||
throw new IllegalArgumentException("Unsupported extension");
|
||||
}
|
||||
} finally {
|
||||
unregisterClient(clientId);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user