aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2011-11-28 10:02:21 +0100
committerAnton Khirnov <anton@khirnov.net>2011-11-30 07:47:43 +0100
commit2092232581468e3d656805e2b0effd14092dc6f5 (patch)
tree8854a180c65ca2e10ff9f0e6e0ce13961d8e3d85
parent91b412e786055aec3c5b6529a0c9ecc70fde8a6d (diff)
downloadffmpeg-2092232581468e3d656805e2b0effd14092dc6f5.tar.gz
lavf: estimate frame duration from r_frame_rate.
If r_frame_rate is set, it should be more reliable for this than either codec or stream timebase.
-rw-r--r--libavformat/utils.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 2b378ab712..29eaf1b15a 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -826,7 +826,10 @@ static void compute_frame_duration(int *pnum, int *pden, AVStream *st,
*pden = 0;
switch(st->codec->codec_type) {
case AVMEDIA_TYPE_VIDEO:
- if(st->time_base.num*1000LL > st->time_base.den){
+ if (st->r_frame_rate.num) {
+ *pnum = st->r_frame_rate.den;
+ *pden = st->r_frame_rate.num;
+ } else if(st->time_base.num*1000LL > st->time_base.den) {
*pnum = st->time_base.num;
*pden = st->time_base.den;
}else if(st->codec->time_base.num*1000LL > st->codec->time_base.den){