From b136fa417f74c3804d52b376a17f7f4741560c6d Mon Sep 17 00:00:00 2001 From: gpoirier Date: Mon, 10 Oct 2005 05:45:38 +0000 Subject: 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 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16719 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/demux_lavf.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libmpdemux') diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c index 8588e0918b..c31a0a9114 100644 --- a/libmpdemux/demux_lavf.c +++ b/libmpdemux/demux_lavf.c @@ -259,6 +259,10 @@ static demuxer_t* demux_open_lavf(demuxer_t *demuxer){ 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 @@ static demuxer_t* demux_open_lavf(demuxer_t *demuxer){ 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; -- cgit v1.2.3