Param: add process latency param and info

This commit is contained in:
Wim Taymans 2021-06-22 16:10:13 +02:00
parent 8c77713a7b
commit 79866a93cd
7 changed files with 97 additions and 4 deletions

View file

@ -27,6 +27,9 @@
#include <math.h>
#include <signal.h>
#include <spa/pod/builder.h>
#include <spa/param/latency-utils.h>
#include <pipewire/pipewire.h>
#include <pipewire/filter.h>
@ -87,6 +90,9 @@ static void do_quit(void *userdata, int signal_number)
int main(int argc, char *argv[])
{
struct data data = { 0, };
const struct spa_pod *params[1];
uint8_t buffer[1024];
struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
pw_init(&argc, &argv);
@ -138,11 +144,18 @@ int main(int argc, char *argv[])
NULL),
NULL, 0);
params[0] = spa_process_latency_build(&b,
SPA_PARAM_ProcessLatency,
&SPA_PROCESS_LATENCY_INFO_INIT(
.ns = 10 * SPA_NSEC_PER_MSEC
));
/* Now connect this filter. We ask that our process function is
* called in a realtime thread. */
if (pw_filter_connect(data.filter,
PW_FILTER_FLAG_RT_PROCESS,
NULL, 0) < 0) {
params, 1) < 0) {
fprintf(stderr, "can't connect\n");
return -1;
}