ImageWriter.DequeueInputImage Method

Definition

Dequeue the next available input Image for the application to produce data into.

[Android.Runtime.Register("dequeueInputImage", "()Landroid/media/Image;", "GetDequeueInputImageHandler", ApiSince=23)]
public virtual Android.Media.Image? DequeueInputImage ();
[<Android.Runtime.Register("dequeueInputImage", "()Landroid/media/Image;", "GetDequeueInputImageHandler", ApiSince=23)>]
abstract member DequeueInputImage : unit -> Android.Media.Image
override this.DequeueInputImage : unit -> Android.Media.Image

Returns

The next available input Image from this ImageWriter.

Attributes

Remarks

Dequeue the next available input Image for the application to produce data into.

This method requests a new input Image from ImageWriter. The application owns this Image after this call. Once the application fills the Image data, it is expected to return this Image back to ImageWriter for downstream consumer components (e.g. android.hardware.camera2.CameraDevice) to consume. The Image can be returned to ImageWriter via #queueInputImage or Image#close().

This call will block if all available input images have been queued by the application and the downstream consumer has not yet consumed any. When an Image is consumed by the downstream consumer and released, an OnImageReleasedListener#onImageReleased callback will be fired, which indicates that there is one input Image available. For non- ImageFormat#PRIVATE PRIVATE formats ( ImageWriter#getFormat() != ImageFormat#PRIVATE), it is recommended to dequeue the next Image only after this callback is fired, in the steady state.

If the format of ImageWriter is ImageFormat#PRIVATE PRIVATE ( ImageWriter#getFormat() == ImageFormat#PRIVATE), the image buffer is accessible to the application only through the hardware buffer obtained through Image#getHardwareBuffer(). (On Android versions prior to P, dequeueing private buffers will cause an IllegalStateException to be thrown). Alternatively, the application can acquire images from some other component (e.g. an ImageReader), and queue them directly to this ImageWriter via the ImageWriter#queueInputImage queueInputImage() method.

Java documentation for android.media.ImageWriter.dequeueInputImage().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to