# HG changeset patch # User gpoirier # Date 1128923138 0 # Node ID 044260623695bea5ac0cf66c243b1d97694f2d65 # Parent 9c80148c5a4d4d522c16a896be9153f4c5cb800c makes demux_lavf (-demuxer 35) use the framerate specified in the container if it's set and only fall back to the codec framerate if the former is not set. This solves the issue of some avi's playing at 30000/1 fps instead of the correct framerate. Patch by Ivo < ivop AH euronet POIS nl > Original thread: Date: Sep 25, 2005 12:34 AM Subject: [MPlayer-dev-eng] [PATCH] make demux_lavf use container framerate diff -r 9c80148c5a4d -r 044260623695 libmpdemux/demux_lavf.c --- a/libmpdemux/demux_lavf.c Sun Oct 09 19:26:23 2005 +0000 +++ b/libmpdemux/demux_lavf.c Mon Oct 10 05:45:38 2005 +0000 @@ -259,6 +259,10 @@ sh_video->bih= bih; sh_video->disp_w= codec->width; sh_video->disp_h= codec->height; + if (st->time_base.den) { /* if container has time_base, use that */ + sh_video->video.dwRate= st->time_base.den; + sh_video->video.dwScale= st->time_base.num; + } else { #if LIBAVFORMAT_BUILD >= 4624 sh_video->video.dwRate= codec->time_base.den; sh_video->video.dwScale= codec->time_base.num; @@ -266,6 +270,7 @@ sh_video->video.dwRate= codec->frame_rate; sh_video->video.dwScale= codec->frame_rate_base; #endif + } sh_video->fps=(float)sh_video->video.dwRate/(float)sh_video->video.dwScale; sh_video->frametime=(float)sh_video->video.dwScale/(float)sh_video->video.dwRate; sh_video->format = bih->biCompression;