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) { /* No session in progress */ return -1; } /* Todo: Generate these values randomly as per spec */ *seq = *rtptime = 0; headers = pa_headerlist_new(); pa_headerlist_puts(headers, "Range", "npt=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); pa_headerlist_free(headers); return rv; }
int pa_rtsp_record(pa_rtsp_client *c, uint16_t *seq, uint32_t *rtptime) { pa_headerlist *headers; char *info; int rv; pa_assert(c); if (!c->session) { /* No session in progress */ return -1; } pa_random(seq, sizeof(*seq)); pa_random(rtptime, sizeof(*rtptime)); headers = pa_headerlist_new(); pa_headerlist_puts(headers, "Range", "npt=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); pa_headerlist_free(headers); return rv; }
int pa_rtsp_setparameter(pa_rtsp_client *c, const char* param) { pa_assert(c); if (!param) return -1; c->state = STATE_SET_PARAMETER; return rtsp_exec(c, "SET_PARAMETER", "text/parameters", param, 1, NULL); }
int pa_rtsp_announce(pa_rtsp_client *c, const char* sdp) { pa_assert(c); if (!sdp) return -1; c->state = STATE_ANNOUNCE; return rtsp_exec(c, "ANNOUNCE", "application/sdp", sdp, 1, NULL); }
int pa_rtsp_teardown(pa_rtsp_client *c) { int rv; pa_assert(c); c->state = STATE_TEARDOWN; rv = rtsp_exec(c, "TEARDOWN", NULL, NULL, 0, NULL); return rv; }
int pa_rtsp_setup(pa_rtsp_client* c) { pa_headerlist* headers; int rv; pa_assert(c); headers = pa_headerlist_new(); pa_headerlist_puts(headers, "Transport", "RTP/AVP/TCP;unicast;interleaved=0-1;mode=record"); c->state = STATE_SETUP; rv = rtsp_exec(c, "SETUP", NULL, NULL, 1, headers); pa_headerlist_free(headers); return rv; }
int pa_rtsp_options(pa_rtsp_client *c) { char *url; int rv; pa_assert(c); url = c->url; c->state = STATE_OPTIONS; c->url = (char *)"*"; rv = rtsp_exec(c, "OPTIONS", NULL, NULL, 0, NULL); c->url = url; return rv; }
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(); 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); pa_headerlist_free(headers); return rv; }