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

qwen dux qwendu at gmail.com
Thu Apr 26 04:05:03 CEST 2007


Hello,
>off_t should be 64 bits as well, so why does this patch help?
I test it on my i386 pc,but  the  sizeof(off_t) is  4, also on my emedded
board;

>%lld is not portable (PRI macros are the right thing to use) and it
was already wrong before anyway.
OK,I modified.

Index: demux_asf.c
===================================================================
--- demux_asf.c (revision 23112)
+++ 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: use int64_t?
        (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 -> %"PRId64" packs -> %"PRId64" 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