[pulseaudio-commits] man/pacat.1.xml.in src/utils

Tanu Kaskinen tanuk at kemper.freedesktop.org
Wed Aug 14 06:23:36 PDT 2013


 man/pacat.1.xml.in |    6 ++++++
 src/utils/pacat.c  |   21 ++++++++++++++++++---
 2 files changed, 24 insertions(+), 3 deletions(-)

New commits:
commit 49f93eb2b09f3a20733dbb80c6448ee69b0c89ec
Author: Magnus Ekhall <magnus.ekhall at gmail.com>
Date:   Sun Aug 11 21:21:41 2013 +0200

    pacat: Added support for recording from one specific sink input
    
    BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=66326

diff --git a/man/pacat.1.xml.in b/man/pacat.1.xml.in
index 868e772..1c5a6c0 100644
--- a/man/pacat.1.xml.in
+++ b/man/pacat.1.xml.in
@@ -84,6 +84,12 @@ USA.
     </option>
 
     <option>
+      <p><opt>--monitor-stream</opt><arg>=INDEX</arg></p>
+
+      <optdesc><p>Record from the sink input with index INDEX.</p></optdesc>
+    </option>
+
+    <option>
       <p><opt>-n | --client-name</opt><arg>=NAME</arg></p>
 
       <optdesc><p>Specify the client name <file>paplay</file> shall pass to the server when connecting.</p></optdesc>
diff --git a/src/utils/pacat.c b/src/utils/pacat.c
index a712ccf..e1abc31 100644
--- a/src/utils/pacat.c
+++ b/src/utils/pacat.c
@@ -95,6 +95,8 @@ static int32_t latency_msec = 0, process_time_msec = 0;
 static bool raw = true;
 static int file_format = -1;
 
+static uint32_t monitor_stream = PA_INVALID_INDEX;
+
 static uint32_t cork_requests = 0;
 
 /* A shortcut for terminating the application */
@@ -508,12 +510,15 @@ static void context_state_callback(pa_context *c, void *userdata) {
                 }
 
             } else {
+                if (monitor_stream != PA_INVALID_INDEX && (pa_stream_set_monitor_stream(stream, monitor_stream) < 0)) {
+                    pa_log(_("Failed to set monitor stream: %s"), pa_strerror(pa_context_errno(c)));
+                    goto fail;
+                }
                 if (pa_stream_connect_record(stream, device, &buffer_attr, flags) < 0) {
                     pa_log(_("pa_stream_connect_record() failed: %s"), pa_strerror(pa_context_errno(c)));
                     goto fail;
                 }
             }
-
             break;
         }
 
@@ -698,7 +703,8 @@ static void help(const char *argv0) {
              "      --raw                             Record/play raw PCM data.\n"
              "      --passthrough                     passthrough data \n"
              "      --file-format[=FFORMAT]           Record/play formatted PCM data.\n"
-             "      --list-file-formats               List available file formats.\n")
+             "      --list-file-formats               List available file formats.\n"
+             "      --monitor-stream=INDEX            Record from the sink input with index INDEX.\n")
            , argv0);
 }
 
@@ -723,7 +729,8 @@ enum {
     ARG_FILE_FORMAT,
     ARG_LIST_FILE_FORMATS,
     ARG_LATENCY_MSEC,
-    ARG_PROCESS_TIME_MSEC
+    ARG_PROCESS_TIME_MSEC,
+    ARG_MONITOR_STREAM,
 };
 
 int main(int argc, char *argv[]) {
@@ -764,6 +771,7 @@ int main(int argc, char *argv[]) {
         {"list-file-formats", 0, NULL, ARG_LIST_FILE_FORMATS},
         {"latency-msec", 1, NULL, ARG_LATENCY_MSEC},
         {"process-time-msec", 1, NULL, ARG_PROCESS_TIME_MSEC},
+        {"monitor-stream", 1, NULL, ARG_MONITOR_STREAM},
         {NULL,           0, NULL, 0}
     };
 
@@ -978,6 +986,13 @@ int main(int argc, char *argv[]) {
                 ret = 0;
                 goto quit;
 
+            case ARG_MONITOR_STREAM:
+                if (pa_atou(optarg, &monitor_stream) < 0) {
+                    pa_log(_("Failed to parse the argument for --monitor-stream"));
+                    goto quit;
+                }
+                break;
+
             default:
                 goto quit;
         }



More information about the pulseaudio-commits mailing list