changeset 10891:65ed62e138fa

Fixed 'reading after EOF'. demuxers didn't check, how many they've read!
author lumag
date Sat, 20 Sep 2003 12:50:25 +0000
parents 7777dded6caa
children 2167ac4c1d72
files libmpdemux/demux_audio.c libmpdemux/demux_rawaudio.c libmpdemux/demuxer.c
diffstat 3 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_audio.c	Sat Sep 20 11:57:42 2003 +0000
+++ b/libmpdemux/demux_audio.c	Sat Sep 20 12:50:25 2003 +0000
@@ -265,7 +265,8 @@
   case WAV : {
     int l = sh_audio->wf->nAvgBytesPerSec;
     demux_packet_t*  dp = new_demux_packet(l);
-    stream_read(s,dp->buffer,l);
+    l = stream_read(s,dp->buffer,l);
+    resize_demux_packet(dp, l);
     priv->last_pts = priv->last_pts < 0 ? 0 : priv->last_pts + l/(float)sh_audio->i_bps;
     ds->pts = priv->last_pts - (ds_tell_pts(demux->audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps;
     ds_add_packet(ds,dp);
--- a/libmpdemux/demux_rawaudio.c	Sat Sep 20 11:57:42 2003 +0000
+++ b/libmpdemux/demux_rawaudio.c	Sat Sep 20 12:50:25 2003 +0000
@@ -68,7 +68,8 @@
   dp->pts = (spos - demuxer->movi_start)  / (float)(sh_audio->wf->nAvgBytesPerSec);
   dp->pos = (spos - demuxer->movi_start);
 
-  stream_read(demuxer->stream,dp->buffer,l);
+  l = stream_read(demuxer->stream,dp->buffer,l);
+  resize_demux_packet(dp, l);
   ds_add_packet(ds,dp);
 
   return 1;
--- a/libmpdemux/demuxer.c	Sat Sep 20 11:57:42 2003 +0000
+++ b/libmpdemux/demuxer.c	Sat Sep 20 12:50:25 2003 +0000
@@ -265,7 +265,8 @@
 
 void ds_read_packet(demux_stream_t *ds,stream_t *stream,int len,float pts,off_t pos,int flags){
     demux_packet_t* dp=new_demux_packet(len);
-    stream_read(stream,dp->buffer,len);
+    len = stream_read(stream,dp->buffer,len);
+    resize_demux_packet(dp, len);
     dp->pts=pts; //(float)pts/90000.0f;
     dp->pos=pos;
     dp->flags=flags;