changeset 2365:93616490c0dd

-loop patch by Pascal Haakmat <a.haakmat@chello.nl>
author arpi
date Mon, 22 Oct 2001 14:42:47 +0000
parents 2f8f83ddbab3
children 2df2a1c1c2dc
files cfg-mplayer.h mplayer.c
diffstat 2 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/cfg-mplayer.h	Mon Oct 22 14:19:48 2001 +0000
+++ b/cfg-mplayer.h	Mon Oct 22 14:42:47 2001 +0000
@@ -153,6 +153,7 @@
 	{"nobg", &play_in_bg, CONF_TYPE_FLAG, 0, 1, 0},
 	{"sb", &seek_to_byte, CONF_TYPE_INT, CONF_MIN, 0, 0},
 	{"ss", &seek_to_sec, CONF_TYPE_STRING, CONF_MIN, 0, 0},
+	{"loop", &loop_times, CONF_TYPE_INT, CONF_RANGE, -1, 10000},
 	{"sound", &has_audio, CONF_TYPE_FLAG, 0, 0, 1},
 	{"nosound", &has_audio, CONF_TYPE_FLAG, 0, 1, 0},
 	{"abs", &ao_buffersize, CONF_TYPE_INT, CONF_MIN, 0, 0},
--- a/mplayer.c	Mon Oct 22 14:19:48 2001 +0000
+++ b/mplayer.c	Mon Oct 22 14:42:47 2001 +0000
@@ -186,6 +186,7 @@
 char *seek_to_sec=NULL;
 off_t seek_to_byte=0;
 int has_audio=1;
+int loop_times=-1;
 
 char *audio_codec=NULL; // override audio codec
 char *video_codec=NULL; // override video codec
@@ -1848,6 +1849,25 @@
      seek_to_sec = NULL;
   }
   
+  /* Looping. */
+  if(eof==5 && loop_times>-1) {
+
+    if(loop_times!=0) {
+      
+      loop_times--;
+      
+      if(loop_times==0)
+        loop_times=-1;
+      
+    }
+    
+    eof=0;
+    abs_seek_pos=1;
+
+    mp_msg(MSGT_CPLAYER,MSGL_V,"loop_times = %d, eof = 0\n", loop_times);
+    
+  }
+
 if(rel_seek_secs || abs_seek_pos){
   current_module="seek";
   if(demux_seek(demuxer,rel_seek_secs,abs_seek_pos)){