Search in sources :

Example 1 with SimpleImageWriterListener

use of com.android.mediaframeworktest.helpers.CameraTestUtils.SimpleImageWriterListener in project android_frameworks_base by ResurrectionRemix.

the class Camera2ReprocessCaptureTest method setupReprocessableSession.

/**
     * Set up a reprocessable session and create an ImageWriter with the sessoin's input surface.
     */
private void setupReprocessableSession(Surface previewSurface, int numImageWriterImages) throws Exception {
    // create a reprocessable capture session
    List<Surface> outSurfaces = new ArrayList<Surface>();
    outSurfaces.add(mFirstImageReader.getSurface());
    if (!mShareOneImageReader) {
        outSurfaces.add(mSecondImageReader.getSurface());
    }
    if (previewSurface != null) {
        outSurfaces.add(previewSurface);
    }
    InputConfiguration inputConfig = new InputConfiguration(mFirstImageReader.getWidth(), mFirstImageReader.getHeight(), mFirstImageReader.getImageFormat());
    String inputConfigString = inputConfig.toString();
    if (VERBOSE) {
        Log.v(TAG, "InputConfiguration: " + inputConfigString);
    }
    assertTrue(String.format("inputConfig is wrong: %dx%d format %d. Expect %dx%d format %d", inputConfig.getWidth(), inputConfig.getHeight(), inputConfig.getFormat(), mFirstImageReader.getWidth(), mFirstImageReader.getHeight(), mFirstImageReader.getImageFormat()), inputConfig.getWidth() == mFirstImageReader.getWidth() && inputConfig.getHeight() == mFirstImageReader.getHeight() && inputConfig.getFormat() == mFirstImageReader.getImageFormat());
    mSessionListener = new BlockingSessionCallback();
    mSession = configureReprocessableCameraSession(mCamera, inputConfig, outSurfaces, mSessionListener, mHandler);
    // create an ImageWriter
    mInputSurface = mSession.getInputSurface();
    mImageWriter = ImageWriter.newInstance(mInputSurface, numImageWriterImages);
    mImageWriterListener = new SimpleImageWriterListener(mImageWriter);
    mImageWriter.setOnImageReleasedListener(mImageWriterListener, mHandler);
}
Also used : BlockingSessionCallback(com.android.ex.camera2.blocking.BlockingSessionCallback) ArrayList(java.util.ArrayList) InputConfiguration(android.hardware.camera2.params.InputConfiguration) Surface(android.view.Surface) SimpleImageWriterListener(com.android.mediaframeworktest.helpers.CameraTestUtils.SimpleImageWriterListener)

Example 2 with SimpleImageWriterListener

use of com.android.mediaframeworktest.helpers.CameraTestUtils.SimpleImageWriterListener in project android_frameworks_base by AOSPA.

the class Camera2ReprocessCaptureTest method setupReprocessableSession.

/**
     * Set up a reprocessable session and create an ImageWriter with the sessoin's input surface.
     */
private void setupReprocessableSession(Surface previewSurface, int numImageWriterImages) throws Exception {
    // create a reprocessable capture session
    List<Surface> outSurfaces = new ArrayList<Surface>();
    outSurfaces.add(mFirstImageReader.getSurface());
    if (!mShareOneImageReader) {
        outSurfaces.add(mSecondImageReader.getSurface());
    }
    if (previewSurface != null) {
        outSurfaces.add(previewSurface);
    }
    InputConfiguration inputConfig = new InputConfiguration(mFirstImageReader.getWidth(), mFirstImageReader.getHeight(), mFirstImageReader.getImageFormat());
    String inputConfigString = inputConfig.toString();
    if (VERBOSE) {
        Log.v(TAG, "InputConfiguration: " + inputConfigString);
    }
    assertTrue(String.format("inputConfig is wrong: %dx%d format %d. Expect %dx%d format %d", inputConfig.getWidth(), inputConfig.getHeight(), inputConfig.getFormat(), mFirstImageReader.getWidth(), mFirstImageReader.getHeight(), mFirstImageReader.getImageFormat()), inputConfig.getWidth() == mFirstImageReader.getWidth() && inputConfig.getHeight() == mFirstImageReader.getHeight() && inputConfig.getFormat() == mFirstImageReader.getImageFormat());
    mSessionListener = new BlockingSessionCallback();
    mSession = configureReprocessableCameraSession(mCamera, inputConfig, outSurfaces, mSessionListener, mHandler);
    // create an ImageWriter
    mInputSurface = mSession.getInputSurface();
    mImageWriter = ImageWriter.newInstance(mInputSurface, numImageWriterImages);
    mImageWriterListener = new SimpleImageWriterListener(mImageWriter);
    mImageWriter.setOnImageReleasedListener(mImageWriterListener, mHandler);
}
Also used : BlockingSessionCallback(com.android.ex.camera2.blocking.BlockingSessionCallback) ArrayList(java.util.ArrayList) InputConfiguration(android.hardware.camera2.params.InputConfiguration) Surface(android.view.Surface) SimpleImageWriterListener(com.android.mediaframeworktest.helpers.CameraTestUtils.SimpleImageWriterListener)

