החל מ-27 במרץ 2025, מומלץ להשתמש ב-android-latest-release
במקום ב-aosp-main
כדי ליצור תרומות ל-AOSP. מידע נוסף זמין במאמר שינויים ב-AOSP.
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
עזרה בנושא המבנה camera3_stream_buffer
#include <
camera3.h
>
camera3_stream_buffer_t:
מאגר אחד מסטרימינג של camera3. הוא כולל את ה-handle של מקור הנתונים שלו, את ה-handle של מאגר ה-gralloc עצמו ואת גדרות הסנכרון
המאגר לא מציין אם הוא ישמש לקלט או לפלט. הדבר נקבע לפי סוג הסטרימינג של ההורה שלו ועל ידי האופן שבו המאגר מועבר למכשיר ה-HAL.
ההגדרה מופיעה בשורה
1755
בקובץ
camera3.h
.
גדר הסנכרון לרכישה של המאגר הזה. ה-HAL צריך להמתין ל-fd של הגדרת המחסום לפני שהוא מנסה לקרוא מהמאגר או לכתוב אליו.
אפשר להגדיר את המסגרת ל--1 כדי לציין שאין צורך להמתין למאגר הזה.
כש-HAL מחזיר למסגרת מאגר פלט באמצעות process_capture_result(), צריך להגדיר את acquire_fence לערך -1. אם ה-HAL אף פעם לא ממתין ל-acquire_fence בגלל שגיאה במילוי מאגר, בקריאה ל-process_capture_result(), ה-HAL צריך להגדיר את release_fence של המאגר כ-acquire_fence שהועברה אליו על ידי המסגרת. כך המסגרת תוכל להמתין לפני שימוש חוזר במאגר.
במאגרי קלט, ה-HAL לא יכול לשנות את השדה acquire_fence במהלך הקריאה process_capture_request().
>= CAMERA_DEVICE_API_VERSION_3_2:
כש-HAL מחזיר למסגרת מאגר קלט באמצעות process_capture_result(), צריך להגדיר את acquire_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 לא הצליח למלא מאגר, הסטטוס שלו צריך להיות מוגדר כ-CAMERA3_BUFFER_STATUS_ERROR כשהוא מוחזר למסגרת באמצעות process_capture_result().
ההגדרה מופיעה בשורה
1773
בקובץ
camera3.h
.
הכינוי של השידור שאליו המאגר הזה משויך
ההגדרה מופיעה בשורה
1759
בקובץ
camera3.h
.
התיעוד של המבנה הזה נוצר מהקובץ הבא:
-
hardware/libhardware/include/hardware/
camera3.h
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-27 (שעון UTC).
[[["התוכן קל להבנה","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-27 (שעון UTC)."],[],[],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)"]]