diff mplayer.c @ 32690:55953c41f4ae

Add size based support for -endpos in MPlayer.
author cboesch
date Mon, 10 Jan 2011 19:18:51 +0000
parents 6d08af681d54
children fd7560f8d530
line wrap: on
line diff
--- a/mplayer.c	Sun Jan 09 20:21:45 2011 +0000
+++ b/mplayer.c	Mon Jan 10 19:18:51 2011 +0000
@@ -3654,11 +3654,6 @@
     end_at.pos += seek_to_sec;
 }
 
-if (end_at.type == END_AT_SIZE) {
-    mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_MPEndposNoSizeBased);
-    end_at.type = END_AT_NONE;
-}
-
 #ifdef CONFIG_DVDNAV
 mp_dvdnav_context_free(mpctx);
 if (mpctx->stream->type == STREAMTYPE_DVDNAV) {
@@ -3702,7 +3697,8 @@
   if(!quiet)
     print_status(a_pos, 0, 0);
 
-  if(end_at.type == END_AT_TIME && end_at.pos < a_pos)
+  if(end_at.type == END_AT_TIME && end_at.pos < a_pos ||
+     end_at.type == END_AT_SIZE && end_at.pos < stream_tell(mpctx->stream))
     mpctx->eof = PT_NEXT_ENTRY;
   update_subtitles(NULL, a_pos, mpctx->d_sub, 0);
   update_osd_msg();
@@ -3810,10 +3806,9 @@
      if (play_n_frames <= 0) mpctx->eof = PT_NEXT_ENTRY;
  }
 
-
-// FIXME: add size based support for -endpos
- if (end_at.type == END_AT_TIME &&
-         !frame_time_remaining && end_at.pos <= mpctx->sh_video->pts)
+ if (!frame_time_remaining &&
+     ((end_at.type == END_AT_TIME &&       mpctx->sh_video->pts >= end_at.pos) ||
+      (end_at.type == END_AT_SIZE && stream_tell(mpctx->stream) >= end_at.pos)))
      mpctx->eof = PT_NEXT_ENTRY;
 
 } // end if(mpctx->sh_video)