Example 3 with SimpleImageWriterListener

use of com.android.mediaframeworktest.helpers.CameraTestUtils.SimpleImageWriterListener in project platform_frameworks_base by android.

the class Camera2ReprocessCaptureTest method setupReprocessableSession.

/**
     * Set up a reprocessable session and create an ImageWriter with the sessoin's input surface.
     */
private void setupReprocessableSession(Surface previewSurface, int numImageWriterImages) throws Exception {
    // create a reprocessable capture session
    List<Surface> outSurfaces = new ArrayList<Surface>();
    outSurfaces.add(mFirstImageReader.getSurface());
    if (!mShareOneImageReader) {
        outSurfaces.add(mSecondImageReader.getSurface());
    }
    if (previewSurface != null) {
        outSurfaces.add(previewSurface);
    }
    InputConfiguration inputConfig = new InputConfiguration(mFirstImageReader.getWidth(), mFirstImageReader.getHeight(), mFirstImageReader.getImageFormat());
    String inputConfigString = inputConfig.toString();
    if (VERBOSE) {
        Log.v(TAG, "InputConfiguration: " + inputConfigString);
    }
    assertTrue(String.format("inputConfig is wrong: %dx%d format %d. Expect %dx%d format %d", inputConfig.getWidth(), inputConfig.getHeight(), inputConfig.getFormat(), mFirstImageReader.getWidth(), mFirstImageReader.getHeight(), mFirstImageReader.getImageFormat()), inputConfig.getWidth() == mFirstImageReader.getWidth() && inputConfig.getHeight() == mFirstImageReader.getHeight() && inputConfig.getFormat() == mFirstImageReader.getImageFormat());
    mSessionListener = new BlockingSessionCallback();
    mSession = configureReprocessableCameraSession(mCamera, inputConfig, outSurfaces, mSessionListener, mHandler);
    // create an ImageWriter
    mInputSurface = mSession.getInputSurface();
    mImageWriter = ImageWriter.newInstance(mInputSurface, numImageWriterImages);
    mImageWriterListener = new SimpleImageWriterListener(mImageWriter);
    mImageWriter.setOnImageReleasedListener(mImageWriterListener, mHandler);
}
Also used : BlockingSessionCallback(com.android.ex.camera2.blocking.BlockingSessionCallback) ArrayList(java.util.ArrayList) InputConfiguration(android.hardware.camera2.params.InputConfiguration) Surface(android.view.Surface) SimpleImageWriterListener(com.android.mediaframeworktest.helpers.CameraTestUtils.SimpleImageWriterListener)

Example 4 with SimpleImageWriterListener

use of com.android.mediaframeworktest.helpers.CameraTestUtils.SimpleImageWriterListener in project android_frameworks_base by DirtyUnicorns.

the class Camera2ReprocessCaptureTest method setupReprocessableSession.

/**
     * Set up a reprocessable session and create an ImageWriter with the sessoin's input surface.
     */
