new/reworked audio plugins ported from hv72 compressor/multi/reverb, glyph workaround...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / mwindow.h
1 /*
2  * CINELERRA
3  * Copyright (C) 1997-2014 Adam Williams <broadcast at earthling dot net>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  *
19  */
20
21 #ifndef MWINDOW_H
22 #define MWINDOW_H
23
24 #include <stdio.h>
25 #include <stdint.h>
26
27 #include "apatchgui.h"
28 #include "arraylist.h"
29 #include "asset.inc"
30 #include "assets.inc"
31 #include "audiodevice.inc"
32 #include "autos.inc"
33 #include "awindow.inc"
34 #include "batchrender.inc"
35 #include "bcwindowbase.inc"
36 #include "bdcreate.inc"
37 #include "brender.inc"
38 #include "cache.inc"
39 #include "channel.inc"
40 #include "channeldb.inc"
41 #include "commercials.inc"
42 #include "convert.inc"
43 #include "cwindow.inc"
44 #include "bchash.inc"
45 #include "devicedvbinput.inc"
46 #include "devicempeginput.inc"
47 #include "dvdcreate.inc"
48 #include "edit.inc"
49 #include "edl.inc"
50 #include "edlsession.inc"
51 #include "exportedl.inc"
52 #include "filesystem.inc"
53 #include "filexml.inc"
54 #include "framecache.inc"
55 #include "gwindow.inc"
56 #include "indexable.inc"
57 #include "keyframegui.inc"
58 #include "levelwindow.inc"
59 #include "loadmode.inc"
60 #include "mainerror.inc"
61 #include "mainindexes.inc"
62 #include "mainprogress.inc"
63 #include "mainsession.inc"
64 #include "mainundo.inc"
65 #include "maxchannels.h"
66 #include "mixersalign.inc"
67 #include "mutex.inc"
68 #include "mwindow.inc"
69 #include "mwindowgui.inc"
70 #include "new.inc"
71 #include "patchbay.inc"
72 #include "playback3d.inc"
73 #include "playbackengine.inc"
74 #include "plugin.inc"
75 #include "pluginclient.inc"
76 #include "pluginfclient.inc"
77 #include "pluginserver.inc"
78 #include "pluginset.inc"
79 #include "preferences.inc"
80 #include "preferencesthread.inc"
81 #include "proxy.inc"
82 #include "record.inc"
83 #include "recordlabel.inc"
84 #include "render.inc"
85 #include "sharedlocation.inc"
86 #include "sighandler.inc"
87 #include "splashgui.inc"
88 #include "shuttle.inc"
89 #include "theme.inc"
90 #include "thread.h"
91 #include "threadloader.inc"
92 #include "timebar.inc"
93 #include "tipwindow.inc"
94 #include "track.inc"
95 #include "tracking.inc"
96 #include "tracks.inc"
97 #include "transition.inc"
98 #include "transportque.inc"
99 #include "videowindow.inc"
100 #include "vpatchgui.h"
101 #include "vwindow.inc"
102 #include "zwindow.inc"
103 #include "wwindow.inc"
104 #include "wavecache.inc"
105
106 #define FONT_SEARCHPATH "fonts"
107
108
109 class MWindow : public Thread
110 {
111 public:
112         MWindow();
113         ~MWindow();
114
115 // ======================================== initialization commands
116         void create_objects(int want_gui,
117                 int want_new,
118                 char *config_path);
119         int uses_opengl();
120         void show_splash();
121         void hide_splash();
122         void start();
123         void run();
124
125         int run_script(FileXML *script);
126         int new_project();
127         int delete_project(int flash = 1);
128         void quit();
129         int restart() { return restart_status; }
130
131         int load_defaults();
132         int save_defaults();
133         int set_filename(const char *filename);
134 // Total vertical pixels in timeline
135         int get_tracks_height();
136 // Total horizontal pixels in timeline
137         int get_tracks_width();
138 // Show windows
139         void show_vwindow();
140         void show_awindow();
141         void show_lwindow();
142         void show_cwindow();
143         void show_gwindow();
144         void hide_gwindow();
145         void restore_windows();
146         void load_layout(const char *layout);
147         void save_layout(const char *layout);
148         void delete_layout(const char *layout);
149         int tile_windows(int window_config);
150         char *get_cwindow_display();
151         void set_screens(int value);
152         int asset_to_edl(EDL *new_edl,
153                 Asset *new_asset,
154                 RecordLabels *labels = 0);
155
156 // Entry point to insert assets and insert edls.  Called by TrackCanvas
157 // and AssetPopup when assets are dragged in from AWindow.
158 // Takes the drag vectors from MainSession and
159 // pastes either assets or clips depending on which is full.
160 // Returns 1 if the vectors were full
161         int paste_assets(double position, Track *dest_track, int overwrite);
162
163 // Insert the assets at a point in the EDL.  Called by menueffects,
164 // render, and CWindow drop but recording calls paste_edls directly for
165 // labels.
166         void load_assets(ArrayList<Indexable*> *new_assets,
167                 double position,
168                 int load_mode,
169                 Track *first_track /* = 0 */,
170                 RecordLabels *labels /* = 0 */,
171                 int edit_labels,
172                 int edit_plugins,
173                 int edit_autos,
174                 int overwrite);
175         int paste_edls(ArrayList<EDL*> *new_edls,
176                 int load_mode,
177                 Track *first_track /* = 0 */,
178                 double current_position /* = -1 */,
179                 int edit_labels,
180                 int edit_plugins,
181                 int edit_autos,
182                 int overwrite);
183 // Reset everything for a load
184         void update_project(int load_mode);
185         void update_preferences(Preferences *prefs);
186         void update_vwindow();
187 // Fit selected time to horizontal display range
188         void fit_selection();
189 // Fit selected autos to the vertical display range
190         void fit_autos(int all);
191         void change_currentautorange(int autogrouptype, int increment, int changemax);
192         void expand_autos(int changeall, int domin, int domax);
193         void shrink_autos(int changeall, int domin, int domax);
194 // move the window to include the cursor
195         void find_cursor();
196 // Search plugindb and put results in argument
197         static void search_plugindb(int do_audio,
198                 int do_video,
199                 int is_realtime,
200                 int is_transition,
201                 int is_theme,
202                 ArrayList<PluginServer*> &results);
203 // Find the plugin whose title matches title and return it
204         static PluginServer* scan_plugindb(char *title,
205                 int data_type);
206         static void fix_plugin_title(char *title);
207         static int plugin_exists(const char *plugin_path, ArrayList<PluginServer*> &plugins);
208         static int plugin_exists(char *plugin_path);
209         void dump_plugindb(FILE *fp);
210         void stop_playback(int wait);
211         void stop_transport();
212         void undo_before(const char *description = "", void *creator = 0);
213         void undo_after(const char *description, uint32_t load_flags, int changes_made = 1);
214
215         void handle_mixers(EDL *edl, int command, int wait_tracking,
216                 int use_inout, int toggle_audio, int loop_play, float speed);
217         ZWindow *create_mixer(Indexable *indexable, double position);
218         void create_mixers(double position = 0);
219         void refresh_mixers(int dir=1);
220         void stop_mixers();
221         void close_mixers(int destroy=1);
222         void open_mixers();
223         ZWindow *get_mixer(Mixer *&mixer);
224         void del_mixer(ZWindow *zwindow);
225         int mixer_track_active(Track *track);
226         void update_mixer_tracks();
227         void start_mixer();
228         int select_zwindow(ZWindow *zwindow);
229         void tile_mixers();
230         int load_filenames(ArrayList<char*> *filenames,
231                 int load_mode = LOADMODE_REPLACE,
232 // Cause the project filename on the top of the window to be updated.
233 // Not wanted for loading backups.
234                 int update_filename = 1);
235
236 // Print out plugins which are referenced in the EDL but not loaded.
237         void test_plugins(EDL *new_edl, char *path);
238
239         int interrupt_indexes();  // Stop index building
240
241         int redraw_time_dependancies();     // after reconfiguring the time format, sample rate, frame rate
242
243 // =========================================== movement
244
245         void next_time_format();
246         void prev_time_format();
247         void time_format_common();
248         int reposition_timebar(int new_pixel, int new_height);
249         int expand_sample();
250         int zoom_in_sample();
251         int zoom_sample(int64_t zoom_sample);
252         void zoom_autos(float min, float max);
253         void zoom_amp(int64_t zoom_amp);
254         void zoom_track(int64_t zoom_track);
255         int fit_sample();
256         int move_left(int64_t distance = 0);
257         int move_right(int64_t distance = 0);
258         void move_up(int64_t distance = 0);
259         void move_down(int64_t distance = 0);
260         int find_selection(double position, int scroll_display = 0);
261         void toggle_camera_xyz();
262         void toggle_projector_xyz();
263         double get_position();
264         void set_position(double position);
265
266 // seek to labels
267 // shift_down must be passed by the caller because different windows call
268 // into this
269         int next_label(int shift_down);
270         int prev_label(int shift_down);
271 // seek to edit handles
272         int next_edit_handle(int shift_down);
273         int prev_edit_handle(int shift_down);
274 // seek to keyframes
275         int nearest_plugin_keyframe(int shift_down, int dir);
276 // offset is pixels to add to track_start
277         void trackmovement(int offset, int pane_number);
278 // view_start is pixels
279         int samplemovement(int64_t view_start, int pane_number);
280         void select_all();
281         int goto_start();
282         int goto_end();
283         int goto_position(double position);
284         int expand_y();
285         int zoom_in_y();
286         int expand_t();
287         int zoom_in_t();
288         void split_x();
289         void split_y();
290         void crop_video(int mode);
291         void update_plugins();
292 // Call after every edit operation
293         void save_backup();
294         void load_backup();
295         void show_plugin(Plugin *plugin);
296         void hide_plugin(Plugin *plugin, int lock);
297         void hide_plugins();
298         void delete_plugin(PluginServer *plugin);
299 // Update plugins with configuration changes.
300 // Called by TrackCanvas::cursor_motion_event.
301         void update_plugin_guis(int do_keyframe_guis = 1);
302         void update_plugin_states();
303         void update_plugin_titles();
304 // Called by Attachmentpoint during playback.
305 // Searches for matching plugin and renders data in it.
306         void render_plugin_gui(void *data, Plugin *plugin);
307         void render_plugin_gui(void *data, int size, Plugin *plugin);
308         void reset_plugin_gui_frames(Plugin *plugin);
309         void render_plugin_gui_frames(PluginClientFrames *frames, Plugin *plugin);
310         double get_tracking_position();
311         int get_tracking_direction();
312
313 // Called from PluginVClient::process_buffer
314 // Returns 1 if a GUI for the plugin is open so OpenGL routines can determine if
315 // they can run.
316         int plugin_gui_open(Plugin *plugin);
317
318         void show_keyframe_gui(Plugin *plugin);
319         void hide_keyframe_guis();
320         void hide_keyframe_gui(Plugin *plugin);
321         void update_keyframe_guis();
322         int get_hash_color(Edit *edit);
323         int get_hash_color(int v);
324         int get_group_color(int v);
325         int get_title_color(Edit *edit);
326
327 // ============================= editing commands ========================
328
329 // Map each recordable audio track to the desired pattern
330         void map_audio(int pattern);
331         void remap_audio(int pattern);
332         enum
333         {
334                 AUDIO_5_1_TO_2,
335                 AUDIO_1_TO_1
336         };
337         void add_audio_track_entry(int above, Track *dst);
338         int add_audio_track(int above, Track *dst);
339         void add_clip_to_edl(EDL *edl);
340         void add_video_track_entry(Track *dst = 0);
341         int add_video_track(int above, Track *dst);
342         void add_subttl_track_entry(Track *dst = 0);
343         int add_subttl_track(int above, Track *dst);
344
345         void asset_to_all();
346         void asset_to_size();
347         void asset_to_rate();
348 // Entry point for clear operations.
349         void clear_entry();
350 // Clears active region in EDL.
351 // If clear_handle, edit boundaries are cleared if the range is 0.
352 // Called by paste, record, menueffects, render, and CWindow drop.
353         void clear(int clear_handle);
354         void clear_labels();
355         int clear_labels(double start, double end);
356         void clear_hard_edges();
357         int clear_hard_edges(double start, double end);
358         void clear_select();
359         void concatenate_tracks();
360         int copy_flags(int copy_flags=COPY_CLIPBOARD);
361         void copy();
362         int copy(double start, double end);
363         void cut();
364         void blade(double position);
365         void cut(double start, double end, double new_position=-1);
366 // cut edit from current position to handle/label
367         void cut_left_edit();
368         void cut_right_edit();
369         void cut_left_label();
370         void cut_right_label();
371
372 // Calculate aspect ratio from pixel counts
373         static int create_aspect_ratio(float &w, float &h, int width, int height);
374 // Calculate defaults path
375         static void create_defaults_path(char *string, const char *config_file);
376
377         void delete_track(Track *track);
378         void delete_tracks();
379         int feather_edits(int64_t feather_samples, int audio, int video);
380         int64_t get_feather(int audio, int video);
381         float get_aspect_ratio();
382         void insert(double position, FileXML *file,
383                 int edit_labels, int edit_plugins, int edit_autos,
384                 EDL *parent_edl, Track *first_track, int overwrite);
385
386 // TrackCanvas calls this to insert multiple effects from the drag_pluginservers
387 // into pluginset_highlighted.
388         void insert_effects_canvas(double start, double length);
389
390 // CWindow calls this to insert multiple effects from
391 // the drag_pluginservers array.
392         void insert_effects_cwindow(Track *dest_track);
393
394 // Attach new effect to all recordable tracks
395 // single_standalone - attach 1 standalone on the first track and share it with
396 // other tracks
397         void insert_effect(char *title,
398                 SharedLocation *shared_location,
399                 int data_type, int plugin_type, int single_standalone);
400
401 // This is called multiple times by the above functions.
402 // It can't sync parameters.
403         void insert_effect(char *title,
404                 SharedLocation *shared_location,
405                 Track *track, PluginSet *plugin_set,
406                 double start, double length, int plugin_type);
407
408         void match_output_size(Track *track);
409         void delete_edit(Edit *edit, const char *msg, int collapse=0);
410         void delete_edits(ArrayList<Edit*> *edits, const char *msg, int collapse=0);
411         void delete_edits(int collapse=0);
412         void cut_selected_edits(int collapse, int packed);
413 // Move edit to new position
414         void move_edits(ArrayList<Edit*> *edits, Track *track, double position,
415                 int mode); // mode: 0 - mute and overwrite,  1 - cut and paste
416         void selected_edits_to_clipboard(int packed);
417         void paste_clipboard(Track *first_track, double position, int overwrite,
418                 int edit_edits, int edit_labels, int edit_autos, int edit_plugins);
419         void move_group(EDL *group, Track *first_track, double position, int overwrite);
420 // Move effect to position
421         void move_effect(Plugin *plugin, Track *track, int64_t position);
422         void move_effect(Plugin *plugin, PluginSet *plugin_set, int64_t position);
423         void move_plugins_up(PluginSet *plugin_set);
424         void move_plugins_down(PluginSet *plugin_set);
425         void move_track_down(Track *track);
426         void move_tracks_down();
427         void move_track_up(Track *track);
428         void move_tracks_up();
429         void mute_selection();
430         void new_folder(const char *new_folder, int is_clips);
431         void delete_folder(char *folder);
432 // For clipboard commands
433         void paste();
434         void paste(double start, Track *first_track, int clear_selection, int overwrite);
435 // For splice and overwrite
436         void overwrite(EDL *source, int all);
437         void splice(EDL *source, int all);
438         int paste(double start, double end, FileXML *file,
439                 int edit_labels, int edit_plugins, int edit_autos,
440                 Track *first_track, int overwrite);
441         int paste_output(int64_t startproject, int64_t endproject,
442                 int64_t startsource_sample, int64_t endsource_sample,
443                 int64_t startsource_frame, int64_t endsource_frame,
444                 Asset *asset, RecordLabels *new_labels);
445         void paste_silence();
446
447 // Detach single transition
448         void detach_transition(Transition *transition);
449 // Detach all transitions in selection
450         void detach_transitions();
451 // Attach dragged transition
452         void paste_transition();
453 // Attach transition to all edits in selection
454         void paste_transitions(int track_type, char *title);
455 // Attach transition dragged onto CWindow
456         void paste_transition_cwindow(Track *dest_track);
457 // Attach default transition to single edit
458         void paste_audio_transition();
459         void paste_video_transition();
460         void shuffle_edits();
461         void reverse_edits();
462         void align_edits();
463         void set_edit_length(double length);
464 // Set length of single transition
465         void set_transition_length(Transition *transition, double length);
466 // Set length in seconds of all transitions in active range
467         void set_transition_length(double length);
468
469         void remove_indexfile(Indexable *indexable);
470         void rebuild_indices();
471 // Asset removal from caches
472         void reset_caches();
473         void remove_asset_from_caches(Asset *asset);
474         void remove_assets_from_project(int push_undo, int redraw, int delete_indexes,
475                 ArrayList<Indexable*> *drag_assets /* mwindow->session->drag_assets */,
476                 ArrayList<EDL*> *drag_clips /* mwindow->session->drag_clips */);
477         void remove_assets_from_disk();
478         void resize_track(Track *track, int w, int h);
479
480         void set_automation_mode(int mode);
481         void set_keyframe_type(int mode);
482         void set_auto_keyframes(int value);
483         void set_span_keyframes(int value);
484         void set_auto_visibility(Autos *autos, int value);
485         void set_labels_follow_edits(int value);
486
487 // Update the editing mode
488         int set_editing_mode(int new_editing_mode);
489         void toggle_editing_mode();
490         void set_inpoint();
491         void set_outpoint();
492         void unset_inoutpoint();
493         void toggle_loop_playback();
494         void trim_selection();
495 // Synchronize EDL settings with all playback engines depending on current
496 // operation.  Doesn't redraw anything.
497         void sync_parameters(int change_type = CHANGE_PARAMS);
498         void save_clip(EDL *new_edl, const char *txt);
499         void to_clip(EDL *edl, const char *txt, int all);
500         int toggle_label();
501         void undo_entry(BC_WindowBase *calling_window_gui);
502         void redo_entry(BC_WindowBase *calling_window_gui);
503         void save_undo_data();
504         void load_undo_data();
505         int copy_target(const char *path, const char *target);
506         int link_target(const char *real_path, const char *link_path, int relative);
507         void save_project(const char *dir, int save_mode, int overwrite, int reload);
508
509         int cut_automation();
510         int copy_automation();
511         int paste_automation();
512         void clear_automation();
513         int cut_default_keyframe();
514         int copy_default_keyframe();
515 // Use paste_automation to paste the default keyframe in other position.
516 // Use paste_default_keyframe to replace the default keyframe with whatever is
517 // in the clipboard.
518         int paste_default_keyframe();
519         int clear_default_keyframe();
520
521         FloatAuto* get_float_auto(PatchGUI *patch,int idx);
522         IntAuto* get_int_auto(PatchGUI *patch,int idx);
523         PanAuto* get_pan_auto(PatchGUI *patch);
524         PatchGUI *get_patchgui(Track *track);
525
526         int modify_edithandles();
527         int modify_pluginhandles();
528         void finish_modify_handles();
529         void rescale_proxy(EDL *clip, int orig_scale, int new_scale);
530         void add_proxy(ArrayList<Indexable*> *orig_assets,
531                         ArrayList<Indexable*> *proxy_assets);
532         int render_proxy(ArrayList<Indexable *> &new_idxbls);
533         void beep(double freq, double secs, double gain);
534         int enable_proxy();
535         int disable_proxy();
536         int to_proxy(Asset *asset, int new_scale, int new_use_scaler);
537         ProxyBeep *proxy_beep;
538
539         void dump_plugins(FILE *fp=stdout);
540         void dump_edl(FILE *fp=stdout);
541         void dump_undo(FILE *fp=stdout);
542         void dump_exe(FILE *fp=stdout);
543         static void trap_hook(FILE *fp, void *vp);
544
545         void reset_android_remote();
546
547 // Send new EDL to caches
548         void age_caches();
549         int optimize_assets();            // delete unused assets from the cache and assets
550 // render edl assets to specified format, then replace in edl
551         void start_convert(Asset *format_asset, const char *suffix,
552                         float beep, int remove_originals);
553         void finish_convert(int remove_originals);
554         ConvertRender *convert_render;
555
556         void select_point(double position);
557         int set_loop_boundaries();         // toggle loop playback and set boundaries for loop playback
558
559
560         Playback3D *playback_3d;
561         SplashGUI *splash_window;
562
563 // Main undo stack
564         MainUndo *undo;
565         int undo_command;
566
567         BC_Hash *defaults;
568         Assets *assets;
569 // CICaches for drawing timeline only
570         CICache *audio_cache, *video_cache;
571 // Frame cache for drawing timeline only.
572 // Cache drawing doesn't wait for file decoding.
573         FrameCache *frame_cache;
574         WaveCache *wave_cache;
575         Preferences *preferences;
576         PreferencesThread *preferences_thread;
577         MainSession *session;
578         Theme *theme;
579         MainIndexes *mainindexes;
580         MainProgress *mainprogress;
581         BRender *brender;
582         char cin_lang[4];
583         int brender_active;
584         const char *default_standard;
585         static Commercials *commercials;
586         int commercial_active;
587         int has_commercials();
588 // copy of edl created in speed_before, used in speed_after to normalize_speed
589         EDL *speed_edl;
590
591 // Menu items
592         ArrayList<ColormodelItem*> colormodels;
593         ArrayList<InterlacemodeItem*>          interlace_project_modes;
594         ArrayList<InterlacemodeItem*>          interlace_asset_modes;
595
596         int reset_meters();
597         void resync_guis();
598
599         int select_asset(Asset *asset, int vstream, int astream, int delete_tracks);
600         int select_asset(int vtrack, int delete_tracks);
601
602 // Channel DB for playback only.  Record channel DB's are in record.C
603         ChannelDB *channeldb_buz;
604         ChannelDB *channeldb_v4l2jpeg;
605
606 // ====================================== plugins ==============================
607
608 // Contains file descriptors for all the dlopens
609         static ArrayList<PluginServer*> *plugindb;
610 // Currently visible plugins
611         int64_t plugin_visibility;
612         PluginGUIs *plugin_guis;
613 // GUI Plugins to delete
614         ArrayList<PluginServer*> *dead_plugins;
615 // Keyframe editors
616         ArrayList<KeyFrameThread*> *keyframe_threads;
617
618 // Adjust sample position to line up with frames.
619         int fix_timing(int64_t &samples_out,
620                 int64_t &frames_out,
621                 int64_t samples_in);
622
623
624         CreateBD_Thread *create_bd;
625         CreateDVD_Thread *create_dvd;
626         BatchRenderThread *batch_render;
627         Render *render;
628
629         ExportEDL *exportedl;
630
631
632 // Master edl
633         EDL *edl;
634 // Main Window GUI
635         MWindowGUI *gui;
636 // Compositor
637         CWindow *cwindow;
638 // Viewer
639         Mutex *vwindows_lock;
640         ArrayList<VWindow*> vwindows;
641 // Mixer
642         Mutex *zwindows_lock;
643         ArrayList<ZWindow*> zwindows;
644         MixersAlign *mixers_align;
645
646 // Asset manager
647         AWindow *awindow;
648 // Automation window
649         GWindow *gwindow;
650 // Tip of the day
651         TipWindow *twindow;
652 // Warning window
653         WWindow *wwindow;
654         void show_warning(int *do_warning, const char *text);
655         int wait_warning();
656 // Levels
657         LevelWindow *lwindow;
658         Mutex *run_lock;
659 // Lock during creation and destruction of GUI
660         Mutex *plugin_gui_lock;
661         Mutex *dead_plugin_lock;
662         Mutex *keyframe_gui_lock;
663 // Lock during creation and destruction of brender so playback doesn't use it.
664         Mutex *brender_lock;
665 // Initialize shared memory
666         void init_shm(const char *pfn, int64_t min);
667 // Initialize channel DB's for playback
668         void init_channeldb();
669         void init_render();
670         void init_exportedl();
671 // These three happen synchronously with each other
672 // Make sure this is called after synchronizing EDL's.
673         void init_brender();
674 // Restart brender after testing its existence
675         void restart_brender();
676 // Stops brender after testing its existence
677         void stop_brender();
678 // This one happens asynchronously of the others.  Used by playback to
679 // see what frame is background rendered.
680         int brender_available(int position);
681         void set_brender_active(int v, int update=1);
682         int put_commercial();
683         void activate_commercial() { commercial_active = 1; }
684         void commit_commercial();
685         void undo_commercial();
686         void cut_commercials();
687         void update_gui(int changed_edl);
688         int paste_subtitle_text(char *text, double start, double end);
689
690         void init_error();
691         void finit_error();
692         static void init_defaults(BC_Hash* &defaults, char *config_path);
693         void check_language();
694         const char *default_std();
695         void fill_preset_defaults(const char *preset, EDLSession *session);
696         const char *get_preset_name(int index);
697         void init_edl();
698         void init_awindow();
699         void init_gwindow();
700         void init_tipwindow();
701 // Used by MWindow and RenderFarmClient
702         static void get_plugin_path(char *path, const char *plug_dir, const char *fs_path);
703         static int init_plugins(MWindow *mwindow, Preferences *preferences);
704         static int init_ladspa_plugins(MWindow *mwindow, Preferences *preferences);
705         static void init_plugin_tips(ArrayList<PluginServer*> &plugins, const char *lang);
706         static int check_plugin_index(ArrayList<PluginServer*> &plugins,
707                 const char *plug_dir, const char *plug_path);
708         static void init_plugin_index(MWindow *mwindow, Preferences *preferences,
709                 FILE *fp, const char *plugin_dir);
710         static int init_ladspa_index(MWindow *mwindow, Preferences *preferences,
711                 FILE *fp, const char *plugin_dir);
712         static void scan_plugin_index(MWindow *mwindow, Preferences *preferences,
713                 FILE *fp, const char *plug_dir, const char *plug_path, int &idx);
714         static void init_ffmpeg();
715         static void init_ffmpeg_index(MWindow *mwindow, Preferences *preferences, FILE *fp);
716         static int load_plugin_index(MWindow *mwindow, FILE *fp, const char *plugin_dir);
717         static PluginServer *new_ffmpeg_server(MWindow *mwindow, const char *name);
718         static int init_lv2_index(MWindow *mwindow, Preferences *preferences, FILE *fp);
719         static PluginServer *new_lv2_server(MWindow *mwindow, const char *name);
720         static void remove_plugin_index();
721
722         void init_preferences();
723         void init_signals();
724         void init_shuttle();
725         void init_theme();
726         void init_compositor();
727         void init_levelwindow();
728 // Called when creating a new viewer to view footage
729         VWindow* get_viewer(int start_it, int idx=-1);
730         void init_cache();
731         void init_menus();
732         void init_indexes();
733         void init_gui();
734         void init_3d();
735         void init_playbackcursor();
736         void init_commercials();
737         static void add_plugins(ArrayList<PluginServer*> &plugins);
738         static void delete_plugins();
739         void speed_before();
740         int speed_after(int done);
741         int normalize_speed(EDL *old_edl, EDL *new_edl);
742 //
743         void clean_indexes();
744 //      TimeBomb timebomb;
745         SigHandler *sighandler;
746         int restart_status;
747         int screens;
748         int in_destructor;
749         Shuttle *shuttle;
750 };
751
752 #endif