PipeWire 1.4.8

Loading...
Searching...
No Matches
filter-graph.h
Go to the documentation of this file.
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#ifdef __cplusplus
9 extern "C" {
10#endif
11
12#include <sys/types.h>
13
14#include <spa/utils/defs.h>
15#include <spa/utils/hook.h>
16#include <spa/pod/builder.h>
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
29
34
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
builder.h
spa/pod/builder.h
defs.h
spa/utils/defs.h
SPA_API_FILTER_GRAPH
#define SPA_API_FILTER_GRAPH
Definition filter-graph.h:29
spa_filter_graph_process
SPA_API_FILTER_GRAPH int spa_filter_graph_process(struct spa_filter_graph *object, const void *in[], void *out[], uint32_t n_samples)
Definition filter-graph.h:147
spa_filter_graph_enum_prop_info
SPA_API_FILTER_GRAPH int spa_filter_graph_enum_prop_info(struct spa_filter_graph *object, uint32_t idx, struct spa_pod_builder *b, struct spa_pod **param)
Definition filter-graph.h:110
spa_filter_graph_reset
SPA_API_FILTER_GRAPH int spa_filter_graph_reset(struct spa_filter_graph *object)
Definition filter-graph.h:141
spa_filter_graph_set_props
SPA_API_FILTER_GRAPH int spa_filter_graph_set_props(struct spa_filter_graph *object, enum spa_direction direction, const struct spa_pod *props)
Definition filter-graph.h:123
spa_filter_graph_deactivate
SPA_API_FILTER_GRAPH int spa_filter_graph_deactivate(struct spa_filter_graph *object)
Definition filter-graph.h:135
spa_filter_graph_activate
SPA_API_FILTER_GRAPH int spa_filter_graph_activate(struct spa_filter_graph *object, const struct spa_dict *props)
Definition filter-graph.h:130
spa_filter_graph_get_props
SPA_API_FILTER_GRAPH int spa_filter_graph_get_props(struct spa_filter_graph *object, struct spa_pod_builder *b, struct spa_pod **props)
Definition filter-graph.h:116
spa_filter_graph_add_listener
SPA_API_FILTER_GRAPH int spa_filter_graph_add_listener(struct spa_filter_graph *object, struct spa_hook *listener, const struct spa_filter_graph_events *events, void *data)
Definition filter-graph.h:101
spa_api_method_r
#define spa_api_method_r(rtype, def, type, o, method, version,...)
Definition hook.h:291
spa_direction
spa_direction
Definition defs.h:106
hook.h
spa/utils/hook.h
spa_dict
Definition dict.h:51
spa_filter_graph_events
Definition filter-graph.h:66
spa_filter_graph_events::version
uint32_t version
Definition filter-graph.h:69
spa_filter_graph_events::apply_props
void(* apply_props)(void *object, enum spa_direction direction, const struct spa_pod *props)
Definition filter-graph.h:73
spa_filter_graph_info
Definition filter-graph.h:52
spa_filter_graph_info::change_mask
uint64_t change_mask
Definition filter-graph.h:60
spa_filter_graph_info::n_outputs
uint32_t n_outputs
Definition filter-graph.h:54
spa_filter_graph_info::flags
uint64_t flags
Definition filter-graph.h:62
spa_filter_graph_info::n_inputs
uint32_t n_inputs
Definition filter-graph.h:53
spa_filter_graph_methods
Definition filter-graph.h:78
spa_filter_graph_methods::process
int(* process)(void *object, const void *in[], void *out[], uint32_t n_samples)
Definition filter-graph.h:98
spa_filter_graph_methods::version
uint32_t version
Definition filter-graph.h:81
spa_filter_graph_methods::activate
int(* activate)(void *object, const struct spa_dict *props)
Definition filter-graph.h:93
spa_filter_graph_methods::set_props
int(* set_props)(void *object, enum spa_direction direction, const struct spa_pod *props)
Definition filter-graph.h:91
spa_filter_graph_methods::reset
int(* reset)(void *object)
Definition filter-graph.h:96
spa_filter_graph_methods::enum_prop_info
int(* enum_prop_info)(void *object, uint32_t idx, struct spa_pod_builder *b, struct spa_pod **param)
Definition filter-graph.h:88
spa_filter_graph_methods::deactivate
int(* deactivate)(void *object)
Definition filter-graph.h:94
spa_filter_graph_methods::get_props
int(* get_props)(void *object, struct spa_pod_builder *b, struct spa_pod **props)
Definition filter-graph.h:90
spa_filter_graph_methods::add_listener
int(* add_listener)(void *object, struct spa_hook *listener, const struct spa_filter_graph_events *events, void *data)
Definition filter-graph.h:83
spa_filter_graph
Definition filter-graph.h:50
spa_filter_graph::iface
struct spa_interface iface
Definition filter-graph.h:50
spa_hook
A hook, contains the structure with functions and the data passed to the functions.
Definition hook.h:427
spa_interface
Definition hook.h:148
spa_pod_builder
Definition builder.h:63
spa_pod
Definition pod.h:43