diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-09-09 20:05:42 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-09-09 20:05:42 +0000 |
commit | 021f63cd71afb4bf6e6ca6fd0a76cc8099a504e0 (patch) | |
tree | bccfec1bbcc7b4965e0b3829aefecd8b82e953c9 /libmpdemux/demux_audio.c | |
parent | 703189e5ea2d1e403e3419c6e96c3ce156325d57 (diff) | |
download | mpv-021f63cd71afb4bf6e6ca6fd0a76cc8099a504e0.tar.bz2 mpv-021f63cd71afb4bf6e6ca6fd0a76cc8099a504e0.tar.xz |
Ignore movi_end (except on error) to allow playing growing files.
Also adds a check if stream_read read the requested length.
This and the movi_end check on error help not accidently playing ID3 tags.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16439 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux/demux_audio.c')
-rw-r--r-- | libmpdemux/demux_audio.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libmpdemux/demux_audio.c b/libmpdemux/demux_audio.c index b747e5e1ec..6ac7563980 100644 --- a/libmpdemux/demux_audio.c +++ b/libmpdemux/demux_audio.c @@ -404,7 +404,7 @@ static int demux_audio_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds) { priv = demux->priv; s = demux->stream; - if(s->eof || (demux->movi_end && stream_tell(s) >= demux->movi_end) ) + if(s->eof) return 0; switch(priv->frmt) { @@ -412,15 +412,18 @@ static int demux_audio_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds) { while(1) { uint8_t hdr[4]; stream_read(s,hdr,4); - if (s->eof || (demux->movi_end && stream_tell(s) >= demux->movi_end)) + if (s->eof) return 0; l = mp_decode_mp3_header(hdr); if(l < 0) { + if (demux->movi_end && stream_tell(s) >= demux->movi_end) + return 0; // might be ID3 tag, i.e. EOF stream_skip(s,-3); } else { dp = new_demux_packet(l); memcpy(dp->buffer,hdr,4); - stream_read(s,dp->buffer + 4,l-4); + if (stream_read(s,dp->buffer + 4,l-4) != l-4) + return 0; priv->last_pts = priv->last_pts < 0 ? 0 : priv->last_pts + sh_audio->audio.dwScale/(float)sh_audio->samplerate; break; } |