annotate playtree.h @ 10340:2eaabacd1429

prefer UTF-8 encoding subs and automatically recognize them by suffix
author atlka
date Fri, 27 Jun 2003 09:25:05 +0000
parents 0e043196d176
children 1a14fde7680d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4156
22fadd4022b5 playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents: 4043
diff changeset
1
22fadd4022b5 playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents: 4043
diff changeset
2 #ifndef __PLAYTREE_H
22fadd4022b5 playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents: 4043
diff changeset
3 #define __PLAYTREE_H
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
4
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents: 5217
diff changeset
5 struct stream_st;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents: 5217
diff changeset
6 struct m_config;
4156
22fadd4022b5 playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents: 4043
diff changeset
7
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
8 #define PLAY_TREE_ITER_ERROR 0
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
9 #define PLAY_TREE_ITER_ENTRY 1
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
10 #define PLAY_TREE_ITER_NODE 2
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
11 #define PLAY_TREE_ITER_END 3
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
12
4220
fe2c20d52a25 Fixed a few bugs and added support for VCD/DVD/TV in playlist using virtual url
albeu
parents: 4156
diff changeset
13 #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
14 #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
15 #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
16 #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
17 #define PLAY_TREE_ENTRY_FILE 3
fe2c20d52a25 Fixed a few bugs and added support for VCD/DVD/TV in playlist using virtual url
albeu
parents: 4156
diff changeset
18
8174
014e0ea85bdb Add random stepping support
albeu
parents: 8164
diff changeset
19 // Playtree flags
014e0ea85bdb Add random stepping support
albeu
parents: 8164
diff changeset
20 #define PLAY_TREE_RND (1<<0)
014e0ea85bdb Add random stepping support
albeu
parents: 8164
diff changeset
21 // Playtree flags used by the iter
014e0ea85bdb Add random stepping support
albeu
parents: 8164
diff changeset
22 #define PLAY_TREE_RND_PLAYED (1<<8)
014e0ea85bdb Add random stepping support
albeu
parents: 8164
diff changeset
23
014e0ea85bdb Add random stepping support
albeu
parents: 8164
diff changeset
24 // Iter mode
014e0ea85bdb Add random stepping support
albeu
parents: 8164
diff changeset
25 #define PLAY_TREE_ITER_NORMAL 0
014e0ea85bdb Add random stepping support
albeu
parents: 8164
diff changeset
26 #define PLAY_TREE_ITER_RND 1
014e0ea85bdb Add random stepping support
albeu
parents: 8164
diff changeset
27
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
28 typedef struct play_tree play_tree_t;
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
29 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
30 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
31
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
32
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
33 #if 0
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
34 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
35 // 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
36 struct play_tree_info {
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
37 char* title;
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
38 char* author;
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
39 char* copyright;
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
40 char* abstract;
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
41 // Some more ??
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
42 }
4156
22fadd4022b5 playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents: 4043
diff changeset
43 #endif
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
44
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
45 struct play_tree_param {
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
46 char* name;
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
47 char* value;
4156
22fadd4022b5 playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents: 4043
diff changeset
48 };
22fadd4022b5 playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents: 4043
diff changeset
49
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
50
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
51 struct play_tree {
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
52 play_tree_t* parent;
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
53 play_tree_t* child;
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
54 play_tree_t* next;
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
55 play_tree_t* prev;
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
56
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
57 //play_tree_info_t info;
4156
22fadd4022b5 playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents: 4043
diff changeset
58 play_tree_param_t* params;
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
59 int loop;
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
60 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
61 int entry_type;
8174
014e0ea85bdb Add random stepping support
albeu
parents: 8164
diff changeset
62 int flags;
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
63 };
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
64
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
65 struct play_tree_iter {
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
66 play_tree_t* root; // Iter root tree
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
67 play_tree_t* tree; // Current tree
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents: 5217
diff changeset
68 struct m_config* config;
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
69 int loop; // Looping status
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
70 int file;
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
71 int num_files;
4156
22fadd4022b5 playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents: 4043
diff changeset
72 int entry_pushed;
8174
014e0ea85bdb Add random stepping support
albeu
parents: 8164
diff changeset
73 int mode;
4043
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
74
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
75 int* status_stack; // loop/valid stack to save/revert status when we go up/down
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
76 int stack_size; // status stack size
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
77 };
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
78
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
79 play_tree_t*
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
80 play_tree_new(void);
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
81
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
82 // If childs is true free also the childs
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
83 void
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
84 play_tree_free(play_tree_t* pt, int childs);
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
85
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
86
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
87 void
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
88 play_tree_free_list(play_tree_t* pt, int childs);
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
89
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
90
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
91 // Childs
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
92 void
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
93 play_tree_set_child(play_tree_t* pt, play_tree_t* child);
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
94 // Or parent
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
95 void
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
96 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
97
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
98
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
99 // Add at end
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
100 void
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
101 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
102
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
103 // And on begining
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
104 void
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
105 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
106
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
107 // Insert after
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
108 void
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
109 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
110
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
111 // Detach from the tree
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
112 void
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
113 play_tree_remove(play_tree_t* pt, int free_it,int with_childs);
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
114
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
115
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
116 void
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
117 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
118
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
119 int
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
120 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
121
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
122
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
123 // Val can be NULL
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
124 void
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
125 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
126
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
127 int
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
128 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
129
5217
3e7152b383ca Set the params given to a playlist url to the playlist
albeu
parents: 4220
diff changeset
130 // Set all paramter of source in dest
3e7152b383ca Set the params given to a playlist url to the playlist
albeu
parents: 4220
diff changeset
131 void
3e7152b383ca Set the params given to a playlist url to the playlist
albeu
parents: 4220
diff changeset
132 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
133
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
134 /// Iterator
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
135
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
136 play_tree_iter_t*
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents: 5217
diff changeset
137 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
138
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
139 play_tree_iter_t*
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
140 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
141
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
142 void
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
143 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
144
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
145 // d is the direction : d > 0 == next , d < 0 == prev
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
146 // with_node : TRUE == stop on nodes with childs, FALSE == go directly to the next child
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
147
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
148 int
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
149 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
150
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
151 int // Break a loop, etc
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
152 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
153
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
154 int // Enter a node child list
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
155 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
156
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
157 char*
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
158 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
159
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
160 play_tree_t*
8925
5c15777f1c07 this patch adds an fallback to playlist (any but the plaintext-list format)
arpi
parents: 8174
diff changeset
161 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
162
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
163 play_tree_t*
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
164 play_tree_cleanup(play_tree_t* pt);
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
165
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
166 play_tree_t*
25590564842f tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff changeset
167 parse_playlist_file(char* file);
4156
22fadd4022b5 playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents: 4043
diff changeset
168
9290
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
169 // Highlevel API with pt-suffix to different from low-level API
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
170 // by Fabian Franz (mplayer@fabian-franz.de)
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
171
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
172 // Cleanups pt and creates a new iter
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
173 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
174
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
175 // Frees the iter
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
176 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
177
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
178 // Gets the next available file in the direction (d=-1 || d=+1)
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
179 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
180
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
181 // Two Macros that implement forward and backward direction
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
182 #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
183 #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
184
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
185 // Inserts entry into the playtree
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
186 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
187
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
188 //Replaces current entry in playtree with entry
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
189 //by doing insert and remove
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
190 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
191
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
192 // Adds a new file to the playtree,
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
193 // if it is not valid it is created
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
194 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
195
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
196 // Performs a convert to playtree-syntax, by concat path/file
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
197 // and performs pt_add_file
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
198 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
199
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
200 //Two macros to use only the iter and not the other things
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
201 #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
202 #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
203
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
204 // Resets the iter and goes back to head
0e043196d176 this patch adds a high-level-api to playtree, allowing to use it more easily
arpi
parents: 8925
diff changeset
205 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
206
4156
22fadd4022b5 playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents: 4043
diff changeset
207 #endif