demux_ts: fix crash on broken packets
[mplayer/glamo.git] / playtreeparser.h
bloba3d729fdb383318a88c08a0cdcfb7f8e4959bb73
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"
24 /// \defgroup PlaytreeParser Playtree parser
25 /// \ingroup Playtree
26 ///
27 /// The playtree parser allows to read various playlist formats. It reads from
28 /// a stream allowing to handle playlists from local files and the network.
29 ///@{
31 /// \file
33 struct stream;
35 typedef struct play_tree_parser {
36 struct stream *stream;
37 struct m_config *mconfig;
38 char *buffer,*iter,*line;
39 int buffer_size , buffer_end;
40 int deep,keep;
41 } play_tree_parser_t;
43 /// Create a new parser.
44 /** \param stream The stream to read from.
45 * \param deep Parser depth. Some formats allow including other files,
46 * this is used to track the inclusion depth.
47 * \return The new parser.
49 play_tree_parser_t*
50 play_tree_parser_new(struct stream* stream, struct m_config *mconfig, int deep);
52 /// Destroy a parser.
53 void
54 play_tree_parser_free(play_tree_parser_t* p);
56 /// Build a playtree from the playlist opened with the parser.
57 /** \param p The parser.
58 * \param forced If non-zero the playlist file was explicitly
59 * given by the user, allow falling back on
60 * one filename per line playlist.
61 * \return A new playtree or NULL on error.
63 play_tree_t*
64 play_tree_parser_get_play_tree(play_tree_parser_t* p, int forced);
66 /// Wrapper for play_tree_add_basepath (add base path from file).
67 void
68 play_tree_add_bpf(play_tree_t* pt, char* filename);
70 ///@}
72 #endif /* MPLAYER_PLAYTREEPARSER_H */