Mercurial > mplayer.hg
comparison playtree.h @ 4043:25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
author | arpi |
---|---|
date | Tue, 08 Jan 2002 01:24:25 +0000 |
parents | |
children | 22fadd4022b5 |
comparison
equal
deleted
inserted
replaced
4042:d651a7b5d213 | 4043:25590564842f |
---|---|
1 | |
2 #include "libmpdemux/stream.h" | |
3 | |
4 #define PLAY_TREE_ITER_ERROR 0 | |
5 #define PLAY_TREE_ITER_ENTRY 1 | |
6 #define PLAY_TREE_ITER_NODE 2 | |
7 #define PLAY_TREE_ITER_END 3 | |
8 | |
9 typedef struct play_tree play_tree_t; | |
10 typedef struct play_tree_iter play_tree_iter_t; | |
11 | |
12 #if 0 | |
13 typedef struct play_tree_info play_tree_info_t; | |
14 typedef struct play_tree_param play_tree_param_t; | |
15 | |
16 // TODO : a attrib,val pair system and not something hardcoded | |
17 struct play_tree_info { | |
18 char* title; | |
19 char* author; | |
20 char* copyright; | |
21 char* abstract; | |
22 // Some more ?? | |
23 } | |
24 | |
25 struct play_tree_param { | |
26 char* name; | |
27 char* value; | |
28 } | |
29 #endif | |
30 | |
31 struct play_tree { | |
32 play_tree_t* parent; | |
33 play_tree_t* child; | |
34 play_tree_t* next; | |
35 play_tree_t* prev; | |
36 | |
37 //play_tree_info_t info; | |
38 //int n_param; | |
39 //play_tree_param_t* params; | |
40 int loop; | |
41 char** files; | |
42 }; | |
43 | |
44 struct play_tree_iter { | |
45 play_tree_t* root; // Iter root tree | |
46 play_tree_t* tree; // Current tree | |
47 // struct m_config* config; | |
48 int loop; // Looping status | |
49 int file; | |
50 int num_files; | |
51 | |
52 int* status_stack; // loop/valid stack to save/revert status when we go up/down | |
53 int stack_size; // status stack size | |
54 }; | |
55 | |
56 play_tree_t* | |
57 play_tree_new(void); | |
58 | |
59 // If childs is true free also the childs | |
60 void | |
61 play_tree_free(play_tree_t* pt, int childs); | |
62 | |
63 | |
64 void | |
65 play_tree_free_list(play_tree_t* pt, int childs); | |
66 | |
67 | |
68 // Childs | |
69 void | |
70 play_tree_set_child(play_tree_t* pt, play_tree_t* child); | |
71 // Or parent | |
72 void | |
73 play_tree_set_parent(play_tree_t* pt, play_tree_t* parent); | |
74 | |
75 | |
76 // Add at end | |
77 void | |
78 play_tree_append_entry(play_tree_t* pt, play_tree_t* entry); | |
79 | |
80 // And on begining | |
81 void | |
82 play_tree_prepend_entry(play_tree_t* pt, play_tree_t* entry); | |
83 | |
84 // Insert after | |
85 void | |
86 play_tree_insert_entry(play_tree_t* pt, play_tree_t* entry); | |
87 | |
88 // Detach from the tree | |
89 void | |
90 play_tree_remove(play_tree_t* pt, int free_it,int with_childs); | |
91 | |
92 | |
93 void | |
94 play_tree_add_file(play_tree_t* pt,char* file); | |
95 | |
96 int | |
97 play_tree_remove_file(play_tree_t* pt,char* file); | |
98 | |
99 | |
100 #if 0 | |
101 // Val can be NULL | |
102 void | |
103 play_tree_set_param(play_tree_t* pt, char* name, char* val); | |
104 | |
105 int | |
106 play_tree_unset_param(play_tree_t* pt, char* name); | |
107 | |
108 #endif | |
109 | |
110 | |
111 /// Iterator | |
112 | |
113 play_tree_iter_t* | |
114 play_tree_iter_new(play_tree_t* pt); | |
115 | |
116 play_tree_iter_t* | |
117 play_tree_iter_new_copy(play_tree_iter_t* old); | |
118 | |
119 void | |
120 play_tree_iter_free(play_tree_iter_t* iter); | |
121 | |
122 // d is the direction : d > 0 == next , d < 0 == prev | |
123 // with_node : TRUE == stop on nodes with childs, FALSE == go directly to the next child | |
124 | |
125 int | |
126 play_tree_iter_step(play_tree_iter_t* iter, int d,int with_nodes); | |
127 | |
128 int // Break a loop, etc | |
129 play_tree_iter_up_step(play_tree_iter_t* iter, int d,int with_nodes); | |
130 | |
131 int // Enter a node child list | |
132 play_tree_iter_down_step(play_tree_iter_t* iter, int d,int with_nodes); | |
133 | |
134 char* | |
135 play_tree_iter_get_file(play_tree_iter_t* iter, int d); | |
136 | |
137 play_tree_t* | |
138 parse_playtree(stream_t *stream); | |
139 | |
140 play_tree_t* | |
141 play_tree_cleanup(play_tree_t* pt); | |
142 | |
143 play_tree_t* | |
144 parse_playlist_file(char* file); |