From 50fcf64058f657e457b6b7d72fd6afdaf825e40e Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 25 Mar 2026 18:06:17 +0100 Subject: [PATCH] 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. --- doc/dox/programs/pw-cat.1.md | 3 +++ src/tools/pw-cat.c | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/doc/dox/programs/pw-cat.1.md b/doc/dox/programs/pw-cat.1.md index b681e54a1..8ec02c711 100644 --- a/doc/dox/programs/pw-cat.1.md +++ b/doc/dox/programs/pw-cat.1.md @@ -124,6 +124,9 @@ Set a node target (default auto). The value can be: - \: 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) diff --git a/src/tools/pw-cat.c b/src/tools/pw-cat.c index 6b1916d55..c8ee6a195 100644 --- a/src/tools/pw-cat.c +++ b/src/tools/pw-cat.c @@ -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;