private void setupReprocessableSession(Surface previewSurface, int numImageWriterImages) throws Exception {
    // create a reprocessable capture session
    List<Surface> outSurfaces = new ArrayList<Surface>();
    outSurfaces.add(mFirstImageReader.getSurface());
    if (!mShareOneImageReader) {
        outSurfaces.add(mSecondImageReader.getSurface());
    }
    if (previewSurface != null) {
        outSurfaces.add(previewSurface);
    }
    InputConfiguration inputConfig = new InputConfiguration(mFirstImageReader.getWidth(), mFirstImageReader.getHeight(), mFirstImageReader.getImageFormat());
    String inputConfigString = inputConfig.toString();
    if (VERBOSE) {
        Log.v(TAG, "InputConfiguration: " + inputConfigString);
    }
    assertTrue(String.format("inputConfig is wrong: %dx%d format %d. Expect %dx%d format %d", inputConfig.getWidth(), inputConfig.getHeight(), inputConfig.getFormat(), mFirstImageReader.getWidth(), mFirstImageReader.getHeight(), mFirstImageReader.getImageFormat()), inputConfig.getWidth() == mFirstImageReader.getWidth() && inputConfig.getHeight() == mFirstImageReader.getHeight() && inputConfig.getFormat() == mFirstImageReader.getImageFormat());
    mSessionListener = new BlockingSessionCallback();
    mSession = configureReprocessableCameraSession(mCamera, inputConfig, outSurfaces, mSessionListener, mHandler);
    // create an ImageWriter
    mInputSurface = mSession.getInputSurface();
    mImageWriter = ImageWriter.newInstance(mInputSurface, numImageWriterImages);
    mImageWriterListener = new SimpleImageWriterListener(mImageWriter);
    mImageWriter.setOnImageReleasedListener(mImageWriterListener, mHandler);
}
Also used : BlockingSessionCallback(com.android.ex.camera2.blocking.BlockingSessionCallback) ArrayList(java.util.ArrayList) InputConfiguration(android.hardware.camera2.params.InputConfiguration) Surface(android.view.Surface) SimpleImageWriterListener(com.android.mediaframeworktest.helpers.CameraTestUtils.SimpleImageWriterListener)

Example 5 with SimpleImageWriterListener

use of com.android.mediaframeworktest.helpers.CameraTestUtils.SimpleImageWriterListener in project android_frameworks_base by crdroidandroid.

the class Camera2ReprocessCaptureTest method setupReprocessableSession.

/**
     * Set up a reprocessable session and create an ImageWriter with the sessoin's input surface.
     */
private void setupReprocessableSession(Surface previewSurface, int numImageWriterImages) throws Exception {
    // create a reprocessable capture session
    List<Surface> outSurfaces = new ArrayList<Surface>();
    outSurfaces.add(mFirstImageReader.getSurface());
    if (!mShareOneImageReader) {
        outSurfaces.add(mSecondImageReader.getSurface());
    }
    if (previewSurface != null) {
        outSurfaces.add(previewSurface);
    }
    InputConfiguration inputConfig = new InputConfiguration(mFirstImageReader.getWidth(), mFirstImageReader.getHeight(), mFirstImageReader.getImageFormat());
    String inputConfigString = inputConfig.toString();
    if (VERBOSE) {
        Log.v(TAG, "InputConfiguration: " + inputConfigString);
    }
    assertTrue(String.format("inputConfig is wrong: %dx%d format %d. Expect %dx%d format %d", inputConfig.getWidth(), inputConfig.getHeight(), inputConfig.getFormat(), mFirstImageReader.getWidth(), mFirstImageReader.getHeight(), mFirstImageReader.getImageFormat()), inputConfig.getWidth() == mFirstImageReader.getWidth() && inputConfig.getHeight() == mFirstImageReader.getHeight() && inputConfig.getFormat() == mFirstImageReader.getImageFormat());
    mSessionListener = new BlockingSessionCallback();
    mSession = configureReprocessableCameraSession(mCamera, inputConfig, outSurfaces, mSessionListener, mHandler);
    // create an ImageWriter
    mInputSurface = mSession.getInputSurface();
    mImageWriter = ImageWriter.newInstance(mInputSurface, numImageWriterImages);
    mImageWriterListener = new SimpleImageWriterListener(mImageWriter);
    mImageWriter.setOnImageReleasedListener(mImageWriterListener, mHandler);
}
Also used : BlockingSessionCallback(com.android.ex.camera2.blocking.BlockingSessionCallback) ArrayList(java.util.ArrayList) InputConfiguration(android.hardware.camera2.params.InputConfiguration) Surface(android.view.Surface) SimpleImageWriterListener(com.android.mediaframeworktest.helpers.CameraTestUtils.SimpleImageWriterListener)

Aggregations

InputConfiguration (android.hardware.camera2.params.InputConfiguration)5 Surface (android.view.Surface)5 BlockingSessionCallback (com.android.ex.camera2.blocking.BlockingSessionCallback)5 SimpleImageWriterListener (com.android.mediaframeworktest.helpers.CameraTestUtils.SimpleImageWriterListener)5 ArrayList (java.util.ArrayList)5