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