החל מ-27 במרץ 2025, מומלץ להשתמש ב-android-latest-release
במקום ב-aosp-main
כדי ליצור תרומות ל-AOSP. מידע נוסף זמין במאמר שינויים ב-AOSP.
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
חומר עזר בנושא המבנה camera3_callback_ops
#include <
camera3.h
>
ההגדרה בשורה
2397
של הקובץ
camera3.h
.
notify:
קריאה חוזרת (callback) אסינכרונית של התראה מ-HAL, מופעלת מסיבות שונות. רק למידע שלא תלוי בצילום פריים, או למידע שדורש תזמון ספציפי. הבעלות על מבנה ההודעה נשארת אצל HAL, וההודעה צריכה להיות תקפה רק למשך השיחה.
יכול להיות שכמה תהליכים יקראו ל-
notify()
בו-זמנית.
<= CAMERA_DEVICE_API_VERSION_3_1:
ההתראה על תחילת החשיפה לבקשה נתונה חייבת להישלח על ידי HAL לפני הקריאה הראשונה אל
process_capture_result()
עבור הבקשה הזו.
>= CAMERA_DEVICE_API_VERSION_3_2:
מאגרי נתונים זמניים שמועברים למסגרת לא יישלחו לשכבת האפליקציה עד שיתקבל חותמת זמן של תחילת החשיפה (או חותמת זמן של תחילת החשיפה של תמונת הקלט לבקשת עיבוד מחדש) באמצעות קריאה ל-SHUTTER
notify()
. מומלץ מאוד לשלוח את השיחה הזו בהקדם האפשרי.
דרישות הביצועים:
זו קריאה לא חוסמת. המסגרת תחזיר את השיחה הזו תוך 5 אלפיות השנייה.
ההגדרה בשורה
2499
של הקובץ
camera3.h
.
process_capture_result:
שליחת תוצאות מלוכידה שהושלמה אל המסגרת.
process_capture_result()
may be invoked multiple times by the HAL in response to a single capture request. לדוגמה, אפשר להחזיר את המטא-נתונים ואת המאגרים ברזולוציה נמוכה בקריאה אחת, ואת מאגרי ה-JPEG שעברו עיבוד בקריאה מאוחרת יותר, ברגע שהם זמינים. כל קריאה חייבת לכלול את מספר הפריימים של הבקשה שעבורה היא מחזירה מטא-נתונים או מאגרי נתונים זמניים.
רכיב (מאגר או מטא-נתונים) של התוצאה המלאה יכול להיכלל רק בקריאה אחת של process_capture_result. ממשק HAL צריך להחזיר מאגר נתונים זמני לכל זרם, ואת המטא נתונים של התוצאה, לכל בקשה באחת מהקריאות של process_capture_result, גם במקרה של שגיאות שמובילות ליצירת חלק מהפלט. אסור לבצע קריאה לשיטה
process_capture_result()
ללא מאגרי פלט או מטא-נתונים של תוצאות.
הסדר שבו מוחזרים מטא-נתונים ומאגרי נתונים זמניים לתוצאה יחידה לא משנה, אבל מאגרי נתונים זמניים של סטרימינג מסוים צריכים להיות מוחזרים בסדר FIFO. לכן, המאגר של בקשה 5 עבור זרם A תמיד צריך להיות מוחזר לפני המאגר של בקשה 6 עבור זרם A. הדבר נכון גם לגבי המטא-נתונים של התוצאה. המטא-נתונים של בקשה 5 צריכים להיות מוחזרים לפני המטא-נתונים של בקשה 6.
עם זאת, כל סטרימינג הוא עצמאי, ולכן מקובל וצפוי שהמאגר של בקשה 5 לסטרימינג A יוחזר אחרי המאגר של בקשה 6 לסטרימינג B. כמו כן, מקובל שמטא-נתונים של תוצאה של בקשה 6 לסטרימינג B יוחזרו לפני המאגר של בקשה 5 לסטרימינג A.
ה-HAL שומר על הבעלות על מבנה התוצאה, שצריך להיות תקין רק כדי לגשת אליו במהלך השיחה. המסגרת תעתיק את כל מה שהיא צריכה לפני שהקריאה הזו תחזור.
אין צורך למלא את מאגרי הפלט בשלב הזה. המסגרת תמתין לגדר הסנכרון של שחרור מאגר הזרם לפני קריאת נתוני המאגר. לכן, ה-HAL צריך לקרוא לשיטה הזו בהקדם האפשרי, גם אם חלק ממאגרי הפלט או כולם עדיין בתהליך מילוי. ה-HAL צריך לכלול גדרות תקפות של סנכרון שחרור בכל רשומה של מאגר הזרם output_buffers, או -1 אם מאגר הזרם הזה כבר מלא.
אם אי אפשר ליצור את מאגר התוצאות עבור בקשה, ה-HAL צריך להחזיר מאגר מטא-נתונים ריק, אבל עדיין לספק את מאגרי הפלט ואת גדרות הסנכרון שלהם. בנוסף,
notify()
צריך לקרוא עם הודעה מסוג ERROR_RESULT.
אם אי אפשר למלא את מאגר הפלט, צריך להגדיר את שדה הסטטוס שלו לערך STATUS_ERROR. בנוסף,
notify()
צריך להיקרא עם הודעת ERROR_BUFFER.
אם כל הלכידה נכשלה, עדיין צריך להפעיל את השיטה הזו כדי להחזיר את מאגרי הפלט למסגרת. כל סטטוסי המאגר צריכים להיות STATUS_ERROR, ומטא-נתוני התוצאה צריכים להיות מאגר ריק. בנוסף,
notify()
צריך להיקרא עם הודעת ERROR_REQUEST. במקרה כזה, אין לשלוח הודעות ERROR_RESULT/ERROR_BUFFER נפרדות.
דרישות הביצועים:
זו קריאה לא חוסמת. המסגרת תחזיר את השיחה הזו תוך 5 אלפיות השנייה.
השהיית הצינור (ראו הגדרה S7) צריכה להיות קטנה ממרווחי 4 פריימים או שווה להם, וקטנה ממרווחי 8 פריימים או שווה להם.
ההגדרה בשורה
2466
בקובץ
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_callback_ops Struct Reference\n\ncamera3_callback_ops Struct Reference\n=====================================\n\n[Data Fields](#pub-attribs) \ncamera3_callback_ops 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| void(\\* | [process_capture_result](/reference/hal/structcamera3__callback__ops#a2f7cf688a195532999b8498d6ef15e45) )(const struct [camera3_callback_ops](/reference/hal/structcamera3__callback__ops) \\*, const [camera3_capture_result_t](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera3.h) \\*result) |\n| ||\n| void(\\* | [notify](/reference/hal/structcamera3__callback__ops#a6d702d6e962f95105b984b17462619b3) )(const struct [camera3_callback_ops](/reference/hal/structcamera3__callback__ops) \\*, const [camera3_notify_msg_t](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera3.h) \\*msg) |\n| ||\n\n\nDetailed Description\n--------------------\n\n\nDefinition at line\n[2397](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| void(\\* notify)(const struct [camera3_callback_ops](/reference/hal/structcamera3__callback__ops) \\*, const [camera3_notify_msg_t](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera3.h) \\*msg) |\n\n\nnotify:\n\n\nAsynchronous notification callback from the HAL, fired for various reasons. Only for information independent of frame capture, or that require specific timing. The ownership of the message structure remains with the HAL, and the msg only needs to be valid for the duration of this call.\n\n\nMultiple threads may call\n[notify()](/reference/hal/structcamera3__callback__ops#a6d702d6e962f95105b984b17462619b3)\nsimultaneously.\n\n\n\\\u003c= CAMERA_DEVICE_API_VERSION_3_1:\n\n\nThe notification for the start of exposure for a given request must be sent by the HAL before the first call to\n[process_capture_result()](/reference/hal/structcamera3__callback__ops#a2f7cf688a195532999b8498d6ef15e45)\nfor that request is made.\n\n\n\\\u003e= CAMERA_DEVICE_API_VERSION_3_2:\n\n\nBuffers delivered to the framework will not be dispatched to the application layer until a start of exposure timestamp (or input image's start of exposure timestamp for a reprocess request) has been received via a SHUTTER\n[notify()](/reference/hal/structcamera3__callback__ops#a6d702d6e962f95105b984b17462619b3)\ncall. It is highly recommended to dispatch this call as early as possible.\n\n*** ** * ** ***\n\n\nPerformance requirements:\n\n\nThis is a non-blocking call. The framework will return this call in 5ms.\n\n\nDefinition at line\n[2499](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| void(\\* process_capture_result)(const struct [camera3_callback_ops](/reference/hal/structcamera3__callback__ops) \\*, const [camera3_capture_result_t](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera3.h) \\*result) |\n\n\nprocess_capture_result:\n\n\nSend results from a completed capture to the framework.\n[process_capture_result()](/reference/hal/structcamera3__callback__ops#a2f7cf688a195532999b8498d6ef15e45)\nmay be invoked multiple times by the HAL in response to a single capture request. This allows, for example, the metadata and low-resolution buffers to be returned in one call, and post-processed JPEG buffers in a later call, once it is available. Each call must include the frame number of the request it is returning metadata or buffers for.\n\n\nA component (buffer or metadata) of the complete result may only be included in one process_capture_result call. A buffer for each stream, and the result metadata, must be returned by the HAL for each request in one of the process_capture_result calls, even in case of errors producing some of the output. A call to\n[process_capture_result()](/reference/hal/structcamera3__callback__ops#a2f7cf688a195532999b8498d6ef15e45)\nwith neither output buffers or result metadata is not allowed.\n\n\nThe order of returning metadata and buffers for a single result does not matter, but buffers for a given stream must be returned in FIFO order. So the buffer for request 5 for stream A must always be returned before the buffer for request 6 for stream A. This also applies to the result metadata; the metadata for request 5 must be returned before the metadata for request 6.\n\n\nHowever, different streams are independent of each other, so it is acceptable and expected that the buffer for request 5 for stream A may be returned after the buffer for request 6 for stream B is. And it is acceptable that the result metadata for request 6 for stream B is returned before the buffer for request 5 for stream A is.\n\n\nThe HAL retains ownership of result structure, which only needs to be valid to access during this call. The framework will copy whatever it needs before this call returns.\n\n\nThe output buffers do not need to be filled yet; the framework will wait on the stream buffer release sync fence before reading the buffer data. Therefore, this method should be called by the HAL as soon as possible, even if some or all of the output buffers are still in being filled. The HAL must include valid release sync fences into each output_buffers stream buffer entry, or -1 if that stream buffer is already filled.\n\n\nIf the result buffer cannot be constructed for a request, the HAL should return an empty metadata buffer, but still provide the output buffers and their sync fences. In addition,\n[notify()](/reference/hal/structcamera3__callback__ops#a6d702d6e962f95105b984b17462619b3)\nmust be called with an ERROR_RESULT message.\n\n\nIf an output buffer cannot be filled, its status field must be set to STATUS_ERROR. In addition,\n[notify()](/reference/hal/structcamera3__callback__ops#a6d702d6e962f95105b984b17462619b3)\nmust be called with a ERROR_BUFFER message.\n\n\nIf the entire capture has failed, then this method still needs to be called to return the output buffers to the framework. All the buffer statuses should be STATUS_ERROR, and the result metadata should be an empty buffer. In addition,\n[notify()](/reference/hal/structcamera3__callback__ops#a6d702d6e962f95105b984b17462619b3)\nmust be called with a ERROR_REQUEST message. In this case, individual ERROR_RESULT/ERROR_BUFFER messages should not be sent.\n\n\nPerformance requirements:\n\n\nThis is a non-blocking call. The framework will return this call in 5ms.\n\n\nThe pipeline latency (see S7 for definition) should be less than or equal to 4 frame intervals, and must be less than or equal to 8 frame intervals.\n\n\nDefinition at line\n[2466](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)"]]