Merge "Camera: Enable SurfaceView extension output" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
83ddb864d7
@@ -541,7 +541,8 @@ public final class CameraExtensionCharacteristics {
|
|||||||
private static <T> boolean isOutputSupportedFor(Class<T> klass) {
|
private static <T> boolean isOutputSupportedFor(Class<T> klass) {
|
||||||
Objects.requireNonNull(klass, "klass must not be null");
|
Objects.requireNonNull(klass, "klass must not be null");
|
||||||
|
|
||||||
if (klass == android.graphics.SurfaceTexture.class) {
|
if ((klass == android.graphics.SurfaceTexture.class) ||
|
||||||
|
(klass == android.view.SurfaceView.class)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -725,6 +726,12 @@ public final class CameraExtensionCharacteristics {
|
|||||||
* backward compatible cameras whereas other output classes are not guaranteed to be supported.
|
* backward compatible cameras whereas other output classes are not guaranteed to be supported.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
|
* <p>Starting with Android {@link android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE}
|
||||||
|
* {@link android.view.SurfaceView} classes are also guaranteed to be supported and include
|
||||||
|
* the same resolutions as {@link android.graphics.SurfaceTexture}.
|
||||||
|
* Clients must set the desired SurfaceView resolution by calling
|
||||||
|
* {@link android.view.SurfaceHolder#setFixedSize}.</p>
|
||||||
|
*
|
||||||
* @param extension the extension type
|
* @param extension the extension type
|
||||||
* @param klass a non-{@code null} {@link Class} object reference
|
* @param klass a non-{@code null} {@link Class} object reference
|
||||||
* @return non-modifiable list of available sizes or an empty list if the Surface output is not
|
* @return non-modifiable list of available sizes or an empty list if the Surface output is not
|
||||||
|
|||||||
@@ -62,8 +62,6 @@ import android.os.Handler;
|
|||||||
import android.os.HandlerThread;
|
import android.os.HandlerThread;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.Pair;
|
|
||||||
import android.util.Range;
|
|
||||||
import android.util.Size;
|
import android.util.Size;
|
||||||
import android.view.Surface;
|
import android.view.Surface;
|
||||||
|
|
||||||
@@ -270,6 +268,10 @@ public final class CameraAdvancedExtensionSessionImpl extends CameraExtensionSes
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The extension processing logic needs to be able to match images to capture results via
|
||||||
|
// image and result timestamps.
|
||||||
|
cameraOutput.setTimestampBase(OutputConfiguration.TIMESTAMP_BASE_SENSOR);
|
||||||
|
cameraOutput.setReadoutTimestampEnabled(false);
|
||||||
cameraOutput.setPhysicalCameraId(output.physicalCameraId);
|
cameraOutput.setPhysicalCameraId(output.physicalCameraId);
|
||||||
outputList.add(cameraOutput);
|
outputList.add(cameraOutput);
|
||||||
mCameraConfigMap.put(cameraOutput.getSurface(), output);
|
mCameraConfigMap.put(cameraOutput.getSurface(), output);
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ import android.os.RemoteException;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.LongSparseArray;
|
import android.util.LongSparseArray;
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
import android.util.Range;
|
|
||||||
import android.util.Size;
|
import android.util.Size;
|
||||||
import android.view.Surface;
|
import android.view.Surface;
|
||||||
|
|
||||||
@@ -478,13 +477,21 @@ public final class CameraExtensionSessionImpl extends CameraExtensionSession {
|
|||||||
ArrayList<CaptureStageImpl> sessionParamsList = new ArrayList<>();
|
ArrayList<CaptureStageImpl> sessionParamsList = new ArrayList<>();
|
||||||
ArrayList<OutputConfiguration> outputList = new ArrayList<>();
|
ArrayList<OutputConfiguration> outputList = new ArrayList<>();
|
||||||
initializeRepeatingRequestPipeline();
|
initializeRepeatingRequestPipeline();
|
||||||
outputList.add(new OutputConfiguration(mCameraRepeatingSurface));
|
OutputConfiguration previewOutput = new OutputConfiguration(mCameraRepeatingSurface);
|
||||||
|
// The extension processing logic needs to be able to match images to capture results via
|
||||||
|
// image and result timestamps.
|
||||||
|
previewOutput.setTimestampBase(OutputConfiguration.TIMESTAMP_BASE_SENSOR);
|
||||||
|
previewOutput.setReadoutTimestampEnabled(false);
|
||||||
|
outputList.add(previewOutput);
|
||||||
CaptureStageImpl previewSessionParams = mPreviewExtender.onPresetSession();
|
CaptureStageImpl previewSessionParams = mPreviewExtender.onPresetSession();
|
||||||
if (previewSessionParams != null) {
|
if (previewSessionParams != null) {
|
||||||
sessionParamsList.add(previewSessionParams);
|
sessionParamsList.add(previewSessionParams);
|
||||||
}
|
}
|
||||||
initializeBurstCapturePipeline();
|
initializeBurstCapturePipeline();
|
||||||
outputList.add(new OutputConfiguration(mCameraBurstSurface));
|
OutputConfiguration captureOutput = new OutputConfiguration(mCameraBurstSurface);
|
||||||
|
captureOutput.setTimestampBase(OutputConfiguration.TIMESTAMP_BASE_SENSOR);
|
||||||
|
captureOutput.setReadoutTimestampEnabled(false);
|
||||||
|
outputList.add(captureOutput);
|
||||||
CaptureStageImpl stillCaptureSessionParams = mImageExtender.onPresetSession();
|
CaptureStageImpl stillCaptureSessionParams = mImageExtender.onPresetSession();
|
||||||
if (stillCaptureSessionParams != null) {
|
if (stillCaptureSessionParams != null) {
|
||||||
sessionParamsList.add(stillCaptureSessionParams);
|
sessionParamsList.add(stillCaptureSessionParams);
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import android.annotation.NonNull;
|
|||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.graphics.ImageFormat;
|
import android.graphics.ImageFormat;
|
||||||
import android.graphics.PixelFormat;
|
import android.graphics.PixelFormat;
|
||||||
|
import android.hardware.HardwareBuffer;
|
||||||
import android.hardware.camera2.CameraExtensionCharacteristics;
|
import android.hardware.camera2.CameraExtensionCharacteristics;
|
||||||
import android.hardware.camera2.params.OutputConfiguration;
|
import android.hardware.camera2.params.OutputConfiguration;
|
||||||
import android.hardware.camera2.params.StreamConfigurationMap;
|
import android.hardware.camera2.params.StreamConfigurationMap;
|
||||||
@@ -149,6 +150,7 @@ public final class CameraExtensionUtils {
|
|||||||
SurfaceInfo surfaceInfo = querySurface(config.getSurface());
|
SurfaceInfo surfaceInfo = querySurface(config.getSurface());
|
||||||
if ((surfaceInfo.mFormat ==
|
if ((surfaceInfo.mFormat ==
|
||||||
CameraExtensionCharacteristics.NON_PROCESSING_INPUT_FORMAT) ||
|
CameraExtensionCharacteristics.NON_PROCESSING_INPUT_FORMAT) ||
|
||||||
|
((surfaceInfo.mUsage & HardwareBuffer.USAGE_COMPOSER_OVERLAY) != 0) ||
|
||||||
// The default RGBA_8888 is also implicitly supported because camera will
|
// The default RGBA_8888 is also implicitly supported because camera will
|
||||||
// internally override it to
|
// internally override it to
|
||||||
// 'CameraExtensionCharacteristics.NON_PROCESSING_INPUT_FORMAT'
|
// 'CameraExtensionCharacteristics.NON_PROCESSING_INPUT_FORMAT'
|
||||||
|
|||||||
Reference in New Issue
Block a user