החל מ-27 במרץ 2025, מומלץ להשתמש ב-android-latest-release
במקום ב-aosp-main
כדי ליצור תרומות ל-AOSP. מידע נוסף זמין במאמר שינויים ב-AOSP.
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
עזרה בנושא המבנה camera2_request_queue_src_ops
#include <
camera2.h
>
פרוטוקול של תור בקשות קלט:
המסגרת מכילה את התור ואת התוכן שלו. בהתחלה, התור ריק.
-
כשמאגר המטא-נתונים הראשון מועבר לתור, המסגרת שולחת אות למכשיר באמצעות קריאה ל-notify_request_queue_not_empty().
-
אחרי קבלת ההודעה notify_request_queue_not_empty, המכשיר צריך להפעיל את dequeue() ברגע שהוא מוכן לטפל במאגר הבא.
-
אחרי שהמכשיר מעבד מאגר ומוכן למאגר הבא, הוא צריך לבצע קריאה חוזרת ל-dequeue() במקום להמתין להתראה. אם אין מאגרים זמינים, הפונקציה dequeue() תחזיר את הערך NULL. לאחר מכן, כשמאגר זמין, המסגרת צריכה לקרוא שוב ל-notify_request_queue_not_empty(). אם המכשיר מקבל חזרה NULL מ-dequeue, הוא לא צריך לשלוח שוב שאילתה לתור עד שמתקבלת מהמקור קריאה ל-notify_request_queue_not_empty().
-
אם המכשיר קורא לפונקציה buffer_count() ומקבל 0, זה לא אומר שהמסגרת תספק קריאה ל-notify_request_queue_not_empty(). המסגרת תספק התראה כזו רק אחרי שהמכשיר יקבל ערך NULL מ-dequeue, או בהפעלה הראשונית.
-
הקריאה dequeue() בתגובה ל-notify_request_queue_not_empty() עשויה להיות באותו שרשור כמו הקריאה notify_request_queue_not_empty(), ועשויה להתבצע מתוך הקריאה notify.
-
צריך להחזיר את כל מאגרי הבקשות שהוצאו מהתור למסגרת באמצעות קריאה ל-free_request, כולל במקרים של שגיאות, בקשה לניקוי המכשיר או כשהמכשיר נכבה.
ההגדרה מופיעה בשורה
220
בקובץ
camera2.h
.
אחזור מאגר מטא-נתונים מהמסגרת. הפונקציה מחזירה את הערך OK אם אין שגיאה. אם התור ריק, הפונקציה מחזירה NULL במאגר. במקרה כזה, המכשיר צריך להמתין להודעה notify_request_queue_not_empty() לפני שינסה שוב להסיר את הבקשה מהתור. מאגרים שנוצרים בדרך הזו צריך להחזיר למסגרת באמצעות
free_request()
.
ההגדרה מופיעה בשורה
237
בקובץ
camera2.h
.
החזרת מאגר מטא-נתונים למסגרת אחרי השימוש בו, או אם מתרחשת שגיאה או כיבוי.
ההגדרה מופיעה בשורה
243
בקובץ
camera2.h
.
אחזור המספר של מאגרי הבקשות בהמתנה בתור. יכול להיות שהערך CAMERA2_REQUEST_QUEUE_IS_BOTTOMLESS יופיע אם מוגדרת כרגע בקשה חוזרת (בקשת סטרימינג). לקריאה לשיטה הזו אין השפעה על הקריאה של ה-framework לשיטה notify_request_queue_not_empty().
ההגדרה מופיעה בשורה
228
בקובץ
camera2.h
.
התיעוד של המבנה הזה נוצר מהקובץ הבא:
-
hardware/libhardware/include/hardware/
camera2.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: camera2_request_queue_src_ops Struct Reference\n\ncamera2_request_queue_src_ops Struct Reference\n==============================================\n\n[Data Fields](#pub-attribs) \ncamera2_request_queue_src_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(\\* | [request_count](/reference/hal/structcamera2__request__queue__src__ops#a19ec09251038ee392fedcaeb68ede229) )(const struct [camera2_request_queue_src_ops](/reference/hal/structcamera2__request__queue__src__ops) \\*q) |\n| ||\n| int(\\* | [dequeue_request](/reference/hal/structcamera2__request__queue__src__ops#a79adee987dbd6a8ea0cfab81c89ae579) )(const struct [camera2_request_queue_src_ops](/reference/hal/structcamera2__request__queue__src__ops) \\*q, [camera_metadata_t](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera_common.h) \\*\\*buffer) |\n| ||\n| int(\\* | [free_request](/reference/hal/structcamera2__request__queue__src__ops#aa45ae2fd2aedf1843378e213e65a66f8) )(const struct [camera2_request_queue_src_ops](/reference/hal/structcamera2__request__queue__src__ops) \\*q, [camera_metadata_t](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera_common.h) \\*old_buffer) |\n| ||\n\n\nDetailed Description\n--------------------\n\n\nRequest input queue protocol:\n\n\nThe framework holds the queue and its contents. At start, the queue is empty.\n\n1. When the first metadata buffer is placed into the queue, the framework signals the device by calling notify_request_queue_not_empty().\n2. After receiving notify_request_queue_not_empty, the device must call dequeue() once it's ready to handle the next buffer.\n3. Once the device has processed a buffer, and is ready for the next buffer, it must call dequeue() again instead of waiting for a notification. If there are no more buffers available, dequeue() will return NULL. After this point, when a buffer becomes available, the framework must call notify_request_queue_not_empty() again. If the device receives a NULL return from dequeue, it does not need to query the queue again until a notify_request_queue_not_empty() call is received from the source.\n4. If the device calls buffer_count() and receives 0, this does not mean that the framework will provide a notify_request_queue_not_empty() call. The framework will only provide such a notification after the device has received a NULL from dequeue, or on initial startup.\n5. The dequeue() call in response to notify_request_queue_not_empty() may be on the same thread as the notify_request_queue_not_empty() call, and may be performed from within the notify call.\n6. All dequeued request buffers must be returned to the framework by calling free_request, including when errors occur, a device flush is requested, or when the device is shutting down.\n\n\nDefinition at line\n[220](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(\\* dequeue_request)(const struct [camera2_request_queue_src_ops](/reference/hal/structcamera2__request__queue__src__ops) \\*q, [camera_metadata_t](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera_common.h) \\*\\*buffer) |\n\n\nGet a metadata buffer from the framework. Returns OK if there is no error. If the queue is empty, returns NULL in buffer. In that case, the device must wait for a notify_request_queue_not_empty() message before attempting to dequeue again. Buffers obtained in this way must be returned to the framework with\n[free_request()](/reference/hal/structcamera2__request__queue__src__ops#aa45ae2fd2aedf1843378e213e65a66f8)\n.\n\n\nDefinition at line\n[237](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(\\* free_request)(const struct [camera2_request_queue_src_ops](/reference/hal/structcamera2__request__queue__src__ops) \\*q, [camera_metadata_t](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/camera_common.h) \\*old_buffer) |\n\n\nReturn a metadata buffer to the framework once it has been used, or if an error or shutdown occurs.\n\n\nDefinition at line\n[243](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(\\* request_count)(const struct [camera2_request_queue_src_ops](/reference/hal/structcamera2__request__queue__src__ops) \\*q) |\n\n\nGet the count of request buffers pending in the queue. May return CAMERA2_REQUEST_QUEUE_IS_BOTTOMLESS if a repeating request (stream request) is currently configured. Calling this method has no effect on whether the notify_request_queue_not_empty() method will be called by the framework.\n\n\nDefinition at line\n[228](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)"]]