[MPlayer-dev-eng] [PATCH] fix length in asf files

Reimar Döffinger Reimar.Doeffinger at gmx.de
Tue Nov 10 17:22:21 CET 2009


On Tue, Nov 10, 2009 at 11:11:56AM -0500, compn wrote:
> On Tue, 10 Nov 2009 16:42:39 +0100, Reimar Döffinger wrote:
> >On Tue, Nov 10, 2009 at 10:07:48AM -0500, compn wrote:
> >> Index: libmpdemux/demux_asf.c
> >> ===================================================================
> >> --- libmpdemux/demux_asf.c	(revision 29165)
> >> +++ libmpdemux/demux_asf.c	(working copy)
> >> @@ -594,7 +594,7 @@
> >>  */
> >>      switch(cmd) {
> >>  	case DEMUXER_CTRL_GET_TIME_LENGTH:
> >> -	    *((double *)arg)=(double)(asf->movielength);
> >> +	    *((double *)arg)=asf->movielength;
> >>  	    return DEMUXER_CTRL_OK;
> >>  
> >>  	case DEMUXER_CTRL_GET_PERCENT_POS:
> >
> >Looks unrelated/purely cosmetic to me.
> >And can be applied immediately I'd say.
> >
> >> Index: libmpdemux/asf.h
> >> ===================================================================
> >> --- libmpdemux/asf.h	(revision 29165)
> >> +++ libmpdemux/asf.h	(working copy)
> >> @@ -204,7 +204,7 @@
> >>      int scrambling_b;
> >>      unsigned packetsize;
> >>      double   packetrate;
> >> -    unsigned movielength;
> >> +    double   movielength;
> >>      int asf_is_dvr_ms;
> >>      uint32_t asf_frame_state;
> >>      int asf_frame_start_found;
> >> Index: libmpdemux/asfheader.c
> >> ===================================================================
> >> --- libmpdemux/asfheader.c	(revision 29165)
> >> +++ libmpdemux/asfheader.c	(working copy)
> >> @@ -527,7 +527,8 @@
> >>        asf->packetsize=fileh->max_packet_size;
> >>        asf->packet=malloc(asf->packetsize); // !!!
> >>        asf->packetrate=fileh->max_bitrate/8.0/(double)asf->packetsize;
> >> -      asf->movielength=(fileh->play_duration-fileh->preroll)/10000000LL;
> >> +      asf->movielength=(double)fileh->play_duration/10000000 -
> >> +                       (double)fileh->preroll/1000;
> >
> >How about just
> >(fileh->play_duration - 10000*fileh->preroll) / 10000000.0
> >The different time-base are really strange though...
> 
> whatever you think works best. patch gets closest to wmp.
> 
> http://samples.mplayerhq.hu/V-codecs/WMV9/buggyDMOdecoding.wmv
> wmp reports: 2:49
> lavf reports: ID_LENGTH=165.05
> before patch: ID_LENGTH=174.00
> after patch:  ID_LENGTH=169.39

Huh? FFmpeg says
Duration: 00:02:49.42, start: 5.000000
and -demuxer lavf says
ID_LENGTH=169.43
too.



More information about the MPlayer-dev-eng mailing list