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 */);
68 void set_title(char *string
);
69 // Generate title for display
70 void generate_display_title(char *string
);
71 // Get keyframes for configuration. Position is always relative to EDL rate.
72 KeyFrame
* get_prev_keyframe(int64_t position
);
73 KeyFrame
* get_next_keyframe(int64_t position
);
74 // Get interpolation used by EDL
75 int get_interpolation_type();
76 // Get or create keyframe for writing, depending on whether auto keyframes
77 // is enabled. Called by PluginClient::send_configure_change
78 KeyFrame
* get_keyframe();
79 // Create new theme object. Used by theme plugins.
81 // Get theme being used by Cinelerra currently. Used by all plugins.
87 // =============================== for realtime plugins
88 // save configuration of plugin
89 void save_data(KeyFrame
*keyframe
);
90 // Update EDL and playback engines to reflect changes
91 void sync_parameters();
92 // set for realtime processor usage
93 int set_realtime_sched();
97 // cause the plugin to show the GUI
98 // Called by MWindow::show_plugin
100 // Update GUI with keyframe settings
103 void client_side_close();
106 // set the string that appears on the plugin title
107 int set_string(char *string
);
108 // give the buffers and sizes and prepare processing realtime data
109 int init_realtime(int realtime_sched
,
110 int total_in_buffers
,
112 // process the data in the buffers
113 // Really process_realtime replaced by pull method but still needed for transitions
114 // input - the current edit's data
115 // output - the previous edit's data and the destination of the transition output
116 // current_position - Position from start of the transition and
117 // relative to the transition.
118 // total_len - total len for transition
119 void process_transition(VFrame
*input
,
121 int64_t current_position
,
123 void process_transition(double *input
,
125 int64_t current_position
,
126 int64_t fragment_size
,
129 // Process using pull method.
130 // current_position - start of region if forward, end of region if reverse
131 // relative to requested rate
132 // fragment_size - amount of data to put in buffer relative to requested rate
133 // sample_rate - sample rate of requested output
134 // frame_rate - frame rate of requested output
135 // total_len - length of plugin in track units relative to the EDL rate
136 // Units are kept relative to the EDL rate so plugins don't need to convert rates
137 // to get the keyframes.
138 void process_buffer(VFrame
**frame
,
139 int64_t current_position
,
143 void process_buffer(double **buffer
,
144 int64_t current_position
,
145 int64_t fragment_size
,
150 // Called by rendering client to cause the GUI to display something with the data.
151 void send_render_gui(void *data
);
152 void send_render_gui(void *data
, int size
);
153 // Called by MWindow to cause GUI to display
154 void render_gui(void *data
);
155 void render_gui(void *data
, int size
);
157 // Send the boundary autos of the next fragment
158 int set_automation(FloatAutos
*autos
, FloatAuto
**start_auto
, FloatAuto
**end_auto
, int reverse
);
162 // set the fragment position of a buffer before rendering
163 int arm_buffer(int buffer_number
,
164 int64_t in_fragment_position
,
165 int64_t out_fragment_position
,
166 int double_buffer_in
,
167 int double_buffer_out
);
168 // Detach all the shared buffers.
169 int detach_buffers();
171 int send_buffer_info();
179 // ============================ for non realtime plugins
180 // start processing data in plugin
181 int start_loop(int64_t start
, int64_t end
, int64_t buffer_size
, int total_buffers
);
182 // Do one iteration of a nonrealtime plugin and return if finished
183 int process_loop(VFrame
**buffers
, int64_t &write_length
);
184 int process_loop(double **buffers
, int64_t &write_length
);
188 // Called by client to read data in non-realtime effect
189 int read_frame(VFrame
*buffer
,
191 int64_t start_position
);
192 int read_samples(double *buffer
,
194 int64_t start_position
,
195 int64_t total_samples
);
198 // Called by client to read data in realtime effect. Returns -1 if error or 0
200 int read_frame(VFrame
*buffer
,
202 int64_t start_position
,
204 int read_samples(double *buffer
,
207 int64_t start_position
,
210 // For non realtime, prompt user for parameters, waits for plugin to finish and returns a result
211 int get_parameters(int64_t start
, int64_t end
, int channels
);
212 int get_samplerate(); // get samplerate produced by plugin
213 double get_framerate(); // get framerate produced by plugin
214 int get_project_samplerate(); // get samplerate of project data before processing
215 double get_project_framerate(); // get framerate of project data before processing
216 int set_path(char *path
); // required first
217 // Used by PluginArray and MenuEffects to get user parameters and progress bar.
218 // Set pointer to mwindow for opening GUI and reconfiguring EDL.
219 void set_mwindow(MWindow
*mwindow
);
220 // Used in VirtualConsole
221 // Set pointer to AttachmentPoint to render GUI.
222 void set_attachmentpoint(AttachmentPoint
*attachmentpoint
);
223 // Set pointer to a default keyframe when there is no plugin
224 void set_keyframe(KeyFrame
*keyframe
);
225 // Set pointer to menueffect window
226 void set_prompt(MenuEffectPrompt
*prompt
);
227 int set_interactive(); // make this the master plugin for progress bars
228 int set_error(); // flag to send plugin an error on next request
229 MainProgressBar
* start_progress(char *string
, int64_t length
);
231 // add track to the list of affected tracks for a non realtime plugin
232 void append_module(Module
*module
);
233 // add node for realtime plugin
234 void append_node(VirtualNode
*node
);
235 // reset node table after virtual console reconfiguration
238 int64_t get_written_samples(); // after samples are written, get the number written
239 int64_t get_written_frames(); // after frames are written, get the number written
243 int64_t out_buffer_size
; // size of a send buffer to the plugin
244 int64_t in_buffer_size
; // size of a recieve buffer from the plugin
245 int total_in_buffers
;
246 int total_out_buffers
;
248 // number of double buffers for each channel
249 ArrayList
<int> ring_buffers_in
;
250 ArrayList
<int> ring_buffers_out
;
251 // Parameters for automation. Setting autos to 0 disables automation.
252 FloatAuto
**start_auto
, **end_auto
;
256 // size of each buffer
257 ArrayList
<int64_t> realtime_in_size
;
258 ArrayList
<int64_t> realtime_out_size
;
260 // When arming buffers need to know the offsets in all the buffers and which
261 // double buffers for each channel before rendering.
262 ArrayList
<int64_t> offset_in_render
;
263 ArrayList
<int64_t> offset_out_render
;
264 ArrayList
<int64_t> double_buffer_in_render
;
265 ArrayList
<int64_t> double_buffer_out_render
;
267 // don't delete buffers if they belong to a virtual module
269 // Send new buffer information for next render
273 int plugin_open
; // Whether or not the plugin is open.
274 // Specifies what type of plugin.
275 int realtime
, multichannel
, fileio
;
276 // Plugin generates media
278 // What data types the plugin can handle. One of these is set.
279 int audio
, video
, theme
;
282 // Plugin is a transition
284 // name of plugin in english. Compared against the title value in the plugin.
286 int64_t written_samples
, written_frames
;
287 char *path
; // location of plugin on disk
288 char *data_text
; // pointer to the data that was requested by a save_data command
291 int error_flag
; // send plugin an error code on next request
292 // Pointers to tracks affected by this plugin during a non realtime operation.
293 // Allows read functions to read data.
294 ArrayList
<Module
*> *modules
;
295 // Used by realtime read functions to get data. Corresponds to the buffer table in the
297 ArrayList
<VirtualNode
*> *nodes
;
298 AttachmentPoint
*attachmentpoint
;
300 // Pointer to keyframe when plugin is not available
302 AttachmentPoint
*attachment
;
303 // Storage of keyframes and GUI status
306 // Storage of session parameters
308 Preferences
*preferences
;
309 MenuEffectPrompt
*prompt
;
314 // Icon for Asset Window
318 int reset_parameters();
319 int cleanup_plugin();
321 // Base class created by client
322 PluginClient
*client
;
323 // Handle from dlopen. Plugins are opened once at startup and stored in the master
326 // If no path, this is going to be set to a function which
327 // instantiates the plugin.
328 PluginClient
* (*new_plugin
)(PluginServer
*);
332 LADSPA_Descriptor_Function lad_descriptor_function
;
333 const LADSPA_Descriptor
*lad_descriptor
;