4 // inherited by plugins
8 #include "attachmentpoint.inc"
10 #include "floatauto.inc"
11 #include "floatautos.inc"
12 #include "keyframe.inc"
14 #include "mainprogress.inc"
15 #include "maxbuffers.h"
16 #include "menueffects.inc"
18 #include "mwindow.inc"
20 #include "pluginaclientlad.inc"
21 #include "pluginclient.inc"
22 #include "pluginserver.inc"
23 #include "preferences.inc"
28 #include "virtualnode.inc"
43 PluginServer(char *path
);
44 PluginServer(PluginServer
&);
45 virtual ~PluginServer();
48 friend class PluginAClientLAD
;
49 friend class PluginAClientConfig
;
50 friend class PluginAClientWindow
;
52 // open a plugin and wait for commands
53 // Get information for plugindb if master.
54 #define PLUGINSERVER_IS_LAD 2
55 #define PLUGINSERVER_NOT_RECOGNIZED 1
56 #define PLUGINSERVER_OK 0
57 int open_plugin(int master
,
58 Preferences
*preferences
,
61 int lad_index
/* = -1 */);
65 // get camera and projector autos
66 void get_camera(float *x
, float *y
, float *z
,
67 int64_t position
, int direction
);
68 void get_projector(float *x
, float *y
, float *z
,
69 int64_t position
, int direction
);
73 void set_title(char *string
);
74 // Generate title for display
75 void generate_display_title(char *string
);
76 // Get keyframes for configuration. Position is always relative to EDL rate.
77 KeyFrame
* get_prev_keyframe(int64_t position
);
78 KeyFrame
* get_next_keyframe(int64_t position
);
79 // Get interpolation used by EDL
80 int get_interpolation_type();
81 // Get or create keyframe for writing, depending on whether auto keyframes
82 // is enabled. Called by PluginClient::send_configure_change
83 KeyFrame
* get_keyframe();
84 // Create new theme object. Used by theme plugins.
86 // Get theme being used by Cinelerra currently. Used by all plugins.
92 // =============================== for realtime plugins
93 // save configuration of plugin
94 void save_data(KeyFrame
*keyframe
);
95 // Update EDL and playback engines to reflect changes
96 void sync_parameters();
97 // set for realtime processor usage
98 int set_realtime_sched();
102 // cause the plugin to show the GUI
103 // Called by MWindow::show_plugin
105 // Update GUI with keyframe settings
108 void client_side_close();
111 // set the string that appears on the plugin title
112 int set_string(char *string
);
113 // give the buffers and sizes and prepare processing realtime data
114 int init_realtime(int realtime_sched
,
115 int total_in_buffers
,
117 // process the data in the buffers
118 // Really process_realtime replaced by pull method but still needed for transitions
119 // input - the current edit's data
120 // output - the previous edit's data and the destination of the transition output
121 // current_position - Position from start of the transition and
122 // relative to the transition.
123 // total_len - total len for transition
124 void process_transition(VFrame
*input
,
126 int64_t current_position
,
128 void process_transition(double *input
,
130 int64_t current_position
,
131 int64_t fragment_size
,
134 // Process using pull method.
135 // current_position - start of region if forward, end of region if reverse
136 // relative to requested rate
137 // fragment_size - amount of data to put in buffer relative to requested rate
138 // sample_rate - sample rate of requested output
139 // frame_rate - frame rate of requested output
140 // total_len - length of plugin in track units relative to the EDL rate
141 // Units are kept relative to the EDL rate so plugins don't need to convert rates
142 // to get the keyframes.
143 void process_buffer(VFrame
**frame
,
144 int64_t current_position
,
148 void process_buffer(double **buffer
,
149 int64_t current_position
,
150 int64_t fragment_size
,
155 // Called by rendering client to cause the GUI to display something with the data.
156 void send_render_gui(void *data
);
157 void send_render_gui(void *data
, int size
);
158 // Called by MWindow to cause GUI to display
159 void render_gui(void *data
);
160 void render_gui(void *data
, int size
);
162 // Send the boundary autos of the next fragment
163 int set_automation(FloatAutos
*autos
, FloatAuto
**start_auto
, FloatAuto
**end_auto
, int reverse
);
167 // set the fragment position of a buffer before rendering
168 int arm_buffer(int buffer_number
,
169 int64_t in_fragment_position
,
170 int64_t out_fragment_position
,
171 int double_buffer_in
,
172 int double_buffer_out
);
173 // Detach all the shared buffers.
174 int detach_buffers();
176 int send_buffer_info();
184 // ============================ for non realtime plugins
185 // start processing data in plugin
186 int start_loop(int64_t start
, int64_t end
, int64_t buffer_size
, int total_buffers
);
187 // Do one iteration of a nonrealtime plugin and return if finished
188 int process_loop(VFrame
**buffers
, int64_t &write_length
);
189 int process_loop(double **buffers
, int64_t &write_length
);
193 // Called by client to read data in non-realtime effect
194 int read_frame(VFrame
*buffer
,
196 int64_t start_position
);
197 int read_samples(double *buffer
,
199 int64_t start_position
,
200 int64_t total_samples
);
203 // Called by client to read data in realtime effect. Returns -1 if error or 0
205 int read_frame(VFrame
*buffer
,
207 int64_t start_position
,
209 int read_samples(double *buffer
,
212 int64_t start_position
,
215 // For non realtime, prompt user for parameters, waits for plugin to finish and returns a result
216 int get_parameters(int64_t start
, int64_t end
, int channels
);
217 int get_samplerate(); // get samplerate produced by plugin
218 double get_framerate(); // get framerate produced by plugin
219 int get_project_samplerate(); // get samplerate of project data before processing
220 double get_project_framerate(); // get framerate of project data before processing
221 int set_path(char *path
); // required first
222 // Used by PluginArray and MenuEffects to get user parameters and progress bar.
223 // Set pointer to mwindow for opening GUI and reconfiguring EDL.
224 void set_mwindow(MWindow
*mwindow
);
225 // Used in VirtualConsole
226 // Set pointer to AttachmentPoint to render GUI.
227 void set_attachmentpoint(AttachmentPoint
*attachmentpoint
);
228 // Set pointer to a default keyframe when there is no plugin
229 void set_keyframe(KeyFrame
*keyframe
);
230 // Set pointer to menueffect window
231 void set_prompt(MenuEffectPrompt
*prompt
);
232 int set_interactive(); // make this the master plugin for progress bars
233 int set_error(); // flag to send plugin an error on next request
234 MainProgressBar
* start_progress(char *string
, int64_t length
);
236 // add track to the list of affected tracks for a non realtime plugin
237 void append_module(Module
*module
);
238 // add node for realtime plugin
239 void append_node(VirtualNode
*node
);
240 // reset node table after virtual console reconfiguration
243 int64_t get_written_samples(); // after samples are written, get the number written
244 int64_t get_written_frames(); // after frames are written, get the number written
248 int64_t out_buffer_size
; // size of a send buffer to the plugin
249 int64_t in_buffer_size
; // size of a recieve buffer from the plugin
250 int total_in_buffers
;
251 int total_out_buffers
;
253 // number of double buffers for each channel
254 ArrayList
<int> ring_buffers_in
;
255 ArrayList
<int> ring_buffers_out
;
256 // Parameters for automation. Setting autos to 0 disables automation.
257 FloatAuto
**start_auto
, **end_auto
;
261 // size of each buffer
262 ArrayList
<int64_t> realtime_in_size
;
263 ArrayList
<int64_t> realtime_out_size
;
265 // When arming buffers need to know the offsets in all the buffers and which
266 // double buffers for each channel before rendering.
267 ArrayList
<int64_t> offset_in_render
;
268 ArrayList
<int64_t> offset_out_render
;
269 ArrayList
<int64_t> double_buffer_in_render
;
270 ArrayList
<int64_t> double_buffer_out_render
;
272 // don't delete buffers if they belong to a virtual module
274 // Send new buffer information for next render
278 int plugin_open
; // Whether or not the plugin is open.
279 // Specifies what type of plugin.
280 int realtime
, multichannel
, fileio
;
281 // Plugin generates media
283 // What data types the plugin can handle. One of these is set.
284 int audio
, video
, theme
;
287 // Plugin is a transition
289 // name of plugin in english. Compared against the title value in the plugin.
291 int64_t written_samples
, written_frames
;
292 char *path
; // location of plugin on disk
293 char *data_text
; // pointer to the data that was requested by a save_data command
296 int error_flag
; // send plugin an error code on next request
297 // Pointers to tracks affected by this plugin during a non realtime operation.
298 // Allows read functions to read data.
299 ArrayList
<Module
*> *modules
;
300 // Used by realtime read functions to get data. Corresponds to the buffer table in the
302 ArrayList
<VirtualNode
*> *nodes
;
303 AttachmentPoint
*attachmentpoint
;
305 // Pointer to keyframe when plugin is not available
307 AttachmentPoint
*attachment
;
308 // Storage of keyframes and GUI status
311 // Storage of session parameters
313 Preferences
*preferences
;
314 MenuEffectPrompt
*prompt
;
319 // Icon for Asset Window
323 int reset_parameters();
324 int cleanup_plugin();
326 // Base class created by client
327 PluginClient
*client
;
328 // Handle from dlopen. Plugins are opened once at startup and stored in the master
331 // If no path, this is going to be set to a function which
332 // instantiates the plugin.
333 PluginClient
* (*new_plugin
)(PluginServer
*);
337 LADSPA_Descriptor_Function lad_descriptor_function
;
338 const LADSPA_Descriptor
*lad_descriptor
;