[MPlayer-dev-eng] [PATCH] libmpdemux/demux_audio: Fix audio time length.

Benoît Thébaudeau benoit.thebaudeau at advansee.com
Tue Jan 17 19:45:02 CET 2012


Reimar,

> > diff -Nrdup mplayer.orig/libmpdemux/demux_audio.c
> > mplayer/libmpdemux/demux_audio.c
> > --- mplayer.orig/libmpdemux/demux_audio.c	2012-01-17
> > 15:03:29.757246846 +0100
> > +++ mplayer/libmpdemux/demux_audio.c	2012-01-17 15:11:47.549260678
> > +0100
> > @@ -787,7 +787,9 @@ static void demux_close_audio(demuxer_t*
> >  
> >  static int demux_audio_control(demuxer_t *demuxer,int cmd, void
> >  *arg){
> >      sh_audio_t *sh_audio=demuxer->audio->sh;
> > -    int audio_length = sh_audio->i_bps ? demuxer->movi_end /
> > sh_audio->i_bps : 0;
> > +    off_t movi_size = (demuxer->movi_end > demuxer->movi_start) ?
> > +                      demuxer->movi_end - demuxer->movi_start :
> > demuxer->movi_end;
> > +    int audio_length = sh_audio->i_bps ? movi_size /
> > sh_audio->i_bps : 0;
> 
> Hm, is there much point/sense in falling back to just movi_end?
> I would have suggest something like e.g.
> int audio_length = sh_audio->i_bps && demuxer->movi_end >
> demuxer->movi_start ? ... : 0;

I don't know. I just put that because it was the previous code, and because
it might be a better length indication than 0 even if not accurate.

I attach the patch with your suggestion.

Can someone also take a look at these?
http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/2012-January/069820.html
http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/2012-January/069821.html

Benoît
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 4-fix-audio-length.patch
Type: text/x-patch
Size: 731 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20120117/af2a1fcb/attachment.bin>


More information about the MPlayer-dev-eng mailing list