Mercurial > mplayer.hg
comparison parser-mpcmd.c @ 8175:bf5d1da56ecd
Basic support for random playing (-rnd and -nornd)
author | albeu |
---|---|
date | Tue, 12 Nov 2002 23:41:32 +0000 |
parents | 487cfc28525d |
children | 587b62cd4119 |
comparison
equal
deleted
inserted
replaced
8174:014e0ea85bdb | 8175:bf5d1da56ecd |
---|---|
175 } | 175 } |
176 if((opt[0] == '{') && (opt[1] == '\0')) | 176 if((opt[0] == '{') && (opt[1] == '\0')) |
177 { | 177 { |
178 play_tree_t* entry = play_tree_new(); | 178 play_tree_t* entry = play_tree_new(); |
179 UNSET_GLOBAL; | 179 UNSET_GLOBAL; |
180 if(last_parent->flags & PLAY_TREE_RND) | |
181 entry->flags |= PLAY_TREE_RND; | |
180 if(last_entry == NULL) { | 182 if(last_entry == NULL) { |
181 play_tree_set_child(last_parent,entry); | 183 play_tree_set_child(last_parent,entry); |
182 } else { | 184 } else { |
183 play_tree_append_entry(last_entry,entry); | 185 play_tree_append_entry(last_entry,entry); |
184 last_entry = NULL; | 186 last_entry = NULL; |
220 play_tree_t* pt = last_entry ? last_entry : last_parent; | 222 play_tree_t* pt = last_entry ? last_entry : last_parent; |
221 l = l <= 0 ? -1 : l; | 223 l = l <= 0 ? -1 : l; |
222 pt->loop = l; | 224 pt->loop = l; |
223 tmp = 1; | 225 tmp = 1; |
224 } | 226 } |
227 } else if(strcasecmp(opt,"rnd") == 0) { | |
228 if(last_entry && last_entry->child) | |
229 last_entry->flags |= PLAY_TREE_RND; | |
230 else | |
231 last_parent->flags |= PLAY_TREE_RND; | |
232 } else if(strcasecmp(opt,"nornd") == 0) { | |
233 if(last_entry && last_entry->child) | |
234 last_entry->flags &= ~PLAY_TREE_RND; | |
235 else | |
236 last_parent->flags &= ~PLAY_TREE_RND; | |
225 } else { | 237 } else { |
226 m_option_t* mp_opt = NULL; | 238 m_option_t* mp_opt = NULL; |
227 play_tree_t* entry = NULL; | 239 play_tree_t* entry = NULL; |
228 | 240 |
229 tmp = is_entry_option(opt,argv[i + 1],&entry); | 241 tmp = is_entry_option(opt,argv[i + 1],&entry); |
230 if(tmp > 0) { // It's an entry | 242 if(tmp > 0) { // It's an entry |
231 if(entry) { | 243 if(entry) { |
232 add_entry(entry); | 244 add_entry(entry); |
245 if((last_parent->flags & PLAY_TREE_RND) && entry->child) | |
246 entry->flags |= PLAY_TREE_RND; | |
233 UNSET_GLOBAL; | 247 UNSET_GLOBAL; |
234 } else if(mode == LOCAL) // Entry is empty we have to drop his params | 248 } else if(mode == LOCAL) // Entry is empty we have to drop his params |
235 mode = DROP_LOCAL; | 249 mode = DROP_LOCAL; |
236 } else if(tmp == 0) { // 'normal' options | 250 } else if(tmp == 0) { // 'normal' options |
237 mp_opt = m_config_get_option(config,opt); | 251 mp_opt = m_config_get_option(config,opt); |