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

Function rm_read_header

libavformat/rmdec.c:406–510  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

404}
405
406static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
407{
408 RMDemuxContext *rm = s->priv_data;
409 AVStream *st;
410 ByteIOContext *pb = s->pb;
411 unsigned int tag;
412 int tag_size;
413 unsigned int start_time, duration;
414 unsigned int data_off = 0, indx_off = 0;
415 char buf[128];
416 int flags = 0;
417
418 tag = get_le32(pb);
419 if (tag == MKTAG('.', 'r', 'a', 0xfd)) {
420 /* very old .ra format */
421 return rm_read_header_old(s, ap);
422 } else if (tag != MKTAG('.', 'R', 'M', 'F')) {
423 return AVERROR(EIO);
424 }
425
426 get_be32(pb); /* header size */
427 get_be16(pb);
428 get_be32(pb);
429 get_be32(pb); /* number of headers */
430
431 for(;;) {
432 if (url_feof(pb))
433 return -1;
434 tag = get_le32(pb);
435 tag_size = get_be32(pb);
436 get_be16(pb);
437#if 0
438 printf("tag=%c%c%c%c (%08x) size=%d\n",
439 (tag) & 0xff,
440 (tag >> 8) & 0xff,
441 (tag >> 16) & 0xff,
442 (tag >> 24) & 0xff,
443 tag,
444 tag_size);
445#endif
446 if (tag_size < 10 && tag != MKTAG('D', 'A', 'T', 'A'))
447 return -1;
448 switch(tag) {
449 case MKTAG('P', 'R', 'O', 'P'):
450 /* file header */
451 get_be32(pb); /* max bit rate */
452 get_be32(pb); /* avg bit rate */
453 get_be32(pb); /* max packet size */
454 get_be32(pb); /* avg packet size */
455 get_be32(pb); /* nb packets */
456 get_be32(pb); /* duration */
457 get_be32(pb); /* preroll */
458 indx_off = get_be32(pb); /* index offset */
459 data_off = get_be32(pb); /* data offset */
460 get_be16(pb); /* nb streams */
461 flags = get_be16(pb); /* flags */
462 break;
463 case MKTAG('C', 'O', 'N', 'T'):

Callers

nothing calls this directly

Calls 14

rm_read_header_oldFunction · 0.85
get_be32Function · 0.85
get_be16Function · 0.85
url_feofFunction · 0.85
rm_read_metadataFunction · 0.85
av_new_streamFunction · 0.85
get_str8Function · 0.85
ff_rm_alloc_rmstreamFunction · 0.85
url_fskipFunction · 0.85
url_ftellFunction · 0.85
url_fseekFunction · 0.85

Tested by

no test coverage detected