]> git.sesse.net Git - mlt/blobdiff - src/framework/mlt_property.c
Make animation length optional.
[mlt] / src / framework / mlt_property.c
index bbc02ee0d7c49940dcea22bbdbf7e15a34fb2104..0edd0161bbf5bd9fcdf878108a34b3ba1c2ed1ea 100644 (file)
@@ -35,6 +35,7 @@
 #include <locale.h>
 #include <pthread.h>
 #include <float.h>
+#include <math.h>
 
 
 /** Bit pattern used internally to indicated representations available.
@@ -305,7 +306,7 @@ static int time_clock_to_frames( const char *s, double fps, locale_t locale )
        }
        free( copy );
 
-       return fps * ( (hours * 3600) + (minutes * 60) + seconds ) + 0.5;
+       return lrint( fps * ( (hours * 3600) + (minutes * 60) + seconds ) );
 }
 
 /** Parse a SMPTE timecode string.
@@ -351,7 +352,7 @@ static int time_code_to_frames( const char *s, double fps )
        }
        free( copy );
 
-       return frames + ( fps * ( (hours * 3600) + (minutes * 60) + seconds ) + 0.5 );
+       return lrint( fps * ( (hours * 3600) + (minutes * 60) + seconds ) + frames );
 }
 
 /** Convert a string to an integer.