החל מ-27 במרץ 2025, מומלץ להשתמש ב-android-latest-release
במקום ב-aosp-main
כדי ליצור תרומות ל-AOSP. מידע נוסף זמין במאמר שינויים ב-AOSP.
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
מידע על המבנה של audio_stream_in
#include <
audio.h
>
ההגדרה מופיעה בשורה
404
בקובץ
audio.h
.
int(* get_capture_position)(const struct
audio_stream_in
*stream, int64_t *frames, int64_t *time)
|
הפונקציה מחזירה ספירה עדכנית של מספר הפריימים של האודיו שהתקבלו ואת השעה המקומית שמשויכת למספר הפריימים הזה.
frames הוא מספר הפריימים הכולל שהתקבלו. כדאי לעשות זאת בשלב מוקדם ככל האפשר בצינור עיבוד הנתונים לצילום. באופן כללי, הפריימים צריכים להיות לא שליליים ולא צריך לעבור "לאחור".
time הוא הזמן המונוטוני של השעון שבו נמדדו הפריימים. באופן כללי, הזמן צריך להיות כמות חיובית ולא יכול לנוע "לאחור".
הסטטוס המוחזר הוא 0 אם הפעולה בוצעה בהצלחה, -ENOSYS אם המכשיר לא מוכן או לא זמין או -EINVAL אם הארגומנטים הם null או לא תקינים מסיבה אחרת.
ההגדרה מופיעה בשורה
449
בקובץ
audio.h
.
הפונקציה מחזירה את מספר הפריימים שהתקבלו מהקלט שאבדו במנהל האודיו מאז הקריאה האחרונה של הפונקציה הזו. מנהל האודיו אמור לאפס את הערך ל-0 ולהתחיל את הספירה מחדש לאחר החזרת הערך הנוכחי על ידי קריאת הפונקציה הזו. אובדן כזה קורה בדרך כלל כשתהליך במרחב המשתמש חסום למשך זמן ארוך יותר מהקיבולת של מאגרי ה-buffer של מנהל האודיו.
יחידה: מספר הפריימים של אודיו בקלט
ההגדרה מופיעה בשורה
433
בקובץ
audio.h
.
ssize_t(* read)(struct
audio_stream_in
*stream, void *buffer, size_t bytes)
|
קריאת מאגר הנתונים הזמני של האודיו מהדריבר של האודיו. הפונקציה מחזירה את מספר הבייטים שקראו, או את הערך השלילי status_t. אם נקרא פריים אחד לפחות לפני השגיאה, הפונקציה read אמורה להחזיר את מספר הבייטים הזה ואז להחזיר שגיאה בקריאה הבאה.
ההגדרה מופיעה בשורה
420
בקובץ
audio.h
.
מגדירים את הגברה הקלט של מנהל האודיו. השיטה הזו מיועדת לשימוש עתידי
ההגדרה מופיעה בשורה
414
בקובץ
audio.h
.
התיעוד של המבנה הזה נוצר מהקובץ הבא:
-
hardware/libhardware/include/hardware/
audio.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: audio_stream_in Struct Reference\n\naudio_stream_in Struct Reference\n================================\n\n[Data Fields](#pub-attribs) \naudio_stream_in Struct Reference \n\n`\n#include \u003c\n`[audio.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/audio.h)`\n\u003e\n`\n\n|-----------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Data Fields ----------- ||\n| struct [audio_stream](/reference/hal/structaudio__stream) | [common](/reference/hal/structaudio__stream__in#a9975d0888d3a4eecf4f0144ea954a80f) |\n| ||\n| int(\\* | [set_gain](/reference/hal/structaudio__stream__in#a928a709953a9cf43e9594699946d968b) )(struct [audio_stream_in](/reference/hal/structaudio__stream__in) \\*stream, float gain) |\n| ||\n| ssize_t(\\* | [read](/reference/hal/structaudio__stream__in#ae29cb94a8369b1b06cdfc51b3ef3d61d) )(struct [audio_stream_in](/reference/hal/structaudio__stream__in) \\*stream, void \\*buffer, size_t bytes) |\n| ||\n| uint32_t(\\* | [get_input_frames_lost](/reference/hal/structaudio__stream__in#ac35c041acf754e3ec3e83763080e8209) )(struct [audio_stream_in](/reference/hal/structaudio__stream__in) \\*stream) |\n| ||\n| int(\\* | [get_capture_position](/reference/hal/structaudio__stream__in#a7049256b82aad74e1dc976a3d5406985) )(const struct [audio_stream_in](/reference/hal/structaudio__stream__in) \\*stream, int64_t \\*frames, int64_t \\*time) |\n| ||\n\n\nDetailed Description\n--------------------\n\n\nDefinition at line\n[404](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/audio.h)\nof file\n[audio.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/audio.h)\n.\n\nField Documentation\n-------------------\n\n\n|------------------------------------------------------------------|\n| struct [audio_stream](/reference/hal/structaudio__stream) common |\n\n\nCommon methods of the audio stream in. This\n*must*\nbe the first member of\n[audio_stream_in](/reference/hal/structaudio__stream__in)\nas users of this structure will cast a\n[audio_stream](/reference/hal/structaudio__stream)\nto\n[audio_stream_in](/reference/hal/structaudio__stream__in)\npointer in contexts where it's known the\n[audio_stream](/reference/hal/structaudio__stream)\nreferences an\n[audio_stream_in](/reference/hal/structaudio__stream__in)\n.\n\n\nDefinition at line\n[410](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/audio.h)\nof file\n[audio.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/audio.h)\n.\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------|\n| int(\\* get_capture_position)(const struct [audio_stream_in](/reference/hal/structaudio__stream__in) \\*stream, int64_t \\*frames, int64_t \\*time) |\n\n\nReturn a recent count of the number of audio frames received and the clock time associated with that frame count.\n\n\nframes is the total frame count received. This should be as early in the capture pipeline as possible. In general, frames should be non-negative and should not go \"backwards\".\n\n\ntime is the clock MONOTONIC time when frames was measured. In general, time should be a positive quantity and should not go \"backwards\".\n\n\nThe status returned is 0 on success, -ENOSYS if the device is not ready/available, or -EINVAL if the arguments are null or otherwise invalid.\n\n\nDefinition at line\n[449](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/audio.h)\nof file\n[audio.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/audio.h)\n.\n\n|---------------------------------------------------------------------------------------------------------------|\n| uint32_t(\\* get_input_frames_lost)(struct [audio_stream_in](/reference/hal/structaudio__stream__in) \\*stream) |\n\n\nReturn the amount of input frames lost in the audio driver since the last call of this function. Audio driver is expected to reset the value to 0 and restart counting upon returning the current value by this function call. Such loss typically occurs when the user space process is blocked longer than the capacity of audio driver buffers.\n\n\nUnit: the number of input audio frames\n\n\nDefinition at line\n[433](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/audio.h)\nof file\n[audio.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/audio.h)\n.\n\n|--------------------------------------------------------------------------------------------------------------------------|\n| ssize_t(\\* read)(struct [audio_stream_in](/reference/hal/structaudio__stream__in) \\*stream, void \\*buffer, size_t bytes) |\n\n\nRead audio buffer in from audio driver. Returns number of bytes read, or a negative status_t. If at least one frame was read prior to the error, read should return that byte count and then return an error in the subsequent call.\n\n\nDefinition at line\n[420](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/audio.h)\nof file\n[audio.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/audio.h)\n.\n\n|---------------------------------------------------------------------------------------------------------|\n| int(\\* set_gain)(struct [audio_stream_in](/reference/hal/structaudio__stream__in) \\*stream, float gain) |\n\n\nset the input gain for the audio driver. This method is for for future use\n\n\nDefinition at line\n[414](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/audio.h)\nof file\n[audio.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/audio.h)\n.\n\n*** ** * ** ***\n\nThe documentation for this struct was generated from the following file:\n\n- hardware/libhardware/include/hardware/ [audio.h](https://android.googlesource.com/platform/hardware/libhardware/+/master/include/hardware/audio.h)"]]