Merge svn changes up to r30663
[mplayer/kovensky.git] / asxparser.h
blobc5a3b18fc76bc47a57fdbbe769242619eb4edc67
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 typedef struct ASX_Parser_t ASX_Parser_t;
24 typedef struct {
25 char* buffer;
26 int line;
27 } ASX_LineSave_t;
29 struct ASX_Parser_t {
30 int line; // Curent line
31 ASX_LineSave_t *ret_stack;
32 int ret_stack_size;
33 char* last_body;
34 int deep;
35 struct m_config *mconfig;
38 struct m_config;
39 ASX_Parser_t*
40 asx_parser_new(struct m_config *mconfig);
42 void
43 asx_parser_free(ASX_Parser_t* parser);
46 * Return -1 on error, 0 when nothing is found, 1 on sucess
48 int
49 asx_get_element(ASX_Parser_t* parser,char** _buffer,
50 char** _element,char** _body,char*** _attribs);
52 int
53 asx_parse_attribs(ASX_Parser_t* parser,char* buffer,char*** _attribs);
55 /////// Attribs utils
57 char*
58 asx_get_attrib(const char* attrib,char** attribs);
60 int
61 asx_attrib_to_enum(const char* val,char** valid_vals);
63 #define asx_free_attribs(a) asx_list_free(&a,free)
65 ////// List utils
67 typedef void (*ASX_FreeFunc)(void* arg);
69 void
70 asx_list_free(void* list_ptr,ASX_FreeFunc free_func);
72 #endif /* MPLAYER_ASXPARSER_H */