[MPlayer-dev-eng] [PATCH]calculating asf seek_bytes with int64_t
Reimar Döffinger
Reimar.Doeffinger at stud.uni-karlsruhe.de
Wed Apr 25 12:20:18 CEST 2007
Hellom
On Wed, Apr 25, 2007 at 05:47:30PM +0800, qwen dux wrote:
> 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 should be 64 bits as well, so why does this patch help?
> 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);
Cosmetics (adding spaces before the //), %lld is not portable (PRI
macros are the right thing to use) and it was already wrong before
anyway.
Greetings,
Reimar Döffinger
More information about the MPlayer-dev-eng
mailing list