Mercurial > libavformat.hg
changeset 6191:7884ec350d88 libavformat
rtpdec: Clean up FMTP parsing code in MPEG-4/AAC RTP depacketizer
Patch by Josh Allmann, joshua dot allmann at gmail
author | mstorsjo |
---|---|
date | Mon, 28 Jun 2010 11:30:44 +0000 |
parents | 8ee715d46f99 |
children | b93d7a25cd6b |
files | rtpdec_mpeg4.c |
diffstat | 1 files changed, 13 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/rtpdec_mpeg4.c Mon Jun 28 11:28:02 2010 +0000 +++ b/rtpdec_mpeg4.c Mon Jun 28 11:30:44 2010 +0000 @@ -219,24 +219,12 @@ return 0; } -static int parse_sdp_line(AVFormatContext *s, int st_index, - PayloadContext *data, const char *line) +static int parse_fmtp(AVStream *stream, PayloadContext *data, + char *attr, char *value) { - const char *p; - char value[4096], attr[25]; - int res = 0, i; - AVStream *st = s->streams[st_index]; - AVCodecContext* codec = st->codec; + AVCodecContext *codec = stream->codec; + int res, i; - 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, sizeof(attr), - value, sizeof(value))) { if (!strcmp(attr, "config")) { res = parse_fmtp_config(codec, value); @@ -257,11 +245,18 @@ } } } + return 0; } - } + +static int parse_sdp_line(AVFormatContext *s, int st_index, + PayloadContext *data, const char *line) +{ + const char *p; + + if (av_strstart(line, "fmtp:", &p)) + return ff_parse_fmtp(s->streams[st_index], data, p, parse_fmtp); return 0; - } RTPDynamicProtocolHandler ff_mp4v_es_dynamic_handler = {