1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

rtpdec: Clean up FMTP parsing code in MPEG-4/AAC RTP depacketizer

Patch by Josh Allmann, joshua dot allmann at gmail

Originally committed as revision 23851 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Josh Allmann 2010-06-28 11:30:44 +00:00 committed by Martin Storsjö
parent fb4ca2cb51
commit efc6d45196

View File

@ -219,24 +219,12 @@ static int aac_parse_packet(AVFormatContext *ctx,
return 0; return 0;
} }
static int parse_sdp_line(AVFormatContext *s, int st_index, static int parse_fmtp(AVStream *stream, PayloadContext *data,
PayloadContext *data, const char *line) char *attr, char *value)
{ {
const char *p; AVCodecContext *codec = stream->codec;
char value[4096], attr[25]; int res, i;
int res = 0, i;
AVStream *st = s->streams[st_index];
AVCodecContext* codec = st->codec;
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")) { if (!strcmp(attr, "config")) {
res = parse_fmtp_config(codec, value); res = parse_fmtp_config(codec, value);
@ -257,11 +245,18 @@ static int parse_sdp_line(AVFormatContext *s, int st_index,
} }
} }
} }
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; return 0;
} }
RTPDynamicProtocolHandler ff_mp4v_es_dynamic_handler = { RTPDynamicProtocolHandler ff_mp4v_es_dynamic_handler = {