Search in sources :

Example 1 with OnImageAvailableListener

use of android.media.ImageReader.OnImageAvailableListener in project android_packages_apps_Snap by LineageOS.

the class ClearSightImageProcessor method createEncodeImageReader.

private ImageReader createEncodeImageReader(final int cam, int width, int height) {
    ImageReader reader = ImageReader.newInstance(width, height, ImageFormat.JPEG, mNumFrameCount + 1);
    reader.setOnImageAvailableListener(new OnImageAvailableListener() {

        @Override
        public void onImageAvailable(ImageReader reader) {
            Log.d(TAG, "jpeg image available for cam: " + cam);
            mImageEncodeHandler.obtainMessage(MSG_NEW_IMG, cam, 0, reader.acquireNextImage()).sendToTarget();
        }
    }, null);
    return reader;
}
Also used : OnImageAvailableListener(android.media.ImageReader.OnImageAvailableListener) ImageReader(android.media.ImageReader)

Example 2 with OnImageAvailableListener

use of android.media.ImageReader.OnImageAvailableListener in project android_packages_apps_Snap by LineageOS.

the class ClearSightImageProcessor method createImageReader.

private ImageReader createImageReader(final int cam, int width, int height) {
    ImageReader reader = ImageReader.newInstance(width, height, ImageFormat.YUV_420_888, mNumBurstCount + mNumFrameCount);
    reader.setOnImageAvailableListener(new OnImageAvailableListener() {

        @Override
        public void onImageAvailable(ImageReader reader) {
            Log.d(TAG, "onImageAvailable for cam: " + cam);
            if (isClosing())
                Log.d(TAG, "onImageAvailable - closing");
            else
                mImageProcessHandler.obtainMessage(MSG_NEW_IMG, cam, 0, reader.acquireNextImage()).sendToTarget();
        }
    }, null);
    return reader;
}
Also used : OnImageAvailableListener(android.media.ImageReader.OnImageAvailableListener) ImageReader(android.media.ImageReader)

Aggregations

ImageReader (android.media.ImageReader)2 OnImageAvailableListener (android.media.ImageReader.OnImageAvailableListener)2