summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorColin Guthrie <pulse@colin.guthr.ie>2008-07-03 23:47:34 +0100
committerColin Guthrie <pulse@colin.guthr.ie>2008-10-08 20:36:24 +0100
commite543e04ca725ef1c240762529e7dafec31749683 (patch)
tree320ef8734313a5c15483e9ccb9a339346e9337b7 /src
parent36f2aad5f0892e6738a8d59111c3c9017152db7e (diff)
Implement a set volume function to expose this capability to higher layers
Diffstat (limited to 'src')
-rw-r--r--src/modules/rtp/raop_client.c24
-rw-r--r--src/modules/rtp/raop_client.h1
2 files changed, 25 insertions, 0 deletions
diff --git a/src/modules/rtp/raop_client.c b/src/modules/rtp/raop_client.c
index 48deff0d..792eceec 100644
--- a/src/modules/rtp/raop_client.c
+++ b/src/modules/rtp/raop_client.c
@@ -342,6 +342,7 @@ static void rtsp_cb(pa_rtsp_client *rtsp, pa_rtsp_state state, pa_headerlist* he
case STATE_TEARDOWN:
case STATE_SET_PARAMETER:
+ pa_log_debug("RAOP: SET_PARAMETER");
break;
case STATE_DISCONNECTED:
pa_assert(c->closed_callback);
@@ -439,6 +440,29 @@ int pa_raop_flush(pa_raop_client* c)
}
+int pa_raop_client_set_volume(pa_raop_client* c, pa_volume_t volume)
+{
+ int rv;
+ double db;
+ char *param;
+
+ pa_assert(c);
+
+ db = pa_sw_volume_to_dB(volume);
+ if (db < VOLUME_MIN)
+ db = VOLUME_MIN;
+ else if (db > VOLUME_MAX)
+ db = VOLUME_MAX;
+
+ param = pa_sprintf_malloc("volume: %0.6f\r\n", db);
+
+ /* We just hit and hope, cannot wait for the callback */
+ rv = pa_rtsp_setparameter(c->rtsp, param);
+ pa_xfree(param);
+ return rv;
+}
+
+
int pa_raop_client_encode_sample(pa_raop_client* c, pa_memchunk* raw, pa_memchunk* encoded)
{
uint16_t len;
diff --git a/src/modules/rtp/raop_client.h b/src/modules/rtp/raop_client.h
index 882dae17..3d5ef167 100644
--- a/src/modules/rtp/raop_client.h
+++ b/src/modules/rtp/raop_client.h
@@ -36,6 +36,7 @@ void pa_raop_client_free(pa_raop_client* c);
int pa_raop_connect(pa_raop_client* c);
int pa_raop_flush(pa_raop_client* c);
+int pa_raop_client_set_volume(pa_raop_client* c, pa_volume_t volume);
int pa_raop_client_encode_sample(pa_raop_client* c, pa_memchunk* raw, pa_memchunk* encoded);
typedef void (*pa_raop_client_cb_t)(int fd, void *userdata);