diff ffm.c @ 85:25062c9b1f86 libavformat

per context frame_rate_base, this should finally fix frame_rate related av sync issues
author michaelni
date Wed, 12 Mar 2003 15:16:19 +0000
parents 8bdaec4e3e4b
children 2fa5e94ba716
line wrap: on
line diff
--- a/ffm.c	Wed Mar 12 01:35:47 2003 +0000
+++ b/ffm.c	Wed Mar 12 15:16:19 2003 +0000
@@ -140,8 +140,6 @@
 
     /* list of streams */
     for(i=0;i<s->nb_streams;i++) {
-        int gcd;
-    
         st = s->streams[i];
         fst = av_mallocz(sizeof(FFMStream));
         if (!fst)
@@ -158,9 +156,8 @@
         /* specific info */
         switch(codec->codec_type) {
         case CODEC_TYPE_VIDEO:
-            gcd= av_gcd(FRAME_RATE_BASE, codec->frame_rate);
-            put_be32(pb, FRAME_RATE_BASE / gcd);
-            put_be32(pb, codec->frame_rate / gcd);
+            put_be32(pb, codec->frame_rate_base);
+            put_be32(pb, codec->frame_rate);
             put_be16(pb, codec->width);
             put_be16(pb, codec->height);
             put_be16(pb, codec->gop_size);
@@ -229,7 +226,7 @@
     if (st->codec.codec_type == CODEC_TYPE_AUDIO) {
         duration = ((float)st->codec.frame_size / st->codec.sample_rate * 1000000.0);
     } else {
-        duration = (1000000.0 * FRAME_RATE_BASE / (float)st->codec.frame_rate);
+        duration = (1000000.0 * st->codec.frame_rate_base / (float)st->codec.frame_rate);
     }
 
     pts = fst->pts;
@@ -394,7 +391,6 @@
     /* read each stream */
     for(i=0;i<s->nb_streams;i++) {
         char rc_eq_buf[128];
-        int rate, scale;
 
         st = av_mallocz(sizeof(AVStream));
         if (!st)
@@ -416,9 +412,8 @@
         /* specific info */
         switch(codec->codec_type) {
         case CODEC_TYPE_VIDEO:
-            scale= get_be32(pb);
-            rate= get_be32(pb);
-            codec->frame_rate = (rate * (int64_t)FRAME_RATE_BASE) / scale;
+            codec->frame_rate_base = get_be32(pb);
+            codec->frame_rate = get_be32(pb);
             codec->width = get_be16(pb);
             codec->height = get_be16(pb);
             codec->gop_size = get_be16(pb);