+ +
2da5fe7 OpenAVX v0.2.0 - High-performance open-standard IP audio and video transport suite
saifmukhtar · 2026-11-24
main
| 1 | /* Simple Plugin API */ |
| 2 | /* SPDX-FileCopyrightText: Copyright © 2023 Wim Taymans */ |
| 3 | /* SPDX-License-Identifier: MIT */ |
| 4 | |
| 5 | #ifndef SPA_PARAM_LATENY_H |
| 6 | #define SPA_PARAM_LATENY_H |
| 7 | |
| 8 | #include <spa/param/param.h> |
| 9 | |
| 10 | #ifdef __cplusplus |
| 11 | extern "C" { |
| 12 | #endif |
| 13 | |
| 14 | /** |
| 15 | * \addtogroup spa_param |
| 16 | * \{ |
| 17 | */ |
| 18 | |
| 19 | /** |
| 20 | * Properties for SPA_TYPE_OBJECT_ParamLatency |
| 21 | * |
| 22 | * The latency indicates: |
| 23 | * |
| 24 | * - for playback: time delay between start of a graph cycle, and the rendering of |
| 25 | * the first sample of that cycle in audio output. |
| 26 | * |
| 27 | * - for capture: time delay between start of a graph cycle, and the first sample |
| 28 | * of that cycle having occurred in audio input. |
| 29 | * |
| 30 | * For physical output/input, the latency is intended to correspond to the |
| 31 | * rendering/capture of physical audio, including hardware internal rendering delay. |
| 32 | * |
| 33 | * The latency values are adjusted by \ref SPA_PROP_latencyOffsetNsec or |
| 34 | * SPA_PARAM_ProcessLatency, if present. (e.g. for ALSA this is used to adjust for |
| 35 | * the internal hardware latency). |
| 36 | */ |
| 37 | enum spa_param_latency { |
| 38 | SPA_PARAM_LATENCY_START, |
| 39 | SPA_PARAM_LATENCY_direction, /**< direction, input/output (Id enum spa_direction) */ |
| 40 | SPA_PARAM_LATENCY_minQuantum, /**< min latency relative to quantum (Float) */ |
| 41 | SPA_PARAM_LATENCY_maxQuantum, /**< max latency relative to quantum (Float) */ |
| 42 | SPA_PARAM_LATENCY_minRate, /**< min latency (Int) relative to graph rate */ |
| 43 | SPA_PARAM_LATENCY_maxRate, /**< max latency (Int) relative to graph rate */ |
| 44 | SPA_PARAM_LATENCY_minNs, /**< min latency (Long) in nanoseconds */ |
| 45 | SPA_PARAM_LATENCY_maxNs, /**< max latency (Long) in nanoseconds */ |
| 46 | }; |
| 47 | |
| 48 | /** helper structure for managing latency objects */ |
| 49 | struct spa_latency_info { |
| 50 | enum spa_direction direction; |
| 51 | float min_quantum; |
| 52 | float max_quantum; |
| 53 | int32_t min_rate; |
| 54 | int32_t max_rate; |
| 55 | int64_t min_ns; |
| 56 | int64_t max_ns; |
| 57 | }; |
| 58 | |
| 59 | #define SPA_LATENCY_INFO(dir,...) ((struct spa_latency_info) { .direction = (dir), ## __VA_ARGS__ }) |
| 60 | #define SPA_LATENCY_INFO_UNSET(dir) SPA_LATENCY_INFO(dir, \ |
| 61 | .min_quantum = FLT_MAX, .max_quantum = FLT_MIN, \ |
| 62 | .min_rate = INT32_MAX, .max_rate = INT32_MIN, \ |
| 63 | .min_ns = INT64_MAX, .max_ns = INT64_MIN) |
| 64 | |
| 65 | /** |
| 66 | * Properties for SPA_TYPE_OBJECT_ParamProcessLatency |
| 67 | * |
| 68 | * The processing latency indicates logical time delay between a sample in an input port, |
| 69 | * and a corresponding sample in an output port, relative to the graph time. |
| 70 | */ |
| 71 | enum spa_param_process_latency { |
| 72 | SPA_PARAM_PROCESS_LATENCY_START, |
| 73 | SPA_PARAM_PROCESS_LATENCY_quantum, /**< latency relative to quantum (Float) */ |
| 74 | SPA_PARAM_PROCESS_LATENCY_rate, /**< latency (Int) relative to graph rate */ |
| 75 | SPA_PARAM_PROCESS_LATENCY_ns, /**< latency (Long) in nanoseconds */ |
| 76 | }; |
| 77 | |
| 78 | /** Helper structure for managing process latency objects */ |
| 79 | struct spa_process_latency_info { |
| 80 | float quantum; |
| 81 | int32_t rate; |
| 82 | int64_t ns; |
| 83 | }; |
| 84 | |
| 85 | #define SPA_PROCESS_LATENCY_INFO_INIT(...) ((struct spa_process_latency_info) { __VA_ARGS__ }) |
| 86 | |
| 87 | /** |
| 88 | * \} |
| 89 | */ |
| 90 | |
| 91 | #ifdef __cplusplus |
| 92 | } /* extern "C" */ |
| 93 | #endif |
| 94 | |
| 95 | #endif /* SPA_PARAM_LATENY_H */ |