mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
filter-graph: add a debug node
Add a node that logs audio or control data to the log.
This commit is contained in:
parent
958ae36717
commit
5bf3a0c454
2 changed files with 66 additions and 1 deletions
|
|
@ -17,6 +17,7 @@
|
|||
#include <spa/support/cpu.h>
|
||||
#include <spa/support/log.h>
|
||||
#include <spa/plugins/audioconvert/resample.h>
|
||||
#include <spa/debug/log.h>
|
||||
|
||||
#include "audio-plugin.h"
|
||||
|
||||
|
|
@ -2453,6 +2454,58 @@ static const struct spa_fga_descriptor sqrt_desc = {
|
|||
.cleanup = builtin_cleanup,
|
||||
};
|
||||
|
||||
/* debug */
|
||||
static void debug_run(void * Instance, unsigned long SampleCount)
|
||||
{
|
||||
struct builtin *impl = Instance;
|
||||
float *in = impl->port[0], *out = impl->port[1];
|
||||
float *control = impl->port[2], *notify = impl->port[3];
|
||||
|
||||
if (in != NULL) {
|
||||
spa_debug_log_mem(impl->log, SPA_LOG_LEVEL_INFO, 0, in, SampleCount * sizeof(float));
|
||||
if (out != NULL)
|
||||
memcpy(out, in, SampleCount * sizeof(float));
|
||||
}
|
||||
if (control != NULL) {
|
||||
spa_log_info(impl->log, "control: %f", control[0]);
|
||||
if (notify != NULL)
|
||||
notify[0] = control[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static struct spa_fga_port debug_ports[] = {
|
||||
{ .index = 0,
|
||||
.name = "In",
|
||||
.flags = SPA_FGA_PORT_INPUT | SPA_FGA_PORT_AUDIO,
|
||||
},
|
||||
{ .index = 1,
|
||||
.name = "Out",
|
||||
.flags = SPA_FGA_PORT_OUTPUT | SPA_FGA_PORT_AUDIO,
|
||||
},
|
||||
{ .index = 2,
|
||||
.name = "Control",
|
||||
.flags = SPA_FGA_PORT_INPUT | SPA_FGA_PORT_CONTROL,
|
||||
},
|
||||
{ .index = 3,
|
||||
.name = "Notify",
|
||||
.flags = SPA_FGA_PORT_OUTPUT | SPA_FGA_PORT_CONTROL,
|
||||
},
|
||||
};
|
||||
|
||||
static const struct spa_fga_descriptor debug_desc = {
|
||||
.name = "debug",
|
||||
.flags = SPA_FGA_DESCRIPTOR_SUPPORTS_NULL_DATA,
|
||||
|
||||
.n_ports = SPA_N_ELEMENTS(debug_ports),
|
||||
.ports = debug_ports,
|
||||
|
||||
.instantiate = builtin_instantiate,
|
||||
.connect_port = builtin_connect_port,
|
||||
.run = debug_run,
|
||||
.cleanup = builtin_cleanup,
|
||||
};
|
||||
|
||||
static const struct spa_fga_descriptor * builtin_descriptor(unsigned long Index)
|
||||
{
|
||||
switch(Index) {
|
||||
|
|
@ -2510,6 +2563,8 @@ static const struct spa_fga_descriptor * builtin_descriptor(unsigned long Index)
|
|||
return &abs_desc;
|
||||
case 26:
|
||||
return &sqrt_desc;
|
||||
case 27:
|
||||
return &debug_desc;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -580,7 +580,7 @@ extern struct spa_handle_factory spa_filter_graph_factory;
|
|||
* and that can be used to control the processing of the audio. Some of these ports
|
||||
* contain values in LUFS, or "Loudness Units relative to Full Scale". These are
|
||||
* negative values, closer to 0 is louder. You can use the lufs2gain plugin to
|
||||
* convert this value to again to adjust a volume (See below).
|
||||
* convert this value to a gain to adjust a volume (See below).
|
||||
*
|
||||
* "Momentary LUFS" contains the momentary loudness measurement with a 400ms window
|
||||
* and 75% overlap. It works mostly like an R.M.S. meter.
|
||||
|
|
@ -638,6 +638,16 @@ extern struct spa_handle_factory spa_filter_graph_factory;
|
|||
* control value "Gain". This gain can be used as input for the builtin `linear`
|
||||
* node, for example, to adust the gain.
|
||||
*
|
||||
* ### debug
|
||||
*
|
||||
* The debug plugin can be used to debug the audio and control data of other plugins.
|
||||
*
|
||||
* It has an "In" input port and an "Out" output data ports. The data from "In" will
|
||||
* be copied to "Out" and the data will be dumped into the INFO log.
|
||||
*
|
||||
* There is also a "Control" input port and an "Notify" output control ports. The
|
||||
* control from "Control" will be copied to "Notify" and the control value will be
|
||||
* dumped into the INFO log.
|
||||
*
|
||||
* ## General options
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue