Mercurial > mplayer.hg
annotate playtreeparser.c @ 30598:a9eac13b820a
Add a InitializeCriticalSectionAndSpinCount function.
author | reimar |
---|---|
date | Thu, 18 Feb 2010 20:24:52 +0000 |
parents | c1a3f1bbba26 |
children | dad8e0eb182a |
rev | line source |
---|---|
30429
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
1 /* |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
2 * This file is part of MPlayer. |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
3 * |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
4 * MPlayer is free software; you can redistribute it and/or modify |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
7 * (at your option) any later version. |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
8 * |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
9 * MPlayer is distributed in the hope that it will be useful, |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
12 * GNU General Public License for more details. |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
13 * |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
14 * You should have received a copy of the GNU General Public License along |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
17 */ |
18265 | 18 |
19 /// \file | |
20 /// \ingroup PlaytreeParser | |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
21 |
4156
22fadd4022b5
playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents:
4043
diff
changeset
|
22 #include "config.h" |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
23 #include <stdlib.h> |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
24 #include <stdio.h> |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
25 #include <string.h> |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
26 #include <assert.h> |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
27 #include <errno.h> |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
28 #include <sys/types.h> |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
29 #include <sys/stat.h> |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
30 #include <fcntl.h> |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
31 #include <unistd.h> |
12300
95ea9f5f6f14
Fix embedded smil playlist detection if there are parameters on the url
rtognimp
parents:
12223
diff
changeset
|
32 #include <ctype.h> |
9749 | 33 #include "m_config.h" |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
34 #include "playtree.h" |
4308
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
35 #include "playtreeparser.h" |
19271
64d82a45a05d
introduce new 'stream' directory for all stream layer related components and split them from libmpdemux
ben
parents:
18928
diff
changeset
|
36 #include "stream/stream.h" |
12223 | 37 #include "libmpdemux/demuxer.h" |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
38 #include "mp_msg.h" |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
39 |
6662
f8e25756a5ec
Relative filename in playlist are now relative to the playlist path
albeu
parents:
6661
diff
changeset
|
40 |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
41 extern play_tree_t* |
4308
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
42 asx_parser_build_tree(char* buffer, int ref); |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
43 |
4782 | 44 #define BUF_STEP 1024 |
45 | |
46 #define WHITES " \n\r\t" | |
47 | |
48 static void | |
49 strstrip(char* str) { | |
50 char* i; | |
51 | |
8907 | 52 if (str==NULL) |
53 return; | |
4782 | 54 for(i = str ; i[0] != '\0' && strchr(WHITES,i[0]) != NULL; i++) |
55 /* NOTHING */; | |
56 if(i[0] != '\0') { | |
8907 | 57 memmove(str,i,strlen(i) + 1); |
58 for(i = str + strlen(str) - 1 ; strchr(WHITES,i[0]) != NULL; i--) | |
4782 | 59 /* NOTHING */; |
60 i[1] = '\0'; | |
61 } else | |
62 str[0] = '\0'; | |
63 } | |
64 | |
65 static char* | |
66 play_tree_parser_get_line(play_tree_parser_t* p) { | |
67 char *end,*line_end; | |
68 int r,resize = 0; | |
69 | |
70 if(p->buffer == NULL) { | |
18869 | 71 p->buffer = malloc(BUF_STEP); |
4782 | 72 p->buffer_size = BUF_STEP; |
28183 | 73 p->buffer[0] = 0; |
4782 | 74 p->iter = p->buffer; |
75 } | |
76 | |
5802 | 77 if(p->stream->eof && (p->buffer_end == 0 || p->iter[0] == '\0')) |
4782 | 78 return NULL; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28314
diff
changeset
|
79 |
28182
26ab2d01157f
Add asserts to detect when assumptions for play_tree_parser_get_line
reimar
parents:
25141
diff
changeset
|
80 assert(p->buffer_end < p->buffer_size); |
26ab2d01157f
Add asserts to detect when assumptions for play_tree_parser_get_line
reimar
parents:
25141
diff
changeset
|
81 assert(!p->buffer[p->buffer_end]); |
4782 | 82 while(1) { |
83 | |
84 if(resize) { | |
85 r = p->iter - p->buffer; | |
86 p->buffer = (char*)realloc(p->buffer,p->buffer_size+BUF_STEP); | |
87 p->iter = p->buffer + r; | |
88 p->buffer_size += BUF_STEP; | |
89 resize = 0; | |
90 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28314
diff
changeset
|
91 |
4782 | 92 if(p->buffer_size - p->buffer_end > 1 && ! p->stream->eof) { |
93 r = stream_read(p->stream,p->buffer + p->buffer_end,p->buffer_size - p->buffer_end - 1); | |
94 if(r > 0) { | |
95 p->buffer_end += r; | |
28182
26ab2d01157f
Add asserts to detect when assumptions for play_tree_parser_get_line
reimar
parents:
25141
diff
changeset
|
96 assert(p->buffer_end < p->buffer_size); |
4782 | 97 p->buffer[p->buffer_end] = '\0'; |
22242
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
98 while(strlen(p->buffer + p->buffer_end - r) != r) |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
99 p->buffer[p->buffer_end - r + strlen(p->buffer + p->buffer_end - r)] = '\n'; |
4782 | 100 } |
28182
26ab2d01157f
Add asserts to detect when assumptions for play_tree_parser_get_line
reimar
parents:
25141
diff
changeset
|
101 assert(!p->buffer[p->buffer_end]); |
4782 | 102 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28314
diff
changeset
|
103 |
4782 | 104 end = strchr(p->iter,'\n'); |
105 if(!end) { | |
106 if(p->stream->eof) { | |
4857 | 107 end = p->buffer + p->buffer_end; |
4782 | 108 break; |
109 } | |
110 resize = 1; | |
111 continue; | |
112 } | |
113 break; | |
114 } | |
115 | |
25141
fba022abe464
100l in play_tree_parser_get_line, check that there actually is
reimar
parents:
24962
diff
changeset
|
116 line_end = (end > p->iter && *(end-1) == '\r') ? end-1 : end; |
5802 | 117 if(line_end - p->iter >= 0) |
118 p->line = (char*)realloc(p->line,line_end - p->iter+1); | |
119 else | |
4782 | 120 return NULL; |
5802 | 121 if(line_end - p->iter > 0) |
122 strncpy(p->line,p->iter,line_end - p->iter); | |
4782 | 123 p->line[line_end - p->iter] = '\0'; |
5802 | 124 if(end[0] != '\0') |
4857 | 125 end++; |
4782 | 126 |
127 if(!p->keep) { | |
4857 | 128 if(end[0] != '\0') { |
5788
8bd1c1e319fb
Fix a bug produced when line are terminated with \r\n and not a single
albeu
parents:
4857
diff
changeset
|
129 p->buffer_end -= end-p->iter; |
4782 | 130 memmove(p->buffer,end,p->buffer_end); |
131 } else | |
132 p->buffer_end = 0; | |
28183 | 133 p->buffer[p->buffer_end] = '\0'; |
4782 | 134 p->iter = p->buffer; |
135 } else | |
136 p->iter = end; | |
137 | |
138 return p->line; | |
139 } | |
140 | |
141 static void | |
142 play_tree_parser_reset(play_tree_parser_t* p) { | |
143 p->iter = p->buffer; | |
144 } | |
145 | |
146 static void | |
147 play_tree_parser_stop_keeping(play_tree_parser_t* p) { | |
148 p->keep = 0; | |
149 if(p->iter && p->iter != p->buffer) { | |
150 p->buffer_end -= p->iter -p->buffer; | |
151 if(p->buffer_end) | |
152 memmove(p->buffer,p->iter,p->buffer_end); | |
28184
0fb5551413f7
1000l, play_tree_parser_stop_keeping broke 0-termination of buffer
reimar
parents:
28183
diff
changeset
|
153 p->buffer[p->buffer_end] = 0; |
4782 | 154 p->iter = p->buffer; |
155 } | |
156 } | |
157 | |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
158 |
18916
a95ed361d16b
several function from playtreeparser.c maked static,
reynaldo
parents:
18879
diff
changeset
|
159 static play_tree_t* |
4308
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
160 parse_asx(play_tree_parser_t* p) { |
4782 | 161 int comments = 0,get_line = 1; |
162 char* line = NULL; | |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
163 |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
164 mp_msg(MSGT_PLAYTREE,MSGL_V,"Trying asx...\n"); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28314
diff
changeset
|
165 |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
166 while(1) { |
4782 | 167 if(get_line) { |
168 line = play_tree_parser_get_line(p); | |
169 if(!line) | |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
170 return NULL; |
4782 | 171 strstrip(line); |
172 if(line[0] == '\0') | |
173 continue; | |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
174 } |
4782 | 175 if(!comments) { |
176 if(line[0] != '<') { | |
177 mp_msg(MSGT_PLAYTREE,MSGL_DBG2,"First char isn't '<' but '%c'\n",line[0]); | |
4308
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
178 mp_msg(MSGT_PLAYTREE,MSGL_DBG3,"Buffer = [%s]\n",p->buffer); |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
179 return NULL; |
4782 | 180 } else if(strncmp(line,"<!--",4) == 0) { // Comments |
181 comments = 1; | |
182 line += 4; | |
183 if(line[0] != '\0' && strlen(line) > 0) | |
184 get_line = 0; | |
185 } else if(strncasecmp(line,"<ASX",4) == 0) // We got an asx element | |
186 break; | |
187 else // We don't get an asx | |
188 return NULL; | |
189 } else { // Comments | |
190 char* c; | |
191 c = strchr(line,'-'); | |
192 if(c) { | |
193 if (strncmp(c,"--!>",4) == 0) { // End of comments | |
194 comments = 0; | |
195 line = c+4; | |
196 if(line[0] != '\0') // There is some more data on this line : keep it | |
197 get_line = 0; | |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
198 |
4782 | 199 } else { |
200 line = c+1; // Jump the - | |
201 if(line[0] != '\0') // Some more data | |
202 get_line = 0; | |
203 else // End of line | |
204 get_line = 1; | |
205 } | |
206 } else // No - on this line (or rest of line) : get next one | |
207 get_line = 1; | |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
208 } |
4782 | 209 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28314
diff
changeset
|
210 |
4782 | 211 mp_msg(MSGT_PLAYTREE,MSGL_V,"Detected asx format\n"); |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
212 |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
213 // We have an asx : load it in memory and parse |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
214 |
4782 | 215 while((line = play_tree_parser_get_line(p)) != NULL) |
216 /* NOTHING */; | |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
217 |
10487 | 218 mp_msg(MSGT_PLAYTREE,MSGL_DBG3,"Parsing asx file: [%s]\n",p->buffer); |
4308
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
219 return asx_parser_build_tree(p->buffer,p->deep); |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
220 } |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
221 |
4782 | 222 static char* |
223 pls_entry_get_value(char* line) { | |
224 char* i; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28314
diff
changeset
|
225 |
4782 | 226 i = strchr(line,'='); |
227 if(!i || i[1] == '\0') | |
228 return NULL; | |
229 else | |
230 return i+1; | |
231 } | |
232 | |
233 typedef struct pls_entry { | |
234 char* file; | |
235 char* title; | |
236 char* length; | |
237 } pls_entry_t; | |
238 | |
239 static int | |
240 pls_read_entry(char* line,pls_entry_t** _e,int* _max_entry,char** val) { | |
241 int num,max_entry = (*_max_entry); | |
242 pls_entry_t* e = (*_e); | |
243 char* v; | |
244 | |
245 v = pls_entry_get_value(line); | |
246 if(!v) { | |
247 mp_msg(MSGT_PLAYTREE,MSGL_ERR,"No value in entry %s\n",line); | |
248 return 0; | |
249 } | |
250 | |
251 num = atoi(line); | |
252 if(num < 0) { | |
253 num = max_entry+1; | |
254 mp_msg(MSGT_PLAYTREE,MSGL_WARN,"No entry index in entry %s\nAssuming %d\n",line,num); | |
255 } | |
256 if(num > max_entry) { | |
257 e = (pls_entry_t*)realloc(e,num*sizeof(pls_entry_t)); | |
258 memset(&e[max_entry],0,(num-max_entry)*sizeof(pls_entry_t)); | |
259 max_entry = num; | |
260 } | |
261 (*_e) = e; | |
262 (*_max_entry) = max_entry; | |
263 (*val) = v; | |
264 | |
265 return num; | |
266 } | |
267 | |
268 | |
18916
a95ed361d16b
several function from playtreeparser.c maked static,
reynaldo
parents:
18879
diff
changeset
|
269 static play_tree_t* |
4782 | 270 parse_pls(play_tree_parser_t* p) { |
271 char *line,*v; | |
272 pls_entry_t* entries = NULL; | |
273 int n_entries = 0,max_entry=0,num; | |
9789
45173e0d34cc
Fix the incredible slowness with very long list. Now a 10^6 entries
albeu
parents:
9749
diff
changeset
|
274 play_tree_t *list = NULL, *entry = NULL, *last_entry = NULL; |
4782 | 275 |
10487 | 276 mp_msg(MSGT_PLAYTREE,MSGL_V,"Trying Winamp playlist...\n"); |
20834 | 277 while((line = play_tree_parser_get_line(p))) { |
278 strstrip(line); | |
279 if(strlen(line)) | |
280 break; | |
281 } | |
282 if (!line) | |
8925
5c15777f1c07
this patch adds an fallback to playlist (any but the plaintext-list format)
arpi
parents:
8907
diff
changeset
|
283 return NULL; |
4782 | 284 if(strcasecmp(line,"[playlist]")) |
285 return NULL; | |
10487 | 286 mp_msg(MSGT_PLAYTREE,MSGL_V,"Detected Winamp playlist format\n"); |
4782 | 287 play_tree_parser_stop_keeping(p); |
288 line = play_tree_parser_get_line(p); | |
289 if(!line) | |
290 return NULL; | |
291 strstrip(line); | |
292 if(strncasecmp(line,"NumberOfEntries",15) == 0) { | |
293 v = pls_entry_get_value(line); | |
294 n_entries = atoi(v); | |
295 if(n_entries < 0) | |
10487 | 296 mp_msg(MSGT_PLAYTREE,MSGL_DBG2,"Invalid number of entries: very funny!!!\n"); |
4782 | 297 else |
10487 | 298 mp_msg(MSGT_PLAYTREE,MSGL_DBG2,"Playlist claims to have %d entries. Let's see.\n",n_entries); |
4782 | 299 line = play_tree_parser_get_line(p); |
300 } | |
301 | |
302 while(line) { | |
303 strstrip(line); | |
304 if(line[0] == '\0') { | |
305 line = play_tree_parser_get_line(p); | |
306 continue; | |
307 } | |
308 if(strncasecmp(line,"File",4) == 0) { | |
309 num = pls_read_entry(line+4,&entries,&max_entry,&v); | |
310 if(num < 0) | |
311 mp_msg(MSGT_PLAYTREE,MSGL_ERR,"No value in entry %s\n",line); | |
312 else | |
313 entries[num-1].file = strdup(v); | |
314 } else if(strncasecmp(line,"Title",5) == 0) { | |
315 num = pls_read_entry(line+5,&entries,&max_entry,&v); | |
316 if(num < 0) | |
317 mp_msg(MSGT_PLAYTREE,MSGL_ERR,"No value in entry %s\n",line); | |
318 else | |
319 entries[num-1].title = strdup(v); | |
320 } else if(strncasecmp(line,"Length",6) == 0) { | |
321 num = pls_read_entry(line+6,&entries,&max_entry,&v); | |
322 if(num < 0) | |
323 mp_msg(MSGT_PLAYTREE,MSGL_ERR,"No value in entry %s\n",line); | |
324 else | |
325 entries[num-1].length = strdup(v); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28314
diff
changeset
|
326 } else |
10397 | 327 mp_msg(MSGT_PLAYTREE,MSGL_WARN,"Unknown entry type %s\n",line); |
4782 | 328 line = play_tree_parser_get_line(p); |
329 } | |
330 | |
331 for(num = 0; num < max_entry ; num++) { | |
332 if(entries[num].file == NULL) | |
333 mp_msg(MSGT_PLAYTREE,MSGL_ERR,"Entry %d don't have a file !!!!\n",num+1); | |
334 else { | |
5866 | 335 mp_msg(MSGT_PLAYTREE,MSGL_DBG2,"Adding entry %s\n",entries[num].file); |
4782 | 336 entry = play_tree_new(); |
337 play_tree_add_file(entry,entries[num].file); | |
338 free(entries[num].file); | |
339 if(list) | |
9789
45173e0d34cc
Fix the incredible slowness with very long list. Now a 10^6 entries
albeu
parents:
9749
diff
changeset
|
340 play_tree_append_entry(last_entry,entry); |
4782 | 341 else |
342 list = entry; | |
9789
45173e0d34cc
Fix the incredible slowness with very long list. Now a 10^6 entries
albeu
parents:
9749
diff
changeset
|
343 last_entry = entry; |
4782 | 344 } |
345 if(entries[num].title) { | |
346 // When we have info in playtree we add this info | |
347 free(entries[num].title); | |
348 } | |
349 if(entries[num].length) { | |
350 // When we have info in playtree we add this info | |
351 free(entries[num].length); | |
352 } | |
353 } | |
354 | |
355 free(entries); | |
5866 | 356 |
357 entry = play_tree_new(); | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28314
diff
changeset
|
358 play_tree_set_child(entry,list); |
5866 | 359 return entry; |
4782 | 360 } |
361 | |
8897
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
362 /* |
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
363 Reference Ini-Format: Each entry is assumed a reference |
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
364 */ |
18916
a95ed361d16b
several function from playtreeparser.c maked static,
reynaldo
parents:
18879
diff
changeset
|
365 static play_tree_t* |
8897
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
366 parse_ref_ini(play_tree_parser_t* p) { |
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
367 char *line,*v; |
9789
45173e0d34cc
Fix the incredible slowness with very long list. Now a 10^6 entries
albeu
parents:
9749
diff
changeset
|
368 play_tree_t *list = NULL, *entry = NULL, *last_entry = NULL; |
8897
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
369 |
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
370 mp_msg(MSGT_PLAYTREE,MSGL_V,"Trying reference-ini playlist...\n"); |
8925
5c15777f1c07
this patch adds an fallback to playlist (any but the plaintext-list format)
arpi
parents:
8907
diff
changeset
|
371 if (!(line = play_tree_parser_get_line(p))) |
5c15777f1c07
this patch adds an fallback to playlist (any but the plaintext-list format)
arpi
parents:
8907
diff
changeset
|
372 return NULL; |
8897
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
373 strstrip(line); |
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
374 if(strcasecmp(line,"[Reference]")) |
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
375 return NULL; |
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
376 mp_msg(MSGT_PLAYTREE,MSGL_V,"Detected reference-ini playlist format\n"); |
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
377 play_tree_parser_stop_keeping(p); |
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
378 line = play_tree_parser_get_line(p); |
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
379 if(!line) |
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
380 return NULL; |
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
381 while(line) { |
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
382 strstrip(line); |
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
383 if(strncasecmp(line,"Ref",3) == 0) { |
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
384 v = pls_entry_get_value(line+3); |
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
385 if(!v) |
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
386 mp_msg(MSGT_PLAYTREE,MSGL_ERR,"No value in entry %s\n",line); |
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
387 else |
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
388 { |
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
389 mp_msg(MSGT_PLAYTREE,MSGL_DBG2,"Adding entry %s\n",v); |
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
390 entry = play_tree_new(); |
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
391 play_tree_add_file(entry,v); |
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
392 if(list) |
9789
45173e0d34cc
Fix the incredible slowness with very long list. Now a 10^6 entries
albeu
parents:
9749
diff
changeset
|
393 play_tree_append_entry(last_entry,entry); |
8897
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
394 else |
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
395 list = entry; |
9789
45173e0d34cc
Fix the incredible slowness with very long list. Now a 10^6 entries
albeu
parents:
9749
diff
changeset
|
396 last_entry = entry; |
8897
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
397 } |
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
398 } |
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
399 line = play_tree_parser_get_line(p); |
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
400 } |
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
401 |
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
402 if(!list) return NULL; |
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
403 entry = play_tree_new(); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28314
diff
changeset
|
404 play_tree_set_child(entry,list); |
8897
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
405 return entry; |
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
406 } |
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
407 |
18916
a95ed361d16b
several function from playtreeparser.c maked static,
reynaldo
parents:
18879
diff
changeset
|
408 static play_tree_t* |
6661
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
409 parse_m3u(play_tree_parser_t* p) { |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
410 char* line; |
9789
45173e0d34cc
Fix the incredible slowness with very long list. Now a 10^6 entries
albeu
parents:
9749
diff
changeset
|
411 play_tree_t *list = NULL, *entry = NULL, *last_entry = NULL; |
6661
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
412 |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
413 mp_msg(MSGT_PLAYTREE,MSGL_V,"Trying extended m3u playlist...\n"); |
8925
5c15777f1c07
this patch adds an fallback to playlist (any but the plaintext-list format)
arpi
parents:
8907
diff
changeset
|
414 if (!(line = play_tree_parser_get_line(p))) |
5c15777f1c07
this patch adds an fallback to playlist (any but the plaintext-list format)
arpi
parents:
8907
diff
changeset
|
415 return NULL; |
6661
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
416 strstrip(line); |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
417 if(strcasecmp(line,"#EXTM3U")) |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
418 return NULL; |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
419 mp_msg(MSGT_PLAYTREE,MSGL_V,"Detected extended m3u playlist format\n"); |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
420 play_tree_parser_stop_keeping(p); |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
421 |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
422 while((line = play_tree_parser_get_line(p)) != NULL) { |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
423 strstrip(line); |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
424 if(line[0] == '\0') |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
425 continue; |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
426 /* EXTM3U files contain such lines: |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
427 * #EXTINF:<seconds>, <title> |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
428 * followed by a line with the filename |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
429 * for now we have no place to put that |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
430 * so we just skip that extra-info ::atmos |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
431 */ |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
432 if(line[0] == '#') { |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
433 #if 0 /* code functional */ |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
434 if(strncasecmp(line,"#EXTINF:",8) == 0) { |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
435 mp_msg(MSGT_PLAYTREE,MSGL_INFO,"[M3U] Duration: %dsec Title: %s\n", |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
436 strtol(line+8,&line,10), line+2); |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
437 } |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
438 #endif |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
439 continue; |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
440 } |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
441 entry = play_tree_new(); |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
442 play_tree_add_file(entry,line); |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
443 if(!list) |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
444 list = entry; |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
445 else |
9789
45173e0d34cc
Fix the incredible slowness with very long list. Now a 10^6 entries
albeu
parents:
9749
diff
changeset
|
446 play_tree_append_entry(last_entry,entry); |
45173e0d34cc
Fix the incredible slowness with very long list. Now a 10^6 entries
albeu
parents:
9749
diff
changeset
|
447 last_entry = entry; |
6661
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
448 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28314
diff
changeset
|
449 |
6661
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
450 if(!list) return NULL; |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
451 entry = play_tree_new(); |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
452 play_tree_set_child(entry,list); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28314
diff
changeset
|
453 return entry; |
6661
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
454 } |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
455 |
18916
a95ed361d16b
several function from playtreeparser.c maked static,
reynaldo
parents:
18879
diff
changeset
|
456 static play_tree_t* |
12097
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
457 parse_smil(play_tree_parser_t* p) { |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
458 int entrymode=0; |
22242
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
459 char* line,source[512],*pos,*s_start,*s_end,*src_line; |
12097
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
460 play_tree_t *list = NULL, *entry = NULL, *last_entry = NULL; |
22242
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
461 int is_rmsmil = 0; |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
462 unsigned int npkt, ttlpkt; |
12097
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
463 |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
464 mp_msg(MSGT_PLAYTREE,MSGL_V,"Trying smil playlist...\n"); |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
465 |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
466 // Check if smil |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
467 while((line = play_tree_parser_get_line(p)) != NULL) { |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
468 strstrip(line); |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
469 if(line[0] == '\0') // Ignore empties |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
470 continue; |
22518
29a3bb75db47
Support smil embedded into xml, fixes bugzilla #768
rtogni
parents:
22477
diff
changeset
|
471 if (strncasecmp(line,"<?xml",5)==0) // smil in xml |
29a3bb75db47
Support smil embedded into xml, fixes bugzilla #768
rtogni
parents:
22477
diff
changeset
|
472 continue; |
28314 | 473 if (strncasecmp(line,"<!DOCTYPE smil",13)==0) // smil in xml |
474 continue; | |
22242
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
475 if (strncasecmp(line,"<smil",5)==0 || strncasecmp(line,"<?wpl",5)==0 || |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
476 strncasecmp(line,"(smil-document",14)==0) |
12097
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
477 break; // smil header found |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
478 else |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
479 return NULL; //line not smil exit |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
480 } |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
481 |
24962
fb50e37df836
Fix possible null-pointer-dereference in parse_smil().
cehoyos
parents:
24424
diff
changeset
|
482 if (!line) return NULL; |
12097
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
483 mp_msg(MSGT_PLAYTREE,MSGL_V,"Detected smil playlist format\n"); |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
484 play_tree_parser_stop_keeping(p); |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
485 |
22242
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
486 if (strncasecmp(line,"(smil-document",14)==0) { |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
487 mp_msg(MSGT_PLAYTREE,MSGL_V,"Special smil-over-realrtsp playlist header\n"); |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
488 is_rmsmil = 1; |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
489 if (sscanf(line, "(smil-document (ver 1.0)(npkt %u)(ttlpkt %u", &npkt, &ttlpkt) != 2) { |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
490 mp_msg(MSGT_PLAYTREE,MSGL_WARN,"smil-over-realrtsp: header parsing failure, assuming single packet.\n"); |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
491 npkt = ttlpkt = 1; |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
492 } |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
493 if (ttlpkt == 0 || npkt > ttlpkt) { |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
494 mp_msg(MSGT_PLAYTREE,MSGL_WARN,"smil-over-realrtsp: bad packet counters (npkk = %u, ttlpkt = %u), assuming single packet.\n", |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
495 npkt, ttlpkt); |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
496 npkt = ttlpkt = 1; |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
497 } |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
498 } |
12097
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
499 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28314
diff
changeset
|
500 //Get entries from smil |
22712
c7eee1ecbe8c
Support multiple tags in a single line and tags on the same line as the
rtogni
parents:
22520
diff
changeset
|
501 src_line = line; |
22242
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
502 line = NULL; |
22712
c7eee1ecbe8c
Support multiple tags in a single line and tags on the same line as the
rtogni
parents:
22520
diff
changeset
|
503 do { |
22242
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
504 strstrip(src_line); |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
505 if (line) { |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
506 free(line); |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
507 line = NULL; |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
508 } |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
509 /* If we're parsing smil over realrtsp and this is not the last packet and |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
510 * this is the last line in the packet (terminating with ") ) we must get |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
511 * the next line, strip the header, and concatenate it to the current line. |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
512 */ |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
513 if (is_rmsmil && npkt != ttlpkt && strstr(src_line,"\")")) { |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
514 char *payload; |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
515 |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
516 line = strdup(src_line); |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
517 if(!(src_line = play_tree_parser_get_line(p))) { |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
518 mp_msg(MSGT_PLAYTREE,MSGL_WARN,"smil-over-realrtsp: can't get line from packet %u/%u.\n", npkt, ttlpkt); |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
519 break; |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
520 } |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
521 strstrip(src_line); |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
522 // Skip header, packet starts after " |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
523 if(!(payload = strchr(src_line,'\"'))) { |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
524 mp_msg(MSGT_PLAYTREE,MSGL_WARN,"smil-over-realrtsp: can't find start of packet, using complete line.\n"); |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
525 payload = src_line; |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
526 } else |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
527 payload++; |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
528 // Skip ") at the end of the last line from the current packet |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
529 line[strlen(line)-2] = 0; |
22477 | 530 line = realloc(line, strlen(line)+strlen(payload)+1); |
22242
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
531 strcat (line, payload); |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
532 npkt++; |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
533 } else |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
534 line = strdup(src_line); |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
535 /* Unescape \" to " for smil-over-rtsp */ |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
536 if (is_rmsmil && line[0] != '\0') { |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
537 int i, j; |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
538 |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
539 for (i = 0; i < strlen(line); i++) |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
540 if (line[i] == '\\' && line[i+1] == '"') |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
541 for (j = i; line[j]; j++) |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
542 line[j] = line[j+1]; |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
543 } |
22712
c7eee1ecbe8c
Support multiple tags in a single line and tags on the same line as the
rtogni
parents:
22520
diff
changeset
|
544 pos = line; |
c7eee1ecbe8c
Support multiple tags in a single line and tags on the same line as the
rtogni
parents:
22520
diff
changeset
|
545 while (pos) { |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28314
diff
changeset
|
546 if (!entrymode) { // all entries filled so far |
24424 | 547 while ((pos=strchr(pos, '<'))) { |
22712
c7eee1ecbe8c
Support multiple tags in a single line and tags on the same line as the
rtogni
parents:
22520
diff
changeset
|
548 if (strncasecmp(pos,"<video",6)==0 || strncasecmp(pos,"<audio",6)==0 || strncasecmp(pos,"<media",6)==0) { |
12097
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
549 entrymode=1; |
22712
c7eee1ecbe8c
Support multiple tags in a single line and tags on the same line as the
rtogni
parents:
22520
diff
changeset
|
550 break; // Got a valid tag, exit '<' search loop |
12097
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
551 } |
22712
c7eee1ecbe8c
Support multiple tags in a single line and tags on the same line as the
rtogni
parents:
22520
diff
changeset
|
552 pos++; |
c7eee1ecbe8c
Support multiple tags in a single line and tags on the same line as the
rtogni
parents:
22520
diff
changeset
|
553 } |
22520 | 554 } |
555 if (entrymode) { //Entry found but not yet filled | |
22712
c7eee1ecbe8c
Support multiple tags in a single line and tags on the same line as the
rtogni
parents:
22520
diff
changeset
|
556 pos = strstr(pos,"src="); // Is source present on this line |
12097
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
557 if (pos != NULL) { |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
558 entrymode=0; |
23774
16a67232e916
realrtsp smil files can also use ' as field delimiter instead of "
rtogni
parents:
22712
diff
changeset
|
559 if (pos[4] != '"' && pos[4] != '\'') { |
16a67232e916
realrtsp smil files can also use ' as field delimiter instead of "
rtogni
parents:
22712
diff
changeset
|
560 mp_msg(MSGT_PLAYTREE,MSGL_V,"Unknown delimiter %c in source line %s\n", pos[4], line); |
16a67232e916
realrtsp smil files can also use ' as field delimiter instead of "
rtogni
parents:
22712
diff
changeset
|
561 break; |
16a67232e916
realrtsp smil files can also use ' as field delimiter instead of "
rtogni
parents:
22712
diff
changeset
|
562 } |
12097
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
563 s_start=pos+5; |
23774
16a67232e916
realrtsp smil files can also use ' as field delimiter instead of "
rtogni
parents:
22712
diff
changeset
|
564 s_end=strchr(s_start,pos[4]); |
12097
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
565 if (s_end == NULL) { |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
566 mp_msg(MSGT_PLAYTREE,MSGL_V,"Error parsing this source line %s\n",line); |
22712
c7eee1ecbe8c
Support multiple tags in a single line and tags on the same line as the
rtogni
parents:
22520
diff
changeset
|
567 break; |
12097
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
568 } |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
569 if (s_end-s_start> 511) { |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
570 mp_msg(MSGT_PLAYTREE,MSGL_V,"Cannot store such a large source %s\n",line); |
22712
c7eee1ecbe8c
Support multiple tags in a single line and tags on the same line as the
rtogni
parents:
22520
diff
changeset
|
571 break; |
12097
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
572 } |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
573 strncpy(source,s_start,s_end-s_start); |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
574 source[(s_end-s_start)]='\0'; // Null terminate |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
575 entry = play_tree_new(); |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
576 play_tree_add_file(entry,source); |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
577 if(!list) //Insert new entry |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
578 list = entry; |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
579 else |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
580 play_tree_append_entry(last_entry,entry); |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
581 last_entry = entry; |
22712
c7eee1ecbe8c
Support multiple tags in a single line and tags on the same line as the
rtogni
parents:
22520
diff
changeset
|
582 pos = s_end; |
12097
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
583 } |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
584 } |
22712
c7eee1ecbe8c
Support multiple tags in a single line and tags on the same line as the
rtogni
parents:
22520
diff
changeset
|
585 } |
c7eee1ecbe8c
Support multiple tags in a single line and tags on the same line as the
rtogni
parents:
22520
diff
changeset
|
586 } while((src_line = play_tree_parser_get_line(p)) != NULL); |
12097
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
587 |
22242
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
588 if (line) |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
589 free(line); |
4cabf7499fef
Add support for smil playlist served over realrtsp
rtogni
parents:
21910
diff
changeset
|
590 |
12097
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
591 if(!list) return NULL; // Nothing found |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
592 |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
593 entry = play_tree_new(); |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
594 play_tree_set_child(entry,list); |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
595 return entry; |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
596 } |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
597 |
18916
a95ed361d16b
several function from playtreeparser.c maked static,
reynaldo
parents:
18879
diff
changeset
|
598 static play_tree_t* |
12097
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
599 embedded_playlist_parse(char *line) { |
12223 | 600 int f=DEMUXER_TYPE_PLAYLIST; |
12097
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
601 stream_t* stream; |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
602 play_tree_parser_t* ptp; |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
603 play_tree_t* entry; |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
604 |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
605 // Get stream opened to link |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
606 stream=open_stream(line,0,&f); |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
607 if(!stream) { |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
608 mp_msg(MSGT_PLAYTREE,MSGL_WARN,"Can't open playlist %s\n",line); |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
609 return NULL; |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
610 } |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
611 |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
612 //add new playtree |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
613 mp_msg(MSGT_PLAYTREE,MSGL_V,"Adding playlist %s to element entryref\n",line); |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
614 |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
615 ptp = play_tree_parser_new(stream,1); |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
616 entry = play_tree_parser_get_play_tree(ptp, 1); |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
617 play_tree_parser_free(ptp); |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
618 free_stream(stream); |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
619 |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
620 return entry; |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
621 } |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
622 |
18916
a95ed361d16b
several function from playtreeparser.c maked static,
reynaldo
parents:
18879
diff
changeset
|
623 static play_tree_t* |
4308
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
624 parse_textplain(play_tree_parser_t* p) { |
4782 | 625 char* line; |
12300
95ea9f5f6f14
Fix embedded smil playlist detection if there are parameters on the url
rtognimp
parents:
12223
diff
changeset
|
626 char *c; |
95ea9f5f6f14
Fix embedded smil playlist detection if there are parameters on the url
rtognimp
parents:
12223
diff
changeset
|
627 int embedded; |
9789
45173e0d34cc
Fix the incredible slowness with very long list. Now a 10^6 entries
albeu
parents:
9749
diff
changeset
|
628 play_tree_t *list = NULL, *entry = NULL, *last_entry = NULL; |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
629 |
6661
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
630 mp_msg(MSGT_PLAYTREE,MSGL_V,"Trying plaintext playlist...\n"); |
4782 | 631 play_tree_parser_stop_keeping(p); |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
632 |
4782 | 633 while((line = play_tree_parser_get_line(p)) != NULL) { |
634 strstrip(line); | |
12689
050c90536ddd
Support for comments in plaintext playlist by adland
alex
parents:
12538
diff
changeset
|
635 if(line[0] == '\0' || line[0] == '#' || (line[0] == '/' && line[1] == '/')) |
4782 | 636 continue; |
12097
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
637 |
12538
2beafad68f68
Enhance detection of embedded smil playlist, add embedded ram playlist
rtognimp
parents:
12300
diff
changeset
|
638 //Special check for embedded smil or ram reference in file |
12300
95ea9f5f6f14
Fix embedded smil playlist detection if there are parameters on the url
rtognimp
parents:
12223
diff
changeset
|
639 embedded = 0; |
95ea9f5f6f14
Fix embedded smil playlist detection if there are parameters on the url
rtognimp
parents:
12223
diff
changeset
|
640 if (strlen(line) > 5) |
95ea9f5f6f14
Fix embedded smil playlist detection if there are parameters on the url
rtognimp
parents:
12223
diff
changeset
|
641 for(c = line; c[0]; c++ ) |
12538
2beafad68f68
Enhance detection of embedded smil playlist, add embedded ram playlist
rtognimp
parents:
12300
diff
changeset
|
642 if ( ((c[0] == '.') && //start with . and next have smil with optional ? or & |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28314
diff
changeset
|
643 (tolower(c[1]) == 's') && (tolower(c[2])== 'm') && |
12300
95ea9f5f6f14
Fix embedded smil playlist detection if there are parameters on the url
rtognimp
parents:
12223
diff
changeset
|
644 (tolower(c[3]) == 'i') && (tolower(c[4]) == 'l') && |
12538
2beafad68f68
Enhance detection of embedded smil playlist, add embedded ram playlist
rtognimp
parents:
12300
diff
changeset
|
645 (!c[5] || c[5] == '?' || c[5] == '&')) || // or |
2beafad68f68
Enhance detection of embedded smil playlist, add embedded ram playlist
rtognimp
parents:
12300
diff
changeset
|
646 ((c[0] == '.') && // start with . and next have smi or ram with optional ? or & |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28314
diff
changeset
|
647 ( ((tolower(c[1]) == 's') && (tolower(c[2])== 'm') && (tolower(c[3]) == 'i')) || |
12538
2beafad68f68
Enhance detection of embedded smil playlist, add embedded ram playlist
rtognimp
parents:
12300
diff
changeset
|
648 ((tolower(c[1]) == 'r') && (tolower(c[2])== 'a') && (tolower(c[3]) == 'm')) ) |
2beafad68f68
Enhance detection of embedded smil playlist, add embedded ram playlist
rtognimp
parents:
12300
diff
changeset
|
649 && (!c[4] || c[4] == '?' || c[4] == '&')) ){ |
12300
95ea9f5f6f14
Fix embedded smil playlist detection if there are parameters on the url
rtognimp
parents:
12223
diff
changeset
|
650 entry=embedded_playlist_parse(line); |
95ea9f5f6f14
Fix embedded smil playlist detection if there are parameters on the url
rtognimp
parents:
12223
diff
changeset
|
651 embedded = 1; |
95ea9f5f6f14
Fix embedded smil playlist detection if there are parameters on the url
rtognimp
parents:
12223
diff
changeset
|
652 break; |
95ea9f5f6f14
Fix embedded smil playlist detection if there are parameters on the url
rtognimp
parents:
12223
diff
changeset
|
653 } |
95ea9f5f6f14
Fix embedded smil playlist detection if there are parameters on the url
rtognimp
parents:
12223
diff
changeset
|
654 |
95ea9f5f6f14
Fix embedded smil playlist detection if there are parameters on the url
rtognimp
parents:
12223
diff
changeset
|
655 if (!embedded) { //regular file link |
12097
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
656 entry = play_tree_new(); |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
657 play_tree_add_file(entry,line); |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
658 } |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
659 |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
660 if (entry != NULL) { |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
661 if(!list) |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
662 list = entry; |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
663 else |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
664 play_tree_append_entry(last_entry,entry); |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
665 last_entry = entry; |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
666 } |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
667 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28314
diff
changeset
|
668 |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
669 if(!list) return NULL; |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
670 entry = play_tree_new(); |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
671 play_tree_set_child(entry,list); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28314
diff
changeset
|
672 return entry; |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
673 } |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
674 |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
675 play_tree_t* |
8925
5c15777f1c07
this patch adds an fallback to playlist (any but the plaintext-list format)
arpi
parents:
8907
diff
changeset
|
676 parse_playtree(stream_t *stream, int forced) { |
4308
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
677 play_tree_parser_t* p; |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
678 play_tree_t* ret; |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
679 |
4156
22fadd4022b5
playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents:
4043
diff
changeset
|
680 #ifdef MP_DEBUG |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
681 assert(stream != NULL); |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
682 #endif |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
683 |
4308
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
684 p = play_tree_parser_new(stream,0); |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
685 if(!p) |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
686 return NULL; |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
687 |
8925
5c15777f1c07
this patch adds an fallback to playlist (any but the plaintext-list format)
arpi
parents:
8907
diff
changeset
|
688 ret = play_tree_parser_get_play_tree(p, forced); |
4308
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
689 play_tree_parser_free(p); |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
690 |
4308
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
691 return ret; |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
692 } |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
693 |
6662
f8e25756a5ec
Relative filename in playlist are now relative to the playlist path
albeu
parents:
6661
diff
changeset
|
694 static void |
f8e25756a5ec
Relative filename in playlist are now relative to the playlist path
albeu
parents:
6661
diff
changeset
|
695 play_tree_add_basepath(play_tree_t* pt, char* bp) { |
f8e25756a5ec
Relative filename in playlist are now relative to the playlist path
albeu
parents:
6661
diff
changeset
|
696 int i,bl = strlen(bp),fl; |
f8e25756a5ec
Relative filename in playlist are now relative to the playlist path
albeu
parents:
6661
diff
changeset
|
697 |
f8e25756a5ec
Relative filename in playlist are now relative to the playlist path
albeu
parents:
6661
diff
changeset
|
698 if(pt->child) { |
f8e25756a5ec
Relative filename in playlist are now relative to the playlist path
albeu
parents:
6661
diff
changeset
|
699 play_tree_t* i; |
f8e25756a5ec
Relative filename in playlist are now relative to the playlist path
albeu
parents:
6661
diff
changeset
|
700 for(i = pt->child ; i != NULL ; i = i->next) |
f8e25756a5ec
Relative filename in playlist are now relative to the playlist path
albeu
parents:
6661
diff
changeset
|
701 play_tree_add_basepath(i,bp); |
f8e25756a5ec
Relative filename in playlist are now relative to the playlist path
albeu
parents:
6661
diff
changeset
|
702 return; |
f8e25756a5ec
Relative filename in playlist are now relative to the playlist path
albeu
parents:
6661
diff
changeset
|
703 } |
f8e25756a5ec
Relative filename in playlist are now relative to the playlist path
albeu
parents:
6661
diff
changeset
|
704 |
f8e25756a5ec
Relative filename in playlist are now relative to the playlist path
albeu
parents:
6661
diff
changeset
|
705 if(!pt->files) |
f8e25756a5ec
Relative filename in playlist are now relative to the playlist path
albeu
parents:
6661
diff
changeset
|
706 return; |
f8e25756a5ec
Relative filename in playlist are now relative to the playlist path
albeu
parents:
6661
diff
changeset
|
707 |
f8e25756a5ec
Relative filename in playlist are now relative to the playlist path
albeu
parents:
6661
diff
changeset
|
708 for(i = 0 ; pt->files[i] != NULL ; i++) { |
f8e25756a5ec
Relative filename in playlist are now relative to the playlist path
albeu
parents:
6661
diff
changeset
|
709 fl = strlen(pt->files[i]); |
13305
90ffe76b5b25
Don't prepend basepath to a full unix path. ( 10l to Joey. )
al
parents:
13010
diff
changeset
|
710 // if we find a full unix path, url:// or X:\ at the beginning, |
90ffe76b5b25
Don't prepend basepath to a full unix path. ( 10l to Joey. )
al
parents:
13010
diff
changeset
|
711 // don't mangle it. |
90ffe76b5b25
Don't prepend basepath to a full unix path. ( 10l to Joey. )
al
parents:
13010
diff
changeset
|
712 if(fl <= 0 || strstr(pt->files[i],"://") || (strstr(pt->files[i],":\\") == pt->files[i] + 1) || (pt->files[i][0] == '/') ) |
6662
f8e25756a5ec
Relative filename in playlist are now relative to the playlist path
albeu
parents:
6661
diff
changeset
|
713 continue; |
13010 | 714 // if the path begins with \ then prepend drive letter to it. |
715 if (pt->files[i][0] == '\\') { | |
18928
586777f09b1b
relative-to-absolute path fixes: Do not prepend drive letter to \\ paths.
reimar
parents:
18916
diff
changeset
|
716 if (pt->files[i][1] == '\\') |
586777f09b1b
relative-to-absolute path fixes: Do not prepend drive letter to \\ paths.
reimar
parents:
18916
diff
changeset
|
717 continue; |
13010 | 718 pt->files[i] = (char*)realloc(pt->files[i],2+fl+1); |
719 memmove(pt->files[i] + 2,pt->files[i],fl+1); | |
720 memcpy(pt->files[i],bp,2); | |
18928
586777f09b1b
relative-to-absolute path fixes: Do not prepend drive letter to \\ paths.
reimar
parents:
18916
diff
changeset
|
721 continue; |
13010 | 722 } |
6662
f8e25756a5ec
Relative filename in playlist are now relative to the playlist path
albeu
parents:
6661
diff
changeset
|
723 pt->files[i] = (char*)realloc(pt->files[i],bl+fl+1); |
f8e25756a5ec
Relative filename in playlist are now relative to the playlist path
albeu
parents:
6661
diff
changeset
|
724 memmove(pt->files[i] + bl,pt->files[i],fl+1); |
f8e25756a5ec
Relative filename in playlist are now relative to the playlist path
albeu
parents:
6661
diff
changeset
|
725 memcpy(pt->files[i],bp,bl); |
f8e25756a5ec
Relative filename in playlist are now relative to the playlist path
albeu
parents:
6661
diff
changeset
|
726 } |
f8e25756a5ec
Relative filename in playlist are now relative to the playlist path
albeu
parents:
6661
diff
changeset
|
727 } |
f8e25756a5ec
Relative filename in playlist are now relative to the playlist path
albeu
parents:
6661
diff
changeset
|
728 |
9301
7841308ad250
this patch fixes latest bug, discovered by .so ... (relative filenames &
arpi
parents:
9089
diff
changeset
|
729 // Wrapper for play_tree_add_basepath (add base path from file) |
7841308ad250
this patch fixes latest bug, discovered by .so ... (relative filenames &
arpi
parents:
9089
diff
changeset
|
730 void play_tree_add_bpf(play_tree_t* pt, char* filename) |
7841308ad250
this patch fixes latest bug, discovered by .so ... (relative filenames &
arpi
parents:
9089
diff
changeset
|
731 { |
7841308ad250
this patch fixes latest bug, discovered by .so ... (relative filenames &
arpi
parents:
9089
diff
changeset
|
732 char *ls, *file; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28314
diff
changeset
|
733 |
9301
7841308ad250
this patch fixes latest bug, discovered by .so ... (relative filenames &
arpi
parents:
9089
diff
changeset
|
734 if (pt && filename) |
7841308ad250
this patch fixes latest bug, discovered by .so ... (relative filenames &
arpi
parents:
9089
diff
changeset
|
735 { |
7841308ad250
this patch fixes latest bug, discovered by .so ... (relative filenames &
arpi
parents:
9089
diff
changeset
|
736 file = strdup(filename); |
7841308ad250
this patch fixes latest bug, discovered by .so ... (relative filenames &
arpi
parents:
9089
diff
changeset
|
737 if (file) |
7841308ad250
this patch fixes latest bug, discovered by .so ... (relative filenames &
arpi
parents:
9089
diff
changeset
|
738 { |
13010 | 739 ls = strrchr(file,'/'); |
740 if(!ls) ls = strrchr(file,'\\'); | |
9301
7841308ad250
this patch fixes latest bug, discovered by .so ... (relative filenames &
arpi
parents:
9089
diff
changeset
|
741 if(ls) { |
7841308ad250
this patch fixes latest bug, discovered by .so ... (relative filenames &
arpi
parents:
9089
diff
changeset
|
742 ls[1] = '\0'; |
7841308ad250
this patch fixes latest bug, discovered by .so ... (relative filenames &
arpi
parents:
9089
diff
changeset
|
743 play_tree_add_basepath(pt,file); |
7841308ad250
this patch fixes latest bug, discovered by .so ... (relative filenames &
arpi
parents:
9089
diff
changeset
|
744 } |
7841308ad250
this patch fixes latest bug, discovered by .so ... (relative filenames &
arpi
parents:
9089
diff
changeset
|
745 free(file); |
7841308ad250
this patch fixes latest bug, discovered by .so ... (relative filenames &
arpi
parents:
9089
diff
changeset
|
746 } |
7841308ad250
this patch fixes latest bug, discovered by .so ... (relative filenames &
arpi
parents:
9089
diff
changeset
|
747 } |
7841308ad250
this patch fixes latest bug, discovered by .so ... (relative filenames &
arpi
parents:
9089
diff
changeset
|
748 } |
7841308ad250
this patch fixes latest bug, discovered by .so ... (relative filenames &
arpi
parents:
9089
diff
changeset
|
749 |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
750 play_tree_t* |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
751 parse_playlist_file(char* file) { |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
752 stream_t *stream; |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
753 play_tree_t* ret; |
12223 | 754 int f=DEMUXER_TYPE_PLAYLIST; |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
755 |
9749 | 756 stream = open_stream(file,0,&f); |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
757 |
9749 | 758 if(!stream) { |
10487 | 759 mp_msg(MSGT_PLAYTREE,MSGL_ERR,"Error while opening playlist file %s: %s\n",file,strerror(errno)); |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
760 return NULL; |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
761 } |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
762 |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
763 mp_msg(MSGT_PLAYTREE,MSGL_V,"Parsing playlist file %s...\n",file); |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
764 |
8925
5c15777f1c07
this patch adds an fallback to playlist (any but the plaintext-list format)
arpi
parents:
8907
diff
changeset
|
765 ret = parse_playtree(stream,1); |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
766 free_stream(stream); |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
767 |
9301
7841308ad250
this patch fixes latest bug, discovered by .so ... (relative filenames &
arpi
parents:
9089
diff
changeset
|
768 play_tree_add_bpf(ret, file); |
6662
f8e25756a5ec
Relative filename in playlist are now relative to the playlist path
albeu
parents:
6661
diff
changeset
|
769 |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
770 return ret; |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
771 |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
772 } |
4308
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
773 |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
774 |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
775 play_tree_parser_t* |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
776 play_tree_parser_new(stream_t* stream,int deep) { |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
777 play_tree_parser_t* p; |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
778 |
18879 | 779 p = calloc(1,sizeof(play_tree_parser_t)); |
4308
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
780 if(!p) |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
781 return NULL; |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
782 p->stream = stream; |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
783 p->deep = deep; |
4782 | 784 p->keep = 1; |
4308
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
785 |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
786 return p; |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
787 |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
788 } |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
789 |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
790 void |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
791 play_tree_parser_free(play_tree_parser_t* p) { |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
792 |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
793 #ifdef MP_DEBUG |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
794 assert(p != NULL); |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
795 #endif |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
796 |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
797 if(p->buffer) free(p->buffer); |
4782 | 798 if(p->line) free(p->line); |
799 free(p); | |
4308
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
800 } |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
801 |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
802 play_tree_t* |
8925
5c15777f1c07
this patch adds an fallback to playlist (any but the plaintext-list format)
arpi
parents:
8907
diff
changeset
|
803 play_tree_parser_get_play_tree(play_tree_parser_t* p, int forced) { |
4308
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
804 play_tree_t* tree = NULL; |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
805 |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
806 #ifdef MP_DEBUG |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
807 assert(p != NULL); |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
808 #endif |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
809 |
4782 | 810 |
811 while(play_tree_parser_get_line(p) != NULL) { | |
812 play_tree_parser_reset(p); | |
813 | |
4308
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
814 tree = parse_asx(p); |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
815 if(tree) break; |
4782 | 816 play_tree_parser_reset(p); |
817 | |
818 tree = parse_pls(p); | |
819 if(tree) break; | |
820 play_tree_parser_reset(p); | |
821 | |
6661
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
822 tree = parse_m3u(p); |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
823 if(tree) break; |
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
824 play_tree_parser_reset(p); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28314
diff
changeset
|
825 |
8897
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
826 tree = parse_ref_ini(p); |
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
827 if(tree) break; |
ef01554542fb
This patch adds support for some silly ini-style-playlist-file-format ...
arpi
parents:
8164
diff
changeset
|
828 play_tree_parser_reset(p); |
6661
dc61b6b159e4
Add support for m3u playlists as generated by eg recent versions of winamp.
atmos4
parents:
5866
diff
changeset
|
829 |
12097
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
830 tree = parse_smil(p); |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
831 if(tree) break; |
cb0cdaa0bddf
Support for smil playlist, both standalone and embedded into other
rtognimp
parents:
10694
diff
changeset
|
832 play_tree_parser_reset(p); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28314
diff
changeset
|
833 |
4308
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
834 // Here come the others formats ( textplain must stay the last one ) |
8925
5c15777f1c07
this patch adds an fallback to playlist (any but the plaintext-list format)
arpi
parents:
8907
diff
changeset
|
835 if (forced) |
5c15777f1c07
this patch adds an fallback to playlist (any but the plaintext-list format)
arpi
parents:
8907
diff
changeset
|
836 { |
5c15777f1c07
this patch adds an fallback to playlist (any but the plaintext-list format)
arpi
parents:
8907
diff
changeset
|
837 tree = parse_textplain(p); |
5c15777f1c07
this patch adds an fallback to playlist (any but the plaintext-list format)
arpi
parents:
8907
diff
changeset
|
838 if(tree) break; |
5c15777f1c07
this patch adds an fallback to playlist (any but the plaintext-list format)
arpi
parents:
8907
diff
changeset
|
839 } |
4308
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
840 break; |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
841 } |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
842 |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
843 if(tree) |
10487 | 844 mp_msg(MSGT_PLAYTREE,MSGL_V,"Playlist successfully parsed\n"); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28314
diff
changeset
|
845 else |
8925
5c15777f1c07
this patch adds an fallback to playlist (any but the plaintext-list format)
arpi
parents:
8907
diff
changeset
|
846 mp_msg(MSGT_PLAYTREE,((forced==1)?MSGL_ERR:MSGL_V),"Error while parsing playlist\n"); |
4308
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
847 |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
848 if(tree) |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
849 tree = play_tree_cleanup(tree); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28314
diff
changeset
|
850 |
10487 | 851 if(!tree) mp_msg(MSGT_PLAYTREE,((forced==1)?MSGL_WARN:MSGL_V),"Warning: empty playlist\n"); |
4308
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
852 |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
853 return tree; |
d752f99fd535
Objectization of the play_tree_parser for more flexiblity
albeu
parents:
4156
diff
changeset
|
854 } |