diff options
author | Ryan Martell <rdm4@martellventures.com> | 2006-10-29 10:58:51 +0000 |
---|---|---|
committer | Guillaume Poirier <gpoirier@mplayerhq.hu> | 2006-10-29 10:58:51 +0000 |
commit | d0deedcb07adf60f23fa54d0ed7dcf7ca29ea833 (patch) | |
tree | 63e474cff3be96252aaa2c67595a42d8978338e1 /libavformat/rtsp.c | |
parent | 3cedeeca02b7bc6f0de1849bbdad4e4961bcc027 (diff) | |
download | ffmpeg-d0deedcb07adf60f23fa54d0ed7dcf7ca29ea833.tar.gz |
fix more dynamic protocol stuff, needed by the forthcoming h264
streaming patch.
(Minor additions to give more information to the dynamic protocol
handlers, and a slight rearrangement of code.)
Patch by Ryan Martell %rdm4 A martellventures P com%
Original thread:
Date: Oct 29, 2006 2:30 AM
Subject: Re: [Ffmpeg-devel] RTP patches & RFC
Originally committed as revision 6831 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/rtsp.c')
-rw-r--r-- | libavformat/rtsp.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 08c71c534b..0c5038e0d4 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -200,6 +200,8 @@ static int sdp_parse_rtpmap(AVCodecContext *codec, RTSPStream *rtsp_st, int payl i = atoi(buf); if (i > 0) codec->channels = i; + // TODO: there is a bug here; if it is a mono stream, and less than 22000Hz, faad upconverts to stereo and twice the + // frequency. No problem, but the sample rate is being set here by the sdp line. Upcoming patch forthcoming. (rdm) } av_log(codec, AV_LOG_DEBUG, " audio samplerate set to : %i\n", codec->sample_rate); av_log(codec, AV_LOG_DEBUG, " audio channels set to : %i\n", codec->channels); @@ -287,6 +289,25 @@ static attrname_map_t attr_names[]= {NULL, -1, -1}, }; +/** parse the attribute line from the fmtp a line of an sdp resonse. This is broken out as a function +* because it is used in rtp_h264.c, which is forthcoming. +*/ +int rtsp_next_attr_and_value(const char **p, char *attr, int attr_size, char *value, int value_size) +{ + skip_spaces(p); + if(**p) + { + get_word_sep(attr, attr_size, "=", p); + if (**p == '=') + (*p)++; + get_word_sep(value, value_size, ";", p); + if (**p == ';') + (*p)++; + return 1; + } + return 0; +} + /* parse a SDP line and save stream attributes */ static void sdp_parse_fmtp(AVStream *st, const char *p) { @@ -298,6 +319,7 @@ static void sdp_parse_fmtp(AVStream *st, const char *p) AVCodecContext *codec = st->codec; rtp_payload_data_t *rtp_payload_data = &rtsp_st->rtp_payload_data; + // TODO (Replace with rtsp_next_attr_and_value) /* loop on each attribute */ for(;;) { skip_spaces(&p); @@ -471,6 +493,19 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, } } } + } else if(strstart(p, "framesize:", &p)) { + // let dynamic protocol handlers have a stab at the line. + get_word(buf1, sizeof(buf1), &p); + payload_type = atoi(buf1); + for(i = 0; i < s->nb_streams;i++) { + st = s->streams[i]; + rtsp_st = st->priv_data; + if (rtsp_st->sdp_payload_type == payload_type) { + if(rtsp_st->dynamic_handler && rtsp_st->dynamic_handler->parse_sdp_a_line) { + rtsp_st->dynamic_handler->parse_sdp_a_line(st, rtsp_st->dynamic_protocol_context, buf); + } + } + } } break; } |