comparison rtpdec_mpeg4.c @ 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 83978c1b9739
children b93d7a25cd6b
comparison
equal deleted inserted replaced
6190:8ee715d46f99 6191:7884ec350d88
217 217
218 pkt->stream_index = st->index; 218 pkt->stream_index = st->index;
219 return 0; 219 return 0;
220 } 220 }
221 221
222 static int parse_sdp_line(AVFormatContext *s, int st_index, 222 static int parse_fmtp(AVStream *stream, PayloadContext *data,
223 PayloadContext *data, const char *line) 223 char *attr, char *value)
224 { 224 {
225 const char *p; 225 AVCodecContext *codec = stream->codec;
226 char value[4096], attr[25]; 226 int res, i;
227 int res = 0, i; 227
228 AVStream *st = s->streams[st_index];
229 AVCodecContext* codec = st->codec;
230
231 if (av_strstart(line, "fmtp:", &p)) {
232 // remove protocol identifier
233 while (*p && *p == ' ') p++; // strip spaces
234 while (*p && *p != ' ') p++; // eat protocol identifier
235 while (*p && *p == ' ') p++; // strip trailing spaces
236
237 while (ff_rtsp_next_attr_and_value(&p,
238 attr, sizeof(attr),
239 value, sizeof(value))) {
240 if (!strcmp(attr, "config")) { 228 if (!strcmp(attr, "config")) {
241 res = parse_fmtp_config(codec, value); 229 res = parse_fmtp_config(codec, value);
242 230
243 if (res < 0) 231 if (res < 0)
244 return res; 232 return res;
255 *(char **)((char *)data+ 243 *(char **)((char *)data+
256 attr_names[i].offset) = av_strdup(value); 244 attr_names[i].offset) = av_strdup(value);
257 } 245 }
258 } 246 }
259 } 247 }
248 return 0;
260 } 249 }
261 } 250
262 251 static int parse_sdp_line(AVFormatContext *s, int st_index,
263 return 0; 252 PayloadContext *data, const char *line)
264 253 {
254 const char *p;
255
256 if (av_strstart(line, "fmtp:", &p))
257 return ff_parse_fmtp(s->streams[st_index], data, p, parse_fmtp);
258
259 return 0;
265 } 260 }
266 261
267 RTPDynamicProtocolHandler ff_mp4v_es_dynamic_handler = { 262 RTPDynamicProtocolHandler ff_mp4v_es_dynamic_handler = {
268 .enc_name = "MP4V-ES", 263 .enc_name = "MP4V-ES",
269 .codec_type = AVMEDIA_TYPE_VIDEO, 264 .codec_type = AVMEDIA_TYPE_VIDEO,