$ cat url http://www.mplayerhq.hu/MPlayer/releases/MPlayer-1.0rc1.tar.bz2 http://www.mplayerhq.hu/MPlayer/releases/MPlayer-1.0rc2.tar.bz2 http://www.mplayerhq.hu/MPlayer/releases/codecs/essential-20071007.tar.bz2 http://www.mplayerhq.hu/MPlayer/releases/codecs/all-20071007.tar.bz2 http://www.mplayerhq.hu/MPlayer/releases/fonts/font-arial-iso-8859-7.tar.bz2 http://www.mplayerhq.hu/MPlayer/skins/Blue-1.7.tar.bz2 http://www.mplayerhq.hu/MPlayer/patches/asmrules_fix_20061231.diff http://www.mplayerhq.hu/MPlayer/patches/cddb_fix_20070605.diff http://www.linuxfromscratch.org/patches/blfs/6.3/MPlayer-1.0rc1-ext_ffmpeg-1.patch $ wget -c -i url #下載url文件列表中的文件 $ tar xvf MPlayer-1.0rc2.tar.bz2 $ cd MPlayer-1.0rc2 $ grep -n -R -i "cflags" * | grep -i "O[0-9]" configure:2326: CFLAGS="-W -Wall -O2 $_march $_mcpu $_pipe $_debug $_profile" configure:2330: CFLAGS="-O2 $_march $_mcpu $_pipe -fomit-frame-pointer -wd167 -wd556 -wd144" configure:2332: CFLAGS="-O2 $_march $_mcpu $_pipe" configure:2334: CFLAGS="-Wall -Wno-switch -Wpointer-arith -Wredundant-decls -O4 $_march $_mcpu $_pipe -ffast-math -fomit-frame-pointer" drivers/Makefile:5:CFLAGS = -O2 -D__KERNEL__ -DMODULE -Wall -I$(KERNEL_INC) \ vidix/kernelhelper/Makefile:2:CFLAGS = -O2 -D__KERNEL__ -DMODULE -I$(KERNEL_INC) \ $ |
$ ./configure --prefix=/usr --enable-debug --codecsdir=/usr/lib/codecs/ --enable-fbdev --disable-dvdnav --disable-dvdread --disable-dvdread-internal --enable-mencoder --confdir=/etc/mplayer $ make |
$ cd libavcodec/ $ cc -I../libswscale -I../libavcodec -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_ISOC9X_SOURCE -I.. -I.. -I../libavutil -Wdisabled-optimization -Wno-pointer-sign -Wdeclaration-after-statement -I. -I.. -I../libavutil -W -Wall -O2 -march=native -mtune=native -pipe -g -D_REENTRANT -DHAVE_CONFIG_H -I/usr/include/directfb -I/usr/include/ -I/usr/include/SDL -D_REENTRANT -I/usr/include/kde/artsc -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include -c -o i386/dsputil_mmx.o i386/dsputil_mmx.c $ cd .. $ make |
$ pwd /home/c-aries/source/mplayer/MPlayer-1.0rc2 $ ls mplayer mplayer $ |
$ gdb ./mplayer (gdb) start -vo fbdev ~/video/擁抱春天.flv (gdb) b GetTimer Breakpoint 2 at 0x86bd320: file timer-lx.c, line 35. (gdb) c Continuing. Breakpoint 2, GetTimer () at timer-lx.c:35 35 gettimeofday(&tv,NULL); (gdb) bt #0 GetTimer () at timer-lx.c:35 #1 0x086bd398 in GetRelativeTime () at timer-lx.c:54 #2 0x086bd3d7 in InitTimer () at timer-lx.c:63 #3 0x080a3523 in main (argc=4, argv=0xbff03334) at mplayer.c:2298 (gdb) l 35 30 31 // Returns current time in microseconds 32 unsigned int GetTimer(void){ 33 struct timeval tv; 34 // float s; 35 gettimeofday(&tv,NULL); 36 // s=tv.tv_usec;s*=0.000001;s+=tv.tv_sec; 37 return (tv.tv_sec*1000000+tv.tv_usec); 38 } 39 (gdb) n 37 return (tv.tv_sec*1000000+tv.tv_usec); (gdb) p tv.tv_sec $1 = 1271052273 (gdb) p tv.tv_sec * 1000000 $2 = -348578240 #想想都知道溢出得很嚴重... (gdb) n 38 } (gdb) GetRelativeTime () at timer-lx.c:56 56 r=t-RelativeTime; (gdb) l 51 // Returns time spent between now and last call in seconds 52 float GetRelativeTime(void){ 53 unsigned int t,r; 54 t=GetTimer(); 55 // t*=16;printf("time=%ud\n",t); 56 r=t-RelativeTime; 57 RelativeTime=t; 58 return (float)r * 0.000001F; 59 } 60 (gdb) p t $3 = 3947348404 (gdb) f #下一步,將運行第56行的代碼,其中RelativeTime為上一次調用GetTimer的時間記錄,t為此次調用GetTimer的時間記錄 #0 GetRelativeTime () at timer-lx.c:56 56 r=t-RelativeTime; (gdb) |
(gdb) printf "%u\n", -1 4294967295 #取無符號數最大數值 (gdb) printf "%u\n", 4294 * 1000000 + 967295 # (1) 當前系統時間為4294.967295秒 4294967295 (gdb) printf "%u\n", 4295 * 1000000 + 967295 # (2) 當前系統時間為4295.967295秒 999999 (gdb) printf "%u\n", 999999 - 4294967295 1000000 # 計算結果為: (2)和(1)相差1秒 (gdb) printf "%u\n", 4294 / 60 71 # 4294秒約為71分鐘 (gdb) printf "%u\n", (4294 * 2 + 1) * 1000000 + 967295 # (3) 當前系統時間為8589.967295秒 32703 # 約72分鐘后 (gdb) printf "%u\n", 32703 - 4294967295 32704 # 計算結果為: (3)和(1)相差0.032704秒,而事實上已經過了約72分鐘 (gdb) |
gdb mplayer bug
[火星人 ] mplayer的GetTimer函數有bug嗎?已經有374次圍觀