MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / ff_rm_read_mdpr_codecdata

Function ff_rm_read_mdpr_codecdata

libavformat/rmdec.c:317–427  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

315}
316
317int ff_rm_read_mdpr_codecdata(AVFormatContext *s, AVIOContext *pb,
318 AVStream *st, RMStream *rst,
319 unsigned int codec_data_size, const uint8_t *mime)
320{
321 unsigned int v;
322 int size;
323 int64_t codec_pos;
324 int ret;
325
326 if (codec_data_size > INT_MAX)
327 return AVERROR_INVALIDDATA;
328 if (codec_data_size == 0)
329 return 0;
330
331 // Duplicate tags
332 if ( st->codecpar->codec_type != AVMEDIA_TYPE_UNKNOWN
333 && st->codecpar->codec_type != AVMEDIA_TYPE_DATA)
334 return AVERROR_INVALIDDATA;
335
336 avpriv_set_pts_info(st, 64, 1, 1000);
337 codec_pos = avio_tell(pb);
338 v = avio_rb32(pb);
339
340 if (v == MKTAG(0xfd, 'a', 'r', '.')) {
341 /* ra type header */
342 if (rm_read_audio_stream_info(s, pb, st, rst, 0))
343 return -1;
344 } else if (v == MKBETAG('L', 'S', 'D', ':')) {
345 avio_seek(pb, -4, SEEK_CUR);
346 if ((ret = rm_read_extradata(s, pb, st->codecpar, codec_data_size)) < 0)
347 return ret;
348
349 st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
350 st->codecpar->codec_tag = AV_RL32(st->codecpar->extradata);
351 st->codecpar->codec_id = ff_codec_get_id(ff_rm_codec_tags,
352 st->codecpar->codec_tag);
353 } else if(mime && !strcmp(mime, "logical-fileinfo")){
354 int stream_count, rule_count, property_count, i;
355 ff_remove_stream(s, st);
356 if (avio_rb16(pb) != 0) {
357 av_log(s, AV_LOG_WARNING, "Unsupported version\n");
358 goto skip;
359 }
360 stream_count = avio_rb16(pb);
361 avio_skip(pb, 6*stream_count);
362 rule_count = avio_rb16(pb);
363 avio_skip(pb, 2*rule_count);
364 property_count = avio_rb16(pb);
365 for(i=0; i<property_count; i++){
366 uint8_t name[128], val[128];
367 avio_rb32(pb);
368 if (avio_rb16(pb) != 0) {
369 av_log(s, AV_LOG_WARNING, "Unsupported Name value property version\n");
370 goto skip; //FIXME skip just this one
371 }
372 get_str8(pb, name, sizeof(name));
373 switch(avio_rb32(pb)) {
374 case 2: get_strl(pb, val, sizeof(val), avio_rb16(pb));

Callers 4

rm_read_multiFunction · 0.85
rm_read_headerFunction · 0.85
ivr_read_headerFunction · 0.85
rdt_load_mdprFunction · 0.85

Calls 15

avpriv_set_pts_infoFunction · 0.85
avio_tellFunction · 0.85
avio_rb32Function · 0.85
avio_seekFunction · 0.85
rm_read_extradataFunction · 0.85
ff_codec_get_idFunction · 0.85
ff_remove_streamFunction · 0.85
avio_rb16Function · 0.85
av_logFunction · 0.85
avio_skipFunction · 0.85
get_str8Function · 0.85

Tested by

no test coverage detected