lbalhar / rpms / pulseaudio

Forked from rpms/pulseaudio 3 years ago
Clone
Blob Blame History Raw
From bfdad535da00ca0a06aeafd774d3168b4f79c82c Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 22 Oct 2008 22:48:53 +0200
Subject: [PATCH] don't set the volume of pacat unless it is explicitly set

---
 src/utils/pacat.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/utils/pacat.c b/src/utils/pacat.c
index 99df5b9..ea736e2 100644
--- a/src/utils/pacat.c
+++ b/src/utils/pacat.c
@@ -57,6 +57,7 @@ static char *stream_name = NULL, *client_name = NULL, *device = NULL;
 
 static int verbose = 0;
 static pa_volume_t volume = PA_VOLUME_NORM;
+static int volume_is_set = 0;
 
 static pa_sample_spec sample_spec = {
     .format = PA_SAMPLE_S16LE,
@@ -283,7 +284,7 @@ static void context_state_callback(pa_context *c, void *userdata) {
 
             if (mode == PLAYBACK) {
                 pa_cvolume cv;
-                if ((r = pa_stream_connect_playback(stream, device, latency > 0 ? &buffer_attr : NULL, flags, pa_cvolume_set(&cv, sample_spec.channels, volume), NULL)) < 0) {
+                if ((r = pa_stream_connect_playback(stream, device, latency > 0 ? &buffer_attr : NULL, flags, volume_is_set ? pa_cvolume_set(&cv, sample_spec.channels, volume) : NULL, NULL)) < 0) {
                     fprintf(stderr, _("pa_stream_connect_playback() failed: %s\n"), pa_strerror(pa_context_errno(c)));
                     goto fail;
                 }
@@ -627,6 +628,7 @@ int main(int argc, char *argv[]) {
             case ARG_VOLUME: {
                 int v = atoi(optarg);
                 volume = v < 0 ? 0U : (pa_volume_t) v;
+                volume_is_set = 1;
                 break;
             }
 
-- 
1.6.0.3