input: stop trying to read terminal input on EOF
[mplayer.git] / playtreeparser.h
bloba774bb9e4a7d6c5e7638d7a88ee7b0833758e1b8
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_PLAYTREEPARSER_H
20 #define MPLAYER_PLAYTREEPARSER_H
22 #include "playtree.h"
23 #include "bstr.h"
25 /// \defgroup PlaytreeParser Playtree parser
26 /// \ingroup Playtree
27 ///
28 /// The playtree parser allows to read various playlist formats. It reads from
29 /// a stream allowing to handle playlists from local files and the network.
30 ///@{
32 /// \file
34 struct stream;
36 typedef struct play_tree_parser {
37 struct stream *stream;
38 struct m_config *mconfig;
39 char *buffer,*iter,*line;
40 int buffer_size , buffer_end;
41 int deep,keep;
42 } play_tree_parser_t;
44 /// Create a new parser.
45 /** \param stream The stream to read from.
46 * \param deep Parser depth. Some formats allow including other files,
47 * this is used to track the inclusion depth.
48 * \return The new parser.
50 play_tree_parser_t*
51 play_tree_parser_new(struct stream* stream, struct m_config *mconfig, int deep);
53 /// Destroy a parser.
54 void
55 play_tree_parser_free(play_tree_parser_t* p);
57 /// Build a playtree from the playlist opened with the parser.
58 /** \param p The parser.
59 * \param forced If non-zero the playlist file was explicitly
60 * given by the user, allow falling back on
61 * one filename per line playlist.
62 * \return A new playtree or NULL on error.
64 play_tree_t*
65 play_tree_parser_get_play_tree(play_tree_parser_t* p, int forced);
67 /// Wrapper for play_tree_add_basepath (add base path from file).
68 void
69 play_tree_add_bpf(play_tree_t* pt, struct bstr filename);
71 ///@}
73 #endif /* MPLAYER_PLAYTREEPARSER_H */