]> git.sesse.net Git - ffmpeg/blobdiff - libav/utils.c
* encoding of AC3 with more than 2 channels
[ffmpeg] / libav / utils.c
index aafc4e786324aca7b4794331ade6f10e73b3904d..8570be2055bb49191aae284c97117f532fa456eb 100644 (file)
@@ -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>
@@ -374,10 +375,10 @@ void av_close_input_file(AVFormatContext *s)
 }
 
 
-int av_write_packet(AVFormatContext *s, AVPacket *pkt)
+int av_write_packet(AVFormatContext *s, AVPacket *pkt, int force_pts)
 {
     /* XXX: currently, an emulation because internal API must change */
-    return s->format->write_packet(s, pkt->stream_index, pkt->data, pkt->size);
+    return s->format->write_packet(s, pkt->stream_index, pkt->data, pkt->size, force_pts);
 }
 
 /* "user interface" functions */
@@ -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;
+}