Kể từ ngày 27 tháng 3 năm 2025, bạn nên sử dụng android-latest-release
thay vì aosp-main
để xây dựng và đóng góp cho AOSP. Để biết thêm thông tin, hãy xem phần Thay đổi đối với AOSP.
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Tài liệu tham khảo về cấu trúc camera2_stream_ops
#include <
camera2.h
>
Giao diện hàng đợi luồng hình ảnh đầu ra. Một nhóm các phương thức này được cung cấp cho thiết bị HAL trong allocate_stream() và được dùng để tương tác với hàng đợi bộ đệm gralloc cho luồng đó. Các hàm này có thể không được gọi cho đến khi allocate_stream trả về.
Định nghĩa tại dòng
73
của tệp
camera2.h
.
Trả về vùng đệm vào hàng đợi mà không đánh dấu vùng đệm đó là đã đầy.
Định nghĩa tại dòng
102
của tệp
camera2.h
.
Lấy vùng đệm để điền từ hàng đợi. Kích thước và định dạng của vùng đệm được cố định cho một luồng nhất định (được xác định trong allocate_stream) và bước phải được truy vấn từ mô-đun gralloc của nền tảng. Vùng đệm gralloc sẽ được phân bổ dựa trên cờ sử dụng do allocate_stream cung cấp và sẽ được khoá để sử dụng.
Định nghĩa tại dòng
81
của tệp
camera2.h
.
int(* enqueue_buffer)(const struct
camera2_stream_ops
*w, int64_t timestamp, buffer_handle_t *buffer)
|
Đẩy vùng đệm đã điền vào luồng để người dùng sử dụng.
Dấu thời gian thể hiện thời gian bắt đầu phơi sáng của hàng đầu tiên của hình ảnh; dấu thời gian phải được lấy từ một đồng hồ đơn điệu và được đo bằng nano giây. Bạn không cần so sánh dấu thời gian giữa các máy ảnh hoặc các thực thể liên tiếp của cùng một máy ảnh. Tuy nhiên, các giá trị này phải tương đương nhau giữa các luồng từ cùng một máy ảnh. Nếu một lần chụp tạo ra vùng đệm cho nhiều luồng, thì mỗi luồng phải có cùng dấu thời gian cho vùng đệm đó và dấu thời gian đó phải khớp với dấu thời gian trong siêu dữ liệu khung đầu ra.
Định nghĩa tại dòng
96
của tệp
camera2.h
.
int(* set_crop)(const struct
camera2_stream_ops
*w, int left, int top, int right, int bottom)
|
Đặt cửa sổ cắt cho các vùng đệm được thêm vào hàng đợi sau đó. Các tham số được đo bằng pixel so với chiều rộng và chiều cao của vùng đệm.
Định nghĩa tại dòng
108
của tệp
camera2.h
.
Tài liệu cho cấu trúc này được tạo từ tệp sau:
-
hardware/libhardware/include/hardware/
camera2.h
Nội dung và mã mẫu trên trang này phải tuân thủ các giấy phép như mô tả trong phần Giấy phép nội dung. Java và OpenJDK là nhãn hiệu hoặc nhãn hiệu đã đăng ký của Oracle và/hoặc đơn vị liên kết của Oracle.
Cập nhật lần gần đây nhất: 2025-07-27 UTC.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-07-27 UTC."],[],[],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)"]]