8 #define PLAY_TREE_ITER_ERROR 0
9 #define PLAY_TREE_ITER_ENTRY 1
10 #define PLAY_TREE_ITER_NODE 2
11 #define PLAY_TREE_ITER_END 3
13 #define PLAY_TREE_ENTRY_NODE -1
14 #define PLAY_TREE_ENTRY_DVD 0
15 #define PLAY_TREE_ENTRY_VCD 1
16 #define PLAY_TREE_ENTRY_TV 2
17 #define PLAY_TREE_ENTRY_FILE 3
20 #define PLAY_TREE_RND (1<<0)
21 // Playtree flags used by the iter
22 #define PLAY_TREE_RND_PLAYED (1<<8)
25 #define PLAY_TREE_ITER_NORMAL 0
26 #define PLAY_TREE_ITER_RND 1
28 typedef struct play_tree play_tree_t
;
29 typedef struct play_tree_iter play_tree_iter_t
;
30 typedef struct play_tree_param play_tree_param_t
;
34 typedef struct play_tree_info play_tree_info_t
;
35 // TODO : a attrib,val pair system and not something hardcoded
36 struct play_tree_info
{
45 struct play_tree_param
{
57 //play_tree_info_t info;
58 play_tree_param_t
* params
;
65 struct play_tree_iter
{
66 play_tree_t
* root
; // Iter root tree
67 play_tree_t
* tree
; // Current tree
68 struct m_config
* config
;
69 int loop
; // Looping status
75 int* status_stack
; // loop/valid stack to save/revert status when we go up/down
76 int stack_size
; // status stack size
82 // If childs is true free also the childs
84 play_tree_free(play_tree_t
* pt
, int childs
);
88 play_tree_free_list(play_tree_t
* pt
, int childs
);
93 play_tree_set_child(play_tree_t
* pt
, play_tree_t
* child
);
96 play_tree_set_parent(play_tree_t
* pt
, play_tree_t
* parent
);
101 play_tree_append_entry(play_tree_t
* pt
, play_tree_t
* entry
);
105 play_tree_prepend_entry(play_tree_t
* pt
, play_tree_t
* entry
);
109 play_tree_insert_entry(play_tree_t
* pt
, play_tree_t
* entry
);
111 // Detach from the tree
113 play_tree_remove(play_tree_t
* pt
, int free_it
,int with_childs
);
117 play_tree_add_file(play_tree_t
* pt
,char* file
);
120 play_tree_remove_file(play_tree_t
* pt
,char* file
);
125 play_tree_set_param(play_tree_t
* pt
, char* name
, char* val
);
128 play_tree_unset_param(play_tree_t
* pt
, char* name
);
130 // Set all paramter of source in dest
132 play_tree_set_params_from(play_tree_t
* dest
,play_tree_t
* src
);
137 play_tree_iter_new(play_tree_t
* pt
, struct m_config
* config
);
140 play_tree_iter_new_copy(play_tree_iter_t
* old
);
143 play_tree_iter_free(play_tree_iter_t
* iter
);
145 // d is the direction : d > 0 == next , d < 0 == prev
146 // with_node : TRUE == stop on nodes with childs, FALSE == go directly to the next child
149 play_tree_iter_step(play_tree_iter_t
* iter
, int d
,int with_nodes
);
151 int // Break a loop, etc
152 play_tree_iter_up_step(play_tree_iter_t
* iter
, int d
,int with_nodes
);
154 int // Enter a node child list
155 play_tree_iter_down_step(play_tree_iter_t
* iter
, int d
,int with_nodes
);
158 play_tree_iter_get_file(play_tree_iter_t
* iter
, int d
);
161 parse_playtree(struct stream_st
*stream
, int forced
);
164 play_tree_cleanup(play_tree_t
* pt
);
167 parse_playlist_file(char* file
);
169 // Highlevel API with pt-suffix to different from low-level API
170 // by Fabian Franz (mplayer@fabian-franz.de)
172 // Cleanups pt and creates a new iter
173 play_tree_iter_t
* pt_iter_create(play_tree_t
** pt
, struct m_config
* config
);
176 void pt_iter_destroy(play_tree_iter_t
** iter
);
178 // Gets the next available file in the direction (d=-1 || d=+1)
179 char* pt_iter_get_file(play_tree_iter_t
* iter
, int d
);
181 // Two Macros that implement forward and backward direction
182 #define pt_iter_get_next_file(iter) pt_iter_get_file(iter, 1)
183 #define pt_iter_get_prev_file(iter) pt_iter_get_file(iter, -1)
185 // Inserts entry into the playtree
186 void pt_iter_insert_entry(play_tree_iter_t
* iter
, play_tree_t
* entry
);
188 //Replaces current entry in playtree with entry
189 //by doing insert and remove
190 void pt_iter_replace_entry(play_tree_iter_t
* iter
, play_tree_t
* entry
);
192 // Adds a new file to the playtree,
193 // if it is not valid it is created
194 void pt_add_file(play_tree_t
** ppt
, char* filename
);
196 // Performs a convert to playtree-syntax, by concat path/file
197 // and performs pt_add_file
198 void pt_add_gui_file(play_tree_t
** ppt
, char* path
, char* file
);
200 //Two macros to use only the iter and not the other things
201 #define pt_iter_add_file(iter, filename) pt_add_file(&iter->tree, filename)
202 #define pt_iter_add_gui_file(iter, path, name) pt_add_gui_file(&iter->tree, path, name)
204 // Resets the iter and goes back to head
205 void pt_iter_goto_head(play_tree_iter_t
* iter
);