* RTSP helpers
*/
-int rtsp_send( http_client_t *hc, http_cmd_t cmd, const char *path,
- const char *query, http_arg_list_t *hdr );
+int rtsp_send_ext( http_client_t *hc, http_cmd_t cmd, const char *path,
+ const char *query, http_arg_list_t *hdr, const char *body, size_t size );
+
+static inline int
+rtsp_send( http_client_t *hc, http_cmd_t cmd, const char *path,
+ const char *query, http_arg_list_t *hdr ) {
+ return rtsp_send_ext( hc, cmd, path, query, hdr, NULL, 0 );
+}
void rtsp_clear_session( http_client_t *hc );
}
static inline int rtsp_get_parameter( http_client_t *hc, const char *parameter ) {
- return rtsp_send(hc, RTSP_CMD_GET_PARAMETER, NULL, parameter, NULL);
+ http_arg_list_t hdr;
+ http_arg_init(&hdr);
+ http_arg_set(&hdr, "Content-Type", "text/parameters");
+ return rtsp_send_ext(hc, RTSP_CMD_GET_PARAMETER, NULL, NULL, &hdr, parameter, strlen(parameter));
}
int rtsp_describe_decode( http_client_t *hc );
iptv_mux_t *im = aux;
rtsp_priv_t *rp = im->im_data;
if(rp->hc->hc_rtsp_keep_alive_cmd == RTSP_CMD_GET_PARAMETER)
- rtsp_get_parameter(rp->hc, "");
+ rtsp_get_parameter(rp->hc, "position");
else if(rp->hc->hc_rtsp_keep_alive_cmd == RTSP_CMD_OPTIONS)
rtsp_send(rp->hc, RTSP_CMD_OPTIONS, rp->path, rp->query, NULL);
else
* Utils
*/
int
-rtsp_send( http_client_t *hc, http_cmd_t cmd,
+rtsp_send_ext( http_client_t *hc, http_cmd_t cmd,
const char *path, const char *query,
- http_arg_list_t *hdr )
+ http_arg_list_t *hdr,
+ const char *body, size_t size )
{
http_arg_list_t h;
size_t blen = 7 + strlen(hc->hc_host) +
(path ? strlen(path) : 1) + 1;
char *buf = alloca(blen);
char buf2[7];
+ char buf_body[size + 3];
if (hc->hc_rtsp_session) {
if (hdr == NULL) {
}
http_arg_set(hdr, "Session", hc->hc_rtsp_session);
}
+
+ if (size > 0) {
+ if (hdr == NULL) {
+ hdr = &h;
+ http_arg_init(&h);
+ }
+ strncpy(buf_body, body, sizeof(buf_body));
+ strncat(buf_body, "\r\n", 2);
+ snprintf(buf2, sizeof(buf2), "%lu", size + 2);
+ http_arg_set(hdr, "Content-Length", buf2);
+ }
+
http_client_basic_auth(hc, hdr, hc->hc_rtsp_user, hc->hc_rtsp_pass);
if (hc->hc_port != 554)
snprintf(buf2, sizeof(buf2), ":%d", hc->hc_port);
else
buf2[0] = '\0';
snprintf(buf, blen, "rtsp://%s%s%s", hc->hc_host, buf2, path ? path : "/");
- return http_client_send(hc, cmd, buf, query, hdr, NULL, 0);
+ if(size > 0)
+ return http_client_send(hc, cmd, buf, query, hdr, buf_body, size + 2);
+ else
+ return http_client_send(hc, cmd, buf, query, hdr, NULL, 0);
}
void