changeset 23726:11abe5f3dcaa

Move loop_times into mpctx.
author albeu
date Mon, 09 Jul 2007 14:51:47 +0000
parents a0432f65040e
children 2de8f66b3570
files cfg-mplayer.h mp_core.h mplayer.c
diffstat 3 files changed, 11 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/cfg-mplayer.h	Mon Jul 09 11:19:21 2007 +0000
+++ b/cfg-mplayer.h	Mon Jul 09 14:51:47 2007 +0000
@@ -353,8 +353,8 @@
 	{"guiwid", &guiWinID, CONF_TYPE_INT, 0, 0, 0, NULL},
 #endif
 
-	{"noloop", &loop_times, CONF_TYPE_FLAG, 0, 0, -1, NULL},
-	{"loop", &loop_times, CONF_TYPE_INT, CONF_RANGE, -1, 10000, NULL},
+	{"noloop", &mpctx_s.loop_times, CONF_TYPE_FLAG, 0, 0, -1, NULL},
+	{"loop", &mpctx_s.loop_times, CONF_TYPE_INT, CONF_RANGE, -1, 10000, NULL},
 	{"playlist", NULL, CONF_TYPE_STRING, 0, 0, 0, NULL},
 
 	// a-v sync stuff:
--- a/mp_core.h	Mon Jul 09 11:19:21 2007 +0000
+++ b/mp_core.h	Mon Jul 09 14:51:47 2007 +0000
@@ -51,6 +51,7 @@
     play_tree_iter_t *playtree_iter;
     int eof;
     int play_tree_step;
+    int loop_times;
 
     stream_t *stream;
     demuxer_t *demuxer;
--- a/mplayer.c	Mon Jul 09 11:19:21 2007 +0000
+++ b/mplayer.c	Mon Jul 09 14:51:47 2007 +0000
@@ -200,6 +200,7 @@
     .global_sub_pos = -1,
     .set_of_sub_pos = -1,
     .file_format = DEMUXER_TYPE_UNKNOWN,
+    .loop_times = -1,
 #ifdef HAS_DVBIN_SUPPORT
     .last_dvb_step = 1,
 #endif
@@ -244,7 +245,6 @@
 static double seek_to_sec;
 static off_t seek_to_byte=0;
 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 };
@@ -3326,8 +3326,8 @@
 
 //==================== START PLAYING =======================
 
-if(loop_times>1) loop_times--; else
-if(loop_times==1) loop_times = -1;
+if(mpctx->loop_times>1) mpctx->loop_times--; else
+if(mpctx->loop_times==1) mpctx->loop_times = -1;
 
 mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_StartPlaying);
 
@@ -3528,11 +3528,11 @@
   mpctx->was_paused = 0;
 
   /* Looping. */
-  if(mpctx->eof==1 && loop_times>=0) {
-    mp_msg(MSGT_CPLAYER,MSGL_V,"loop_times = %d, eof = %d\n", loop_times,mpctx->eof);
-
-    if(loop_times>1) loop_times--; else
-    if(loop_times==1) loop_times=-1;
+  if(mpctx->eof==1 && mpctx->loop_times>=0) {
+    mp_msg(MSGT_CPLAYER,MSGL_V,"loop_times = %d, eof = %d\n", mpctx->loop_times,mpctx->eof);
+
+    if(mpctx->loop_times>1) mpctx->loop_times--; else
+    if(mpctx->loop_times==1) mpctx->loop_times=-1;
     play_n_frames=play_n_frames_mf;
     mpctx->eof=0;
     abs_seek_pos=1; rel_seek_secs=seek_to_sec;