mvcp compilation under mingw32 support added
[melted] / src / mvcp / mvcp.h
1 /*
2 * mvcp.h -- High Level Client API for Melted
3 * Copyright (C) 2002-2009 Ushodaya Enterprises Limited
4 * Author: Charles Yates <charles.yates@pandora.be>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library 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 GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21 #ifndef _MVCP_H_
22 #define _MVCP_H_
23
24 /* System header files */
25 #include <limits.h>
26 #if defined(__MINGW32__)
27 #define NAME_MAX 255
28 #endif
29
30 /* MLT Header files. */
31 #ifndef MVCP_EMBEDDED
32 #include <framework/mlt.h>
33 #else
34 #define mlt_service void *
35 #endif
36
37 /* Application header files */
38 #include "mvcp_parser.h"
39 #include "mvcp_status.h"
40 #include "mvcp_notifier.h"
41
42 #ifdef __cplusplus
43 extern "C"
44 {
45 #endif
46
47 /** Client error conditions
48 */
49
50 typedef enum
51 {
52 mvcp_ok = 0,
53 mvcp_malloc_failed,
54 mvcp_unknown_error,
55 mvcp_no_response,
56 mvcp_invalid_command,
57 mvcp_server_timeout,
58 mvcp_missing_argument,
59 mvcp_server_unavailable,
60 mvcp_unit_creation_failed,
61 mvcp_unit_unavailable,
62 mvcp_invalid_file,
63 mvcp_invalid_position
64 }
65 mvcp_error_code;
66
67 /** Clip index specification.
68 */
69
70 typedef enum
71 {
72 mvcp_absolute = 0,
73 mvcp_relative
74 }
75 mvcp_clip_offset;
76
77 /** Client structure.
78 */
79
80 typedef struct
81 {
82 mvcp_parser parser;
83 mvcp_response last_response;
84 }
85 *mvcp, mvcp_t;
86
87 /** Client API.
88 */
89
90 extern mvcp mvcp_init( mvcp_parser );
91
92 /* Connect to the mvcp parser instance */
93 extern mvcp_error_code mvcp_connect( mvcp );
94
95 /* Global functions */
96 extern mvcp_error_code mvcp_set( mvcp, char *, char * );
97 extern mvcp_error_code mvcp_get( mvcp, char *, char *, int );
98 extern mvcp_error_code mvcp_run( mvcp, char * );
99
100 /* Unit functions */
101 extern mvcp_error_code mvcp_unit_add( mvcp, char *, int * );
102 extern mvcp_error_code mvcp_unit_load( mvcp, int, char * );
103 extern mvcp_error_code mvcp_unit_load_clipped( mvcp, int, char *, int32_t, int32_t );
104 extern mvcp_error_code mvcp_unit_load_back( mvcp, int, char * );
105 extern mvcp_error_code mvcp_unit_load_back_clipped( mvcp, int, char *, int32_t, int32_t );
106 extern mvcp_error_code mvcp_unit_append( mvcp, int, char *, int32_t, int32_t );
107 extern mvcp_error_code mvcp_unit_receive( mvcp, int, char *, char * );
108 extern mvcp_error_code mvcp_unit_push( mvcp, int, char *, mlt_service );
109 extern mvcp_error_code mvcp_unit_clean( mvcp, int );
110 extern mvcp_error_code mvcp_unit_wipe( mvcp, int );
111 extern mvcp_error_code mvcp_unit_clear( mvcp, int );
112 extern mvcp_error_code mvcp_unit_clip_move( mvcp, int, mvcp_clip_offset, int, mvcp_clip_offset, int );
113 extern mvcp_error_code mvcp_unit_clip_remove( mvcp, int, mvcp_clip_offset, int );
114 extern mvcp_error_code mvcp_unit_remove_current_clip( mvcp, int );
115 extern mvcp_error_code mvcp_unit_clip_insert( mvcp, int, mvcp_clip_offset, int, char *, int32_t, int32_t );
116 extern mvcp_error_code mvcp_unit_play( mvcp, int );
117 extern mvcp_error_code mvcp_unit_play_at_speed( mvcp, int, int );
118 extern mvcp_error_code mvcp_unit_stop( mvcp, int );
119 extern mvcp_error_code mvcp_unit_pause( mvcp, int );
120 extern mvcp_error_code mvcp_unit_rewind( mvcp, int );
121 extern mvcp_error_code mvcp_unit_fast_forward( mvcp, int );
122 extern mvcp_error_code mvcp_unit_step( mvcp, int, int32_t );
123 extern mvcp_error_code mvcp_unit_goto( mvcp, int, int32_t );
124 extern mvcp_error_code mvcp_unit_clip_goto( mvcp, int, mvcp_clip_offset, int, int32_t );
125 extern mvcp_error_code mvcp_unit_clip_set_in( mvcp, int, mvcp_clip_offset, int, int32_t );
126 extern mvcp_error_code mvcp_unit_clip_set_out( mvcp, int, mvcp_clip_offset, int, int32_t );
127 extern mvcp_error_code mvcp_unit_set_in( mvcp, int, int32_t );
128 extern mvcp_error_code mvcp_unit_set_out( mvcp, int, int32_t );
129 extern mvcp_error_code mvcp_unit_clear_in( mvcp, int );
130 extern mvcp_error_code mvcp_unit_clear_out( mvcp, int );
131 extern mvcp_error_code mvcp_unit_clear_in_out( mvcp, int );
132 extern mvcp_error_code mvcp_unit_set( mvcp, int, const char *, const char * );
133 extern mvcp_error_code mvcp_unit_get( mvcp, int, char *, char *, int );
134 extern mvcp_error_code mvcp_unit_status( mvcp, int, mvcp_status );
135 extern mvcp_error_code mvcp_unit_transfer( mvcp, int, int );
136
137 /* Notifier functionality. */
138 extern mvcp_notifier mvcp_get_notifier( mvcp );
139
140 /** Structure for the directory.
141 */
142
143 typedef struct
144 {
145 char *directory;
146 mvcp_response response;
147 }
148 *mvcp_dir, mvcp_dir_t;
149
150 /** Directory entry structure.
151 */
152
153 typedef struct
154 {
155 int dir;
156 char name[ NAME_MAX ];
157 char full[ PATH_MAX + NAME_MAX ];
158 unsigned long long size;
159 }
160 *mvcp_dir_entry, mvcp_dir_entry_t;
161
162 /* Directory reading. */
163 extern mvcp_dir mvcp_dir_init( mvcp, const char * );
164 extern mvcp_error_code mvcp_dir_get_error_code( mvcp_dir );
165 extern mvcp_error_code mvcp_dir_get( mvcp_dir, int, mvcp_dir_entry );
166 extern int mvcp_dir_count( mvcp_dir );
167 extern void mvcp_dir_close( mvcp_dir );
168
169 /** Structure for the list.
170 */
171
172 typedef struct
173 {
174 int generation;
175 mvcp_response response;
176 }
177 *mvcp_list, mvcp_list_t;
178
179 /** List entry structure.
180 */
181
182 typedef struct
183 {
184 int clip;
185 char full[ PATH_MAX + NAME_MAX ];
186 int32_t in;
187 int32_t out;
188 int32_t max;
189 int32_t size;
190 float fps;
191 }
192 *mvcp_list_entry, mvcp_list_entry_t;
193
194 /* List reading. */
195 extern mvcp_list mvcp_list_init( mvcp, int );
196 extern mvcp_error_code mvcp_list_get_error_code( mvcp_list );
197 extern mvcp_error_code mvcp_list_get( mvcp_list, int, mvcp_list_entry );
198 extern int mvcp_list_count( mvcp_list );
199 extern void mvcp_list_close( mvcp_list );
200
201 /** Structure for nodes.
202 */
203
204 typedef struct
205 {
206 mvcp_response response;
207 }
208 *mvcp_nodes, mvcp_nodes_t;
209
210 /** Node entry structure.
211 */
212
213 typedef struct
214 {
215 int node;
216 char guid[ 17 ];
217 char name[ 1024 ];
218 }
219 *mvcp_node_entry, mvcp_node_entry_t;
220
221 /* Node reading. */
222 extern mvcp_nodes mvcp_nodes_init( mvcp );
223 extern mvcp_error_code mvcp_nodes_get_error_code( mvcp_nodes );
224 extern mvcp_error_code mvcp_nodes_get( mvcp_nodes, int, mvcp_node_entry );
225 extern int mvcp_nodes_count( mvcp_nodes );
226 extern void mvcp_nodes_close( mvcp_nodes );
227
228 /** Structure for units.
229 */
230
231 typedef struct
232 {
233 mvcp_response response;
234 }
235 *mvcp_units, mvcp_units_t;
236
237 /** Unit entry structure.
238 */
239
240 typedef struct
241 {
242 int unit;
243 int node;
244 char guid[ 512 ];
245 int online;
246 }
247 *mvcp_unit_entry, mvcp_unit_entry_t;
248
249 /* Unit reading. */
250 extern mvcp_units mvcp_units_init( mvcp );
251 extern mvcp_error_code mvcp_units_get_error_code( mvcp_units );
252 extern mvcp_error_code mvcp_units_get( mvcp_units, int, mvcp_unit_entry );
253 extern int mvcp_units_count( mvcp_units );
254 extern void mvcp_units_close( mvcp_units );
255
256 /* Miscellaenous functions */
257 extern mvcp_response mvcp_get_last_response( mvcp );
258 extern const char *mvcp_error_description( mvcp_error_code );
259
260 /* Courtesy functions. */
261 extern mvcp_error_code mvcp_execute( mvcp, size_t, const char *, ... );
262 extern mvcp_error_code mvcp_push( mvcp, mlt_service, size_t, const char *, ... );
263
264 /* Close function. */
265 extern void mvcp_close( mvcp );
266
267 /* Probe function */
268 extern mvcp_error_code mvcp_probe_clip( mvcp, char *, mvcp_list_entry );
269
270 #ifdef __cplusplus
271 }
272 #endif
273
274 #endif