summaryrefslogtreecommitdiffstats
path: root/parser-mpcmd.c
diff options
context:
space:
mode:
authoralbeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-11-12 23:41:32 +0000
committeralbeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-11-12 23:41:32 +0000
commitb3044d0febec37c5629c333a2ba1ae29e488c77b (patch)
tree07b6ae38bb986aebac02f19122ab309044e8e5e9 /parser-mpcmd.c
parent5a4c2c738ee60647a046b6128a503e19cd1dafa1 (diff)
downloadmpv-b3044d0febec37c5629c333a2ba1ae29e488c77b.tar.bz2
mpv-b3044d0febec37c5629c333a2ba1ae29e488c77b.tar.xz
Basic support for random playing (-rnd and -nornd)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8176 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'parser-mpcmd.c')
-rw-r--r--parser-mpcmd.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/parser-mpcmd.c b/parser-mpcmd.c
index 2d72a911d0..42d6efc5d9 100644
--- a/parser-mpcmd.c
+++ b/parser-mpcmd.c
@@ -177,6 +177,8 @@ m_config_parse_mp_command_line(m_config_t *config, int argc, char **argv)
{
play_tree_t* entry = play_tree_new();
UNSET_GLOBAL;
+ if(last_parent->flags & PLAY_TREE_RND)
+ entry->flags |= PLAY_TREE_RND;
if(last_entry == NULL) {
play_tree_set_child(last_parent,entry);
} else {
@@ -222,6 +224,16 @@ m_config_parse_mp_command_line(m_config_t *config, int argc, char **argv)
pt->loop = l;
tmp = 1;
}
+ } else if(strcasecmp(opt,"rnd") == 0) {
+ if(last_entry && last_entry->child)
+ last_entry->flags |= PLAY_TREE_RND;
+ else
+ last_parent->flags |= PLAY_TREE_RND;
+ } else if(strcasecmp(opt,"nornd") == 0) {
+ if(last_entry && last_entry->child)
+ last_entry->flags &= ~PLAY_TREE_RND;
+ else
+ last_parent->flags &= ~PLAY_TREE_RND;
} else {
m_option_t* mp_opt = NULL;
play_tree_t* entry = NULL;
@@ -230,6 +242,8 @@ m_config_parse_mp_command_line(m_config_t *config, int argc, char **argv)
if(tmp > 0) { // It's an entry
if(entry) {
add_entry(entry);
+ if((last_parent->flags & PLAY_TREE_RND) && entry->child)
+ entry->flags |= PLAY_TREE_RND;
UNSET_GLOBAL;
} else if(mode == LOCAL) // Entry is empty we have to drop his params
mode = DROP_LOCAL;