[Ffmpeg-cvslog] CVS: ffmpeg/libavformat nsvdec.c,1.5,1.6

Michael Niedermayer CVS michael
Tue Apr 26 23:46:48 CEST 2005


Update of /cvsroot/ffmpeg/ffmpeg/libavformat
In directory mail:/var2/tmp/cvs-serv27318

Modified Files:
	nsvdec.c 
Log Message:
fix useless framerate messup


Index: nsvdec.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/nsvdec.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- nsvdec.c	24 Feb 2005 19:08:50 -0000	1.5
+++ nsvdec.c	26 Apr 2005 21:46:46 -0000	1.6
@@ -205,13 +205,13 @@
     { 0, 0 },
 };
 
-static const uint64_t nsv_framerate_table[] = {
-    ((uint64_t)AV_TIME_BASE * 30),
-    ((uint64_t)AV_TIME_BASE * 30000 / 1001), /* 29.97 */
-    ((uint64_t)AV_TIME_BASE * 25),
-    ((uint64_t)AV_TIME_BASE * 24000 / 1001), /* 23.98 */
-    ((uint64_t)AV_TIME_BASE * 30), /* ?? */
-    ((uint64_t)AV_TIME_BASE * 15000 / 1001), /* 14.98 */
+static const AVRational nsv_framerate_table[] = {
+    {30,1},
+    {30000,1001},
+    {25,1},
+    {24000,1001},
+    {30,1},
+    {15000,1001},
 };
 
 //static int nsv_load_index(AVFormatContext *s);
@@ -401,7 +401,8 @@
     ByteIOContext *pb = &s->pb;
     uint32_t vtag, atag;
     uint16_t vwidth, vheight;
-    uint32_t framerate;
+    AVRational framerate;
+    int i;
     uint16_t unknown;
     AVStream *st;
     NSVStream *nst;
@@ -411,17 +412,17 @@
     atag = get_le32(pb);
     vwidth = get_le16(pb);
     vheight = get_le16(pb);
-    framerate = (uint8_t)get_byte(pb);
+    i = get_byte(pb);
     /* XXX how big must the table be ? */
     /* seems there is more to that... */
-    PRINT(("NSV NSVs framerate code %2x\n", framerate));
-    framerate = (framerate & 0x80)?(nsv_framerate_table[framerate & 0x7F]):(framerate*AV_TIME_BASE);
+    PRINT(("NSV NSVs framerate code %2x\n", i));
+    if(i&0x80) framerate= nsv_framerate_table[i & 0x7F];
+    else       framerate= (AVRational){i, 1};
     unknown = get_le16(pb);
 #ifdef DEBUG
     print_tag("NSV NSVs vtag", vtag, 0);
     print_tag("NSV NSVs atag", atag, 0);
     PRINT(("NSV NSVs vsize %dx%d\n", vwidth, vheight));
-    PRINT(("NSV NSVs framerate %2x\n", framerate));
 #endif
     
     /* XXX change to ap != NULL ? */
@@ -446,9 +447,9 @@
             st->codec.height = vheight;
             st->codec.bits_per_sample = 24; /* depth XXX */
 
-            st->codec.frame_rate = framerate;
-            st->codec.frame_rate_base = AV_TIME_BASE;
-            av_set_pts_info(st, 64, AV_TIME_BASE, framerate);
+            av_set_pts_info(st, 64, framerate.den, framerate.num);
+            st->codec.frame_rate = framerate.num;
+            st->codec.frame_rate_base = framerate.den;
             st->start_time = 0;
             st->duration = nsv->duration;
         }





More information about the ffmpeg-cvslog mailing list