diff options
author | albeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-02-14 18:37:33 +0000 |
---|---|---|
committer | albeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-02-14 18:37:33 +0000 |
commit | d535bf801d20ad050df76fcebf8de50f35f37bb1 (patch) | |
tree | 1260d2753947d64db1049db2f4586ae1a27b916f /libmpdemux | |
parent | d056e71d6c65dcb92bdc3f3145a92a1a69f5fa98 (diff) |
Improved mp3 detection (don't detect mpeg1/2 as mp3 anymore)
Added resync_audio call
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4701 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r-- | libmpdemux/demux_audio.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/libmpdemux/demux_audio.c b/libmpdemux/demux_audio.c index a8c7bfb468..890b04168e 100644 --- a/libmpdemux/demux_audio.c +++ b/libmpdemux/demux_audio.c @@ -25,6 +25,7 @@ typedef struct da_priv { extern int mp_decode_mp3_header(unsigned char* hbuf); extern void free_sh_audio(sh_audio_t* sh); +extern void resync_audio_stream(sh_audio_t *sh_audio); int demux_audio_open(demuxer_t* demuxer) { @@ -82,8 +83,18 @@ int demux_audio_open(demuxer_t* demuxer) { switch(frmt) { case MP3: sh_audio->format = 0x55; - stream_seek(s,st_pos); demuxer->movi_start = st_pos; + for(n = 0; n < 5 ; n++) { + pos = mp_decode_mp3_header(hdr); + if(pos < 0) + return 0; + stream_skip(s,pos-4); + if(s->eof) + return 0; + stream_read(s,hdr,4); + if(s->eof) + return 0; + } if(s->end_pos) { char tag[4]; stream_seek(s,s->end_pos-128); @@ -197,7 +208,7 @@ int demux_audio_fill_buffer(demux_stream_t *ds) { ds_add_packet(ds,dp); return 1; } - } + } break; case WAV : { int l = sh_audio->wf->nAvgBytesPerSec; demux_packet_t* dp = new_demux_packet(l); @@ -246,4 +257,6 @@ void demux_audio_seek(demuxer_t *demuxer,float rel_seek_secs,int flags){ stream_seek(s,pos); + resync_audio_stream(sh_audio); + } |