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