Mercurial > libavformat.hg
changeset 5681:7539c21106ef libavformat
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>.
author | rbultje |
---|---|
date | Fri, 19 Feb 2010 23:23:40 +0000 |
parents | 129679c03536 |
children | e346e10c9537 |
files | rtsp.c |
diffstat | 1 files changed, 24 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/rtsp.c Fri Feb 19 23:21:44 2010 +0000 +++ b/rtsp.c Fri Feb 19 23:23:40 2010 +0000 @@ -1295,8 +1295,7 @@ 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 @@ 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 @@ 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) {