aboutsummaryrefslogtreecommitdiffstats
path: root/libav/utils.c
diff options
context:
space:
mode:
authorJuanjo <pulento@users.sourceforge.net>2002-03-20 11:16:07 +0000
committerJuanjo <pulento@users.sourceforge.net>2002-03-20 11:16:07 +0000
commitaf469427b345528797a6f0f33e8e6e5df623593d (patch)
tree531b234412600c2f8c22f001639895765ae31691 /libav/utils.c
parentce7c56c2504693d23949cca5b7cadddd673348ab (diff)
downloadffmpeg-af469427b345528797a6f0f33e8e6e5df623593d.tar.gz
- Fix pts calculation on mpeg mux (A/V sync) - Thanks to Lennert Buytenhek
- Fix temporal-reference-glitches for MPEG1 - Thanks to Lennert Buytenhek Originally committed as revision 343 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libav/utils.c')
-rw-r--r--libav/utils.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/libav/utils.c b/libav/utils.c
index aafc4e7863..7315ebdc92 100644
--- a/libav/utils.c
+++ b/libav/utils.c
@@ -17,6 +17,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "avformat.h"
+#include "tick.h"
#ifndef CONFIG_WIN32
#include <unistd.h>
#include <fcntl.h>
@@ -615,4 +616,31 @@ int get_frame_filename(char *buf, int buf_size,
return -1;
}
+static int gcd(INT64 a, INT64 b)
+{
+ INT64 c;
+
+ while (1) {
+ c = a % b;
+ if (c == 0)
+ return b;
+ a = b;
+ b = c;
+ }
+}
+
+void ticker_init(Ticker *tick, INT64 inrate, INT64 outrate)
+{
+ int g;
+
+ g = gcd(inrate, outrate);
+ inrate /= g;
+ outrate /= g;
+ tick->value = -outrate/2;
+
+ tick->inrate = inrate;
+ tick->outrate = outrate;
+ tick->div = tick->outrate / tick->inrate;
+ tick->mod = tick->outrate % tick->inrate;
+}