Commit 1873543e authored by mstorsjo's avatar mstorsjo

Add separate method/url parameters to the rtsp_send_cmd functions


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@22675 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 5398bd0b
This diff is collapsed.
...@@ -330,13 +330,16 @@ extern int rtsp_rtp_port_max; ...@@ -330,13 +330,16 @@ extern int rtsp_rtp_port_max;
* Send a command to the RTSP server without waiting for the reply. * Send a command to the RTSP server without waiting for the reply.
* *
* @param s RTSP (de)muxer context * @param s RTSP (de)muxer context
* @param cmd the full first line of the request * @param method the method for the request
* @param url the target url for the request
* @param headers extra header lines to include in the request
* @param send_content if non-null, the data to send as request body content * @param send_content if non-null, the data to send as request body content
* @param send_content_length the length of the send_content data, or 0 if * @param send_content_length the length of the send_content data, or 0 if
* send_content is null * send_content is null
*/ */
void ff_rtsp_send_cmd_with_content_async(AVFormatContext *s, void ff_rtsp_send_cmd_with_content_async(AVFormatContext *s,
const char *cmd, const char *method, const char *url,
const char *headers,
const unsigned char *send_content, const unsigned char *send_content,
int send_content_length); int send_content_length);
/** /**
...@@ -344,13 +347,16 @@ void ff_rtsp_send_cmd_with_content_async(AVFormatContext *s, ...@@ -344,13 +347,16 @@ void ff_rtsp_send_cmd_with_content_async(AVFormatContext *s,
* *
* @see rtsp_send_cmd_with_content_async * @see rtsp_send_cmd_with_content_async
*/ */
void ff_rtsp_send_cmd_async(AVFormatContext *s, const char *cmd); void ff_rtsp_send_cmd_async(AVFormatContext *s, const char *method,
const char *url, const char *headers);
/** /**
* Send a command to the RTSP server and wait for the reply. * Send a command to the RTSP server and wait for the reply.
* *
* @param s RTSP (de)muxer context * @param s RTSP (de)muxer context
* @param cmd the full first line of the request * @param method the method for the request
* @param url the target url for the request
* @param headers extra header lines to include in the request
* @param reply pointer where the RTSP message header will be stored * @param reply pointer where the RTSP message header will be stored
* @param content_ptr pointer where the RTSP message body, if any, will * @param content_ptr pointer where the RTSP message body, if any, will
* be stored (length is in reply) * be stored (length is in reply)
...@@ -359,7 +365,8 @@ void ff_rtsp_send_cmd_async(AVFormatContext *s, const char *cmd); ...@@ -359,7 +365,8 @@ void ff_rtsp_send_cmd_async(AVFormatContext *s, const char *cmd);
* send_content is null * send_content is null
*/ */
void ff_rtsp_send_cmd_with_content(AVFormatContext *s, void ff_rtsp_send_cmd_with_content(AVFormatContext *s,
const char *cmd, const char *method, const char *url,
const char *headers,
RTSPMessageHeader *reply, RTSPMessageHeader *reply,
unsigned char **content_ptr, unsigned char **content_ptr,
const unsigned char *send_content, const unsigned char *send_content,
...@@ -370,7 +377,8 @@ void ff_rtsp_send_cmd_with_content(AVFormatContext *s, ...@@ -370,7 +377,8 @@ void ff_rtsp_send_cmd_with_content(AVFormatContext *s,
* *
* @see rtsp_send_cmd_with_content * @see rtsp_send_cmd_with_content
*/ */
void ff_rtsp_send_cmd(AVFormatContext *s, const char *cmd, void ff_rtsp_send_cmd(AVFormatContext *s, const char *method,
const char *url, const char *headers,
RTSPMessageHeader *reply, unsigned char **content_ptr); RTSPMessageHeader *reply, unsigned char **content_ptr);
/** /**
......
...@@ -36,11 +36,9 @@ static int rtsp_write_record(AVFormatContext *s) ...@@ -36,11 +36,9 @@ static int rtsp_write_record(AVFormatContext *s)
char cmd[1024]; char cmd[1024];
snprintf(cmd, sizeof(cmd), snprintf(cmd, sizeof(cmd),
"RECORD %s RTSP/1.0\r\n"
"Range: npt=%0.3f-\r\n", "Range: npt=%0.3f-\r\n",
rt->control_uri,
(double) 0); (double) 0);
ff_rtsp_send_cmd(s, cmd, reply, NULL); ff_rtsp_send_cmd(s, "RECORD", rt->control_uri, cmd, reply, NULL);
if (reply->status_code != RTSP_STATUS_OK) if (reply->status_code != RTSP_STATUS_OK)
return -1; return -1;
rt->state = RTSP_STATE_STREAMING; rt->state = RTSP_STATE_STREAMING;
...@@ -159,12 +157,8 @@ static int rtsp_write_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -159,12 +157,8 @@ static int rtsp_write_packet(AVFormatContext *s, AVPacket *pkt)
static int rtsp_write_close(AVFormatContext *s) static int rtsp_write_close(AVFormatContext *s)
{ {
RTSPState *rt = s->priv_data; RTSPState *rt = s->priv_data;
char cmd[1024];
snprintf(cmd, sizeof(cmd), ff_rtsp_send_cmd_async(s, "TEARDOWN", rt->control_uri, NULL);
"TEARDOWN %s RTSP/1.0\r\n",
rt->control_uri);
ff_rtsp_send_cmd_async(s, cmd);
ff_rtsp_close_streams(s); ff_rtsp_close_streams(s);
url_close(rt->rtsp_hd); url_close(rt->rtsp_hd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment