自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
camera2_jpeg_blob 結構參考
#include <
camera2.h
>
輸出串流中壓縮 JPEG 緩衝區的傳輸標頭。
如要擷取 JPEG 圖片,請使用像素格式 HAL_PIXEL_FORMAT_BLOB 建立串流,並將靜態中繼資料欄位 android.jpeg.maxSize 用作緩衝區大小。由於壓縮的 JPEG 圖片大小會有所不同,HAL 需要在輸出串流緩衝區中使用這個結構體,納入壓縮圖片的最終大小。JPEG blob ID 欄位必須設為 CAMERA2_JPEG_BLOB_ID。
傳輸標頭應位於 JPEG 輸出串流緩衝區的結尾。也就是說,jpeg_blob_id 必須從 byte[android.jpeg.maxSize - sizeof(camera2_jpeg_blob)] 開始。任何使用此傳輸標頭的 HAL 都必須在 android.jpeg.maxSize 中納入此標頭。JPEG 資料本身會從位元組 [0] 開始,長度應為 jpeg_size 位元組。
定義位於檔案
camera2.h
的第
146
行。
這個結構體的說明文件是由下列檔案產生:
-
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_jpeg_blob Struct Reference\n\ncamera2_jpeg_blob Struct Reference\n==================================\n\n[Data Fields](#pub-attribs) \ncamera2_jpeg_blob 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| uint16_t | [jpeg_blob_id](/reference/hal/structcamera2__jpeg__blob#a8eecd9b8a99477acdd51629ad25470fe) |\n| ||\n| uint32_t | [jpeg_size](/reference/hal/structcamera2__jpeg__blob#a2dcb603ff79e35e18e814e85f75c83e5) |\n| ||\n\n\nDetailed Description\n--------------------\n\n\nTransport header for compressed JPEG buffers in output streams.\n\n\nTo capture JPEG images, a stream is created using the pixel format HAL_PIXEL_FORMAT_BLOB, and the static metadata field android.jpeg.maxSize is used as the buffer size. Since compressed JPEG images are of variable size, the HAL needs to include the final size of the compressed image using this structure inside the output stream buffer. The JPEG blob ID field must be set to CAMERA2_JPEG_BLOB_ID.\n\n\nTransport header should be at the end of the JPEG output stream buffer. That means the jpeg_blob_id must start at byte\\[android.jpeg.maxSize - sizeof(camera2_jpeg_blob)\\]. Any HAL using this transport header must account for it in android.jpeg.maxSize. The JPEG data itself starts at byte\\[0\\] and should be jpeg_size bytes long.\n\n\nDefinition at line\n[146](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| uint16_t jpeg_blob_id |\n\n\nDefinition at line\n[147](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| uint32_t jpeg_size |\n\n\nDefinition at line\n[148](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)"]]