Mercurial > mplayer.hg
comparison mplayer.c @ 19973:02a18c52a42a
after a long time, finally i could add -endpos option to mplayer executable.
as oded told me on 1006 02 24, i applied it, blame me if some problem occurs,
i hope not, since i tried it for a while....
author | ptt |
---|---|
date | Mon, 25 Sep 2006 16:47:56 +0000 |
parents | ef94dfe93fe8 |
children | 42b46a42f83b |
comparison
equal
deleted
inserted
replaced
19972:6e103c537e6d | 19973:02a18c52a42a |
---|---|
247 static char *seek_to_sec=NULL; | 247 static char *seek_to_sec=NULL; |
248 static off_t seek_to_byte=0; | 248 static off_t seek_to_byte=0; |
249 static off_t step_sec=0; | 249 static off_t step_sec=0; |
250 static int loop_times=-1; | 250 static int loop_times=-1; |
251 static int loop_seek=0; | 251 static int loop_seek=0; |
252 | |
253 static m_time_size_t end_at = { .type = END_AT_NONE, .pos = 0 }; | |
252 | 254 |
253 // A/V sync: | 255 // A/V sync: |
254 int autosync=0; // 30 might be a good default value. | 256 int autosync=0; // 30 might be a good default value. |
255 | 257 |
256 // may be changed by GUI: (FIXME!) | 258 // may be changed by GUI: (FIXME!) |
4048 break; | 4050 break; |
4049 } // while(sh_audio) | 4051 } // while(sh_audio) |
4050 | 4052 |
4051 if(!sh_video) { | 4053 if(!sh_video) { |
4052 // handle audio-only case: | 4054 // handle audio-only case: |
4053 if(!quiet) { | 4055 double a_pos=0; |
4054 double a_pos = playing_audio_pts(sh_audio, d_audio, audio_out); | 4056 if(!quiet || end_at.type == END_AT_TIME ) |
4057 a_pos = playing_audio_pts(sh_audio, d_audio, audio_out); | |
4058 | |
4059 if(!quiet) | |
4055 print_status(a_pos, 0, 0); | 4060 print_status(a_pos, 0, 0); |
4056 } | 4061 |
4062 if(end_at.type == END_AT_TIME && end_at.pos < a_pos) | |
4063 eof = PT_NEXT_ENTRY; | |
4064 | |
4057 } else { | 4065 } else { |
4058 | 4066 |
4059 /*========================== PLAY VIDEO ============================*/ | 4067 /*========================== PLAY VIDEO ============================*/ |
4060 | 4068 |
4061 float frame_time=next_frame_time; | 4069 float frame_time=next_frame_time; |
4293 too_fast_frame_cnt++; | 4301 too_fast_frame_cnt++; |
4294 /* printf ("PANIC: too fast frame (%.3f)!\n", j); */ | 4302 /* printf ("PANIC: too fast frame (%.3f)!\n", j); */ |
4295 else if (j > frame_time + frame_time * FRAME_LAG_WARN) | 4303 else if (j > frame_time + frame_time * FRAME_LAG_WARN) |
4296 too_slow_frame_cnt++; | 4304 too_slow_frame_cnt++; |
4297 /* printf ("PANIC: too slow frame (%.3f)!\n", j); */ | 4305 /* printf ("PANIC: too slow frame (%.3f)!\n", j); */ |
4306 | |
4307 // FIXME: add size based support for -endpos | |
4308 if ( end_at.type == END_AT_TIME && end_at.pos < sh_video->pts ) | |
4309 eof = PT_NEXT_ENTRY; | |
4298 | 4310 |
4299 if(vo_config_count) video_out->flip_page(); | 4311 if(vo_config_count) video_out->flip_page(); |
4300 if (play_n_frames >= 0) { | 4312 if (play_n_frames >= 0) { |
4301 --play_n_frames; | 4313 --play_n_frames; |
4302 if (play_n_frames <= 0) eof = PT_NEXT_ENTRY; | 4314 if (play_n_frames <= 0) eof = PT_NEXT_ENTRY; |
5212 rel_seek_secs += d; | 5224 rel_seek_secs += d; |
5213 | 5225 |
5214 seek_to_sec = NULL; | 5226 seek_to_sec = NULL; |
5215 } | 5227 } |
5216 | 5228 |
5229 if (end_at.type != END_AT_NONE) { | |
5230 if(end_at.type == END_AT_SIZE) { | |
5231 mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_MPEndposNoSizeBased); | |
5232 end_at.type = END_AT_NONE; | |
5233 } else { | |
5234 end_at.pos += rel_seek_secs; | |
5235 } | |
5236 } | |
5237 | |
5217 /* Looping. */ | 5238 /* Looping. */ |
5218 if(eof==1 && loop_times>=0) { | 5239 if(eof==1 && loop_times>=0) { |
5219 int l = loop_times; | 5240 int l = loop_times; |
5220 play_tree_iter_step(playtree_iter,0,0); | 5241 play_tree_iter_step(playtree_iter,0,0); |
5221 loop_times = l; | 5242 loop_times = l; |