comparison mplayer.c @ 15288:7fc3a521d42b

use darwin accurate timer
author nplourde
date Fri, 29 Apr 2005 10:48:32 +0000
parents 39eb8a327ea9
children cec4a515061f
comparison
equal deleted inserted replaced
15287:d4175d6a6131 15288:7fc3a521d42b
1043 int gui_no_filename=0; 1043 int gui_no_filename=0;
1044 1044
1045 1045
1046 srand((int) time(NULL)); 1046 srand((int) time(NULL));
1047 1047
1048 InitTimer();
1049
1048 mp_msg_init(); 1050 mp_msg_init();
1049 mp_msg_set_level(MSGL_STATUS); 1051 mp_msg_set_level(MSGL_STATUS);
1050 1052
1051 mp_msg(MSGT_CPLAYER,MSGL_INFO, "MPlayer " VERSION " (C) 2000-2005 MPlayer Team\n"); 1053 mp_msg(MSGT_CPLAYER,MSGL_INFO, "MPlayer " VERSION " (C) 2000-2005 MPlayer Team\n");
1052 /* Test for cpu capabilities (and corresponding OS support) for optimizing */ 1054 /* Test for cpu capabilities (and corresponding OS support) for optimizing */
2212 if(loop_times>1) loop_times--; else 2214 if(loop_times>1) loop_times--; else
2213 if(loop_times==1) loop_times = -1; 2215 if(loop_times==1) loop_times = -1;
2214 2216
2215 mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_StartPlaying);fflush(stdout); 2217 mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_StartPlaying);fflush(stdout);
2216 2218
2217 InitTimer();
2218
2219 #ifdef USE_DVDNAV 2219 #ifdef USE_DVDNAV
2220 if (stream->type==STREAMTYPE_DVDNAV) { 2220 if (stream->type==STREAMTYPE_DVDNAV) {
2221 dvdnav_stream_fullstart((dvdnav_priv_t *)stream->priv); 2221 dvdnav_stream_fullstart((dvdnav_priv_t *)stream->priv);
2222 } 2222 }
2223 #endif 2223 #endif
2455 mp_msg(MSGT_CPLAYER, MSGL_ERR, MSGTR_LinuxRTCReadError, strerror(errno)); 2455 mp_msg(MSGT_CPLAYER, MSGL_ERR, MSGTR_LinuxRTCReadError, strerror(errno));
2456 time_frame-=GetRelativeTime(); 2456 time_frame-=GetRelativeTime();
2457 } 2457 }
2458 } else 2458 } else
2459 #endif 2459 #endif
2460 #ifdef SYS_DARWIN
2461 {
2462 current_module="sleep_darwin";
2463 while(time_frame>0.005) {
2464 usec_sleep(1000000*time_frame);
2465 time_frame-=GetRelativeTime();
2466 }
2467 }
2468 #else
2460 { 2469 {
2461 // -------- TIMER + SOFTSLEEP ----------- 2470 // -------- TIMER + SOFTSLEEP -----------
2462 float min=softsleep?0.021:0.005; 2471 float min=softsleep?0.021:0.005;
2463 current_module="sleep_timer"; 2472 current_module="sleep_timer";
2464 while(time_frame>min){ 2473 while(time_frame>min){
2472 current_module="sleep_soft"; 2481 current_module="sleep_soft";
2473 if(time_frame<0) mp_msg(MSGT_AVSYNC, MSGL_WARN, MSGTR_SoftsleepUnderflow); 2482 if(time_frame<0) mp_msg(MSGT_AVSYNC, MSGL_WARN, MSGTR_SoftsleepUnderflow);
2474 while(time_frame>0) time_frame-=GetRelativeTime(); // burn the CPU 2483 while(time_frame>0) time_frame-=GetRelativeTime(); // burn the CPU
2475 } 2484 }
2476 } 2485 }
2477 2486 #endif
2478 } 2487 }
2479 2488
2480 //if(!frame_time_remaining){ // should we display the frame now? 2489 //if(!frame_time_remaining){ // should we display the frame now?
2481 2490
2482 //====================== FLIP PAGE (VIDEO BLT): ========================= 2491 //====================== FLIP PAGE (VIDEO BLT): =========================