tools: add -C | --monitor to pw-cat

It sets the stream.capture.sink property which makes a record stream
capture from a sink monitor instead.
This commit is contained in:
Wim Taymans 2026-03-25 18:06:17 +01:00
parent 9eeb2f1930
commit 50fcf64058
2 changed files with 10 additions and 2 deletions

View file

@ -124,6 +124,9 @@ Set a node target (default auto). The value can be:
- <b>\<id\></b>: The object.serial or the node.name of a target node
\endparblock
\par -C | \--monitor
In recording mode, record from monitor ports.
\par \--latency=VALUE\[*units*\]
\parblock
Set the node latency (default 100ms)

View file

@ -1125,9 +1125,9 @@ enum {
};
#ifdef HAVE_PW_CAT_FFMPEG_INTEGRATION
#define OPTIONS "hvprmdosR:P:q:aM:n:c"
#define OPTIONS "hvprmdosR:P:q:aM:n:cC"
#else
#define OPTIONS "hvprmdsR:P:q:aM:n:c"
#define OPTIONS "hvprmdsR:P:q:aM:n:cC"
#endif
static const struct option long_options[] = {
@ -1168,6 +1168,7 @@ static const struct option long_options[] = {
{ "force-midi", required_argument, NULL, 'M' },
{ "sample-count", required_argument, NULL, 'n' },
{ "midi-clip", no_argument, NULL, 'c' },
{ "monitor", no_argument, NULL, 'C' },
{ NULL, 0, NULL, 0 }
};
@ -1192,6 +1193,7 @@ static void show_usage(const char *name, bool is_error)
" --media-role Set media role (default %s)\n"
" --target Set node target serial or name (default %s)\n"
" 0 means don't link\n"
" -C --monitor Capture monitor ports (in recording mode)\n"
" --latency Set node latency (default %s)\n"
" Xunit (unit = s, ms, us, ns)\n"
" or direct samples (256)\n"
@ -2342,6 +2344,9 @@ int main(int argc, char *argv[])
case 'c':
data.data_type = TYPE_MIDI2;
break;
case 'C':
pw_properties_set(data.props, PW_KEY_STREAM_CAPTURE_SINK, "true");
break;
case OPT_LISTFORMATS:
list_formats(&data);
return EXIT_SUCCESS;