AImageReader_BufferRemovedListener

#include <NdkImageReader.h>

A listener to the AHardwareBuffer removal event, use AImageReader_setBufferRemovedListener to register the listener object to AImageReader.

Summary

Public attributes

context
void *
Optional application context passed as the first parameter of the callback.
onBufferRemoved
This callback is called when an old AHardwareBuffer is about to be removed from the image reader.

Public attributes

context

void * AImageReader_BufferRemovedListener::context

Optional application context passed as the first parameter of the callback.

onBufferRemoved

AImageReader_BufferRemovedCallback AImageReader_BufferRemovedListener::onBufferRemoved

This callback is called when an old AHardwareBuffer is about to be removed from the image reader.

Note that registering this callback is optional unless the user holds on extra reference to AHardwareBuffer returned from AImage_getHardwareBuffer by calling AHardwareBuffer_acquire or creating external graphic objects, such as EglImage, from it.

If the callback is registered, the AImageReader will hold on the last of its references to the AHardwareBuffer until this callback returns. User can use the callback to get notified that it becomes the last owner of the buffer. It is up to the user to decide to either 1) immediately release all of its references to the buffer; or 2) keep using the buffer and release it in future. Note that, if option 2 if used, user of this API is responsible to deallocate the buffer properly by calling AHardwareBuffer_release.

See also: AHardwareBuffer_release See also: AImage_getHardwareBuffer