changeset 1351:244017c6b2ae libavformat

fix r_frame_rate detection in mpeg4 streams with non integer fps
author michael
date Tue, 03 Oct 2006 19:13:27 +0000
parents f77cf5a063a8
children e3d0366c8dfb
files utils.c
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/utils.c	Tue Oct 03 17:12:48 2006 +0000
+++ b/utils.c	Tue Oct 03 19:13:27 2006 +0000
@@ -1961,10 +1961,15 @@
                 }
             }
 
-            /* if no real frame rate, use the codec one */
             if (!st->r_frame_rate.num){
-                st->r_frame_rate.num = st->codec->time_base.den;
-                st->r_frame_rate.den = st->codec->time_base.num;
+                if(    st->codec->time_base.den * (int64_t)st->time_base.num
+                    <= st->codec->time_base.num * (int64_t)st->time_base.den){
+                    st->r_frame_rate.num = st->codec->time_base.den;
+                    st->r_frame_rate.den = st->codec->time_base.num;
+                }else{
+                    st->r_frame_rate.num = st->time_base.den;
+                    st->r_frame_rate.den = st->time_base.num;
+                }
             }
         }
     }