Mercurial > mplayer.hg
comparison mplayer.c @ 1400:2bf9c561b01d
stage2 step 1
author | arpi |
---|---|
date | Sat, 28 Jul 2001 20:33:51 +0000 |
parents | 9e8781a3eefc |
children | c11f2a77ff70 |
comparison
equal
deleted
inserted
replaced
1399:79e39ecd2d37 | 1400:2bf9c561b01d |
---|---|
188 //**************************************************************************// | 188 //**************************************************************************// |
189 | 189 |
190 static vo_functions_t *video_out=NULL; | 190 static vo_functions_t *video_out=NULL; |
191 static ao_functions_t *audio_out=NULL; | 191 static ao_functions_t *audio_out=NULL; |
192 | 192 |
193 float c_total=0; | |
194 | |
193 double video_time_usage=0; | 195 double video_time_usage=0; |
194 double vout_time_usage=0; | 196 double vout_time_usage=0; |
195 static double audio_time_usage=0; | 197 static double audio_time_usage=0; |
196 static int total_time_usage_start=0; | 198 static int total_time_usage_start=0; |
197 static int benchmark=0; | 199 static int benchmark=0; |
242 int stream_dump_type=0; | 244 int stream_dump_type=0; |
243 int index_mode=-1; // -1=untouched 0=don't use index 1=use (geneate) index | 245 int index_mode=-1; // -1=untouched 0=don't use index 1=use (geneate) index |
244 int force_ni=0; | 246 int force_ni=0; |
245 | 247 |
246 float default_max_pts_correction=-1;//0.01f; | 248 float default_max_pts_correction=-1;//0.01f; |
249 float max_pts_correction=0;//default_max_pts_correction; | |
247 #ifdef AVI_SYNC_BPS | 250 #ifdef AVI_SYNC_BPS |
248 int pts_from_bps=1; | 251 int pts_from_bps=1; |
249 #else | 252 #else |
250 int pts_from_bps=0; | 253 int pts_from_bps=0; |
251 #endif | 254 #endif |
275 float sub_fps=0; | 278 float sub_fps=0; |
276 int sub_auto = 1; | 279 int sub_auto = 1; |
277 /*DSP!!char *dsp=NULL;*/ | 280 /*DSP!!char *dsp=NULL;*/ |
278 | 281 |
279 float rel_seek_secs=0; | 282 float rel_seek_secs=0; |
283 float initial_pts_delay=0; | |
280 | 284 |
281 extern char *vo_subdevice; | 285 extern char *vo_subdevice; |
282 extern char *ao_subdevice; | 286 extern char *ao_subdevice; |
283 | 287 |
284 void exit_player(char* how){ | 288 void exit_player(char* how){ |
328 lirc_mp_cleanup(); | 332 lirc_mp_cleanup(); |
329 #endif | 333 #endif |
330 exit(1); | 334 exit(1); |
331 } | 335 } |
332 | 336 |
333 static char* current_module=NULL; // for debugging | 337 char* current_module=NULL; // for debugging |
334 | 338 |
335 void exit_sighandler(int x){ | 339 void exit_sighandler(int x){ |
336 static int sig_count=0; | 340 static int sig_count=0; |
337 ++sig_count; | 341 ++sig_count; |
338 if(sig_count==2) exit(1); | 342 if(sig_count==2) exit(1); |
415 char* filename=NULL; //"MI2-Trailer.avi"; | 419 char* filename=NULL; //"MI2-Trailer.avi"; |
416 stream_t* stream=NULL; | 420 stream_t* stream=NULL; |
417 int file_format=DEMUXER_TYPE_UNKNOWN; | 421 int file_format=DEMUXER_TYPE_UNKNOWN; |
418 // | 422 // |
419 int delay_corrected=1; | 423 int delay_corrected=1; |
420 float initial_pts_delay=0; | |
421 #ifdef VCD_CACHE | 424 #ifdef VCD_CACHE |
422 int vcd_cache_size=128; | 425 int vcd_cache_size=128; |
423 #endif | 426 #endif |
424 #ifdef __FreeBSD__ | 427 #ifdef __FreeBSD__ |
425 int bsize = VCD_SECTOR_SIZE; | 428 int bsize = VCD_SECTOR_SIZE; |
944 | 947 |
945 float frame_correction=0; // average of A-V timestamp differences | 948 float frame_correction=0; // average of A-V timestamp differences |
946 int frame_corr_num=0; // | 949 int frame_corr_num=0; // |
947 //float v_frame=0; // Video | 950 //float v_frame=0; // Video |
948 float time_frame=0; // Timer | 951 float time_frame=0; // Timer |
949 float c_total=0; | |
950 float max_pts_correction=0;//default_max_pts_correction; | |
951 int eof=0; | 952 int eof=0; |
952 int force_redraw=0; | 953 int force_redraw=0; |
953 float num_frames=0; // number of frames played | 954 //float num_frames=0; // number of frames played |
954 int grab_frames=0; | 955 int grab_frames=0; |
955 char osd_text_buffer[64]; | 956 char osd_text_buffer[64]; |
956 int drop_frame=0; | 957 int drop_frame=0; |
957 int drop_frame_cnt=0; | 958 int drop_frame_cnt=0; |
958 | 959 |
1218 } | 1219 } |
1219 | 1220 |
1220 //------------------------ frame decoded. -------------------- | 1221 //------------------------ frame decoded. -------------------- |
1221 | 1222 |
1222 // Increase video timers: | 1223 // Increase video timers: |
1223 num_frames+=frame_time; | 1224 sh_video->num_frames+=frame_time; |
1224 frame_time*=sh_video->frametime; | 1225 frame_time*=sh_video->frametime; |
1225 if(file_format==DEMUXER_TYPE_ASF && !force_fps){ | 1226 if(file_format==DEMUXER_TYPE_ASF && !force_fps){ |
1226 // .ASF files has no fixed FPS - just frame durations! | 1227 // .ASF files has no fixed FPS - just frame durations! |
1227 float d=d_video->pts-pts1; | 1228 float d=d_video->pts-pts1; |
1228 if(d>=0 && d<5) frame_time=d; | 1229 if(d>=0 && d<5) frame_time=d; |
1358 max_pts_correction=default_max_pts_correction; | 1359 max_pts_correction=default_max_pts_correction; |
1359 else | 1360 else |
1360 max_pts_correction=sh_video->frametime*0.10; // +-10% of time | 1361 max_pts_correction=sh_video->frametime*0.10; // +-10% of time |
1361 sh_audio->timer+=x; c_total+=x; | 1362 sh_audio->timer+=x; c_total+=x; |
1362 printf(" ct:%7.3f %3d %2d%% %2d%% %4.1f%% %d\r",c_total, | 1363 printf(" ct:%7.3f %3d %2d%% %2d%% %4.1f%% %d\r",c_total, |
1363 (int)num_frames, | 1364 (int)sh_video->num_frames, |
1364 (sh_video->timer>0.5)?(int)(100.0*video_time_usage/(double)sh_video->timer):0, | 1365 (sh_video->timer>0.5)?(int)(100.0*video_time_usage/(double)sh_video->timer):0, |
1365 (sh_video->timer>0.5)?(int)(100.0*vout_time_usage/(double)sh_video->timer):0, | 1366 (sh_video->timer>0.5)?(int)(100.0*vout_time_usage/(double)sh_video->timer):0, |
1366 (sh_video->timer>0.5)?(100.0*audio_time_usage/(double)sh_video->timer):0 | 1367 (sh_video->timer>0.5)?(100.0*audio_time_usage/(double)sh_video->timer):0 |
1367 ,drop_frame_cnt | 1368 ,drop_frame_cnt |
1368 ); | 1369 ); |
1378 //if(d_video->pts) | 1379 //if(d_video->pts) |
1379 float v_pts=d_video->pts; | 1380 float v_pts=d_video->pts; |
1380 if(frame_corr_num==5){ | 1381 if(frame_corr_num==5){ |
1381 // printf("A: --- V:%6.1f \r",v_pts); | 1382 // printf("A: --- V:%6.1f \r",v_pts); |
1382 printf("V:%6.1f %3d %2d%% %2d%% %3.1f%% \r",v_pts, | 1383 printf("V:%6.1f %3d %2d%% %2d%% %3.1f%% \r",v_pts, |
1383 (int)num_frames, | 1384 (int)sh_video->num_frames, |
1384 (sh_video->timer>0.5)?(int)(100.0*video_time_usage/(double)sh_video->timer):0, | 1385 (sh_video->timer>0.5)?(int)(100.0*video_time_usage/(double)sh_video->timer):0, |
1385 (sh_video->timer>0.5)?(int)(100.0*vout_time_usage/(double)sh_video->timer):0, | 1386 (sh_video->timer>0.5)?(int)(100.0*vout_time_usage/(double)sh_video->timer):0, |
1386 (sh_video->timer>0.5)?(100.0*audio_time_usage/(double)sh_video->timer):0 | 1387 (sh_video->timer>0.5)?(100.0*audio_time_usage/(double)sh_video->timer):0 |
1387 ); | 1388 ); |
1388 | 1389 |
1579 d_video->pack_no=0; | 1580 d_video->pack_no=0; |
1580 for(i=0;i<video_chunk_pos;i++){ | 1581 for(i=0;i<video_chunk_pos;i++){ |
1581 int id=((AVIINDEXENTRY *)demuxer->idx)[i].ckid; | 1582 int id=((AVIINDEXENTRY *)demuxer->idx)[i].ckid; |
1582 if(avi_stream_id(id)==d_video->id) ++d_video->pack_no; | 1583 if(avi_stream_id(id)==d_video->id) ++d_video->pack_no; |
1583 } | 1584 } |
1584 num_frames=d_video->pack_no; | 1585 sh_video->num_frames=d_video->pack_no; |
1585 avi_video_pts=d_video->pack_no*(float)sh_video->video.dwScale/(float)sh_video->video.dwRate; | 1586 avi_video_pts=d_video->pack_no*(float)sh_video->video.dwScale/(float)sh_video->video.dwRate; |
1586 | 1587 |
1587 if(sh_audio){ | 1588 if(sh_audio){ |
1588 int i; | 1589 int i; |
1589 int apos=0; | 1590 int apos=0; |