[MPlayer-cvslog] CVS: main/libmpdemux video.c, 1.50, 1.51 mpeg_hdr.h, 1.5, 1.6 mpeg_hdr.c, 1.15, 1.16

Richard Felker CVS syncmail at mplayerhq.hu
Sat Aug 6 18:15:10 CEST 2005


CVS change done by Richard Felker CVS

Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var2/tmp/cvs-serv27145

Modified Files:
	video.c mpeg_hdr.h mpeg_hdr.c 
Log Message:
100l to whoever wrote this crap using 1/10000 units. it caused framerates to get trashed from 30000/1001 to 2997/100, etc.!

Index: video.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/video.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- video.c	6 Mar 2005 21:10:01 -0000	1.50
+++ video.c	6 Aug 2005 16:15:07 -0000	1.51
@@ -194,14 +194,14 @@
      else
        diff = mx - md;
      if(diff > 0){
-       picture.fps = (picture.timeinc_resolution * 10000) / diff;
-       mp_msg(MSGT_DECVIDEO,MSGL_V, "FPS seems to be: %d/10000, resolution: %d, delta_units: %d\n", picture.fps, picture.timeinc_resolution, diff);
+       picture.fps = ((float)picture.timeinc_resolution) / diff;
+       mp_msg(MSGT_DECVIDEO,MSGL_V, "FPS seems to be: %f, resolution: %d, delta_units: %d\n", picture.fps, picture.timeinc_resolution, diff);
      }
    }
    if(picture.fps) {
-    sh_video->fps=picture.fps*0.0001f;
-    sh_video->frametime=10000.0f/(float)picture.fps;
-    mp_msg(MSGT_DECVIDEO,MSGL_INFO, "FPS seems to be: %d/10000\n", picture.fps);
+    sh_video->fps=picture.fps;
+    sh_video->frametime=1.0/picture.fps;
+    mp_msg(MSGT_DECVIDEO,MSGL_INFO, "FPS seems to be: %f\n", picture.fps);
    }
    mp_msg(MSGT_DECVIDEO,MSGL_V,"OK!\n");
    sh_video->format=0x10000004;
@@ -253,9 +253,9 @@
    mp_msg(MSGT_DECVIDEO,MSGL_V,"OK!\n");
    sh_video->format=0x10000005;
    if(picture.fps) {
-     sh_video->fps=picture.fps*0.0001f;
-     sh_video->frametime=10000.0f/(float)picture.fps;
-     mp_msg(MSGT_DECVIDEO,MSGL_INFO, "FPS seems to be: %d/10000\n", picture.fps);
+     sh_video->fps=picture.fps;
+     sh_video->frametime=1.0/picture.fps;
+     mp_msg(MSGT_DECVIDEO,MSGL_INFO, "FPS seems to be: %f\n", picture.fps);
    }
    break;
  }
@@ -336,7 +336,7 @@
    }
    // display info:
    sh_video->format=picture.mpeg1?0x10000001:0x10000002; // mpeg video
-   sh_video->fps=picture.fps*0.0001f;
+   sh_video->fps=picture.fps;
    if(!sh_video->fps){
 //     if(!force_fps){
 //       fprintf(stderr,"FPS not specified (or invalid) in the header! Use the -fps option!\n");
@@ -344,7 +344,7 @@
 //     }
      sh_video->frametime=0;
    } else {
-     sh_video->frametime=10000.0f/(float)picture.fps;
+     sh_video->frametime=1.0/picture.fps;
    }
    sh_video->disp_w=picture.display_picture_width;
    sh_video->disp_h=picture.display_picture_height;
@@ -466,10 +466,10 @@
 #if 1
     // get mpeg fps:
     //newfps=frameratecode2framerate[picture->frame_rate_code]*0.0001f;
-    if((int)(sh_video->fps*10000+0.5)!=picture.fps) if(!force_fps && !telecine){
-            mp_msg(MSGT_CPLAYER,MSGL_WARN,"Warning! FPS changed %5.3f -> %5.3f  (%f) [%d]  \n",sh_video->fps,picture.fps*0.0001,sh_video->fps-picture.fps*0.0001,picture.frame_rate_code);
-            sh_video->fps=picture.fps*0.0001;
-            sh_video->frametime=10000.0f/(float)picture.fps;
+    if(sh_video->fps!=picture.fps) if(!force_fps && !telecine){
+            mp_msg(MSGT_CPLAYER,MSGL_WARN,"Warning! FPS changed %5.3f -> %5.3f  (%f) [%d]  \n",sh_video->fps,picture.fps,sh_video->fps-picture.fps,picture.frame_rate_code);
+            sh_video->fps=picture.fps;
+            sh_video->frametime=1.0/picture.fps;
     }
 #endif
 
@@ -521,8 +521,8 @@
           if((i&~0x60) == 0x107 && i != 0x107) {
             h264_parse_sps(&picture, &(videobuffer[pos]), videobuf_len - pos);
             if(picture.fps > 0) {
-              sh_video->fps=picture.fps*0.0001f;
-              sh_video->frametime=10000.0f/(float)picture.fps;
+              sh_video->fps=picture.fps;
+              sh_video->frametime=1.0/picture.fps;
             }
             i=sync_video_packet(d_video);
             if(!i) return -1;

Index: mpeg_hdr.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/mpeg_hdr.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- mpeg_hdr.h	19 Apr 2005 21:17:39 -0000	1.5
+++ mpeg_hdr.h	6 Aug 2005 16:15:07 -0000	1.6
@@ -6,7 +6,7 @@
     int display_picture_height;
     int aspect_ratio_information;
     int frame_rate_code;
-    int fps; // fps*10000
+    float fps;
     int bitrate; // 0x3FFFF==VBR
     // timing:
     int picture_structure;

Index: mpeg_hdr.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/mpeg_hdr.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- mpeg_hdr.c	2 Jun 2005 21:16:21 -0000	1.15
+++ mpeg_hdr.c	6 Aug 2005 16:15:07 -0000	1.16
@@ -8,16 +8,16 @@
 #include "config.h"
 #include "mpeg_hdr.h"
 
-static int frameratecode2framerate[16] = {
+static float frameratecode2framerate[16] = {
   0,
   // Official mpeg1/2 framerates: (1-8)
-  24000*10000/1001, 24*10000,25*10000,
-  30000*10000/1001, 30*10000,50*10000,
-  60000*10000/1001, 60*10000,
+  24000.0/1001, 24,25,
+  30000.0/1001, 30,50,
+  60000.0/1001, 60,
   // Xing's 15fps: (9)
-  15*10000,
+  15,
   // libmpeg3's "Unofficial economy rates": (10-13)
-  5*10000,10*10000,12*10000,15*10000,
+  5,10,12,15,
   // some invalid ones: (14-15)
   0,0
 };




More information about the MPlayer-cvslog mailing list