summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cfg-mplayer.h5
-rw-r--r--command.c7
-rw-r--r--defaultopts.c1
-rw-r--r--mp_core.h1
-rw-r--r--mplayer.c13
-rw-r--r--options.h1
6 files changed, 15 insertions, 13 deletions
diff --git a/cfg-mplayer.h b/cfg-mplayer.h
index 5b06ed6093..eb7af99924 100644
--- a/cfg-mplayer.h
+++ b/cfg-mplayer.h
@@ -89,6 +89,7 @@ const m_option_t tvscan_conf[]={
#define FLAG_ON(optname, varname, flags) {optname, NULL, CONF_TYPE_FLAG, flags, 0, 1, NULL, 1, offsetof(struct MPOpts, varname)}
#define FLAG_OFF(optname, varname, flags) {optname, NULL, CONF_TYPE_FLAG, flags, 1, 0, NULL, 1, offsetof(struct MPOpts, varname)}
+#define FLAG_CONSTANTS(optname, varname, offvalue, value, flags) {optname, NULL, CONF_TYPE_FLAG, flags, offvalue, value, NULL, 1, offsetof(struct MPOpts, varname)}
#define STRINGLIST(optname, varname, flags) {optname, NULL, CONF_TYPE_STRING_LIST, flags, 0, 0, NULL, 1, offsetof(struct MPOpts, varname)}
#define INTRANGE(optname, varname, min, max, flags) {optname, NULL, CONF_TYPE_INT, (flags)|CONF_RANGE, min, max, NULL, 1, offsetof(struct MPOpts, varname)}
@@ -322,8 +323,8 @@ const m_option_t mplayer_opts[]={
{"guiwid", &guiWinID, CONF_TYPE_INT, 0, 0, 0, NULL},
#endif
- {"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},
+ FLAG_CONSTANTS("noloop", loop_times, 0, -1, 0),
+ INTRANGE("loop", loop_times, -1, 10000, 0),
{"playlist", NULL, CONF_TYPE_STRING, 0, 0, 0, NULL},
// a-v sync stuff:
diff --git a/command.c b/command.c
index 929f52b757..c5c3204d27 100644
--- a/command.c
+++ b/command.c
@@ -177,18 +177,19 @@ static int mp_property_osdlevel(m_option_t * prop, int action, void *arg,
static int mp_property_loop(m_option_t * prop, int action, void *arg,
MPContext * mpctx)
{
+ struct MPOpts *opts = &mpctx->opts;
switch (action) {
case M_PROPERTY_PRINT:
if (!arg) return M_PROPERTY_ERROR;
- if (mpctx->loop_times < 0)
+ if (opts->loop_times < 0)
*(char**)arg = strdup("off");
- else if (mpctx->loop_times == 0)
+ else if (opts->loop_times == 0)
*(char**)arg = strdup("inf");
else
break;
return M_PROPERTY_OK;
}
- return m_property_int_range(prop, action, arg, &mpctx->loop_times);
+ return m_property_int_range(prop, action, arg, &opts->loop_times);
}
/// Playback speed (RW)
diff --git a/defaultopts.c b/defaultopts.c
index 4787d5da09..f0c2483fd2 100644
--- a/defaultopts.c
+++ b/defaultopts.c
@@ -8,6 +8,7 @@ void set_default_mplayer_options(struct MPOpts *opts)
.audio_driver_list = NULL,
.video_driver_list = NULL,
.fixed_vo = 0,
+ .loop_times = -1,
.user_correct_pts = -1,
};
}
diff --git a/mp_core.h b/mp_core.h
index 7ef16ec972..df53fdbb5c 100644
--- a/mp_core.h
+++ b/mp_core.h
@@ -52,7 +52,6 @@ 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 78edd1e06b..97e00d18e5 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -200,7 +200,6 @@ static MPContext mpctx_s = {
.global_sub_pos = -1,
.set_of_sub_pos = -1,
.file_format = DEMUXER_TYPE_UNKNOWN,
- .loop_times = -1,
.last_dvb_step = 1,
};
@@ -3641,8 +3640,8 @@ if (mpctx->stream->type==STREAMTYPE_TV) mp_input_set_section("tv");
//==================== START PLAYING =======================
-if(mpctx->loop_times>1) mpctx->loop_times--; else
-if(mpctx->loop_times==1) mpctx->loop_times = -1;
+if(opts->loop_times>1) opts->loop_times--; else
+if(opts->loop_times==1) opts->loop_times = -1;
mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_StartPlaying);
@@ -3861,11 +3860,11 @@ if(step_sec>0) {
mpctx->was_paused = 0;
/* Looping. */
- 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->eof==1 && opts->loop_times>=0) {
+ mp_msg(MSGT_CPLAYER,MSGL_V,"loop_times = %d, eof = %d\n", opts->loop_times,mpctx->eof);
- if(mpctx->loop_times>1) mpctx->loop_times--; else
- if(mpctx->loop_times==1) mpctx->loop_times=-1;
+ if(opts->loop_times>1) opts->loop_times--; else
+ if(opts->loop_times==1) opts->loop_times=-1;
play_n_frames=play_n_frames_mf;
mpctx->eof=0;
abs_seek_pos=SEEK_ABSOLUTE; rel_seek_secs=seek_to_sec;
diff --git a/options.h b/options.h
index 0235e9c85f..ac8d431b99 100644
--- a/options.h
+++ b/options.h
@@ -10,6 +10,7 @@ typedef struct MPOpts {
int vo_screenheight;
int vo_dbpp;
int correct_pts;
+ int loop_times;
int user_correct_pts;
} MPOpts;