summaryrefslogtreecommitdiff
path: root/libavformat/rtpdec_xiph.c
diff options
context:
space:
mode:
authorJosh Allmann <joshua.allmann@gmail.com>2010-06-28 20:32:03 +0000
committerMartin Storsjö <martin@martin.st>2010-06-28 20:32:03 +0000
commitaf1308f0248d395e00357ce40faf25a226d697cf (patch)
tree41d6bb62ddf0acf4ae75aae8a6fc54c2d277d4c7 /libavformat/rtpdec_xiph.c
parent824535e3c6684ba9327eb62d4514deab459a1957 (diff)
rtpdec: Cleanup FMTP parsing code in Xiph RTP depacketizer
Patch by Josh Allmann, joshua dot allmann at gmail Originally committed as revision 23860 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/rtpdec_xiph.c')
-rw-r--r--libavformat/rtpdec_xiph.c29
1 files changed, 4 insertions, 25 deletions
diff --git a/libavformat/rtpdec_xiph.c b/libavformat/rtpdec_xiph.c
index 34704a2aec..9973efcd73 100644
--- a/libavformat/rtpdec_xiph.c
+++ b/libavformat/rtpdec_xiph.c
@@ -286,10 +286,11 @@ parse_packed_headers(const uint8_t * packed_headers,
return 0;
}
-static int xiph_parse_fmtp_pair(AVCodecContext * codec,
+static int xiph_parse_fmtp_pair(AVStream* stream,
PayloadContext *xiph_data,
char *attr, char *value)
{
+ AVCodecContext *codec = stream->codec;
int result = 0;
if (!strcmp(attr, "sampling")) {
@@ -346,34 +347,12 @@ static int xiph_parse_sdp_line(AVFormatContext *s, int st_index,
PayloadContext *data, const char *line)
{
const char *p;
- char *value;
- char attr[25];
- int value_size = strlen(line), attr_size = sizeof(attr), res = 0;
- AVCodecContext* codec = s->streams[st_index]->codec;
-
- assert(data);
-
- if (!(value = av_malloc(value_size))) {
- av_log(codec, AV_LOG_ERROR, "Out of memory\n");
- return AVERROR(ENOMEM);
- }
if (av_strstart(line, "fmtp:", &p)) {
- // remove protocol identifier
- while (*p && *p == ' ') p++; // strip spaces
- while (*p && *p != ' ') p++; // eat protocol identifier
- while (*p && *p == ' ') p++; // strip trailing spaces
-
- while (ff_rtsp_next_attr_and_value(&p,
- attr, attr_size,
- value, value_size)) {
- res = xiph_parse_fmtp_pair(codec, data, attr, value);
- if (res < 0 && res != AVERROR_PATCHWELCOME)
- return res;
- }
+ return ff_parse_fmtp(s->streams[st_index], data, p,
+ xiph_parse_fmtp_pair);
}
- av_free(value);
return 0;
}