summaryrefslogtreecommitdiffstats
path: root/command.c
diff options
context:
space:
mode:
authoralbeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-07-09 14:52:46 +0000
committeralbeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-07-09 14:52:46 +0000
commit63865de207e821ad5e9d176abb365ffa3e2243af (patch)
tree08e26fdc0237a56db75e48f8cc0c3c4713e44c38 /command.c
parentf48a4beff0a43adf6073fc213b91a7b25e7f931d (diff)
downloadmpv-63865de207e821ad5e9d176abb365ffa3e2243af.tar.bz2
mpv-63865de207e821ad5e9d176abb365ffa3e2243af.tar.xz
Add a loop command and property.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23747 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'command.c')
-rw-r--r--command.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/command.c b/command.c
index f438effe43..85b3121c47 100644
--- a/command.c
+++ b/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 },