از 27 مارس 2025، توصیه می کنیم از android-latest-release
به جای aosp-main
برای ساختن و کمک به AOSP استفاده کنید. برای اطلاعات بیشتر، به تغییرات AOSP مراجعه کنید.
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
مرجع ساختار camera3_stream_buffer
#include < camera3.h >
camera3_stream_buffer_t:
یک بافر واحد از یک جریان camera3. این شامل یک دسته برای جریان اصلی خود، دسته به خود بافر gralloc و حصارهای همگام سازی است.
بافر مشخص نمی کند که از آن برای ورودی یا خروجی استفاده شود. که بر اساس نوع جریان اصلی آن و نحوه ارسال بافر به دستگاه HAL تعیین می شود.
تعریف در خط 1755 فایل camera3.h .
حصار همگام سازی برای این بافر. قبل از تلاش برای خواندن یا نوشتن در این بافر، HAL باید روی این حصار fd منتظر بماند.
چارچوب ممکن است روی -1 تنظیم شود تا نشان دهد که هیچ انتظاری برای این بافر لازم نیست.
هنگامی که HAL یک بافر خروجی را با process_capture_result() به فریم ورک برمی گرداند، acce_fence باید روی -1 تنظیم شود. اگر HAL به دلیل خطایی در پر کردن بافر، هرگز در acce_fence منتظر نماند، هنگام فراخوانی process_capture_result() HAL باید release_fence بافر را به عنوان purchase_fence که توسط فریمورک به آن ارسال میشود تنظیم کند. این به چارچوب اجازه می دهد تا قبل از استفاده مجدد از بافر روی حصار منتظر بماند.
برای بافرهای ورودی، HAL نباید فیلد purchase_fence را در طول فراخوانی process_capture_request () تغییر دهد.
>= CAMERA_DEVICE_API_VERSION_3_2:
وقتی HAL یک بافر ورودی را با process_capture_result() به فریم ورک برمی گرداند، acce_fence باید روی -1 تنظیم شود. اگر HAL به دلیل یک خطا هرگز روی حصار جذب بافر ورودی منتظر نماند، حصارهای همگامسازی باید به همان روشی که برای بافرهای خروجی استفاده میشوند، مدیریت شوند.
تعریف در خط 1800 فایل camera3.h .
حصار همگام سازی انتشار برای این بافر. HAL باید این حصار را هنگام بازگرداندن بافرها به فریمورک تنظیم کند، یا بنویسد -1 تا نشان دهد که برای این بافر نیازی به انتظار نیست.
برای بافرهای خروجی، حصارها باید در آرایه output_buffers تنظیم شوند که به process_capture_result().
<= CAMERA_DEVICE_API_VERSION_3_1:
برای بافر ورودی، حصار آزادسازی باید با فراخوانی ()process_capture_request تنظیم شود.
>= CAMERA_DEVICE_API_VERSION_3_2:
برای بافر ورودی، حصارها باید در input_buffer تنظیم شوند که به process_capture_result().
پس از سیگنال دادن به release_fence برای این بافر، HAL نباید هیچ تلاش دیگری برای دسترسی به این بافر انجام دهد زیرا مالکیت به طور کامل به چارچوب منتقل شده است.
اگر حصار -1 مشخص شده باشد، مالکیت این بافر بلافاصله پس از فراخوانی process_capture_result به عقب منتقل میشود.
تعریف در خط 1827 فایل camera3.h .
وضعیت فعلی بافر، یکی از مقادیر camera3_buffer_status_t. فریم ورک بافرهایی را به HAL که در حالت خطا هستند ارسال نمی کند. در صورتی که یک بافر توسط HAL پر نشود، هنگام بازگشت به چارچوب با process_capture_result() باید وضعیت آن روی CAMERA3_BUFFER_STATUS_ERROR تنظیم شود.
تعریف در خط 1773 فایل camera3.h .
دسته جریانی که این بافر با آن مرتبط است
تعریف در خط 1759 فایل camera3.h .
مستندات این ساختار از فایل زیر تولید شده است:
- hardware/libhardware/include/hardware/ camera3.h
محتوا و نمونه کدها در این صفحه مشمول پروانههای توصیفشده در پروانه محتوا هستند. جاوا و OpenJDK علامتهای تجاری یا علامتهای تجاری ثبتشده Oracle و/یا وابستههای آن هستند.
تاریخ آخرین بهروزرسانی 2025-07-29 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","easyToUnderstand","thumb-up"],["مشکلم را برطرف کرد","solvedMyProblem","thumb-up"],["غیره","otherUp","thumb-up"]],[["اطلاعاتی که نیاز دارم وجود ندارد","missingTheInformationINeed","thumb-down"],["بیشازحد پیچیده/ مراحل بسیار زیاد","tooComplicatedTooManySteps","thumb-down"],["قدیمی","outOfDate","thumb-down"],["مشکل ترجمه","translationIssue","thumb-down"],["مشکل کد / نمونهها","samplesCodeIssue","thumb-down"],["غیره","otherDown","thumb-down"]],["تاریخ آخرین بهروزرسانی 2025-07-29 بهوقت ساعت هماهنگ جهانی."],[],[],null,["# Android Hardware Abstraction Layer: camera3_stream_buffer Struct Reference\n\ncamera3_stream_buffer Struct Reference\n======================================\n\n[Data Fields](#pub-attribs) \ncamera3_stream_buffer Struct Reference \n\n`\n#include \u003c\n`[camera3.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera3.h)`\n\u003e\n`\n\n|---------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------|\n| Data Fields ----------- ||\n| [camera3_stream_t](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera3.h) \\* | [stream](/reference/hal/structcamera3__stream__buffer#afaf6c85f165b4180fe63affae0232dad) |\n| ||\n| buffer_handle_t \\* | [buffer](/reference/hal/structcamera3__stream__buffer#ab87cddef201db642e7972d124d741dc2) |\n| ||\n| int | [status](/reference/hal/structcamera3__stream__buffer#a6e27f49150e9a14580fb313cc2777e00) |\n| ||\n| int | [acquire_fence](/reference/hal/structcamera3__stream__buffer#a5d59e0770b54af97a9fe151da5688719) |\n| ||\n| int | [release_fence](/reference/hal/structcamera3__stream__buffer#a248e5f7856e4c2877715fc9fda8d8ba8) |\n| ||\n\n\nDetailed Description\n--------------------\n\n\ncamera3_stream_buffer_t:\n\n\nA single buffer from a camera3 stream. It includes a handle to its parent stream, the handle to the gralloc buffer itself, and sync fences\n\n\nThe buffer does not specify whether it is to be used for input or output; that is determined by its parent stream type and how the buffer is passed to the HAL device.\n\n\nDefinition at line\n[1755](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera3.h)\nof file\n[camera3.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera3.h)\n.\n\nField Documentation\n-------------------\n\n\n|-------------------|\n| int acquire_fence |\n\n\nThe acquire sync fence for this buffer. The HAL must wait on this fence fd before attempting to read from or write to this buffer.\n\n\nThe framework may be set to -1 to indicate that no waiting is necessary for this buffer.\n\n\nWhen the HAL returns an output buffer to the framework with process_capture_result(), the acquire_fence must be set to -1. If the HAL never waits on the acquire_fence due to an error in filling a buffer, when calling process_capture_result() the HAL must set the release_fence of the buffer to be the acquire_fence passed to it by the framework. This will allow the framework to wait on the fence before reusing the buffer.\n\n\nFor input buffers, the HAL must not change the acquire_fence field during the process_capture_request() call.\n\n\n\\\u003e= CAMERA_DEVICE_API_VERSION_3_2:\n\n\nWhen the HAL returns an input buffer to the framework with process_capture_result(), the acquire_fence must be set to -1. If the HAL never waits on input buffer acquire fence due to an error, the sync fences should be handled similarly to the way they are handled for output buffers.\n\n\nDefinition at line\n[1800](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera3.h)\nof file\n[camera3.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera3.h)\n.\n\n|--------------------------|\n| buffer_handle_t\\* buffer |\n\n\nThe native handle to the buffer\n\n\nDefinition at line\n[1764](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera3.h)\nof file\n[camera3.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera3.h)\n.\n\n|-------------------|\n| int release_fence |\n\n\nThe release sync fence for this buffer. The HAL must set this fence when returning buffers to the framework, or write -1 to indicate that no waiting is required for this buffer.\n\n\nFor the output buffers, the fences must be set in the output_buffers array passed to process_capture_result().\n\n\n\\\u003c= CAMERA_DEVICE_API_VERSION_3_1:\n\n\nFor the input buffer, the release fence must be set by the process_capture_request() call.\n\n\n\\\u003e= CAMERA_DEVICE_API_VERSION_3_2:\n\n\nFor the input buffer, the fences must be set in the input_buffer passed to process_capture_result().\n\n\nAfter signaling the release_fence for this buffer, the HAL should not make any further attempts to access this buffer as the ownership has been fully transferred back to the framework.\n\n\nIf a fence of -1 was specified then the ownership of this buffer is transferred back immediately upon the call of process_capture_result.\n\n\nDefinition at line\n[1827](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera3.h)\nof file\n[camera3.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera3.h)\n.\n\n|------------|\n| int status |\n\n\nCurrent state of the buffer, one of the camera3_buffer_status_t values. The framework will not pass buffers to the HAL that are in an error state. In case a buffer could not be filled by the HAL, it must have its status set to CAMERA3_BUFFER_STATUS_ERROR when returned to the framework with process_capture_result().\n\n\nDefinition at line\n[1773](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera3.h)\nof file\n[camera3.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera3.h)\n.\n\n|----------------------------------------------------------------------------------------------------------------------------------|\n| [camera3_stream_t](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera3.h) \\* stream |\n\n\nThe handle of the stream this buffer is associated with\n\n\nDefinition at line\n[1759](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera3.h)\nof file\n[camera3.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera3.h)\n.\n\n*** ** * ** ***\n\nThe documentation for this struct was generated from the following file:\n\n- hardware/libhardware/include/hardware/ [camera3.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera3.h)"]]