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

Reimar Döffinger Reimar.Doeffinger at gmx.de
Tue Jan 17 19:26:18 CET 2012


On Tue, Jan 17, 2012 at 03:18:11PM +0100, Benoît Thébaudeau wrote:
> Hi all,
> 
> This patch fixes the lack of use of movi_start by the audio demuxer to compute
> the audio time length.
> 
> Signed-off-by: "Benoît Thébaudeau" <benoit.thebaudeau at advansee.com>
> 
> Best regards,
> Benoît Thébaudeau

> 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;


More information about the MPlayer-dev-eng mailing list