Search in sources :

Example 31 with OutputConfiguration

use of android.hardware.camera2.params.OutputConfiguration in project android_frameworks_base by DirtyUnicorns.

the class CameraDeviceImpl method createConstrainedHighSpeedCaptureSession.

@Override
public void createConstrainedHighSpeedCaptureSession(List<Surface> outputs, android.hardware.camera2.CameraCaptureSession.StateCallback callback, Handler handler) throws CameraAccessException {
    if (outputs == null || outputs.size() == 0 || outputs.size() > 2) {
        throw new IllegalArgumentException("Output surface list must not be null and the size must be no more than 2");
    }
    StreamConfigurationMap config = getCharacteristics().get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
    SurfaceUtils.checkConstrainedHighSpeedSurfaces(outputs, /*fpsRange*/
    null, config);
    List<OutputConfiguration> outConfigurations = new ArrayList<>(outputs.size());
    for (Surface surface : outputs) {
        outConfigurations.add(new OutputConfiguration(surface));
    }
    createCaptureSessionInternal(null, outConfigurations, callback, handler, /*isConstrainedHighSpeed*/
    true);
}
Also used : OutputConfiguration(android.hardware.camera2.params.OutputConfiguration) ArrayList(java.util.ArrayList) StreamConfigurationMap(android.hardware.camera2.params.StreamConfigurationMap) Surface(android.view.Surface)

Example 32 with OutputConfiguration

use of android.hardware.camera2.params.OutputConfiguration in project android_frameworks_base by DirtyUnicorns.

the class CameraDeviceBinderTest method testCreateStreamTwo.

@SmallTest
public void testCreateStreamTwo() throws Exception {
    // Create first stream
    int streamId = mCameraUser.createStream(mOutputConfiguration);
    assertEquals(0, streamId);
    try {
        mCameraUser.createStream(mOutputConfiguration);
        fail("Created same stream twice");
    } catch (ServiceSpecificException e) {
        assertEquals("Created same stream twice", ICameraService.ERROR_ALREADY_EXISTS, e.errorCode);
    }
    // Create second stream with a different surface.
    SurfaceTexture surfaceTexture = new SurfaceTexture(/* ignored */
    0);
    surfaceTexture.setDefaultBufferSize(640, 480);
    Surface surface2 = new Surface(surfaceTexture);
    OutputConfiguration output2 = new OutputConfiguration(surface2);
    int streamId2 = mCameraUser.createStream(output2);
    assertEquals(1, streamId2);
    // Clean up streams
    mCameraUser.deleteStream(streamId);
    mCameraUser.deleteStream(streamId2);
}
Also used : ServiceSpecificException(android.os.ServiceSpecificException) SurfaceTexture(android.graphics.SurfaceTexture) OutputConfiguration(android.hardware.camera2.params.OutputConfiguration) Surface(android.view.Surface) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 33 with OutputConfiguration

use of android.hardware.camera2.params.OutputConfiguration in project android_frameworks_base by DirtyUnicorns.

the class CameraDeviceBinderTest method createDefaultSurface.

private void createDefaultSurface() {
    mImageReader = ImageReader.newInstance(DEFAULT_IMAGE_WIDTH, DEFAULT_IMAGE_HEIGHT, ImageFormat.YUV_420_888, MAX_NUM_IMAGES);
    mImageReader.setOnImageAvailableListener(new ImageDropperListener(), mHandler);
    mSurface = mImageReader.getSurface();
    mOutputConfiguration = new OutputConfiguration(mSurface);
}
Also used : OutputConfiguration(android.hardware.camera2.params.OutputConfiguration)

Example 34 with OutputConfiguration

use of android.hardware.camera2.params.OutputConfiguration in project android_frameworks_base by AOSPA.

the class CameraDeviceBinderTest method testCreateStreamTwo.

@SmallTest
public void testCreateStreamTwo() throws Exception {
    // Create first stream
    int streamId = mCameraUser.createStream(mOutputConfiguration);
    assertEquals(0, streamId);
    try {
        mCameraUser.createStream(mOutputConfiguration);
        fail("Created same stream twice");
    } catch (ServiceSpecificException e) {
        assertEquals("Created same stream twice", ICameraService.ERROR_ALREADY_EXISTS, e.errorCode);
    }
    // Create second stream with a different surface.
    SurfaceTexture surfaceTexture = new SurfaceTexture(/* ignored */
    0);
    surfaceTexture.setDefaultBufferSize(640, 480);
    Surface surface2 = new Surface(surfaceTexture);
    OutputConfiguration output2 = new OutputConfiguration(surface2);
    int streamId2 = mCameraUser.createStream(output2);
    assertEquals(1, streamId2);
    // Clean up streams
    mCameraUser.deleteStream(streamId);
    mCameraUser.deleteStream(streamId2);
}
Also used : ServiceSpecificException(android.os.ServiceSpecificException) SurfaceTexture(android.graphics.SurfaceTexture) OutputConfiguration(android.hardware.camera2.params.OutputConfiguration) Surface(android.view.Surface) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 35 with OutputConfiguration

use of android.hardware.camera2.params.OutputConfiguration in project android_frameworks_base by AOSPA.

the class CameraDeviceImpl method createConstrainedHighSpeedCaptureSession.

@Override
public void createConstrainedHighSpeedCaptureSession(List<Surface> outputs, android.hardware.camera2.CameraCaptureSession.StateCallback callback, Handler handler) throws CameraAccessException {
    if (outputs == null || outputs.size() == 0 || outputs.size() > 2) {
        throw new IllegalArgumentException("Output surface list must not be null and the size must be no more than 2");
    }
    StreamConfigurationMap config = getCharacteristics().get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
    SurfaceUtils.checkConstrainedHighSpeedSurfaces(outputs, /*fpsRange*/
    null, config);
    List<OutputConfiguration> outConfigurations = new ArrayList<>(outputs.size());
    for (Surface surface : outputs) {
        outConfigurations.add(new OutputConfiguration(surface));
    }
    createCaptureSessionInternal(null, outConfigurations, callback, handler, /*isConstrainedHighSpeed*/
    true);
}
Also used : OutputConfiguration(android.hardware.camera2.params.OutputConfiguration) ArrayList(java.util.ArrayList) StreamConfigurationMap(android.hardware.camera2.params.StreamConfigurationMap) Surface(android.view.Surface)

Aggregations

OutputConfiguration (android.hardware.camera2.params.OutputConfiguration)50 ArrayList (java.util.ArrayList)35 Surface (android.view.Surface)30 CameraAccessException (android.hardware.camera2.CameraAccessException)10 SurfaceTexture (android.graphics.SurfaceTexture)5 InputConfiguration (android.hardware.camera2.params.InputConfiguration)5 StreamConfigurationMap (android.hardware.camera2.params.StreamConfigurationMap)5 ServiceSpecificException (android.os.ServiceSpecificException)5 SmallTest (android.test.suitebuilder.annotation.SmallTest)5 HashSet (java.util.HashSet)5