Share via


ImageWriter.QueueInputImage(Image) Method

Definition

Queue an input Image back to ImageWriter for the downstream consumer to access.

[Android.Runtime.Register("queueInputImage", "(Landroid/media/Image;)V", "GetQueueInputImage_Landroid_media_Image_Handler", ApiSince=23)]
public virtual void QueueInputImage (Android.Media.Image? image);
[<Android.Runtime.Register("queueInputImage", "(Landroid/media/Image;)V", "GetQueueInputImage_Landroid_media_Image_Handler", ApiSince=23)>]
abstract member QueueInputImage : Android.Media.Image -> unit
override this.QueueInputImage : Android.Media.Image -> unit

Parameters

image
Image

The Image to be queued back to ImageWriter for future consumption.

Attributes

Remarks

Queue an input Image back to ImageWriter for the downstream consumer to access.

The input Image could be from ImageReader (acquired via ImageReader#acquireNextImage or ImageReader#acquireLatestImage), or from this ImageWriter (acquired via #dequeueInputImage). In the former case, the Image data will be moved to this ImageWriter. Note that the Image properties (size, format, strides, etc.) must be the same as the properties of the images dequeued from this ImageWriter. In the latter case, the application has filled the input image with data. This method then passes the filled buffer to the downstream consumer. In both cases, it's up to the caller to ensure that the Image timestamp (in nanoseconds) is correctly set, as the downstream component may want to use it to indicate the Image data capture time.

After this method is called and the downstream consumer consumes and releases the Image, an OnImageReleasedListener#onImageReleased callback will fire. The application can use this callback to avoid sending Images faster than the downstream consumer processing rate in steady state.

Passing in an Image from some other component (e.g. an ImageReader) requires a free input Image from this ImageWriter as the destination. In this case, this call will block, as #dequeueInputImage does, if there are no free Images available. To avoid blocking, the application should ensure that there is at least one free Image available in this ImageWriter before calling this method.

After this call, the input Image is no longer valid for further access, as if the Image is Image#close closed. Attempting to access the ByteBuffer ByteBuffers returned by an earlier Image.Plane#getBuffer Plane#getBuffer call will result in an IllegalStateException.

Java documentation for android.media.ImageWriter.queueInputImage(android.media.Image).

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