added clear to the miracle command set and valerie api
[melted] / src / valerie / valerie.h
1 /*
2 * valerie.h -- High Level Client API for miracle
3 * Copyright (C) 2002-2003 Ushodaya Enterprises Limited
4 * Author: Charles Yates <charles.yates@pandora.be>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */
20
21 #ifndef _VALERIE_H_
22 #define _VALERIE_H_
23
24 /* System header files */
25 #include <limits.h>
26
27 /* Application header files */
28 #include "valerie_parser.h"
29 #include "valerie_status.h"
30 #include "valerie_notifier.h"
31
32 #ifdef __cplusplus
33 extern "C"
34 {
35 #endif
36
37 /** Client error conditions
38 */
39
40 typedef enum
41 {
42 valerie_ok = 0,
43 valerie_malloc_failed,
44 valerie_unknown_error,
45 valerie_no_response,
46 valerie_invalid_command,
47 valerie_server_timeout,
48 valerie_missing_argument,
49 valerie_server_unavailable,
50 valerie_unit_creation_failed,
51 valerie_unit_unavailable,
52 valerie_invalid_file,
53 valerie_invalid_position
54 }
55 valerie_error_code;
56
57 /** Clip index specification.
58 */
59
60 typedef enum
61 {
62 valerie_absolute = 0,
63 valerie_relative
64 }
65 valerie_clip_offset;
66
67 /** Client structure.
68 */
69
70 typedef struct
71 {
72 valerie_parser parser;
73 valerie_response last_response;
74 }
75 *valerie, valerie_t;
76
77 /** Client API.
78 */
79
80 extern valerie valerie_init( valerie_parser );
81
82 /* Connect to the valerie parser instance */
83 extern valerie_error_code valerie_connect( valerie );
84
85 /* Global functions */
86 extern valerie_error_code valerie_set( valerie, char *, char * );
87 extern valerie_error_code valerie_get( valerie, char *, char *, int );
88 extern valerie_error_code valerie_run( valerie, char * );
89
90 /* Unit functions */
91 extern valerie_error_code valerie_unit_add( valerie, char *, int * );
92 extern valerie_error_code valerie_unit_load( valerie, int, char * );
93 extern valerie_error_code valerie_unit_load_clipped( valerie, int, char *, int32_t, int32_t );
94 extern valerie_error_code valerie_unit_load_back( valerie, int, char * );
95 extern valerie_error_code valerie_unit_load_back_clipped( valerie, int, char *, int32_t, int32_t );
96 extern valerie_error_code valerie_unit_append( valerie, int, char *, int32_t, int32_t );
97 extern valerie_error_code valerie_unit_clean( valerie, int );
98 extern valerie_error_code valerie_unit_clear( valerie, int );
99 extern valerie_error_code valerie_unit_clip_move( valerie, int, valerie_clip_offset, int, valerie_clip_offset, int );
100 extern valerie_error_code valerie_unit_clip_remove( valerie, int, valerie_clip_offset, int );
101 extern valerie_error_code valerie_unit_remove_current_clip( valerie, int );
102 extern valerie_error_code valerie_unit_clip_insert( valerie, int, valerie_clip_offset, int, char *, int32_t, int32_t );
103 extern valerie_error_code valerie_unit_play( valerie, int );
104 extern valerie_error_code valerie_unit_play_at_speed( valerie, int, int );
105 extern valerie_error_code valerie_unit_stop( valerie, int );
106 extern valerie_error_code valerie_unit_pause( valerie, int );
107 extern valerie_error_code valerie_unit_rewind( valerie, int );
108 extern valerie_error_code valerie_unit_fast_forward( valerie, int );
109 extern valerie_error_code valerie_unit_step( valerie, int, int32_t );
110 extern valerie_error_code valerie_unit_goto( valerie, int, int32_t );
111 extern valerie_error_code valerie_unit_clip_goto( valerie, int, valerie_clip_offset, int, int32_t );
112 extern valerie_error_code valerie_unit_clip_set_in( valerie, int, valerie_clip_offset, int, int32_t );
113 extern valerie_error_code valerie_unit_clip_set_out( valerie, int, valerie_clip_offset, int, int32_t );
114 extern valerie_error_code valerie_unit_set_in( valerie, int, int32_t );
115 extern valerie_error_code valerie_unit_set_out( valerie, int, int32_t );
116 extern valerie_error_code valerie_unit_clear_in( valerie, int );
117 extern valerie_error_code valerie_unit_clear_out( valerie, int );
118 extern valerie_error_code valerie_unit_clear_in_out( valerie, int );
119 extern valerie_error_code valerie_unit_set( valerie, int, char *, char * );
120 extern valerie_error_code valerie_unit_get( valerie, int, char * );
121 extern valerie_error_code valerie_unit_status( valerie, int, valerie_status );
122 extern valerie_error_code valerie_unit_transfer( valerie, int, int );
123
124 /* Notifier functionality. */
125 extern valerie_notifier valerie_get_notifier( valerie );
126
127 /** Structure for the directory.
128 */
129
130 typedef struct
131 {
132 char *directory;
133 valerie_response response;
134 }
135 *valerie_dir, valerie_dir_t;
136
137 /** Directory entry structure.
138 */
139
140 typedef struct
141 {
142 int dir;
143 char name[ NAME_MAX ];
144 char full[ PATH_MAX + NAME_MAX ];
145 unsigned long long size;
146 }
147 *valerie_dir_entry, valerie_dir_entry_t;
148
149 /* Directory reading. */
150 extern valerie_dir valerie_dir_init( valerie, char * );
151 extern valerie_error_code valerie_dir_get_error_code( valerie_dir );
152 extern valerie_error_code valerie_dir_get( valerie_dir, int, valerie_dir_entry );
153 extern int valerie_dir_count( valerie_dir );
154 extern void valerie_dir_close( valerie_dir );
155
156 /** Structure for the list.
157 */
158
159 typedef struct
160 {
161 int generation;
162 valerie_response response;
163 }
164 *valerie_list, valerie_list_t;
165
166 /** List entry structure.
167 */
168
169 typedef struct
170 {
171 int clip;
172 char full[ PATH_MAX + NAME_MAX ];
173 int32_t in;
174 int32_t out;
175 int32_t max;
176 int32_t size;
177 int32_t fps;
178 }
179 *valerie_list_entry, valerie_list_entry_t;
180
181 /* List reading. */
182 extern valerie_list valerie_list_init( valerie, int );
183 extern valerie_error_code valerie_list_get_error_code( valerie_list );
184 extern valerie_error_code valerie_list_get( valerie_list, int, valerie_list_entry );
185 extern int valerie_list_count( valerie_list );
186 extern void valerie_list_close( valerie_list );
187
188 /** Structure for nodes.
189 */
190
191 typedef struct
192 {
193 valerie_response response;
194 }
195 *valerie_nodes, valerie_nodes_t;
196
197 /** Node entry structure.
198 */
199
200 typedef struct
201 {
202 int node;
203 char guid[ 17 ];
204 char name[ 1024 ];
205 }
206 *valerie_node_entry, valerie_node_entry_t;
207
208 /* Node reading. */
209 extern valerie_nodes valerie_nodes_init( valerie );
210 extern valerie_error_code valerie_nodes_get_error_code( valerie_nodes );
211 extern valerie_error_code valerie_nodes_get( valerie_nodes, int, valerie_node_entry );
212 extern int valerie_nodes_count( valerie_nodes );
213 extern void valerie_nodes_close( valerie_nodes );
214
215 /** Structure for units.
216 */
217
218 typedef struct
219 {
220 valerie_response response;
221 }
222 *valerie_units, valerie_units_t;
223
224 /** Unit entry structure.
225 */
226
227 typedef struct
228 {
229 int unit;
230 int node;
231 char guid[ 512 ];
232 int online;
233 }
234 *valerie_unit_entry, valerie_unit_entry_t;
235
236 /* Unit reading. */
237 extern valerie_units valerie_units_init( valerie );
238 extern valerie_error_code valerie_units_get_error_code( valerie_units );
239 extern valerie_error_code valerie_units_get( valerie_units, int, valerie_unit_entry );
240 extern int valerie_units_count( valerie_units );
241 extern void valerie_units_close( valerie_units );
242
243 /* Miscellaenous functions */
244 extern valerie_response valerie_get_last_response( valerie );
245 extern char *valerie_error_description( valerie_error_code );
246
247 /* Courtesy functions. */
248 extern valerie_error_code valerie_execute( valerie, size_t, char *, ... );
249
250 /* Close function. */
251 extern void valerie_close( valerie );
252
253 #ifdef __cplusplus
254 }
255 #endif
256
257 #endif