annotate playtree.h @ 30811:50e0f6942e43

Implement Win32 mutexes. Implement Win32 mutexes; they used to just be mapped on top of events, which is not the same thing at all. The implementation is pretty much the obvious one, similar to the current critical section implementation and the semaphore implementation; a single lock count protected by a pthread mutex, and an event lockers can sleep on to know when the mutex is available. Also make CreateMutexA and ReleaseMutex available even if QuickTime codecs support is not configured.
author sesse
date Sat, 06 Mar 2010 10:13:37 +0000
parents c1a3f1bbba26
children de190efe4da3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 */
c1a3f1bbba26 Add license header to all top-level files missing them.
diego
parents: 29263
diff changeset
18
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25535
diff changeset
19 #ifndef MPLAYER_PLAYTREE_H
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25535
diff changeset
20 #define MPLAYER_PLAYTREE_H
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
21
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
22 /// \file
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
23 /// \ingroup Playtree
4156
22fadd4022b5 playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents: 4043
diff changeset
24
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents: 5217
diff changeset
25 struct stream_st;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents: 5217
diff changeset
26 struct m_config;
4156
22fadd4022b5 playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents: 4043
diff changeset
27
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
28 /// \defgroup PlaytreeIterReturn Playtree iterator return code
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
29 /// \ingroup PlaytreeIter
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
30 ///@{
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
31 #define PLAY_TREE_ITER_ERROR 0
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
32 #define PLAY_TREE_ITER_ENTRY 1
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
33 #define PLAY_TREE_ITER_NODE 2
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
34 #define PLAY_TREE_ITER_END 3
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
35 ///@}
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
36
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
37 /// \defgroup PlaytreeEntryTypes Playtree entry types
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
38 /// \ingroup Playtree
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
39 ///@{
4220
fe2c20d52a25 Fixed a few bugs and added support for VCD/DVD/TV in playlist using virtual url
albeu
parents: 4156
diff changeset
40 #define PLAY_TREE_ENTRY_NODE -1
fe2c20d52a25 Fixed a few bugs and added support for VCD/DVD/TV in playlist using virtual url
albeu
parents: 4156
diff changeset
41 #define PLAY_TREE_ENTRY_DVD 0
fe2c20d52a25 Fixed a few bugs and added support for VCD/DVD/TV in playlist using virtual url
albeu
parents: 4156
diff changeset
42 #define PLAY_TREE_ENTRY_VCD 1
fe2c20d52a25 Fixed a few bugs and added support for VCD/DVD/TV in playlist using virtual url
albeu
parents: 4156
diff changeset
43 #define PLAY_TREE_ENTRY_TV 2
fe2c20d52a25 Fixed a few bugs and added support for VCD/DVD/TV in playlist using virtual url
albeu
parents: 4156
diff changeset
44 #define PLAY_TREE_ENTRY_FILE 3
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
45 ///@}
4220
fe2c20d52a25 Fixed a few bugs and added support for VCD/DVD/TV in playlist using virtual url
albeu
parents: 4156
diff changeset
46
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
47
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
48 /// \defgroup PlaytreeEntryFlags Playtree flags
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
49 /// \ingroup Playtree
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
50 ///@{
23872
4d936284a5ec typo fix: childs --> children
diego
parents: 23689
diff changeset
51 /// Play the item children in random order.
8174
014e0ea85bdb Add random stepping support
albeu
parents: 8164
diff changeset
52 #define PLAY_TREE_RND (1<<0)
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
53 /// Playtree flags used by the iterator to mark items already "randomly" played.
8174
014e0ea85bdb Add random stepping support
albeu
parents: 8164
diff changeset
54 #define PLAY_TREE_RND_PLAYED (1<<8)
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
55 ///@}
8174
014e0ea85bdb Add random stepping support
albeu
parents: 8164
diff changeset
56
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
57 /// \defgroup PlaytreeIterMode Playtree iterator mode
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
58 /// \ingroup PlaytreeIter
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
59 ///@{
8174
014e0ea85bdb Add random stepping support
albeu
parents: 8164
diff changeset
60 #define PLAY_TREE_ITER_NORMAL 0
014e0ea85bdb Add random stepping support
albeu
parents: 8164
diff changeset
61 #define PLAY_TREE_ITER_RND 1
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
62 ///@}
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
63
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
64 /// \defgroup Playtree
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
65 ///@{
8174
014e0ea85bdb Add random stepping support
albeu
parents: 8164
diff changeset
66
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
67 typedef struct play_tree play_tree_t;
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
68 /// \ingroup PlaytreeIter
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
69 typedef struct play_tree_iter play_tree_iter_t;
4156
22fadd4022b5 playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents: 4043
diff changeset
70 typedef struct play_tree_param play_tree_param_t;
22fadd4022b5 playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents: 4043
diff changeset
71
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
72
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
73 #if 0
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
74 typedef struct play_tree_info play_tree_info_t;
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
75 // TODO : a attrib,val pair system and not something hardcoded
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
76 struct play_tree_info {
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
77 char* title;
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
78 char* author;
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
79 char* copyright;
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
80 char* abstract;
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
81 // Some more ??
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
82 }
4156
22fadd4022b5 playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents: 4043
diff changeset
83 #endif
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
84
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
85 struct play_tree_param {
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
86 char* name;
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
87 char* value;
4156
22fadd4022b5 playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents: 4043
diff changeset
88 };
22fadd4022b5 playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents: 4043
diff changeset
89
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
90
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
91 /// Playtree item
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
92 struct play_tree {
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
93 play_tree_t* parent;
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
94 play_tree_t* child;
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
95 play_tree_t* next;
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
96 play_tree_t* prev;
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
97
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
98 //play_tree_info_t info;
4156
22fadd4022b5 playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents: 4043
diff changeset
99 play_tree_param_t* params;
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
100 int loop;
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
101 char** files;
4220
fe2c20d52a25 Fixed a few bugs and added support for VCD/DVD/TV in playlist using virtual url
albeu
parents: 4156
diff changeset
102 int entry_type;
8174
014e0ea85bdb Add random stepping support
albeu
parents: 8164
diff changeset
103 int flags;
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
104 };
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
105
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
106
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
107 /// \defgroup PlaytreeIter Playtree iterator
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
108 /// \ingroup Playtree
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
109 ///@{
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
110
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
111 /// Playtree iterator
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
112 struct play_tree_iter {
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
113 /// Root of the iterated tree.
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
114 play_tree_t* root;
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
115 /// Current position in the tree.
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
116 play_tree_t* tree;
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
117 /// \ref Config used.
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
118 struct m_config* config;
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
119 /// Looping status
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
120 int loop;
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
121 /// Selected file in the current item.
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
122 int file;
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
123 /// Number of files in the current item.
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
124 int num_files;
4156
22fadd4022b5 playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents: 4043
diff changeset
125 int entry_pushed;
8174
014e0ea85bdb Add random stepping support
albeu
parents: 8164
diff changeset
126 int mode;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26029
diff changeset
127
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
128 /// loop/valid stack to save/revert status when we go up/down.
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
129 int* status_stack;
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
130 /// status stack size
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
131 int stack_size;
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
132 };
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
133 ///@}
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
134
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
135 /// Create a new empty playtree item.
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26029
diff changeset
136 play_tree_t*
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
137 play_tree_new(void);
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
138
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
139 /// Free a playtree item.
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
140 /** \param pt Item to free.
23872
4d936284a5ec typo fix: childs --> children
diego
parents: 23689
diff changeset
141 * \param children If non-zero the item's children are recursively freed.
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
142 */
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
143 void
23872
4d936284a5ec typo fix: childs --> children
diego
parents: 23689
diff changeset
144 play_tree_free(play_tree_t* pt, int children);
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
145
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
146
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
147 /// Free an item and its siblings.
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
148 /** \param pt Item to free.
23872
4d936284a5ec typo fix: childs --> children
diego
parents: 23689
diff changeset
149 * \param children If non-zero the items' children are recursively freed.
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
150 */
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
151 void
23872
4d936284a5ec typo fix: childs --> children
diego
parents: 23689
diff changeset
152 play_tree_free_list(play_tree_t* pt, int children);
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
153
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
154
23872
4d936284a5ec typo fix: childs --> children
diego
parents: 23689
diff changeset
155 /// Set the children of a playtree item.
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
156 void
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
157 play_tree_set_child(play_tree_t* pt, play_tree_t* child);
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
158
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
159 /// Set the parent of a playtree item.
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
160 void
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
161 play_tree_set_parent(play_tree_t* pt, play_tree_t* parent);
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
162
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
163
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
164 /// Append an item after its siblings.
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
165 void
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
166 play_tree_append_entry(play_tree_t* pt, play_tree_t* entry);
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
167
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
168 /// Prepend an item before its siblings.
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
169 void
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
170 play_tree_prepend_entry(play_tree_t* pt, play_tree_t* entry);
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
171
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
172 /// Insert an item right after a siblings.
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
173 void
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
174 play_tree_insert_entry(play_tree_t* pt, play_tree_t* entry);
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
175
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
176 /// Detach an item from the tree.
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
177 void
23872
4d936284a5ec typo fix: childs --> children
diego
parents: 23689
diff changeset
178 play_tree_remove(play_tree_t* pt, int free_it,int with_children);
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
179
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
180 /// Add a file to an item.
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
181 void
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
182 play_tree_add_file(play_tree_t* pt,char* file);
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
183
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
184 /// Remove a file from an item.
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
185 int
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
186 play_tree_remove_file(play_tree_t* pt,char* file);
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
187
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
188
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
189 /// Add a config paramter to an item.
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
190 void
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
191 play_tree_set_param(play_tree_t* pt, char* name, char* val);
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
192
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
193 /// Remove a config parameter from an item.
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
194 int
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
195 play_tree_unset_param(play_tree_t* pt, char* name);
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
196
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
197 /// Copy the config parameters from one item to another.
5217
3e7152b383ca Set the params given to a playlist url to the playlist
albeu
parents: 4220
diff changeset
198 void
3e7152b383ca Set the params given to a playlist url to the playlist
albeu
parents: 4220
diff changeset
199 play_tree_set_params_from(play_tree_t* dest,play_tree_t* src);
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
200
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
201 /// \addtogroup PlaytreeIter
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
202 ///@{
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
203
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
204 /// Create a new iterator.
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
205 play_tree_iter_t*
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents: 5217
diff changeset
206 play_tree_iter_new(play_tree_t* pt, struct m_config* config);
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
207
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
208 /// Duplicate an iterator.
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
209 play_tree_iter_t*
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
210 play_tree_iter_new_copy(play_tree_iter_t* old);
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
211
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
212 /// Free an iterator.
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
213 void
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
214 play_tree_iter_free(play_tree_iter_t* iter);
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
215
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
216 /// Step an iterator.
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
217 /** \param iter The iterator.
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
218 * \param d The direction: d > 0 == next , d < 0 == prev
23872
4d936284a5ec typo fix: childs --> children
diego
parents: 23689
diff changeset
219 * \param with_node TRUE == stop on nodes with children, FALSE == go directly to the next child
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
220 * \return See \ref PlaytreeIterReturn.
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
221 */
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26029
diff changeset
222 int
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
223 play_tree_iter_step(play_tree_iter_t* iter, int d,int with_nodes);
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
224
22289
780caed72ac7 cosmetics: typo fixes, usefuLL --> useful and aswell --> as well
diego
parents: 18316
diff changeset
225 /// Step up, useful to break a loop, etc.
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
226 /** \param iter The iterator.
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
227 * \param d The direction: d > 0 == next , d < 0 == prev
23872
4d936284a5ec typo fix: childs --> children
diego
parents: 23689
diff changeset
228 * \param with_node TRUE == stop on nodes with children, FALSE == go directly to the next child
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
229 * \return See \ref PlaytreeIterReturn.
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
230 */
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
231 int
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
232 play_tree_iter_up_step(play_tree_iter_t* iter, int d,int with_nodes);
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
233
22289
780caed72ac7 cosmetics: typo fixes, usefuLL --> useful and aswell --> as well
diego
parents: 18316
diff changeset
234 /// Enter a node child list, only useful when stopping on nodes.
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
235 int
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
236 play_tree_iter_down_step(play_tree_iter_t* iter, int d,int with_nodes);
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
237
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
238 /// Get a file from the current item.
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
239 char*
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
240 play_tree_iter_get_file(play_tree_iter_t* iter, int d);
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
241
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
242 ///@}
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
243 // PlaytreeIter group
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
244
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
245 /// Create a playtree from a playlist file.
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
246 /** \ingroup PlaytreeParser
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
247 */
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
248 play_tree_t*
8925
5c15777f1c07 this patch adds an fallback to playlist (any but the plaintext-list format)
arpi
parents: 8174
diff changeset
249 parse_playtree(struct stream_st *stream, int forced);
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
250
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
251 /// Clean a tree by destroying all empty elements.
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
252 play_tree_t*
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
253 play_tree_cleanup(play_tree_t* pt);
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
254
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
255 /// Create a playtree from a playlist file.
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
256 /** \ingroup PlaytreeParser
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
257 */
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
258 play_tree_t*
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
259 parse_playlist_file(char* file);
4156
22fadd4022b5 playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents: 4043
diff changeset
260
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
261 /// \defgroup PtAPI Playtree highlevel API
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
262 /// \ingroup Playtree
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
263 /// Highlevel API with pt-suffix to different from low-level API
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
264 /// by Fabian Franz (mplayer@fabian-franz.de).
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
265 ///@{
9290
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
266
18316
b3be7df634b0 spelling/grammar/wording fixes in doxygen and non-doxygen comments
diego
parents: 18265
diff changeset
267 // Cleans up pt and creates a new iter.
9290
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
268 play_tree_iter_t* pt_iter_create(play_tree_t** pt, struct m_config* config);
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
269
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
270 /// Frees the iter.
9290
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
271 void pt_iter_destroy(play_tree_iter_t** iter);
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
272
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
273 /// Gets the next available file in the direction (d=-1 || d=+1).
9290
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
274 char* pt_iter_get_file(play_tree_iter_t* iter, int d);
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
275
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
276 // Two Macros that implement forward and backward direction.
9290
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
277 #define pt_iter_get_next_file(iter) pt_iter_get_file(iter, 1)
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
278 #define pt_iter_get_prev_file(iter) pt_iter_get_file(iter, -1)
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
279
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
280 /// Inserts entry into the playtree.
9290
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
281 void pt_iter_insert_entry(play_tree_iter_t* iter, play_tree_t* entry);
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
282
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
283 /// Replaces current entry in playtree with entry by doing insert and remove.
9290
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
284 void pt_iter_replace_entry(play_tree_iter_t* iter, play_tree_t* entry);
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
285
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
286 /// Adds a new file to the playtree, if it is not valid it is created.
9290
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
287 void pt_add_file(play_tree_t** ppt, char* filename);
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
288
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26029
diff changeset
289 /// \brief Performs a convert to playtree-syntax, by concat path/file
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
290 /// and performs pt_add_file
9290
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
291 void pt_add_gui_file(play_tree_t** ppt, char* path, char* file);
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
292
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
293 // Two macros to use only the iter and not the other things.
9290
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
294 #define pt_iter_add_file(iter, filename) pt_add_file(&iter->tree, filename)
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
295 #define pt_iter_add_gui_file(iter, path, name) pt_add_gui_file(&iter->tree, path, name)
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
296
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
297 /// Resets the iter and goes back to head.
9290
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
298 void pt_iter_goto_head(play_tree_iter_t* iter);
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
299
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
300 ///@}
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
301
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25535
diff changeset
302 ///@}
18265
1a14fde7680d Doxygen Attack! - Chapter 3
albeu
parents: 9290
diff changeset
303
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25535
diff changeset
304 #endif /* MPLAYER_PLAYTREE_H */