+ +
2da5fe7 OpenAVX v0.2.0 - High-performance open-standard IP audio and video transport suite
saifmukhtar · 2026-11-24
main
| 1 | /* PipeWire */ |
| 2 | /* SPDX-FileCopyrightText: Copyright © 2021 Wim Taymans <[email protected]> */ |
| 3 | /* SPDX-License-Identifier: MIT */ |
| 4 | |
| 5 | #include <spa/pod/builder.h> |
| 6 | #include <spa/utils/dict.h> |
| 7 | #include <spa/utils/hook.h> |
| 8 | #include <spa/param/audio/raw.h> |
| 9 | |
| 10 | #ifndef SPA_AUDIO_AEC_H |
| 11 | #define SPA_AUDIO_AEC_H |
| 12 | |
| 13 | #ifdef __cplusplus |
| 14 | extern "C" { |
| 15 | #endif |
| 16 | |
| 17 | #ifndef SPA_API_AUDIO_AEC |
| 18 | #ifdef SPA_API_IMPL |
| 19 | #define SPA_API_AUDIO_AEC SPA_API_IMPL |
| 20 | #else |
| 21 | #define SPA_API_AUDIO_AEC static inline |
| 22 | #endif |
| 23 | #endif |
| 24 | |
| 25 | #define SPA_TYPE_INTERFACE_AUDIO_AEC SPA_TYPE_INFO_INTERFACE_BASE "Audio:AEC" |
| 26 | |
| 27 | #define SPA_VERSION_AUDIO_AEC 1 |
| 28 | struct spa_audio_aec { |
| 29 | struct spa_interface iface; |
| 30 | const char *name; |
| 31 | const struct spa_dict *info; |
| 32 | const char *latency; |
| 33 | }; |
| 34 | |
| 35 | struct spa_audio_aec_info { |
| 36 | #define SPA_AUDIO_AEC_CHANGE_MASK_PROPS (1u<<0) |
| 37 | uint64_t change_mask; |
| 38 | |
| 39 | const struct spa_dict *props; |
| 40 | }; |
| 41 | |
| 42 | struct spa_audio_aec_events { |
| 43 | #define SPA_VERSION_AUDIO_AEC_EVENTS 0 |
| 44 | uint32_t version; /**< version of this structure */ |
| 45 | |
| 46 | /** Emitted when info changes */ |
| 47 | void (*info) (void *data, const struct spa_audio_aec_info *info); |
| 48 | }; |
| 49 | |
| 50 | struct spa_audio_aec_methods { |
| 51 | #define SPA_VERSION_AUDIO_AEC_METHODS 3 |
| 52 | uint32_t version; |
| 53 | |
| 54 | int (*add_listener) (void *object, |
| 55 | struct spa_hook *listener, |
| 56 | const struct spa_audio_aec_events *events, |
| 57 | void *data); |
| 58 | |
| 59 | int (*init) (void *object, const struct spa_dict *args, const struct spa_audio_info_raw *info); |
| 60 | int (*run) (void *object, const float *rec[], const float *play[], float *out[], uint32_t n_samples); |
| 61 | int (*set_props) (void *object, const struct spa_dict *args); |
| 62 | /* since 0.3.58, version 1:1 */ |
| 63 | int (*activate) (void *object); |
| 64 | /* since 0.3.58, version 1:1 */ |
| 65 | int (*deactivate) (void *object); |
| 66 | |
| 67 | /* version 1:2 */ |
| 68 | int (*enum_props) (void* object, int index, struct spa_pod_builder* builder); |
| 69 | int (*get_params) (void* object, struct spa_pod_builder* builder); |
| 70 | int (*set_params) (void *object, const struct spa_pod *args); |
| 71 | |
| 72 | /* version 1:3 */ |
| 73 | int (*init2) (void *object, const struct spa_dict *args, |
| 74 | struct spa_audio_info_raw *play_info, |
| 75 | struct spa_audio_info_raw *rec_info, |
| 76 | struct spa_audio_info_raw *out_info); |
| 77 | }; |
| 78 | |
| 79 | SPA_API_AUDIO_AEC int spa_audio_aec_add_listener(struct spa_audio_aec *object, |
| 80 | struct spa_hook *listener, |
| 81 | const struct spa_audio_aec_events *events, |
| 82 | void *data) |
| 83 | { |
| 84 | return spa_api_method_r(int, -ENOTSUP, |
| 85 | spa_audio_aec, &object->iface, add_listener, 0, listener, events, data); |
| 86 | } |
| 87 | |
| 88 | SPA_API_AUDIO_AEC int spa_audio_aec_init(struct spa_audio_aec *object, |
| 89 | const struct spa_dict *args, const struct spa_audio_info_raw *info) |
| 90 | { |
| 91 | return spa_api_method_r(int, -ENOTSUP, |
| 92 | spa_audio_aec, &object->iface, init, 0, args, info); |
| 93 | } |
| 94 | SPA_API_AUDIO_AEC int spa_audio_aec_run(struct spa_audio_aec *object, |
| 95 | const float *rec[], const float *play[], float *out[], uint32_t n_samples) |
| 96 | { |
| 97 | return spa_api_method_r(int, -ENOTSUP, |
| 98 | spa_audio_aec, &object->iface, run, 0, rec, play, out, n_samples); |
| 99 | } |
| 100 | SPA_API_AUDIO_AEC int spa_audio_aec_set_props(struct spa_audio_aec *object, const struct spa_dict *args) |
| 101 | { |
| 102 | return spa_api_method_r(int, -ENOTSUP, |
| 103 | spa_audio_aec, &object->iface, set_props, 0, args); |
| 104 | } |
| 105 | SPA_API_AUDIO_AEC int spa_audio_aec_activate(struct spa_audio_aec *object) |
| 106 | { |
| 107 | return spa_api_method_r(int, -ENOTSUP, |
| 108 | spa_audio_aec, &object->iface, activate, 1); |
| 109 | } |
| 110 | SPA_API_AUDIO_AEC int spa_audio_aec_deactivate(struct spa_audio_aec *object) |
| 111 | { |
| 112 | return spa_api_method_r(int, -ENOTSUP, |
| 113 | spa_audio_aec, &object->iface, deactivate, 1); |
| 114 | } |
| 115 | SPA_API_AUDIO_AEC int spa_audio_aec_enum_props(struct spa_audio_aec *object, |
| 116 | int index, struct spa_pod_builder* builder) |
| 117 | { |
| 118 | return spa_api_method_r(int, -ENOTSUP, |
| 119 | spa_audio_aec, &object->iface, enum_props, 2, index, builder); |
| 120 | } |
| 121 | SPA_API_AUDIO_AEC int spa_audio_aec_get_params(struct spa_audio_aec *object, |
| 122 | struct spa_pod_builder* builder) |
| 123 | { |
| 124 | return spa_api_method_r(int, -ENOTSUP, |
| 125 | spa_audio_aec, &object->iface, get_params, 2, builder); |
| 126 | } |
| 127 | SPA_API_AUDIO_AEC int spa_audio_aec_set_params(struct spa_audio_aec *object, |
| 128 | const struct spa_pod *args) |
| 129 | { |
| 130 | return spa_api_method_r(int, -ENOTSUP, |
| 131 | spa_audio_aec, &object->iface, set_params, 2, args); |
| 132 | } |
| 133 | SPA_API_AUDIO_AEC int spa_audio_aec_init2(struct spa_audio_aec *object, |
| 134 | const struct spa_dict *args, |
| 135 | struct spa_audio_info_raw *play_info, |
| 136 | struct spa_audio_info_raw *rec_info, |
| 137 | struct spa_audio_info_raw *out_info) |
| 138 | { |
| 139 | return spa_api_method_r(int, -ENOTSUP, |
| 140 | spa_audio_aec, &object->iface, init2, 3, args, play_info, rec_info, out_info); |
| 141 | } |
| 142 | |
| 143 | #ifdef __cplusplus |
| 144 | } /* extern "C" */ |
| 145 | #endif |
| 146 | |
| 147 | #endif /* SPA_AUDIO_AEC_H */ |