[Mplayer-cvslog] CVS: main cfgparser.c,1.48,1.49 mplayer.c,1.472,1.473
Alban Bedel CVS
albeu at mplayerhq.hu
Wed Apr 17 14:24:03 CEST 2002
Update of /cvsroot/mplayer/main
In directory mail:/var/tmp.root/cvs-serv18762
Modified Files:
cfgparser.c mplayer.c
Log Message:
Add correct loop option parsing in command line parser.
Reset the config while looping inside a file
You can now define GLOBAL_OPTIONS_ONLY in your config.h
to have only global options (ie no per file option)
Index: cfgparser.c
===================================================================
RCS file: /cvsroot/mplayer/main/cfgparser.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- cfgparser.c 20 Mar 2002 09:45:39 -0000 1.48
+++ cfgparser.c 17 Apr 2002 12:23:52 -0000 1.49
@@ -28,7 +28,11 @@
#define CONFIG_RUNNING (1<<1)
#define SET_GLOBAL(c) (c->flags |= CONFIG_GLOBAL)
+#ifdef GLOBAL_OPTIONS_ONLY
+#define UNSET_GLOBAL(c)
+#else
#define UNSET_GLOBAL(c) (c->flags &= (!CONFIG_GLOBAL))
+#endif
#define IS_GLOBAL(c) (c->flags & CONFIG_GLOBAL)
#define SET_RUNNING(c) (c->flags |= CONFIG_RUNNING)
#define IS_RUNNING(c) (c->flags & CONFIG_RUNNING)
@@ -1052,11 +1056,26 @@
opt++;
mp_msg(MSGT_CFGPARSER, MSGL_DBG3, "this_opt = option: %s\n", opt);
+ // We handle here some specific option
if(strcasecmp(opt,"list-options") == 0) {
m_config_list_options(config);
exit(1);
- }
- tmp = m_config_set_option(config, opt, argv[i + 1]);
+ // Loop option when it apply to a group
+ } else if(strcasecmp(opt,"loop") == 0 &&
+ (! config->last_entry || config->last_entry->child) ) {
+ int l;
+ char* end;
+ l = strtol(argv[i+1],&end,0);
+ if(!end)
+ tmp = ERR_OUT_OF_RANGE;
+ else {
+ play_tree_t* pt = config->last_entry ? config->last_entry : config->last_parent;
+ l = l <= 0 ? -1 : l;
+ pt->loop = l;
+ tmp = 1;
+ }
+ } else // All normal options
+ tmp = m_config_set_option(config, opt, argv[i + 1]);
switch (tmp) {
case ERR_NOT_AN_OPTION:
@@ -1091,7 +1110,7 @@
--config->recursion_depth;
if(config->last_parent != config->pt)
mp_msg(MSGT_CFGPARSER, MSGL_ERR,"Missing }- ?\n");
- UNSET_GLOBAL(config);
+ config->flags &= (!CONFIG_GLOBAL);
SET_RUNNING(config);
return 1;
#if 0
Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.472
retrieving revision 1.473
diff -u -r1.472 -r1.473
--- mplayer.c 16 Apr 2002 17:41:28 -0000 1.472
+++ mplayer.c 17 Apr 2002 12:23:52 -0000 1.473
@@ -2670,7 +2670,9 @@
/* Looping. */
if(eof==1 && loop_times>=0) {
-
+ int l = loop_times;
+ play_tree_iter_step(playtree_iter,0,0);
+ loop_times = l;
mp_msg(MSGT_CPLAYER,MSGL_V,"loop_times = %d, eof = %d\n", loop_times,eof);
if(loop_times>1) loop_times--; else
More information about the MPlayer-cvslog
mailing list