Stay organized with collections
Save and categorize content based on your preferences.
AImageReader_BufferRemovedListener
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
Declared in media/NdkImageReader.h
void * AImageReader_BufferRemovedListener::context
Optional application context passed as the first parameter of the callback.
onBufferRemoved
Declared in media/NdkImageReader.h
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
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-11-19 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-11-19 UTC."],[],[],null,["# AImageReader_BufferRemovedListener Struct Reference\n\nAImageReader_BufferRemovedListener\n==================================\n\nA listener to the AHardwareBuffer removal event, use [AImageReader_setBufferRemovedListener](/ndk/reference/group/media#group___media_1ga067af6087a020665eaf4eb6c4f756977) to register the listener object to AImageReader.\n\nSummary\n-------\n\n| ### Public attributes ||\n|--------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [context](#struct_a_image_reader___buffer_removed_listener_1a8ae00d53f42caa3f84d72826af8e4dee) | `void *` Optional application context passed as the first parameter of the callback. |\n| [onBufferRemoved](#struct_a_image_reader___buffer_removed_listener_1a682ff381aaa5d75600b26c783916e9a9) | [AImageReader_BufferRemovedCallback](/ndk/reference/group/media#group___media_1gac6332947dfaeb120850f24681a2194dd) This callback is called when an old [AHardwareBuffer](/ndk/reference/group/a-hardware-buffer#group___a_hardware_buffer) is about to be removed from the image reader. |\n\nPublic attributes\n-----------------\n\n### context\n\nDeclared in `media/NdkImageReader.h` \n\n```scdoc\nvoid * AImageReader_BufferRemovedListener::context\n``` \nOptional application context passed as the first parameter of the callback. \n\n### onBufferRemoved\n\nDeclared in `media/NdkImageReader.h` \n\n```scdoc\nAImageReader_BufferRemovedCallback AImageReader_BufferRemovedListener::onBufferRemoved\n``` \nThis callback is called when an old [AHardwareBuffer](/ndk/reference/group/a-hardware-buffer#group___a_hardware_buffer) is about to be removed from the image reader.\n\nNote that registering this callback is optional unless the user holds on extra reference to [AHardwareBuffer](/ndk/reference/group/a-hardware-buffer#group___a_hardware_buffer) returned from [AImage_getHardwareBuffer](/ndk/reference/group/media#group___media_1ga6579db49a016bffeeb25c1b632e35b63) by calling [AHardwareBuffer_acquire](/ndk/reference/group/a-hardware-buffer#group___a_hardware_buffer_1gab4bd20d385520934e627aac0aa3832ac) or creating external graphic objects, such as EglImage, from it.\n\nIf the callback is registered, the [AImageReader](/ndk/reference/group/media#group___media_1gaf14475eb37e14fc67030462d88ab1d28) will hold on the last of its references to the [AHardwareBuffer](/ndk/reference/group/a-hardware-buffer#group___a_hardware_buffer) 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](/ndk/reference/group/a-hardware-buffer#group___a_hardware_buffer_1ga671cf3ec426591b6c8b895591667f6e6).\n\n\n**See also:**\n[AHardwareBuffer_release](/ndk/reference/group/a-hardware-buffer#group___a_hardware_buffer_1ga671cf3ec426591b6c8b895591667f6e6)\n**See also:**\n[AImage_getHardwareBuffer](/ndk/reference/group/media#group___media_1ga6579db49a016bffeeb25c1b632e35b63)"]]