mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
Add a loop command and property.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23747 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
@@ -157,6 +157,10 @@ loadlist <file> <append>
|
||||
If <append> is nonzero playback continues and the playlist file is
|
||||
appended to the current playlist instead.
|
||||
|
||||
loop <value> [abs]
|
||||
Adjust/set how many times the movie should be looped. -1 means no loop,
|
||||
and 0 forever.
|
||||
|
||||
menu <command>
|
||||
Execute an OSD menu command.
|
||||
up Move cursor up.
|
||||
@@ -397,6 +401,7 @@ name type min max get set step comment
|
||||
|
||||
osdlevel int 0 3 X X X as -osdlevel
|
||||
speed float 0.01 100 X X X as -speed
|
||||
loop int -1 X X X as -loop
|
||||
filename string X file playing wo path
|
||||
path string X file playing
|
||||
demuxer string X demuxer used
|
||||
|
||||
22
command.c
22
command.c
@@ -157,6 +157,24 @@ static int mp_property_osdlevel(m_option_t * prop, int action, void *arg,
|
||||
return m_property_choice(prop, action, arg, &osd_level);
|
||||
}
|
||||
|
||||
/// Loop (RW)
|
||||
static int mp_property_loop(m_option_t * prop, int action, void *arg,
|
||||
MPContext * mpctx)
|
||||
{
|
||||
switch (action) {
|
||||
case M_PROPERTY_PRINT:
|
||||
if (!arg) return M_PROPERTY_ERROR;
|
||||
if (mpctx->loop_times < 0)
|
||||
*(char**)arg = strdup("off");
|
||||
else if (mpctx->loop_times == 0)
|
||||
*(char**)arg = strdup("inf");
|
||||
else
|
||||
break;
|
||||
return M_PROPERTY_OK;
|
||||
}
|
||||
return m_property_int_range(prop, action, arg, &mpctx->loop_times);
|
||||
}
|
||||
|
||||
/// Playback speed (RW)
|
||||
static int mp_property_playback_speed(m_option_t * prop, int action,
|
||||
void *arg, MPContext * mpctx)
|
||||
@@ -1488,6 +1506,8 @@ static m_option_t mp_properties[] = {
|
||||
// General
|
||||
{ "osdlevel", mp_property_osdlevel, CONF_TYPE_INT,
|
||||
M_OPT_RANGE, 0, 3, NULL },
|
||||
{ "loop", mp_property_loop, CONF_TYPE_INT,
|
||||
M_OPT_MIN, -1, 0, NULL },
|
||||
{ "speed", mp_property_playback_speed, CONF_TYPE_FLOAT,
|
||||
M_OPT_RANGE, 0.01, 100.0, NULL },
|
||||
{ "filename", mp_property_filename, CONF_TYPE_STRING,
|
||||
@@ -1674,6 +1694,8 @@ static struct {
|
||||
/// osd msg template
|
||||
const char *osd_msg;
|
||||
} set_prop_cmd[] = {
|
||||
// general
|
||||
{ "loop", MP_CMD_LOOP, 0, 0, -1, MSGTR_LoopStatus },
|
||||
// audio
|
||||
{ "volume", MP_CMD_VOLUME, 0, OSD_VOLUME, -1, MSGTR_Volume },
|
||||
{ "mute", MP_CMD_MUTE, 1, 0, -1, MSGTR_MuteStatus },
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
<pref name="general_pref" title="General">
|
||||
<e property="osdlevel" name="OSD level"/>
|
||||
<e property="speed" name="Speed"/>
|
||||
<e property="loop" name="Loop"/>
|
||||
</pref>
|
||||
|
||||
<pref name="demuxer_pref" title="Demuxer">
|
||||
|
||||
@@ -234,6 +234,7 @@ static char help_text[]=
|
||||
#define MSGTR_Balance "Balance"
|
||||
|
||||
// property state
|
||||
#define MSGTR_LoopStatus "Loop: %s"
|
||||
#define MSGTR_MuteStatus "Mute: %s"
|
||||
#define MSGTR_AVDelayStatus "A-V delay: %s"
|
||||
#define MSGTR_OnTopStatus "Stay on top: %s"
|
||||
|
||||
@@ -65,6 +65,7 @@ static mp_cmd_t mp_cmds[] = {
|
||||
{ MP_CMD_PLAY_TREE_STEP, "pt_step",1, { { MP_CMD_ARG_INT ,{0}}, { MP_CMD_ARG_INT ,{0}}, {-1,{0}} } },
|
||||
{ MP_CMD_PLAY_TREE_UP_STEP, "pt_up_step",1, { { MP_CMD_ARG_INT,{0} }, { MP_CMD_ARG_INT ,{0}}, {-1,{0}} } },
|
||||
{ MP_CMD_PLAY_ALT_SRC_STEP, "alt_src_step",1, { { MP_CMD_ARG_INT,{0} }, {-1,{0}} } },
|
||||
{ MP_CMD_LOOP, "loop", 1, { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
|
||||
{ MP_CMD_SUB_DELAY, "sub_delay",1, { {MP_CMD_ARG_FLOAT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
|
||||
{ MP_CMD_SUB_STEP, "sub_step",1, { { MP_CMD_ARG_INT,{0} }, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
|
||||
{ MP_CMD_OSD, "osd",0, { {MP_CMD_ARG_INT,{-1}}, {-1,{0}} } },
|
||||
|
||||
@@ -93,6 +93,7 @@
|
||||
#define MP_CMD_STEP_PROPERTY 91
|
||||
#define MP_CMD_RADIO_STEP_FREQ 92
|
||||
#define MP_CMD_TV_STEP_FREQ 93
|
||||
#define MP_CMD_LOOP 94
|
||||
#define MP_CMD_BALANCE 96
|
||||
#define MP_CMD_SUB_SCALE 97
|
||||
|
||||
|
||||
Reference in New Issue
Block a user