summaryrefslogtreecommitdiffstats
path: root/mplayer.c
diff options
context:
space:
mode:
authorptt <ptt@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-09-25 16:47:56 +0000
committerptt <ptt@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-09-25 16:47:56 +0000
commit928da7a4484938cef38ae682837cf857999e853d (patch)
treef9da93bc2452fcccc35368d1bee9aa3b9631144f /mplayer.c
parentc8c0aa686f8a4ac6ec7ffd3e748d8475cb2f8f97 (diff)
downloadmpv-928da7a4484938cef38ae682837cf857999e853d.tar.bz2
mpv-928da7a4484938cef38ae682837cf857999e853d.tar.xz
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.... git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19979 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'mplayer.c')
-rw-r--r--mplayer.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/mplayer.c b/mplayer.c
index b2ef4bd194..827d222c71 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -250,6 +250,8 @@ static off_t step_sec=0;
static int loop_times=-1;
static int loop_seek=0;
+static m_time_size_t end_at = { .type = END_AT_NONE, .pos = 0 };
+
// A/V sync:
int autosync=0; // 30 might be a good default value.
@@ -4050,10 +4052,16 @@ while(sh_audio){
if(!sh_video) {
// handle audio-only case:
- if(!quiet) {
- double a_pos = playing_audio_pts(sh_audio, d_audio, audio_out);
+ double a_pos=0;
+ if(!quiet || end_at.type == END_AT_TIME )
+ a_pos = playing_audio_pts(sh_audio, d_audio, audio_out);
+
+ if(!quiet)
print_status(a_pos, 0, 0);
- }
+
+ if(end_at.type == END_AT_TIME && end_at.pos < a_pos)
+ eof = PT_NEXT_ENTRY;
+
} else {
/*========================== PLAY VIDEO ============================*/
@@ -4296,6 +4304,10 @@ if(time_frame>0.001 && !(vo_flags&256)){
too_slow_frame_cnt++;
/* printf ("PANIC: too slow frame (%.3f)!\n", j); */
+ // FIXME: add size based support for -endpos
+ if ( end_at.type == END_AT_TIME && end_at.pos < sh_video->pts )
+ eof = PT_NEXT_ENTRY;
+
if(vo_config_count) video_out->flip_page();
if (play_n_frames >= 0) {
--play_n_frames;
@@ -5214,6 +5226,15 @@ if(step_sec>0) {
seek_to_sec = NULL;
}
+ if (end_at.type != END_AT_NONE) {
+ if(end_at.type == END_AT_SIZE) {
+ mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_MPEndposNoSizeBased);
+ end_at.type = END_AT_NONE;
+ } else {
+ end_at.pos += rel_seek_secs;
+ }
+ }
+
/* Looping. */
if(eof==1 && loop_times>=0) {
int l = loop_times;