Mercurial > libavformat.hg
comparison mov.c @ 2589:960795567b33 libavformat
append extradata atoms when parsing, fix OLOCOONS_O3.mov
author | bcoudurier |
---|---|
date | Mon, 08 Oct 2007 13:06:48 +0000 |
parents | 92bf4673d050 |
children | 022174d849d5 |
comparison
equal
deleted
inserted
replaced
2588:577c8b1dafcc | 2589:960795567b33 |
---|---|
468 | 468 |
469 /* FIXME modify qdm2/svq3/h264 decoders to take full atom as extradata */ | 469 /* FIXME modify qdm2/svq3/h264 decoders to take full atom as extradata */ |
470 static int mov_read_extradata(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) | 470 static int mov_read_extradata(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) |
471 { | 471 { |
472 AVStream *st = c->fc->streams[c->fc->nb_streams-1]; | 472 AVStream *st = c->fc->streams[c->fc->nb_streams-1]; |
473 if((uint64_t)atom.size > (1<<30)) | 473 uint64_t size= (uint64_t)st->codec->extradata_size + atom.size + 8 + FF_INPUT_BUFFER_PADDING_SIZE; |
474 return -1; | 474 uint8_t *buf; |
475 av_free(st->codec->extradata); | 475 if(size > INT_MAX || (uint64_t)atom.size > INT_MAX) |
476 st->codec->extradata_size = atom.size + 8; | 476 return -1; |
477 st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); | 477 buf= av_realloc(st->codec->extradata, size); |
478 if (st->codec->extradata) { | 478 if(!buf) |
479 AV_WL32(st->codec->extradata + 4, atom.type); | 479 return -1; |
480 get_buffer(pb, st->codec->extradata + 8, atom.size); | 480 st->codec->extradata= buf; |
481 } else | 481 buf+= st->codec->extradata_size; |
482 url_fskip(pb, atom.size); | 482 st->codec->extradata_size= size - FF_INPUT_BUFFER_PADDING_SIZE; |
483 AV_WB32( buf , atom.size + 8); | |
484 AV_WL32( buf + 4, atom.type); | |
485 get_buffer(pb, buf + 8, atom.size); | |
483 return 0; | 486 return 0; |
484 } | 487 } |
485 | 488 |
486 static int mov_read_wave(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) | 489 static int mov_read_wave(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) |
487 { | 490 { |