diff options
author | Uoti Urpala <uau@symbol.nonexistent.invalid> | 2008-04-21 05:18:40 +0300 |
---|---|---|
committer | Uoti Urpala <uau@symbol.nonexistent.invalid> | 2008-04-23 13:47:44 +0300 |
commit | ef74d21b1f1d96b2e3f180c021998fbdd80ffcba (patch) | |
tree | e0600e83f388e0c2865153c0c8fc4e1aed3faf1c | |
parent | 67778746ce3c917d874baa7c2e6b2a21a50c27e2 (diff) | |
download | mpv-ef74d21b1f1d96b2e3f180c021998fbdd80ffcba.tar.bz2 mpv-ef74d21b1f1d96b2e3f180c021998fbdd80ffcba.tar.xz |
Move loop_times to option struct
-rw-r--r-- | cfg-mplayer.h | 5 | ||||
-rw-r--r-- | command.c | 7 | ||||
-rw-r--r-- | defaultopts.c | 1 | ||||
-rw-r--r-- | mp_core.h | 1 | ||||
-rw-r--r-- | mplayer.c | 13 | ||||
-rw-r--r-- | options.h | 1 |
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: @@ -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, }; } @@ -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; @@ -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; @@ -10,6 +10,7 @@ typedef struct MPOpts { int vo_screenheight; int vo_dbpp; int correct_pts; + int loop_times; int user_correct_pts; } MPOpts; |