自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
camera3_callback_ops 結構體參考資料
#include <
camera3.h
>
檔案第 2397 行的定義:
2397
camera3.h
。
notify:
HAL 觸發的非同步通知回呼,觸發原因有很多。僅適用於與影格擷取無關的資訊,或需要特定時間的資訊。訊息結構的擁有權仍屬於 HAL,且 msg 只需要在這項呼叫期間有效。
多個執行緒可能會同時呼叫
notify()
。
<= CAMERA_DEVICE_API_VERSION_3_1:
HAL 必須先傳送特定要求曝光開始的通知,才能對該要求進行第一次
process_capture_result()
呼叫。
>= CAMERA_DEVICE_API_VERSION_3_2:
在透過 SHUTTER
notify()
呼叫收到曝光開始時間戳記 (或重新處理要求輸入圖片的曝光開始時間戳記) 之前,傳送至架構的緩衝區不會分派至應用程式層。強烈建議盡快發送此呼叫。
成效規定:
這是非封鎖式呼叫。架構會在 5 毫秒內傳回這項呼叫。
第 2499 行的定義
2499
檔案
camera3.h
。
process_capture_result:
將擷取完成的結果傳送至架構。
process_capture_result()
HAL 可能會針對單一擷取要求多次叫用此函式。舉例來說,這項功能可讓中繼資料和低解析度緩衝區在一次呼叫中傳回,而後續呼叫則可傳回後續處理的 JPEG 緩衝區 (如有)。每次呼叫都必須包含要求傳回中繼資料或緩衝區的影格編號。
完整結果的元件 (緩衝區或中繼資料) 只能包含在一個 process_capture_result 呼叫中。即使發生錯誤導致部分輸出內容無法產生,HAL 仍須在其中一個 process_capture_result 呼叫中,為每個要求傳回每個串流的緩衝區和結果中繼資料。不得呼叫
process_capture_result()
,且不得使用輸出緩衝區或結果中繼資料。
單一結果的中繼資料和緩衝區傳回順序不重要,但特定串流的緩衝區必須依先進先出 (FIFO) 順序傳回。因此,串流 A 的要求 5 緩衝區一律必須在串流 A 的要求 6 緩衝區之前傳回。結果中繼資料也適用這項規定,要求 5 的中繼資料必須先傳回,要求 6 的中繼資料才能傳回。
不過,不同串流彼此獨立,因此串流 A 的要求 5 緩衝區可能會在串流 B 的要求 6 緩衝區之後傳回,這是可接受且預期的情況。串流 B 的要求 6 結果中繼資料可能會在串流 A 的要求 5 緩衝區之前傳回,這也是可接受的情況。
HAL 會保留結果結構的擁有權,而這項結構只需要在這項呼叫期間有效即可存取。架構會在這次呼叫傳回前,複製所需的所有內容。
輸出緩衝區還不需要填入資料,架構會等待串流緩衝區發布同步圍欄,再讀取緩衝區資料。因此,即使部分或所有輸出緩衝區仍在填入資料,HAL 也應盡快呼叫這個方法。HAL 必須在每個 output_buffers 串流緩衝區項目中加入有效的發布同步圍欄,如果該串流緩衝區已填滿,則加入 -1。
如果無法為要求建構結果緩衝區,HAL 應傳回空白的中繼資料緩衝區,但仍須提供輸出緩衝區及其同步圍欄。此外,必須使用 ERROR_RESULT 訊息呼叫
notify()
。
如果無法填滿輸出緩衝區,其狀態欄位必須設為 STATUS_ERROR。此外,
notify()
必須使用 ERROR_BUFFER 訊息呼叫。
如果整個擷取作業都失敗,仍須呼叫這個方法,將輸出緩衝區傳回架構。所有緩衝區狀態都應為 STATUS_ERROR,且結果中繼資料應為空白緩衝區。此外,必須使用 ERROR_REQUEST 訊息呼叫
notify()
。在這種情況下,不應傳送個別的 ERROR_RESULT/ERROR_BUFFER 訊息。
成效規定:
這是非封鎖式呼叫。架構會在 5 毫秒內傳回這項呼叫。
管線延遲時間 (定義請參閱 S7) 應小於或等於 4 個影格間隔,且不得超過 8 個影格間隔。
第 2466 行的定義
2466
檔案
camera3.h
。
這個結構的說明文件是從下列檔案產生:
-
hardware/libhardware/include/hardware/
camera3.h
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[[["容易理解","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 (世界標準時間)。"],[],[],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)"]]