[MPlayer-dev-eng] [PATCH]calculating asf seek_bytes with int64_t

qwen dux qwendu at gmail.com
Wed Apr 25 11:47:30 CEST 2007


Hi,
     These is a trouble when I seek asf file(such as wma and wmv file) used
-ss command line option,I found the out-of range when mplayer calculated the
value of rel_seek_packs and rel_seek_bytes:

Index: demux_asf.c
===================================================================
--- demux_asf.c (revision 23093)
+++ demux_asf.c (working copy)
@@ -486,14 +486,14 @@

   //================= seek in ASF ==========================
     float p_rate=asf->packetrate; // packets / sec
-    off_t rel_seek_packs=(flags&2)?     // FIXME: int may be enough?
+    int64_t rel_seek_packs=(flags&2)?   // FIXME: int may be enough?

(rel_seek_secs*(demuxer->movi_end-demuxer->movi_start)/asf->packetsize):
        (rel_seek_secs*p_rate);
-    off_t rel_seek_bytes=rel_seek_packs*asf->packetsize;
+    int64_t rel_seek_bytes=rel_seek_packs*asf->packetsize;
     off_t newpos;
     //printf("ASF: packs: %d  duration: %d
\n",(int)fileh.packets,*((int*)&fileh.duration));
-//    printf("ASF_seek: %d secs -> %d packs -> %d bytes  \n",
-//       rel_seek_secs,rel_seek_packs,rel_seek_bytes);
+    //printf("ASF_seek: %f secs -> %lld packs -> %lld bytes  \n",
+    //   rel_seek_secs,rel_seek_packs,rel_seek_bytes);
     newpos=((flags&1)?demuxer->movi_start:demuxer->filepos)+rel_seek_bytes;
     if(newpos<0 || newpos<demuxer->movi_start) newpos=demuxer->movi_start;
 //    printf("\r -- asf: newpos=%d -- \n",newpos);



More information about the MPlayer-dev-eng mailing list