allow build mvcp client without mlt framework
[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
27 /* MLT Header files. */
28 #ifndef MVCP_EMBEDDED
29 #include <framework/mlt.h>
30 #else
31 #define mlt_service void *
32 #endif
33
34 /* Application header files */
35 #include "mvcp_parser.h"
36 #include "mvcp_status.h"
37 #include "mvcp_notifier.h"
38
39 #ifdef __cplusplus
40 extern "C"
41 {
42 #endif
43
44 /** Client error conditions
45 */
46
47 typedef enum
48 {
49 mvcp_ok = 0,
50 mvcp_malloc_failed,
51 mvcp_unknown_error,
52 mvcp_no_response,
53 mvcp_invalid_command,
54 mvcp_server_timeout,
55 mvcp_missing_argument,
56 mvcp_server_unavailable,
57 mvcp_unit_creation_failed,
58 mvcp_unit_unavailable,
59 mvcp_invalid_file,
60 mvcp_invalid_position
61 }
62 mvcp_error_code;
63
64 /** Clip index specification.
65 */
66
67 typedef enum
68 {
69 mvcp_absolute = 0,
70 mvcp_relative
71 }
72 mvcp_clip_offset;
73
74 /** Client structure.
75 */
76
77 typedef struct
78 {
79 mvcp_parser parser;
80 mvcp_response last_response;
81 }
82 *mvcp, mvcp_t;
83
84 /** Client API.
85 */
86
87 extern mvcp mvcp_init( mvcp_parser );
88
89 /* Connect to the mvcp parser instance */
90 extern mvcp_error_code mvcp_connect( mvcp );
91
92 /* Global functions */
93 extern mvcp_error_code mvcp_set( mvcp, char *, char * );
94 extern mvcp_error_code mvcp_get( mvcp, char *, char *, int );
95 extern mvcp_error_code mvcp_run( mvcp, char * );
96
97 /* Unit functions */
98 extern mvcp_error_code mvcp_unit_add( mvcp, char *, int * );
99 extern mvcp_error_code mvcp_unit_load( mvcp, int, char * );
100 extern mvcp_error_code mvcp_unit_load_clipped( mvcp, int, char *, int32_t, int32_t );
101 extern mvcp_error_code mvcp_unit_load_back( mvcp, int, char * );
102 extern mvcp_error_code mvcp_unit_load_back_clipped( mvcp, int, char *, int32_t, int32_t );
103 extern mvcp_error_code mvcp_unit_append( mvcp, int, char *, int32_t, int32_t );
104 extern mvcp_error_code mvcp_unit_receive( mvcp, int, char *, char * );
105 extern mvcp_error_code mvcp_unit_push( mvcp, int, char *, mlt_service );
106 extern mvcp_error_code mvcp_unit_clean( mvcp, int );
107 extern mvcp_error_code mvcp_unit_wipe( mvcp, int );
108 extern mvcp_error_code mvcp_unit_clear( mvcp, int );
109 extern mvcp_error_code mvcp_unit_clip_move( mvcp, int, mvcp_clip_offset, int, mvcp_clip_offset, int );
110 extern mvcp_error_code mvcp_unit_clip_remove( mvcp, int, mvcp_clip_offset, int );
111 extern mvcp_error_code mvcp_unit_remove_current_clip( mvcp, int );
112 extern mvcp_error_code mvcp_unit_clip_insert( mvcp, int, mvcp_clip_offset, int, char *, int32_t, int32_t );
113 extern mvcp_error_code mvcp_unit_play( mvcp, int );
114 extern mvcp_error_code mvcp_unit_play_at_speed( mvcp, int, int );
115 extern mvcp_error_code mvcp_unit_stop( mvcp, int );
116 extern mvcp_error_code mvcp_unit_pause( mvcp, int );
117 extern mvcp_error_code mvcp_unit_rewind( mvcp, int );
118 extern mvcp_error_code mvcp_unit_fast_forward( mvcp, int );
119 extern mvcp_error_code mvcp_unit_step( mvcp, int, int32_t );
120 extern mvcp_error_code mvcp_unit_goto( mvcp, int, int32_t );
121 extern mvcp_error_code mvcp_unit_clip_goto( mvcp, int, mvcp_clip_offset, int, int32_t );
122 extern mvcp_error_code mvcp_unit_clip_set_in( mvcp, int, mvcp_clip_offset, int, int32_t );
123 extern mvcp_error_code mvcp_unit_clip_set_out( mvcp, int, mvcp_clip_offset, int, int32_t );
124 extern mvcp_error_code mvcp_unit_set_in( mvcp, int, int32_t );
125 extern mvcp_error_code mvcp_unit_set_out( mvcp, int, int32_t );
126 extern mvcp_error_code mvcp_unit_clear_in( mvcp, int );
127 extern mvcp_error_code mvcp_unit_clear_out( mvcp, int );
128 extern mvcp_error_code mvcp_unit_clear_in_out( mvcp, int );
129 extern mvcp_error_code mvcp_unit_set( mvcp, int, const char *, const char * );
130 extern mvcp_error_code mvcp_unit_get( mvcp, int, char *, char *, int );
131 extern mvcp_error_code mvcp_unit_status( mvcp, int, mvcp_status );
132 extern mvcp_error_code mvcp_unit_transfer( mvcp, int, int );
133
134 /* Notifier functionality. */
135 extern mvcp_notifier mvcp_get_notifier( mvcp );
136
137 /** Structure for the directory.
138 */
139
140 typedef struct
141 {
142 char *directory;
143 mvcp_response response;
144 }
145 *mvcp_dir, mvcp_dir_t;
146
147 /** Directory entry structure.
148 */
149
150 typedef struct
151 {
152 int dir;
153 char name[ NAME_MAX ];
154 char full[ PATH_MAX + NAME_MAX ];
155 unsigned long long size;
156 }
157 *mvcp_dir_entry, mvcp_dir_entry_t;
158
159 /* Directory reading. */
160 extern mvcp_dir mvcp_dir_init( mvcp, const char * );
161 extern mvcp_error_code mvcp_dir_get_error_code( mvcp_dir );
162 extern mvcp_error_code mvcp_dir_get( mvcp_dir, int, mvcp_dir_entry );
163 extern int mvcp_dir_count( mvcp_dir );
164 extern void mvcp_dir_close( mvcp_dir );
165
166 /** Structure for the list.
167 */
168
169 typedef struct
170 {
171 int generation;
172 mvcp_response response;
173 }
174 *mvcp_list, mvcp_list_t;
175
176 /** List entry structure.
177 */
178
179 typedef struct
180 {
181 int clip;
182 char full[ PATH_MAX + NAME_MAX ];
183 int32_t in;
184 int32_t out;
185 int32_t max;
186 int32_t size;
187 float fps;
188 }
189 *mvcp_list_entry, mvcp_list_entry_t;
190
191 /* List reading. */
192 extern mvcp_list mvcp_list_init( mvcp, int );
193 extern mvcp_error_code mvcp_list_get_error_code( mvcp_list );
194 extern mvcp_error_code mvcp_list_get( mvcp_list, int, mvcp_list_entry );
195 extern int mvcp_list_count( mvcp_list );
196 extern void mvcp_list_close( mvcp_list );
197
198 /** Structure for nodes.
199 */
200
201 typedef struct
202 {
203 mvcp_response response;
204 }
205 *mvcp_nodes, mvcp_nodes_t;
206
207 /** Node entry structure.
208 */
209
210 typedef struct
211 {
212 int node;
213 char guid[ 17 ];
214 char name[ 1024 ];
215 }
216 *mvcp_node_entry, mvcp_node_entry_t;
217
218 /* Node reading. */
219 extern mvcp_nodes mvcp_nodes_init( mvcp );
220 extern mvcp_error_code mvcp_nodes_get_error_code( mvcp_nodes );
221 extern mvcp_error_code mvcp_nodes_get( mvcp_nodes, int, mvcp_node_entry );
222 extern int mvcp_nodes_count( mvcp_nodes );
223 extern void mvcp_nodes_close( mvcp_nodes );
224
225 /** Structure for units.
226 */
227
228 typedef struct
229 {
230 mvcp_response response;
231 }
232 *mvcp_units, mvcp_units_t;
233
234 /** Unit entry structure.
235 */
236
237 typedef struct
238 {
239 int unit;
240 int node;
241 char guid[ 512 ];
242 int online;
243 }
244 *mvcp_unit_entry, mvcp_unit_entry_t;
245
246 /* Unit reading. */
247 extern mvcp_units mvcp_units_init( mvcp );
248 extern mvcp_error_code mvcp_units_get_error_code( mvcp_units );
249 extern mvcp_error_code mvcp_units_get( mvcp_units, int, mvcp_unit_entry );
250 extern int mvcp_units_count( mvcp_units );
251 extern void mvcp_units_close( mvcp_units );
252
253 /* Miscellaenous functions */
254 extern mvcp_response mvcp_get_last_response( mvcp );
255 extern const char *mvcp_error_description( mvcp_error_code );
256
257 /* Courtesy functions. */
258 extern mvcp_error_code mvcp_execute( mvcp, size_t, const char *, ... );
259 extern mvcp_error_code mvcp_push( mvcp, mlt_service, size_t, const char *, ... );
260
261 /* Close function. */
262 extern void mvcp_close( mvcp );
263
264 #ifdef __cplusplus
265 }
266 #endif
267
268 #endif