00001 #ifndef PLUGINSERVER_H
00002 #define PLUGINSERVER_H
00003
00004
00005
00006
00007 #include "arraylist.h"
00008 #include "attachmentpoint.inc"
00009 #include "edl.inc"
00010 #include "floatauto.inc"
00011 #include "floatautos.inc"
00012 #include "keyframe.inc"
00013 #include "ladspa.h"
00014 #include "mainprogress.inc"
00015 #include "maxbuffers.h"
00016 #include "menueffects.inc"
00017 #include "module.inc"
00018 #include "mwindow.inc"
00019 #include "plugin.inc"
00020 #include "pluginaclientlad.inc"
00021 #include "pluginclient.inc"
00022 #include "pluginserver.inc"
00023 #include "preferences.inc"
00024 #include "theme.inc"
00025 #include "thread.h"
00026 #include "track.inc"
00027 #include "vframe.inc"
00028 #include "videodevice.inc"
00029 #include "virtualnode.inc"
00030
00031 #include <stdio.h>
00032 #include <stdint.h>
00033 #include <string.h>
00034 #include <unistd.h>
00035
00036
00037
00038
00039
00040 class PluginServer
00041 {
00042 public:
00043 PluginServer();
00044 PluginServer(char *path);
00045 PluginServer(PluginServer &);
00046 virtual ~PluginServer();
00047
00048
00049 friend class PluginAClientLAD;
00050 friend class PluginAClientConfig;
00051 friend class PluginAClientWindow;
00052
00053
00054
00055 #define PLUGINSERVER_IS_LAD 2
00056 #define PLUGINSERVER_NOT_RECOGNIZED 1
00057 #define PLUGINSERVER_OK 0
00058 int open_plugin(int master,
00059 Preferences *preferences,
00060 EDL *edl,
00061 Plugin *plugin,
00062 int lad_index );
00063
00064 int close_plugin();
00065 void dump();
00066
00067 void render_stop();
00068
00069
00070 void set_title(char *string);
00071
00072 void generate_display_title(char *string);
00073
00074 KeyFrame* get_prev_keyframe(int64_t position);
00075 KeyFrame* get_next_keyframe(int64_t position);
00076
00077 void get_camera(float *x, float *y, float *z,
00078 int64_t position, int direction);
00079 void get_projector(float *x, float *y, float *z,
00080 int64_t position, int direction);
00081
00082 int get_interpolation_type();
00083
00084
00085 KeyFrame* get_keyframe();
00086
00087 Theme* new_theme();
00088
00089 Theme* get_theme();
00090
00091
00092
00093
00094
00095
00096 void save_data(KeyFrame *keyframe);
00097
00098 void sync_parameters();
00099
00100 int set_realtime_sched();
00101 int get_gui_status();
00102
00103 void raise_window();
00104
00105
00106 void show_gui();
00107
00108 void update_gui();
00109 void update_title();
00110 void client_side_close();
00111
00112
00113 void set_use_opengl(int value, VideoDevice *vdevice);
00114
00115 int get_use_opengl();
00116
00117
00118
00119
00120 int gui_open();
00121
00122
00123 void run_opengl(PluginClient *plugin_client);
00124
00125
00126 int set_string(char *string);
00127
00128 int init_realtime(int realtime_sched,
00129 int total_in_buffers,
00130 int buffer_size);
00131
00132
00133
00134
00135
00136
00137 void process_transition(VFrame *input,
00138 VFrame *output,
00139 int64_t current_position,
00140 int64_t total_len);
00141 void process_transition(double *input,
00142 double *output,
00143 int64_t current_position,
00144 int64_t fragment_size,
00145 int64_t total_len);
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156 void process_buffer(VFrame **frame,
00157 int64_t current_position,
00158 double frame_rate,
00159 int64_t total_len,
00160 int direction);
00161 void process_buffer(double **buffer,
00162 int64_t current_position,
00163 int64_t fragment_size,
00164 int64_t sample_rate,
00165 int64_t total_len,
00166 int direction);
00167
00168
00169 void send_render_gui(void *data);
00170 void send_render_gui(void *data, int size);
00171
00172 void render_gui(void *data);
00173 void render_gui(void *data, int size);
00174
00175
00176 int set_automation(FloatAutos *autos, FloatAuto **start_auto, FloatAuto **end_auto, int reverse);
00177
00178
00179
00180
00181 int arm_buffer(int buffer_number,
00182 int64_t in_fragment_position,
00183 int64_t out_fragment_position,
00184 int double_buffer_in,
00185 int double_buffer_out);
00186
00187 int detach_buffers();
00188
00189 int send_buffer_info();
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199 int start_loop(int64_t start, int64_t end, int64_t buffer_size, int total_buffers);
00200
00201 int process_loop(VFrame **buffers, int64_t &write_length);
00202 int process_loop(double **buffers, int64_t &write_length);
00203 int stop_loop();
00204
00205
00206
00207 int read_frame(VFrame *buffer,
00208 int channel,
00209 int64_t start_position);
00210 int read_samples(double *buffer,
00211 int channel,
00212 int64_t start_position,
00213 int64_t total_samples);
00214
00215
00216
00217
00218 int read_frame(VFrame *buffer,
00219 int channel,
00220 int64_t start_position,
00221 double frame_rate,
00222
00223 int use_opengl = 0);
00224 int read_samples(double *buffer,
00225 int channel,
00226 int64_t sample_rate,
00227 int64_t start_position,
00228 int64_t len);
00229
00230
00231 int get_parameters(int64_t start, int64_t end, int channels);
00232 int get_samplerate();
00233 double get_framerate();
00234 int get_project_samplerate();
00235 double get_project_framerate();
00236 int set_path(char *path);
00237
00238
00239 void set_mwindow(MWindow *mwindow);
00240
00241
00242 void set_attachmentpoint(AttachmentPoint *attachmentpoint);
00243
00244 void set_keyframe(KeyFrame *keyframe);
00245
00246 void set_prompt(MenuEffectPrompt *prompt);
00247 int set_interactive();
00248 int set_error();
00249 MainProgressBar* start_progress(char *string, int64_t length);
00250
00251
00252 void append_module(Module *module);
00253
00254 void append_node(VirtualNode *node);
00255
00256 void reset_nodes();
00257
00258 int64_t get_written_samples();
00259 int64_t get_written_frames();
00260
00261
00262
00263 int64_t out_buffer_size;
00264 int64_t in_buffer_size;
00265 int total_in_buffers;
00266 int total_out_buffers;
00267
00268
00269 ArrayList<int> ring_buffers_in;
00270 ArrayList<int> ring_buffers_out;
00271
00272 FloatAuto **start_auto, **end_auto;
00273 FloatAutos *autos;
00274 int reverse;
00275
00276
00277 ArrayList<int64_t> realtime_in_size;
00278 ArrayList<int64_t> realtime_out_size;
00279
00280
00281
00282 ArrayList<int64_t> offset_in_render;
00283 ArrayList<int64_t> offset_out_render;
00284 ArrayList<int64_t> double_buffer_in_render;
00285 ArrayList<int64_t> double_buffer_out_render;
00286
00287
00288 int shared_buffers;
00289
00290 int new_buffers;
00291
00292
00293 int plugin_open;
00294
00295 int realtime, multichannel, fileio;
00296
00297 int synthesis;
00298
00299 int audio, video, theme;
00300
00301 int uses_gui;
00302
00303 int transition;
00304
00305
00306 char *title;
00307 int64_t written_samples, written_frames;
00308 char *path;
00309 char *data_text;
00310 char *args[4];
00311 int total_args;
00312 int error_flag;
00313
00314
00315 ArrayList<Module*> *modules;
00316
00317
00318 ArrayList<VirtualNode*> *nodes;
00319 AttachmentPoint *attachmentpoint;
00320 MWindow *mwindow;
00321
00322 KeyFrame *keyframe;
00323 AttachmentPoint *attachment;
00324
00325 Plugin *plugin;
00326
00327
00328 EDL *edl;
00329 Preferences *preferences;
00330 MenuEffectPrompt *prompt;
00331 int gui_on;
00332
00333 VFrame *temp_frame;
00334
00335
00336 VFrame *picon;
00337
00338 private:
00339 int reset_parameters();
00340 int cleanup_plugin();
00341
00342
00343 PluginClient *client;
00344
00345
00346 void *plugin_fd;
00347
00348
00349 PluginClient* (*new_plugin)(PluginServer*);
00350
00351
00352 int is_lad;
00353 LADSPA_Descriptor_Function lad_descriptor_function;
00354 const LADSPA_Descriptor *lad_descriptor;
00355 int use_opengl;
00356
00357 VideoDevice *vdevice;
00358 };
00359
00360
00361 #endif