Commit 166046a1 authored by rbultje's avatar rbultje

Split rtsp_read_header() into two functions, so that the main part (now also

known as rtsp_connect()) can be used in the RTSP muxer.

Patch by Martin Storsjö <$firstname $firstname st>.



git-svn-id: file:///var/local/repositories/ffmpeg/trunk@21915 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 9d6d3efb
...@@ -1295,8 +1295,7 @@ static int rtsp_setup_input_streams(AVFormatContext *s) ...@@ -1295,8 +1295,7 @@ static int rtsp_setup_input_streams(AVFormatContext *s)
return 0; return 0;
} }
static int rtsp_read_header(AVFormatContext *s, static int rtsp_connect(AVFormatContext *s)
AVFormatParameters *ap)
{ {
RTSPState *rt = s->priv_data; RTSPState *rt = s->priv_data;
char host[1024], path[1024], tcpname[1024], cmd[2048], auth[128]; char host[1024], path[1024], tcpname[1024], cmd[2048], auth[128];
...@@ -1424,14 +1423,6 @@ redirect: ...@@ -1424,14 +1423,6 @@ redirect:
rt->state = RTSP_STATE_IDLE; rt->state = RTSP_STATE_IDLE;
rt->seek_timestamp = 0; /* default is to start stream at position zero */ rt->seek_timestamp = 0; /* default is to start stream at position zero */
if (ap->initial_pause) {
/* do not start immediately */
} else {
if (rtsp_read_play(s) < 0) {
err = AVERROR_INVALIDDATA;
goto fail;
}
}
return 0; return 0;
fail: fail:
rtsp_close_streams(s); rtsp_close_streams(s);
...@@ -1446,6 +1437,29 @@ redirect: ...@@ -1446,6 +1437,29 @@ redirect:
return err; return err;
} }
static int rtsp_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
RTSPState *rt = s->priv_data;
int ret;
ret = rtsp_connect(s);
if (ret)
return ret;
if (ap->initial_pause) {
/* do not start immediately */
} else {
if (rtsp_read_play(s) < 0) {
rtsp_close_streams(s);
url_close(rt->rtsp_hd);
return AVERROR_INVALIDDATA;
}
}
return 0;
}
static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st, static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
uint8_t *buf, int buf_size) uint8_t *buf, int buf_size)
{ {
......
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