[MPlayer-dev-eng] [PATCH] ASF: Use play_duration instead of send_duration

Zuxy Meng zuxy.meng at gmail.com
Wed May 23 06:39:59 CEST 2007


Hi,

Currently the asf's movielength is obtained thru the send time field
in asf file header, while the correct one to use is play time
substracted by preroll. Send time should be ignored by a demuxer
although most encoders will set it to the same value as play time. I
happened to encounter a clip whose send time isn't properly set,
leading to incorrect OSD display.

Libavformat demuxed the clip correctly, because although it uses send
time, libavformat reads the two fields in a reversed order (play time
appears first in the file header, but libavformat reads it as send
time).
-- 
Zuxy
Beauty is truth,
While truth is beauty.
PGP KeyID: E8555ED6
-------------- next part --------------
Index: libmpdemux/asfheader.c
===================================================================
--- libmpdemux/asfheader.c	?????? 23375??
+++ libmpdemux/asfheader.c	????????????
@@ -588,7 +588,7 @@
       asf->packetsize=fileh->max_packet_size;
       asf->packet=malloc(asf->packetsize); // !!!
       asf->packetrate=fileh->max_bitrate/8.0/(double)asf->packetsize;
-      asf->movielength=fileh->send_duration/10000000LL;
+      asf->movielength=(fileh->play_duration-fileh->preroll)/10000000LL;
   }
 
   // find content header


More information about the MPlayer-dev-eng mailing list