summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc-André Lureau <marc-andre.lureau@nokia.com>2009-04-17 22:28:26 +0300
committerMarc-André Lureau <marc-andre.lureau@nokia.com>2009-04-18 00:08:18 +0300
commitad95e65e46aba26adb125433cf9a10fe5d0275a5 (patch)
tree253e90e5be742b106b32d6c6050fc2f8f12a19f7
parent296b99ea15a5f840fe962558f4f2dfb9636c4905 (diff)
pulse: set volume when streaming directly
-rw-r--r--src/pulse.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/pulse.c b/src/pulse.c
index c3e919d..3cd4b2a 100644
--- a/src/pulse.c
+++ b/src/pulse.c
@@ -698,6 +698,8 @@ int driver_play(ca_context *c, uint32_t id, ca_proplist *proplist, ca_finish_cal
#else
pa_volume_t v = PA_VOLUME_NORM;
#endif
+ ca_bool_t volume_set = FALSE;
+ pa_cvolume cvol;
pa_sample_spec ss;
ca_cache_control_t cache_control = CA_CACHE_CONTROL_NEVER;
struct outstanding *out = NULL;
@@ -748,6 +750,7 @@ int driver_play(ca_context *c, uint32_t id, ca_proplist *proplist, ca_finish_cal
}
v = pa_sw_volume_from_dB(dvol);
+ volume_set = TRUE;
}
if ((ct = pa_proplist_gets(l, CA_PROP_CANBERRA_CACHE_CONTROL)))
@@ -836,13 +839,16 @@ int driver_play(ca_context *c, uint32_t id, ca_proplist *proplist, ca_finish_cal
pa_stream_set_state_callback(out->stream, stream_state_cb, out);
pa_stream_set_write_callback(out->stream, stream_write_cb, out);
+ if (volume_set)
+ pa_cvolume_set(&cvol, ss.channels, v);
+
if (pa_stream_connect_playback(out->stream, NULL, NULL,
#ifdef PA_STREAM_FAIL_ON_SUSPEND
PA_STREAM_FAIL_ON_SUSPEND
#else
0
#endif
- , NULL, NULL) < 0) {
+ , volume_set ? &cvol : NULL, NULL) < 0) {
ret = translate_error(pa_context_errno(p->context));
pa_threaded_mainloop_unlock(p->mainloop);
goto finish;