[MPlayer-dev-eng] [PATCH] audio file truncation

Alan Curry pacman at theworld.com
Sat Jun 17 21:20:50 CEST 2006


Now that uau has committed all the necessary changes to mplayer.c, here's
what's left of my audio truncation diffs. Look good?

Index: libmpdemux/demux_lavf.c
===================================================================
--- libmpdemux/demux_lavf.c	(revision 18744)
+++ libmpdemux/demux_lavf.c	(working copy)
@@ -329,11 +329,6 @@
 
     demux->filepos=stream_tell(demux->stream);
 
-    if(stream_eof(demux->stream)){
-//        demuxre->stream->eof=1;
-        return 0;
-    }
-
     if(av_read_frame(priv->avfc, &pkt) < 0)
         return 0;
         
Index: libao2/ao_oss.c
===================================================================
--- libao2/ao_oss.c	(revision 18744)
+++ libao2/ao_oss.c	(working copy)
@@ -495,8 +495,13 @@
 // it should round it down to outburst*n
 // return: number of bytes played
 static int play(void* data,int len,int flags){
-    len/=ao_data.outburst;
-    len=write(audio_fd,data,len*ao_data.outburst);
+    if(len==0)
+        return len;
+    if(len>ao_data.outburst || !(flags & AOPLAY_FINAL_CHUNK)) {
+        len/=ao_data.outburst;
+        len*=ao_data.outburst;
+    }
+    len=write(audio_fd,data,len);
     return len;
 }
 



More information about the MPlayer-dev-eng mailing list