input: stop trying to read terminal input on EOF
[mplayer.git] / asxparser.h
blob57577101fb43fae0dfa2e82fad1f0c275b683889
1 /*
2 * This file is part of MPlayer.
4 * MPlayer is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * MPlayer is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #ifndef MPLAYER_ASXPARSER_H
20 #define MPLAYER_ASXPARSER_H
22 #include "playtree.h"
24 typedef struct ASX_Parser_t ASX_Parser_t;
26 typedef struct {
27 char* buffer;
28 int line;
29 } ASX_LineSave_t;
31 struct ASX_Parser_t {
32 int line; // Curent line
33 ASX_LineSave_t *ret_stack;
34 int ret_stack_size;
35 char* last_body;
36 int deep;
37 struct m_config *mconfig;
40 struct m_config;
41 ASX_Parser_t*
42 asx_parser_new(struct m_config *mconfig);
44 void
45 asx_parser_free(ASX_Parser_t* parser);
48 * Return -1 on error, 0 when nothing is found, 1 on sucess
50 int
51 asx_get_element(ASX_Parser_t* parser,char** _buffer,
52 char** _element,char** _body,char*** _attribs);
54 int
55 asx_parse_attribs(ASX_Parser_t* parser,char* buffer,char*** _attribs);
57 /////// Attribs utils
59 char*
60 asx_get_attrib(const char* attrib,char** attribs);
62 int
63 asx_attrib_to_enum(const char* val,char** valid_vals);
65 #define asx_free_attribs(a) asx_list_free(&a,free)
67 ////// List utils
69 typedef void (*ASX_FreeFunc)(void* arg);
71 void
72 asx_list_free(void* list_ptr,ASX_FreeFunc free_func);
74 play_tree_t*
75 asx_parser_build_tree(struct m_config *mconfig, char* buffer, int ref);
77 #endif /* MPLAYER_ASXPARSER_H */