#include <stdio.h>
#include <errno.h>
#include <math.h>
#include <signal.h>
struct data;
struct port {
struct data *data;
};
struct data {
struct port *in_port;
struct port *out_port;
};
{
struct data *data = userdata;
float *in, *out;
if (in == NULL || out == NULL)
return;
memcpy(out, in, n_samples * sizeof(float));
}
.process = on_process,
};
static void do_quit(void *userdata, int signal_number)
{
struct data *data = userdata;
}
int main(int argc, char *argv[])
{
struct data data = { 0, };
uint8_t buffer[1024];
"audio-filter",
NULL),
&filter_events,
sizeof(struct port),
NULL),
NULL, 0);
sizeof(struct port),
NULL),
NULL, 0);
));
params, 1) < 0) {
fprintf(stderr, "can't connect\n");
return -1;
}
return 0;
}
int pw_filter_connect(struct pw_filter *filter, enum pw_filter_flags flags, const struct spa_pod **params, uint32_t n_params)
Connect a filter for processing.
Definition: filter.c:1583
void * pw_filter_add_port(struct pw_filter *filter, enum pw_direction direction, enum pw_filter_port_flags flags, size_t port_data_size, struct pw_properties *props, const struct spa_pod **params, uint32_t n_params)
add a port to the filter, returns user data of port_data_size.
Definition: filter.c:1814
#define PW_VERSION_FILTER_EVENTS
Definition: src/pipewire/filter.h:66
void pw_filter_destroy(struct pw_filter *filter)
Destroy a filter
Definition: filter.c:1420
void * pw_filter_get_dsp_buffer(void *port_data, uint32_t n_samples)
Get a data pointer to the buffer data.
Definition: filter.c:2018
struct pw_filter * pw_filter_new_simple(struct pw_loop *loop, const char *name, struct pw_properties *props, const struct pw_filter_events *events, void *data)
Definition: filter.c:1316
@ PW_FILTER_FLAG_RT_PROCESS
call process from the realtime thread
Definition: src/pipewire/filter.h:108
@ PW_FILTER_PORT_FLAG_MAP_BUFFERS
mmap the buffers except DmaBuf
Definition: src/pipewire/filter.h:129
#define PW_KEY_PORT_NAME
port name
Definition: src/pipewire/keys.h:275
#define PW_KEY_MEDIA_TYPE
Media.
Definition: src/pipewire/keys.h:431
#define PW_KEY_MEDIA_ROLE
Role: Movie, Music, Camera, Screen, Communication, Game, Notification, DSP, Production,...
Definition: src/pipewire/keys.h:437
#define PW_KEY_MEDIA_CATEGORY
Media Category: Playback, Capture, Duplex, Monitor, Manager.
Definition: src/pipewire/keys.h:434
#define PW_KEY_FORMAT_DSP
format related properties
Definition: src/pipewire/keys.h:472
#define pw_log_trace(...)
Definition: src/pipewire/log.h:146
#define pw_loop_add_signal(l,...)
Definition: src/pipewire/loop.h:63
int pw_main_loop_quit(struct pw_main_loop *loop)
Quit a main loop.
Definition: main-loop.c:105
void pw_main_loop_destroy(struct pw_main_loop *loop)
Destroy a loop.
Definition: main-loop.c:70
int pw_main_loop_run(struct pw_main_loop *loop)
Run a main loop.
Definition: main-loop.c:119
struct pw_main_loop * pw_main_loop_new(const struct spa_dict *props)
Create a new main loop.
Definition: main-loop.c:60
struct pw_loop * pw_main_loop_get_loop(struct pw_main_loop *loop)
Get the loop implementation.
Definition: main-loop.c:93
void pw_init(int *argc, char **argv[])
Initialize PipeWire.
Definition: pipewire.c:555
void pw_deinit(void)
Deinitialize PipeWire.
Definition: pipewire.c:668
#define PW_DIRECTION_OUTPUT
Definition: port.h:50
#define PW_DIRECTION_INPUT
Definition: port.h:48
struct pw_properties * pw_properties_new(const char *key,...) 1
Make a new properties object.
Definition: properties.c:84
static struct spa_pod * spa_process_latency_build(struct spa_pod_builder *builder, uint32_t id, const struct spa_process_latency_info *info)
Definition: latency-utils.h:131
#define SPA_PROCESS_LATENCY_INFO_INIT(...)
Definition: latency.h:66
@ SPA_PARAM_ProcessLatency
processing latency, a SPA_TYPE_OBJECT_ParamProcessLatency
Definition: param.h:46
#define SPA_POD_BUILDER_INIT(buffer, size)
Definition: builder.h:62
#define SPA_NSEC_PER_MSEC
Definition: defs.h:233
Events for a filter.
Definition: src/pipewire/filter.h:64
uint64_t duration
duration of current cycle
Definition: io.h:135
The position information adds extra meaning to the raw clock times.
Definition: io.h:279
struct spa_io_clock clock
clock position of driver, always valid and read only
Definition: io.h:280
void * data
Definition: builder.h:54