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