+ +
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 © 2024 Wim Taymans */ |
| 3 | /* SPDX-License-Identifier: MIT */ |
| 4 | |
| 5 | #ifndef SPA_FILTER_GRAPH_H |
| 6 | #define SPA_FILTER_GRAPH_H |
| 7 | |
| 8 | #include <sys/types.h> |
| 9 | |
| 10 | #include <spa/utils/defs.h> |
| 11 | #include <spa/utils/hook.h> |
| 12 | #include <spa/pod/builder.h> |
| 13 | |
| 14 | #ifdef __cplusplus |
| 15 | extern "C" { |
| 16 | #endif |
| 17 | |
| 18 | #ifndef SPA_API_FILTER_GRAPH |
| 19 | #ifdef SPA_API_IMPL |
| 20 | #define SPA_API_FILTER_GRAPH SPA_API_IMPL |
| 21 | #else |
| 22 | #define SPA_API_FILTER_GRAPH static inline |
| 23 | #endif |
| 24 | #endif |
| 25 | |
| 26 | /** \defgroup spa_filter_graph Filter Graph |
| 27 | * a graph of filters |
| 28 | */ |
| 29 | |
| 30 | /** |
| 31 | * \addtogroup spa_filter_graph |
| 32 | * \{ |
| 33 | */ |
| 34 | |
| 35 | /** |
| 36 | * A graph of filters |
| 37 | */ |
| 38 | #define SPA_TYPE_INTERFACE_FilterGraph SPA_TYPE_INFO_INTERFACE_BASE "FilterGraph" |
| 39 | |
| 40 | #define SPA_VERSION_FILTER_GRAPH 0 |
| 41 | struct spa_filter_graph { struct spa_interface iface; }; |
| 42 | |
| 43 | struct spa_filter_graph_info { |
| 44 | uint32_t n_inputs; |
| 45 | uint32_t n_outputs; |
| 46 | |
| 47 | #define SPA_FILTER_GRAPH_CHANGE_MASK_FLAGS (1u<<0) |
| 48 | #define SPA_FILTER_GRAPH_CHANGE_MASK_PROPS (1u<<1) |
| 49 | uint64_t change_mask; |
| 50 | |
| 51 | uint64_t flags; |
| 52 | struct spa_dict *props; |
| 53 | }; |
| 54 | |
| 55 | struct spa_filter_graph_events { |
| 56 | #define SPA_VERSION_FILTER_GRAPH_EVENTS 0 |
| 57 | uint32_t version; |
| 58 | |
| 59 | void (*info) (void *object, const struct spa_filter_graph_info *info); |
| 60 | |
| 61 | void (*apply_props) (void *object, enum spa_direction direction, const struct spa_pod *props); |
| 62 | |
| 63 | void (*props_changed) (void *object, enum spa_direction direction); |
| 64 | }; |
| 65 | |
| 66 | struct spa_filter_graph_methods { |
| 67 | #define SPA_VERSION_FILTER_GRAPH_METHODS 0 |
| 68 | uint32_t version; |
| 69 | |
| 70 | int (*add_listener) (void *object, |
| 71 | struct spa_hook *listener, |
| 72 | const struct spa_filter_graph_events *events, |
| 73 | void *data); |
| 74 | |
| 75 | int (*enum_prop_info) (void *object, uint32_t idx, struct spa_pod_builder *b, |
| 76 | struct spa_pod **param); |
| 77 | int (*get_props) (void *object, struct spa_pod_builder *b, struct spa_pod **props); |
| 78 | int (*set_props) (void *object, enum spa_direction direction, const struct spa_pod *props); |
| 79 | |
| 80 | int (*activate) (void *object, const struct spa_dict *props); |
| 81 | int (*deactivate) (void *object); |
| 82 | |
| 83 | int (*reset) (void *object); |
| 84 | |
| 85 | int (*process) (void *object, const void *in[], void *out[], uint32_t n_samples); |
| 86 | }; |
| 87 | |
| 88 | SPA_API_FILTER_GRAPH int spa_filter_graph_add_listener(struct spa_filter_graph *object, |
| 89 | struct spa_hook *listener, |
| 90 | const struct spa_filter_graph_events *events, void *data) |
| 91 | { |
| 92 | return spa_api_method_r(int, -ENOTSUP, |
| 93 | spa_filter_graph, &object->iface, add_listener, 0, listener, |
| 94 | events, data); |
| 95 | } |
| 96 | |
| 97 | SPA_API_FILTER_GRAPH int spa_filter_graph_enum_prop_info(struct spa_filter_graph *object, |
| 98 | uint32_t idx, struct spa_pod_builder *b, struct spa_pod **param) |
| 99 | { |
| 100 | return spa_api_method_r(int, -ENOTSUP, |
| 101 | spa_filter_graph, &object->iface, enum_prop_info, 0, idx, b, param); |
| 102 | } |
| 103 | SPA_API_FILTER_GRAPH int spa_filter_graph_get_props(struct spa_filter_graph *object, |
| 104 | struct spa_pod_builder *b, struct spa_pod **props) |
| 105 | { |
| 106 | return spa_api_method_r(int, -ENOTSUP, |
| 107 | spa_filter_graph, &object->iface, get_props, 0, b, props); |
| 108 | } |
| 109 | |
| 110 | SPA_API_FILTER_GRAPH int spa_filter_graph_set_props(struct spa_filter_graph *object, |
| 111 | enum spa_direction direction, const struct spa_pod *props) |
| 112 | { |
| 113 | return spa_api_method_r(int, -ENOTSUP, |
| 114 | spa_filter_graph, &object->iface, set_props, 0, direction, props); |
| 115 | } |
| 116 | |
| 117 | SPA_API_FILTER_GRAPH int spa_filter_graph_activate(struct spa_filter_graph *object, const struct spa_dict *props) |
| 118 | { |
| 119 | return spa_api_method_r(int, -ENOTSUP, |
| 120 | spa_filter_graph, &object->iface, activate, 0, props); |
| 121 | } |
| 122 | SPA_API_FILTER_GRAPH int spa_filter_graph_deactivate(struct spa_filter_graph *object) |
| 123 | { |
| 124 | return spa_api_method_r(int, -ENOTSUP, |
| 125 | spa_filter_graph, &object->iface, deactivate, 0); |
| 126 | } |
| 127 | |
| 128 | SPA_API_FILTER_GRAPH int spa_filter_graph_reset(struct spa_filter_graph *object) |
| 129 | { |
| 130 | return spa_api_method_r(int, -ENOTSUP, |
| 131 | spa_filter_graph, &object->iface, reset, 0); |
| 132 | } |
| 133 | |
| 134 | SPA_API_FILTER_GRAPH int spa_filter_graph_process(struct spa_filter_graph *object, |
| 135 | const void *in[], void *out[], uint32_t n_samples) |
| 136 | { |
| 137 | return spa_api_method_r(int, -ENOTSUP, |
| 138 | spa_filter_graph, &object->iface, process, 0, in, out, n_samples); |
| 139 | } |
| 140 | |
| 141 | /** |
| 142 | * \} |
| 143 | */ |
| 144 | |
| 145 | #ifdef __cplusplus |
| 146 | } /* extern "C" */ |
| 147 | #endif |
| 148 | |
| 149 | #endif /* SPA_FILTER_GRAPH_H */ |
| 150 |