pa_assert(c->url);
if (!cmd)
- return 0;
+ return -1;
buf = pa_strbuf_new();
pa_strbuf_printf(buf, "%s %s RTSP/1.0\r\nCSeq: %d\r\n", cmd, c->url, ++c->cseq);
/* Do we expect a response? */
if (!expect_response)
- return 1;
+ return 0;
timeout = 5000;
if (pa_read_line(c->io, response, sizeof(response), timeout) <= 0) {
/*ERRMSG("%s: request failed\n",__func__);*/
- return 0;
+ return -1;
}
delimiters[0] = ' ';
if (!token || strcmp(token, "200")) {
pa_xfree(token);
/*ERRMSG("%s: request failed, error %s\n",__func__,token);*/
- return 0;
+ return -1;
}
pa_xfree(token);
/* Reduce timeout for future requests */
timeout = 1000;
}
- return 1;
+ return 0;
}
/* TODO: Move header reading into the headerlist. */
delimpos = strstr(response, ":");
if (!delimpos) {
/*ERRMSG("%s: Request failed, bad header\n",__func__);*/
- return 0;
+ return -1;
}
if (strlen(delimpos) > 1) {
}
pa_strbuf_free(buf);
- return 1;
+ return 0;
}
if (!(c->sc = pa_socket_client_new_string(mainloop, hostname, port))) {
pa_log("failed to connect to server '%s:%d'", hostname, port);
- return 0;
+ return -1;
}
pa_socket_client_set_callback(c->sc, on_connection, c);
- return 1;
+ return 0;
}
int pa_rtsp_announce(pa_rtsp_context *c, const char* sdp) {
pa_assert(c);
if (!sdp)
- return 0;
+ return -1;
return pa_rtsp_exec(c, "ANNOUNCE", "application/sdp", sdp, 1, NULL, NULL);
}
rheaders = pa_headerlist_new();
pa_headerlist_puts(headers, "Transport", "RTP/AVP/TCP;unicast;interleaved=0-1;mode=record");
- if (!pa_rtsp_exec(c, "SETUP", NULL, NULL, 1, headers, &rheaders)) {
+ if (pa_rtsp_exec(c, "SETUP", NULL, NULL, 1, headers, &rheaders)) {
pa_headerlist_free(headers);
pa_headerlist_free(rheaders);
- return 0;
+ return -1;
}
pa_headerlist_free(headers);
if (!c->session || !c->transport) {
pa_headerlist_free(rheaders);
- return 0;
+ return -1;
}
/* Now parse out the server port component of the response. */
if (0 == c->port) {
/* Error no server_port in response */
pa_headerlist_free(rheaders);
- return 0;
+ return -1;
}
*response_headers = rheaders;
- return 1;
+ return 0;
}
pa_assert(c);
if (!c->session) {
/* No seesion in progres */
- return 0;
+ return -1;
}
headers = pa_headerlist_new();
int pa_rtsp_setparameter(pa_rtsp_context *c, const char* param) {
pa_assert(c);
if (!param)
- return 0;
+ return -1;
return pa_rtsp_exec(c, "SET_PARAMETER", "text/parameters", param, 1, NULL, NULL);
}