[NUT-devel] [nut]: r177 - in trunk/libnut: muxer.c priv.h

ods15 subversion at mplayerhq.hu
Sat Nov 4 13:19:22 CET 2006


Author: ods15
Date: Sat Nov  4 13:19:21 2006
New Revision: 177

Modified:
   trunk/libnut/muxer.c
   trunk/libnut/priv.h

Log:
as required by spec, make timebase relatively prime in muxer


Modified: trunk/libnut/muxer.c
==============================================================================
--- trunk/libnut/muxer.c	(original)
+++ trunk/libnut/muxer.c	Sat Nov  4 13:19:21 2006
@@ -617,6 +617,12 @@
 		nut->info = NULL;
 	}
 
+	for (i = 0; i < nut->timebase_count; i++) {
+		int t = gcd(nut->tb[i].nom, nut->tb[i].den);
+		nut->tb[i].nom /= t;
+		nut->tb[i].den /= t;
+	}
+
 	put_data(nut->o, strlen(ID_STRING) + 1, ID_STRING);
 
 	put_headers(nut);

Modified: trunk/libnut/priv.h
==============================================================================
--- trunk/libnut/priv.h	(original)
+++ trunk/libnut/priv.h	Sat Nov  4 13:19:21 2006
@@ -217,6 +217,15 @@
 	return pts;
 }
 
+static inline int gcd(int a, int b) {
+	while (b != 0) {
+		int t = b;
+		b = a % b;
+		a = t;
+	}
+	return a;
+}
+
 #define bctello(bc) ((bc)->file_pos + ((bc)->buf_ptr - (bc)->buf))
 
 #define TO_PTS(prefix, pts) \



More information about the NUT-devel mailing list