summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cfg-mplayer.h4
-rw-r--r--mp_core.h1
-rw-r--r--mplayer.c14
3 files changed, 10 insertions, 9 deletions
diff --git a/cfg-mplayer.h b/cfg-mplayer.h
index daec15eaf0..f334bfdeca 100644
--- a/cfg-mplayer.h
+++ b/cfg-mplayer.h
@@ -353,8 +353,8 @@ m_option_t mplayer_opts[]={
{"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:
diff --git a/mp_core.h b/mp_core.h
index bc46471303..a3c537fd83 100644
--- a/mp_core.h
+++ b/mp_core.h
@@ -51,6 +51,7 @@ typedef struct MPContext {
play_tree_iter_t *playtree_iter;
int eof;
int play_tree_step;
+ int loop_times;
stream_t *stream;
demuxer_t *demuxer;
diff --git a/mplayer.c b/mplayer.c
index 39414e5453..2b37503173 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -200,6 +200,7 @@ static MPContext mpctx_s = {
.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 char* playing_msg = NULL;
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 @@ if (mpctx->stream->type==STREAMTYPE_TV) mp_input_set_section("tv");
//==================== 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 @@ if(step_sec>0) {
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(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(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;
play_n_frames=play_n_frames_mf;
mpctx->eof=0;
abs_seek_pos=1; rel_seek_secs=seek_to_sec;