diff options
author | Colin Guthrie <pulse@colin.guthr.ie> | 2008-06-09 21:59:41 +0000 |
---|---|---|
committer | Colin Guthrie <pulse@colin.guthr.ie> | 2008-10-08 20:32:09 +0100 |
commit | 5f527dc47944bbd97a49e8d89427d09850b28e5d (patch) | |
tree | 78117b4ed69dc3da0f57c5c5385525998a7fd1e7 | |
parent | 651da7d095f78e930fb758442905d5769cfda1c5 (diff) |
Add seq and rtptime params to record/flush with a view to using these for timing and device suspension
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/coling@2500 fefdeb5f-60dc-0310-8127-8f9354f1896f
-rw-r--r-- | src/modules/rtp/raop_client.c | 7 | ||||
-rw-r--r-- | src/modules/rtp/rtsp_client.c | 19 | ||||
-rw-r--r-- | src/modules/rtp/rtsp_client.h | 4 |
3 files changed, 21 insertions, 9 deletions
diff --git a/src/modules/rtp/raop_client.c b/src/modules/rtp/raop_client.c index 4085a494..4714d273 100644 --- a/src/modules/rtp/raop_client.c +++ b/src/modules/rtp/raop_client.c @@ -90,6 +90,9 @@ struct pa_raop_client { pa_socket_client *sc; int fd; + uint16_t seq; + uint32_t rtptime; + pa_raop_client_cb_t callback; void* userdata; pa_raop_client_closed_cb_t closed_callback; @@ -317,7 +320,7 @@ static void rtsp_cb(pa_rtsp_client *rtsp, pa_rtsp_state state, pa_headerlist* he } else { pa_log_warn("Audio Jack Status missing"); } - pa_rtsp_record(c->rtsp); + pa_rtsp_record(c->rtsp, &c->seq, &c->rtptime); break; } @@ -403,8 +406,6 @@ void pa_raop_client_free(pa_raop_client* c) } -static void noop(PA_GCC_UNUSED void* p) {} - 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/rtsp_client.c b/src/modules/rtp/rtsp_client.c index f9fe9bfe..70040428 100644 --- a/src/modules/rtp/rtsp_client.c +++ b/src/modules/rtp/rtsp_client.c @@ -47,6 +47,8 @@ #include <pulsecore/strbuf.h> #include <pulsecore/poll.h> #include <pulsecore/ioline.h> +#include <pulsecore/time-smoother.h> +#include <pulsecore/rtclock.h> #include "rtsp_client.h" @@ -467,9 +469,10 @@ int pa_rtsp_setup(pa_rtsp_client* c) { } -int pa_rtsp_record(pa_rtsp_client* c) { +int pa_rtsp_record(pa_rtsp_client* c, uint16_t* seq, uint32_t* rtptime) { pa_headerlist* headers; int rv; + char *info; pa_assert(c); if (!c->session) { @@ -477,9 +480,14 @@ int pa_rtsp_record(pa_rtsp_client* c) { return -1; } + /* Todo: Generate these values randomly as per spec */ + *seq = *rtptime = 0; + headers = pa_headerlist_new(); pa_headerlist_puts(headers, "Range", "npt=0-"); - pa_headerlist_puts(headers, "RTP-Info", "seq=0;rtptime=0"); + info = pa_sprintf_malloc("seq=%u;rtptime=%u", *seq, *rtptime); + pa_headerlist_puts(headers, "RTP-Info", info); + pa_xfree(info); c->state = STATE_RECORD; rv = rtsp_exec(c, "RECORD", NULL, NULL, 1, headers); @@ -506,14 +514,17 @@ int pa_rtsp_setparameter(pa_rtsp_client *c, const char* param) { } -int pa_rtsp_flush(pa_rtsp_client *c) { +int pa_rtsp_flush(pa_rtsp_client *c, uint16_t seq, uint32_t rtptime) { pa_headerlist* headers; int rv; + char *info; pa_assert(c); headers = pa_headerlist_new(); - pa_headerlist_puts(headers, "RTP-Info", "seq=0;rtptime=0"); + info = pa_sprintf_malloc("seq=%u;rtptime=%u", seq, rtptime); + pa_headerlist_puts(headers, "RTP-Info", info); + pa_xfree(info); c->state = STATE_FLUSH; rv = rtsp_exec(c, "FLUSH", NULL, NULL, 1, headers); diff --git a/src/modules/rtp/rtsp_client.h b/src/modules/rtp/rtsp_client.h index 3c5280c2..55540180 100644 --- a/src/modules/rtp/rtsp_client.h +++ b/src/modules/rtp/rtsp_client.h @@ -66,10 +66,10 @@ void pa_rtsp_remove_header(pa_rtsp_client *c, const char* key); int pa_rtsp_announce(pa_rtsp_client* c, const char* sdp); int pa_rtsp_setup(pa_rtsp_client* c); -int pa_rtsp_record(pa_rtsp_client* c); +int pa_rtsp_record(pa_rtsp_client* c, uint16_t* seq, uint32_t* rtptime); int pa_rtsp_teardown(pa_rtsp_client* c); int pa_rtsp_setparameter(pa_rtsp_client* c, const char* param); -int pa_rtsp_flush(pa_rtsp_client* c); +int pa_rtsp_flush(pa_rtsp_client* c, uint16_t seq, uint32_t rtptime); #endif |