diff options
author | Luca Barbato <lu_zero@gentoo.org> | 2014-06-17 02:36:55 +0200 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2014-06-18 22:03:40 +0200 |
commit | c9c1e00f95350e7a36b0d05a03939c7f6438e371 (patch) | |
tree | e86fe9bade59848b8a78559a42b42cc72c1acfd4 | |
parent | 49a242687cf44f86570b706db3c5912ff06bc6c2 (diff) | |
download | ffmpeg-c9c1e00f95350e7a36b0d05a03939c7f6438e371.tar.gz |
rtsp: Factor out fmtp parsing
-rw-r--r-- | libavformat/rtsp.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 06269bd0e1..adea3c6eda 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -309,6 +309,22 @@ static void copy_default_source_addrs(struct RTSPSource **addrs, int count, } } +static void parse_fmtp(AVFormatContext *s, RTSPState *rt, + int payload_type, const char *line) +{ + int i; + + for (i = 0; i < rt->nb_rtsp_streams; i++) { + RTSPStream *rtsp_st = rt->rtsp_streams[i]; + if (rtsp_st->sdp_payload_type == payload_type && + rtsp_st->dynamic_handler && + rtsp_st->dynamic_handler->parse_sdp_a_line) { + rtsp_st->dynamic_handler->parse_sdp_a_line(s, i, + rtsp_st->dynamic_protocol_context, line); + } + } +} + static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, int letter, const char *buf) { @@ -316,7 +332,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, char buf1[64], st_type[64]; const char *p; enum AVMediaType codec_type; - int payload_type, i; + int payload_type; AVStream *st; RTSPStream *rtsp_st; RTSPSource *rtsp_src; @@ -494,14 +510,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, // let dynamic protocol handlers have a stab at the line. get_word(buf1, sizeof(buf1), &p); payload_type = atoi(buf1); - for (i = 0; i < rt->nb_rtsp_streams; i++) { - rtsp_st = rt->rtsp_streams[i]; - if (rtsp_st->sdp_payload_type == payload_type && - rtsp_st->dynamic_handler && - rtsp_st->dynamic_handler->parse_sdp_a_line) - rtsp_st->dynamic_handler->parse_sdp_a_line(s, i, - rtsp_st->dynamic_protocol_context, buf); - } + parse_fmtp(s, rt, payload_type, buf); } else if (av_strstart(p, "range:", &p)) { int64_t start, end; |