# HG changeset patch # User mstorsjo # Date 1277757123 0 # Node ID 6c03f060caad491f20674860c05563ccc1160b14 # Parent da9998b48dffecba950888128a965eaf23782903 rtpdec: Cleanup FMTP parsing code in Xiph RTP depacketizer Patch by Josh Allmann, joshua dot allmann at gmail diff -r da9998b48dff -r 6c03f060caad rtpdec_xiph.c --- a/rtpdec_xiph.c Mon Jun 28 20:27:25 2010 +0000 +++ b/rtpdec_xiph.c Mon Jun 28 20:32:03 2010 +0000 @@ -286,10 +286,11 @@ 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 @@ 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; }