Mercurial > mplayer.hg
changeset 5307:fb58b4a8fb18
Use esds parser for movie esds atom and only pass decoder specific configuration into the stream_header.
author | atmos4 |
---|---|
date | Sun, 24 Mar 2002 14:47:28 +0000 |
parents | 4b32fe3758fa |
children | 69e55c9c1a1a |
files | libmpdemux/demux_mov.c |
diffstat | 1 files changed, 15 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/demux_mov.c Sun Mar 24 14:15:24 2002 +0000 +++ b/libmpdemux/demux_mov.c Sun Mar 24 14:47:28 2002 +0000 @@ -669,7 +669,7 @@ // esds atom: // 28 int atom size (bytes of int size, int type and data) // 32 char[4] atom type (fourc charater code -> esds) -// 62 int compressed datarate (Bits) +// 36 char[] atom data (len=size-8) sh->samplesize=char2short(trak->stdata,18)/8; sh->channels=char2short(trak->stdata,16); @@ -705,7 +705,7 @@ switch(char2int(trak->stdata,32)) { // atom type case MOV_FOURCC('e','s','d','s'): { mp_msg(MSGT_DEMUX, MSGL_INFO, "MOV: Found MPEG4 audio Elementary Stream Descriptor atom (%d)!\n", atom_len); - if(atom_len >= 8) { + if(atom_len > 8) { esds_t esds; if(!mp4_parse_esds(&trak->stdata[36], atom_len-8, &esds)) { @@ -820,8 +820,17 @@ // add code here to save esds header of length atom_len-8 // beginning at stdata[86] to some variable to pass it // on to the decoder ::atmos - trak->stream_header=trak->stdata+pos+8; - trak->stream_header_len=atom_len-8; + if(atom_len > 8) { + esds_t esds; + if(!mp4_parse_esds(trak->stdata+pos+8, atom_len-8, &esds)) { + + // dump away the codec specific configuration for the AAC decoder + trak->stream_header_len = esds.decoderConfigLen; + trak->stream_header = (unsigned char *)malloc(trak->stream_header_len); + memcpy(trak->stream_header, esds.decoderConfig, trak->stream_header_len); + } + mp4_free_esds(&esds); // freeup esds mem + } break; default: mp_msg(MSGT_DEMUX, MSGL_INFO, "MOV: Found unknown movie atom %c%c%c%c (%d)!\n", @@ -1273,6 +1282,8 @@ demux_packet_t* dp=new_demux_packet(x+trak->stream_header_len); memcpy(dp->buffer,trak->stream_header,trak->stream_header_len); stream_read(demuxer->stream,dp->buffer+trak->stream_header_len,x); + free(trak->stream_header); + trak->stream_header = NULL; dp->pts=pts; dp->flags=0; dp->pos=pos; // FIXME?