自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
camera2_stream_ops 結構參考資料
#include <
camera2.h
>
輸出圖片串流佇列介面。這些方法會在 allocate_stream() 中提供給 HAL 裝置,用於與該串流的 gralloc 緩衝區佇列互動。只有在 allocate_stream 傳回後,才能呼叫這些方法。
定義位於檔案
camera2.h
的第
73
行。
取得要從佇列填入的緩衝區。緩衝區的大小和格式會針對特定串流 (在 allocate_stream 中定義) 固定,而步幅應從平台 gralloc 模組中查詢。系統會根據 allocate_stream 提供的用法標記分配 gralloc 緩衝區,並將其鎖定供使用。
定義位於檔案
camera2.h
的
81
行。
int(* enqueue_buffer)(const struct
camera2_stream_ops
*w, int64_t timestamp, buffer_handle_t *buffer)
|
將已填滿的緩衝區推送至供使用者使用的串流。
時間戳記代表圖像第一列曝光開始的時間,必須來自單調時鐘,並以奈秒為單位。不同相機之間或同一相機的連續例項之間,不必比較時間戳記。不過,同一部攝影機的串流必須可相互比較。如果單次擷取作業會為多個串流產生緩衝區,則每個串流的緩衝區都必須有相同的時間戳記,且該時間戳記必須與輸出影格中繼資料中的時間戳記相符。
定義位於檔案
camera2.h
的
96
行。
int(* set_crop)(const struct
camera2_stream_ops
*w, int left, int top, int right, int bottom)
|
為後續排入佇列的緩衝區設定裁剪視窗。參數是以相對於緩衝區寬度和高度的像素為單位。
定義位於檔案
camera2.h
的第 108 行
。
這個結構體的說明文件是由下列檔案產生:
-
hardware/libhardware/include/hardware/
camera2.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: camera2_stream_ops Struct Reference\n\ncamera2_stream_ops Struct Reference\n===================================\n\n[Data Fields](#pub-attribs) \ncamera2_stream_ops Struct Reference \n\n`\n#include \u003c\n`[camera2.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera2.h)`\n\u003e\n`\n\n|--------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Data Fields ----------- ||\n| int(\\* | [dequeue_buffer](/reference/hal/structcamera2__stream__ops#ad51917100a74cf70e552c51e24407cbb) )(const struct [camera2_stream_ops](/reference/hal/structcamera2__stream__ops) \\*w, buffer_handle_t \\*\\*buffer) |\n| ||\n| int(\\* | [enqueue_buffer](/reference/hal/structcamera2__stream__ops#a724a4193411f3278ad9ad3f04ab983f1) )(const struct [camera2_stream_ops](/reference/hal/structcamera2__stream__ops) \\*w, int64_t timestamp, buffer_handle_t \\*buffer) |\n| ||\n| int(\\* | [cancel_buffer](/reference/hal/structcamera2__stream__ops#ae3aa87ba699c53b8960b6529eb01ba83) )(const struct [camera2_stream_ops](/reference/hal/structcamera2__stream__ops) \\*w, buffer_handle_t \\*buffer) |\n| ||\n| int(\\* | [set_crop](/reference/hal/structcamera2__stream__ops#a3c2102f917bfe992de1967f9f8abc1d6) )(const struct [camera2_stream_ops](/reference/hal/structcamera2__stream__ops) \\*w, int left, int top, int right, int bottom) |\n| ||\n\n\nDetailed Description\n--------------------\n\n\nOutput image stream queue interface. A set of these methods is provided to the HAL device in allocate_stream(), and are used to interact with the gralloc buffer queue for that stream. They may not be called until after allocate_stream returns.\n\n\nDefinition at line\n[73](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera2.h)\nof file\n[camera2.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera2.h)\n.\n\nField Documentation\n-------------------\n\n\n|-----------------------------------------------------------------------------------------------------------------------------------|\n| int(\\* cancel_buffer)(const struct [camera2_stream_ops](/reference/hal/structcamera2__stream__ops) \\*w, buffer_handle_t \\*buffer) |\n\n\nReturn a buffer to the queue without marking it as filled.\n\n\nDefinition at line\n[102](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera2.h)\nof file\n[camera2.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera2.h)\n.\n\n|--------------------------------------------------------------------------------------------------------------------------------------|\n| int(\\* dequeue_buffer)(const struct [camera2_stream_ops](/reference/hal/structcamera2__stream__ops) \\*w, buffer_handle_t \\*\\*buffer) |\n\n\nGet a buffer to fill from the queue. The size and format of the buffer are fixed for a given stream (defined in allocate_stream), and the stride should be queried from the platform gralloc module. The gralloc buffer will have been allocated based on the usage flags provided by allocate_stream, and will be locked for use.\n\n\nDefinition at line\n[81](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera2.h)\nof file\n[camera2.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera2.h)\n.\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------------|\n| int(\\* enqueue_buffer)(const struct [camera2_stream_ops](/reference/hal/structcamera2__stream__ops) \\*w, int64_t timestamp, buffer_handle_t \\*buffer) |\n\n\nPush a filled buffer to the stream to be used by the consumer.\n\n\nThe timestamp represents the time at start of exposure of the first row of the image; it must be from a monotonic clock, and is measured in nanoseconds. The timestamps do not need to be comparable between different cameras, or consecutive instances of the same camera. However, they must be comparable between streams from the same camera. If one capture produces buffers for multiple streams, each stream must have the same timestamp for that buffer, and that timestamp must match the timestamp in the output frame metadata.\n\n\nDefinition at line\n[96](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera2.h)\nof file\n[camera2.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera2.h)\n.\n\n|----------------------------------------------------------------------------------------------------------------------------------------------|\n| int(\\* set_crop)(const struct [camera2_stream_ops](/reference/hal/structcamera2__stream__ops) \\*w, int left, int top, int right, int bottom) |\n\n\nSet the crop window for subsequently enqueued buffers. The parameters are measured in pixels relative to the buffer width and height.\n\n\nDefinition at line\n[108](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera2.h)\nof file\n[camera2.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera2.h)\n.\n\n*** ** * ** ***\n\nThe documentation for this struct was generated from the following file:\n\n- hardware/libhardware/include/hardware/ [camera2.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera2.h)"]]