summaryrefslogtreecommitdiffstats
path: root/libmpdemux/demux_lavf.c
diff options
context:
space:
mode:
authorgpoirier <gpoirier@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-10-10 05:45:38 +0000
committergpoirier <gpoirier@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-10-10 05:45:38 +0000
commitb136fa417f74c3804d52b376a17f7f4741560c6d (patch)
tree6a7cc80baa41b46453d4238018df8a065a270186 /libmpdemux/demux_lavf.c
parent2a0bf625f631939e0f4ca3ed2ef0a3dc396ff4f3 (diff)
downloadmpv-b136fa417f74c3804d52b376a17f7f4741560c6d.tar.bz2
mpv-b136fa417f74c3804d52b376a17f7f4741560c6d.tar.xz
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
Diffstat (limited to 'libmpdemux/demux_lavf.c')
-rw-r--r--libmpdemux/demux_lavf.c5
1 files changed, 5 insertions, 0 deletions
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;