annotate parser-mpcmd.c @ 12396:a4f9c64d9d75

Fix hang for some asf video stream like http://193.219.139.115/ltv/zinios/news1830_20040501.wmv Patch by adland
author rtognimp
date Sun, 02 May 2004 16:22:32 +0000
parents 14bdbd687113
children 2cbc9f1f728f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
1 #include "config.h"
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
2
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
3 #include <stdio.h>
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
4 #include <stdlib.h>
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
5 #include <string.h>
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
6 #include <errno.h>
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
7
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
8 #ifdef MP_DEBUG
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
9 #include <assert.h>
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
10 #endif
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
11
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
12 #include "mp_msg.h"
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
13 #include "m_option.h"
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
14 #include "m_config.h"
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
15 #include "playtree.h"
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
16
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
17 static int recursion_depth = 0;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
18 static int mode = 0;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
19
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
20 #define GLOBAL 0
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
21 #define LOCAL 1
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
22 #define DROP_LOCAL 2
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
23
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
24 #define UNSET_GLOBAL (mode = LOCAL)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
25 // Use this 1 if you want to have only global option (no per file option)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
26 // #define UNSET_GLOBAL (mode = GLOBAL)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
27
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
28
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
29 static int is_entry_option(char *opt, char *param, play_tree_t** ret) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
30 play_tree_t* entry = NULL;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
31
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
32 *ret = NULL;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
33
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
34 if(strcasecmp(opt,"playlist") == 0) { // We handle playlist here
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
35 if(!param)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
36 return M_OPT_MISSING_PARAM;
12267
14bdbd687113 Fail if empty or nonexitant playlist
rtognimp
parents: 10595
diff changeset
37
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
38 entry = parse_playlist_file(param);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
39 if(!entry)
12267
14bdbd687113 Fail if empty or nonexitant playlist
rtognimp
parents: 10595
diff changeset
40 return -1;
14bdbd687113 Fail if empty or nonexitant playlist
rtognimp
parents: 10595
diff changeset
41 else {
14bdbd687113 Fail if empty or nonexitant playlist
rtognimp
parents: 10595
diff changeset
42 *ret=entry;
14bdbd687113 Fail if empty or nonexitant playlist
rtognimp
parents: 10595
diff changeset
43 return 1;
14bdbd687113 Fail if empty or nonexitant playlist
rtognimp
parents: 10595
diff changeset
44 }
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
45 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
46 return 0;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
47 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
48
10542
928c02fa9949 fix the bug where only the last file of the command line is found
pl
parents: 10513
diff changeset
49 static inline void add_entry(play_tree_t **last_parentp,
928c02fa9949 fix the bug where only the last file of the command line is found
pl
parents: 10513
diff changeset
50 play_tree_t **last_entryp, play_tree_t *entry) {
928c02fa9949 fix the bug where only the last file of the command line is found
pl
parents: 10513
diff changeset
51 if(*last_entryp == NULL)
928c02fa9949 fix the bug where only the last file of the command line is found
pl
parents: 10513
diff changeset
52 play_tree_set_child(*last_parentp,entry);
10513
b3f144efb724 c vs c++ syntax
alex
parents: 10397
diff changeset
53 else
10542
928c02fa9949 fix the bug where only the last file of the command line is found
pl
parents: 10513
diff changeset
54 play_tree_append_entry(*last_entryp,entry);
928c02fa9949 fix the bug where only the last file of the command line is found
pl
parents: 10513
diff changeset
55 *last_entryp = entry;
10513
b3f144efb724 c vs c++ syntax
alex
parents: 10397
diff changeset
56 }
b3f144efb724 c vs c++ syntax
alex
parents: 10397
diff changeset
57
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
58 play_tree_t*
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
59 m_config_parse_mp_command_line(m_config_t *config, int argc, char **argv)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
60 {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
61 int i;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
62 int tmp = 0;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
63 char *opt;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
64 int no_more_opts = 0;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
65 play_tree_t *last_parent, *last_entry = NULL, *root;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
66
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
67 #ifdef MP_DEBUG
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
68 assert(config != NULL);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
69 assert(argv != NULL);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
70 assert(argc >= 1);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
71 #endif
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
72
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
73 config->mode = M_COMMAND_LINE;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
74 mode = GLOBAL;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
75 last_parent = root = play_tree_new();
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
76 /* in order to work recursion detection properly in parse_config_file */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
77 ++recursion_depth;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
78
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
79 for (i = 1; i < argc; i++) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
80 //next:
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
81 opt = argv[i];
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
82 /* check for -- (no more options id.) except --help! */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
83 if ((*opt == '-') && (*(opt+1) == '-') && (*(opt+2) != 'h'))
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
84 {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
85 no_more_opts = 1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
86 if (i+1 >= argc)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
87 {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
88 mp_msg(MSGT_CFGPARSER, MSGL_ERR, "You added '--' but no filenames presented!\n");
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
89 goto err_out;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
90 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
91 continue;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
92 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
93 if((opt[0] == '{') && (opt[1] == '\0'))
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
94 {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
95 play_tree_t* entry = play_tree_new();
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
96 UNSET_GLOBAL;
8175
bf5d1da56ecd Basic support for random playing (-rnd and -nornd)
albeu
parents: 8164
diff changeset
97 if(last_parent->flags & PLAY_TREE_RND)
bf5d1da56ecd Basic support for random playing (-rnd and -nornd)
albeu
parents: 8164
diff changeset
98 entry->flags |= PLAY_TREE_RND;
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
99 if(last_entry == NULL) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
100 play_tree_set_child(last_parent,entry);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
101 } else {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
102 play_tree_append_entry(last_entry,entry);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
103 last_entry = NULL;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
104 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
105 last_parent = entry;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
106 continue;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
107 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
108
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
109 if((opt[0] == '}') && (opt[1] == '\0'))
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
110 {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
111 if( ! last_parent || ! last_parent->parent) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
112 mp_msg(MSGT_CFGPARSER, MSGL_ERR, "too much }-\n");
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
113 goto err_out;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
114 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
115 last_entry = last_parent;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
116 last_parent = last_entry->parent;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
117 continue;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
118 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
119
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
120 if ((no_more_opts == 0) && (*opt == '-') && (*(opt+1) != 0)) /* option */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
121 {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
122 /* remove trailing '-' */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
123 opt++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
124
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
125 mp_msg(MSGT_CFGPARSER, MSGL_DBG3, "this_opt = option: %s\n", opt);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
126 // We handle here some specific option
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
127 if(strcasecmp(opt,"list-options") == 0) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
128 m_config_print_option_list(config);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
129 exit(1);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
130 // Loop option when it apply to a group
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
131 } else if(strcasecmp(opt,"loop") == 0 &&
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
132 (! last_entry || last_entry->child) ) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
133 int l;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
134 char* end;
8400
587b62cd4119 10l noticed by "Puk Madick" <pingy@swirvemail.com>
arpi
parents: 8175
diff changeset
135 l = (i+1<argc) ? strtol(argv[i+1],&end,0) : 0;
9106
2c1aee5bb754 Ok, firstly fixed the bug in parser-mpcmd.c where it
arpi
parents: 8458
diff changeset
136 if(*end != '\0') {
2c1aee5bb754 Ok, firstly fixed the bug in parser-mpcmd.c where it
arpi
parents: 8458
diff changeset
137 mp_msg(MSGT_CFGPARSER, MSGL_ERR, "The loop option must be an integer: %s\n",argv[i+1]);
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
138 tmp = ERR_OUT_OF_RANGE;
9106
2c1aee5bb754 Ok, firstly fixed the bug in parser-mpcmd.c where it
arpi
parents: 8458
diff changeset
139 } else {
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
140 play_tree_t* pt = last_entry ? last_entry : last_parent;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
141 l = l <= 0 ? -1 : l;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
142 pt->loop = l;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
143 tmp = 1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
144 }
8452
418b0017a8d2 -rnd --> -shuffle
diego
parents: 8426
diff changeset
145 } else if(strcasecmp(opt,"shuffle") == 0) {
8175
bf5d1da56ecd Basic support for random playing (-rnd and -nornd)
albeu
parents: 8164
diff changeset
146 if(last_entry && last_entry->child)
bf5d1da56ecd Basic support for random playing (-rnd and -nornd)
albeu
parents: 8164
diff changeset
147 last_entry->flags |= PLAY_TREE_RND;
bf5d1da56ecd Basic support for random playing (-rnd and -nornd)
albeu
parents: 8164
diff changeset
148 else
bf5d1da56ecd Basic support for random playing (-rnd and -nornd)
albeu
parents: 8164
diff changeset
149 last_parent->flags |= PLAY_TREE_RND;
8452
418b0017a8d2 -rnd --> -shuffle
diego
parents: 8426
diff changeset
150 } else if(strcasecmp(opt,"noshuffle") == 0) {
8175
bf5d1da56ecd Basic support for random playing (-rnd and -nornd)
albeu
parents: 8164
diff changeset
151 if(last_entry && last_entry->child)
bf5d1da56ecd Basic support for random playing (-rnd and -nornd)
albeu
parents: 8164
diff changeset
152 last_entry->flags &= ~PLAY_TREE_RND;
bf5d1da56ecd Basic support for random playing (-rnd and -nornd)
albeu
parents: 8164
diff changeset
153 else
bf5d1da56ecd Basic support for random playing (-rnd and -nornd)
albeu
parents: 8164
diff changeset
154 last_parent->flags &= ~PLAY_TREE_RND;
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
155 } else {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
156 m_option_t* mp_opt = NULL;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
157 play_tree_t* entry = NULL;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
158
8458
92a7bf835d98 2*10l=20l
arpi
parents: 8452
diff changeset
159 tmp = is_entry_option(opt,(i+1<argc) ? argv[i + 1] : NULL,&entry);
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
160 if(tmp > 0) { // It's an entry
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
161 if(entry) {
10542
928c02fa9949 fix the bug where only the last file of the command line is found
pl
parents: 10513
diff changeset
162 add_entry(&last_parent,&last_entry,entry);
8175
bf5d1da56ecd Basic support for random playing (-rnd and -nornd)
albeu
parents: 8164
diff changeset
163 if((last_parent->flags & PLAY_TREE_RND) && entry->child)
bf5d1da56ecd Basic support for random playing (-rnd and -nornd)
albeu
parents: 8164
diff changeset
164 entry->flags |= PLAY_TREE_RND;
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
165 UNSET_GLOBAL;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
166 } else if(mode == LOCAL) // Entry is empty we have to drop his params
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
167 mode = DROP_LOCAL;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
168 } else if(tmp == 0) { // 'normal' options
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
169 mp_opt = m_config_get_option(config,opt);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
170 if (mp_opt != NULL) { // Option exist
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
171 if(mode == GLOBAL || (mp_opt->flags & M_OPT_GLOBAL))
8426
ca2813aafb35 more i+1<argc checks
arpi
parents: 8400
diff changeset
172 tmp = (i+1<argc) ? m_config_set_option(config, opt, argv[i + 1])
ca2813aafb35 more i+1<argc checks
arpi
parents: 8400
diff changeset
173 : m_config_set_option(config, opt, NULL);
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
174 else {
8458
92a7bf835d98 2*10l=20l
arpi
parents: 8452
diff changeset
175 tmp = m_config_check_option(config, opt, (i+1<argc) ? argv[i + 1] : NULL);
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
176 if(tmp >= 0 && mode != DROP_LOCAL) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
177 play_tree_t* pt = last_entry ? last_entry : last_parent;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
178 play_tree_set_param(pt,opt, argv[i + 1]);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
179 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
180 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
181 } else {
10595
522afd56703c 100l to albeu for his english grammar, and 10l to me becouse I noticed that lately (my backward compatibilty macro uses M_OPT_UNKNOWN)
alex
parents: 10594
diff changeset
182 tmp = M_OPT_UNKNOWN;
10397
6180d7558f75 output typo fixes: unknow --> unknown
diego
parents: 9792
diff changeset
183 mp_msg(MSGT_CFGPARSER, MSGL_ERR, "Unknown option on the command line: %s\n",opt);
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
184 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
185 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
186 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
187
9792
4c34dc17e43d Exit when the option parser return M_OPT_EXIT
albeu
parents: 9747
diff changeset
188 if (tmp < 0) {
4c34dc17e43d Exit when the option parser return M_OPT_EXIT
albeu
parents: 9747
diff changeset
189 if (tmp == M_OPT_EXIT)
4c34dc17e43d Exit when the option parser return M_OPT_EXIT
albeu
parents: 9747
diff changeset
190 exit(0);
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
191 goto err_out;
9792
4c34dc17e43d Exit when the option parser return M_OPT_EXIT
albeu
parents: 9747
diff changeset
192 }
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
193 i += tmp;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
194 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
195 else /* filename */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
196 {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
197 play_tree_t* entry = play_tree_new();
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
198 mp_msg(MSGT_CFGPARSER, MSGL_DBG2,"Adding file %s\n",argv[i]);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
199 play_tree_add_file(entry,argv[i]);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
200 // Lock stdin if it will be used as input
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
201 if(strcasecmp(argv[i],"-") == 0)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
202 m_config_set_option(config,"use-stdin",NULL);
10542
928c02fa9949 fix the bug where only the last file of the command line is found
pl
parents: 10513
diff changeset
203 add_entry(&last_parent,&last_entry,entry);
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
204 UNSET_GLOBAL; // We start entry specific options
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
205
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
206 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
207 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
208
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
209 --recursion_depth;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
210 if(last_parent != root)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
211 mp_msg(MSGT_CFGPARSER, MSGL_ERR,"Missing }- ?\n");
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
212 return root;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
213
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
214 err_out:
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
215 --recursion_depth;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
216 play_tree_free(root,1);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
217 return NULL;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
218 }