summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2010-02-19 23:23:40 +0000
committerRonald S. Bultje <rsbultje@gmail.com>2010-02-19 23:23:40 +0000
commit4280f9bbcd439e43a37e865018ae501e6a8b9a9e (patch)
tree2d1b511406124c7534d12f974951a344249678c1 /libavformat
parente23d195deb63df507a2ad98c3875e8c2a2f5bb9b (diff)
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>. Originally committed as revision 21915 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/rtsp.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 152c2cc70d..ae56396490 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1295,8 +1295,7 @@ static int rtsp_setup_input_streams(AVFormatContext *s)
return 0;
}
-static int rtsp_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int rtsp_connect(AVFormatContext *s)
{
RTSPState *rt = s->priv_data;
char host[1024], path[1024], tcpname[1024], cmd[2048], auth[128];
@@ -1424,14 +1423,6 @@ redirect:
rt->state = RTSP_STATE_IDLE;
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;
fail:
rtsp_close_streams(s);
@@ -1446,6 +1437,29 @@ redirect:
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,
uint8_t *buf, int buf_size)
{