7 #include "audiodevice.inc"
9 #include "batchrender.inc"
10 #include "bcwindowbase.inc"
11 #include "brender.inc"
13 #include "channel.inc"
14 #include "channeldb.inc"
15 #include "cwindow.inc"
19 #include "filesystem.inc"
20 #include "filexml.inc"
21 #include "gwindow.inc"
22 #include "levelwindow.inc"
23 #include "loadmode.inc"
24 #include "mainerror.inc"
25 #include "mainindexes.inc"
26 #include "mainprogress.inc"
27 #include "mainsession.inc"
28 #include "mainundo.inc"
29 #include "maxchannels.h"
31 #include "mwindow.inc"
32 #include "mwindowgui.inc"
34 #include "patchbay.inc"
35 #include "playback3d.inc"
36 #include "playbackengine.inc"
38 #include "pluginserver.inc"
39 #include "pluginset.inc"
40 #include "preferences.inc"
41 #include "preferencesthread.inc"
42 #include "recordlabel.inc"
44 #include "sharedlocation.inc"
45 #include "sighandler.inc"
46 #include "splashgui.inc"
49 #include "threadloader.inc"
50 #include "timebar.inc"
52 #include "tipwindow.inc"
54 #include "tracking.inc"
56 #include "transition.inc"
57 #include "transportque.inc"
58 #include "videowindow.inc"
59 #include "vwindow.inc"
60 #include "bcwindowbase.inc"
61 #include "exportedl.inc"
65 // All entry points for commands except for window locking should be here.
66 // This allows scriptability.
68 class MWindow
: public Thread
74 // ======================================== initialization commands
75 void create_objects(int want_gui
,
83 int run_script(FileXML
*script
);
85 int delete_project(int flash
= 1);
89 int set_filename(char *filename
);
90 // Total vertical pixels in timeline
91 int get_tracks_height();
92 // Total horizontal pixels in timeline
93 int get_tracks_width();
101 void set_titles(int value
);
102 int asset_to_edl(EDL
*new_edl
, Asset
*new_asset
, RecordLabels
*labels
= 0);
104 // Entry point to insert assets and insert edls. Called by TrackCanvas
105 // and AssetPopup when assets are dragged in from AWindow.
106 // Takes the drag vectors from MainSession and
107 // pastes either assets or clips depending on which is full.
108 // Returns 1 if the vectors were full
109 int paste_assets(double position
, Track
*dest_track
);
111 // Insert the assets at a point in the EDL. Called by menueffects,
112 // render, and CWindow drop but recording calls paste_edls directly for
114 void load_assets(ArrayList
<Asset
*> *new_assets
,
117 Track
*first_track
/* = 0 */,
118 RecordLabels
*labels
/* = 0 */,
121 int paste_edls(ArrayList
<EDL
*> *new_edls
,
123 Track
*first_track
/* = 0 */,
124 double current_position
/* = -1 */,
127 // Reset everything for a load
128 void update_project(int load_mode
);
129 // Fit selected time to horizontal display range
130 void fit_selection();
131 // Fit selected autos to the vertical display range
135 // move the window to include the cursor
137 // Append a plugindb with pointers to the master plugindb
138 void create_plugindb(int do_audio
,
143 ArrayList
<PluginServer
*> &plugindb
);
144 // Find the plugin whose title matches title and return it
145 PluginServer
* scan_plugindb(char *title
,
152 int load_filenames(ArrayList
<char*> *filenames
,
153 int load_mode
= LOAD_REPLACE
,
154 // Cause the project filename on the top of the window to be updated.
155 // Not wanted for loading backups.
156 int update_filename
= 1,
157 char *reel_name
= "cin0000",
159 int overwrite_reel
= 0);
162 // Print out plugins which are referenced in the EDL but not loaded.
163 void test_plugins(EDL
*new_edl
, char *path
);
165 int interrupt_indexes(); // Stop index building
168 int redraw_time_dependancies(); // after reconfiguring the time format, sample rate, frame rate
170 // =========================================== movement
172 void next_time_format();
173 void prev_time_format();
174 void time_format_common();
175 int reposition_timebar(int new_pixel
, int new_height
);
176 int expand_sample(double fixed_sample
= -1); // fixed_sample is the sample that should hold fixed position on the screen after zooming, -1 = selection
177 int zoom_in_sample(double fixed_sample
= -1);
178 int zoom_sample(int64_t zoom_sample
, int64_t view_start
= -1); // what's the supposed view start
179 void zoom_amp(int64_t zoom_amp
);
180 void zoom_track(int64_t zoom_track
);
182 int move_left(int64_t distance
= 0);
183 int move_right(int64_t distance
= 0);
184 void move_up(int64_t distance
= 0);
185 void move_down(int64_t distance
= 0);
188 // shift_down must be passed by the caller because different windows call
190 int next_label(int shift_down
);
191 int prev_label(int shift_down
);
192 // seek to edit handles
193 int next_edit_handle(int shift_down
);
194 int prev_edit_handle(int shift_down
);
195 void trackmovement(int track_start
);
196 int samplemovement(int64_t view_start
); // view_start is pixels
205 void update_plugins();
206 // Call after every edit operation
208 void show_plugin(Plugin
*plugin
);
209 void hide_plugin(Plugin
*plugin
, int lock
);
211 // Update plugins with configuration changes.
212 // Called by TrackCanvas::cursor_motion_event.
213 void update_plugin_guis();
214 void update_plugin_states();
215 void update_plugin_titles();
216 // Called by Attachmentpoint during playback.
217 // Searches for matching plugin and renders data in it.
218 void render_plugin_gui(void *data
, Plugin
*plugin
);
219 void render_plugin_gui(void *data
, int size
, Plugin
*plugin
);
221 // Called from PluginVClient::process_buffer
222 // Returns 1 if a GUI for the plugin is open so OpenGL routines can determine if
224 int plugin_gui_open(Plugin
*plugin
);
227 // ============================= editing commands ========================
229 void add_audio_track_entry(int above
, Track
*dst
);
230 int add_audio_track(int above
, Track
*dst
);
231 void add_clip_to_edl(EDL
*edl
);
232 void add_video_track_entry(Track
*dst
= 0);
233 int add_video_track(int above
, Track
*dst
);
235 void asset_to_size();
236 void asset_to_rate();
237 // Entry point for clear operations.
239 // Clears active region in EDL.
240 // If clear_handle, edit boundaries are cleared if the range is 0.
241 // Called by paste, record, menueffects, render, and CWindow drop.
242 void clear(int clear_handle
);
244 int clear_labels(double start
, double end
);
245 void concatenate_tracks();
247 int copy(double start
, double end
);
248 static int create_aspect_ratio(float &w
, float &h
, int width
, int height
);
251 // Calculate defaults path
252 static void create_defaults_path(char *string
);
254 void delete_folder(char *folder
);
255 void delete_inpoint();
256 void delete_outpoint();
259 void delete_track(Track
*track
);
260 void delete_tracks();
261 void detach_transition(Transition
*transition
);
262 int feather_edits(int64_t feather_samples
, int audio
, int video
);
263 int64_t get_feather(int audio
, int video
);
264 float get_aspect_ratio();
265 void insert(double position
,
269 EDL
*parent_edl
= 0);
271 // TrackCanvas calls this to insert multiple effects from the drag_pluginservers
272 // into pluginset_highlighted.
273 void insert_effects_canvas(double start
,
276 // CWindow calls this to insert multiple effects from
277 // the drag_pluginservers array.
278 void insert_effects_cwindow(Track
*dest_track
);
280 // This is called multiple times by the above functions.
281 // It can't sync parameters.
282 void insert_effect(char *title
,
283 SharedLocation
*shared_location
,
285 PluginSet
*plugin_set
,
290 void match_output_size(Track
*track
);
291 // Move edit to new position
292 void move_edits(ArrayList
<Edit
*> *edits
,
295 int behaviour
); // behaviour: 0 - old style (cut and insert elswhere), 1- new style - (clear and overwrite elsewere)
296 // Move effect to position
297 void move_effect(Plugin
*plugin
,
298 PluginSet
*plugin_set
,
301 void move_plugins_up(PluginSet
*plugin_set
);
302 void move_plugins_down(PluginSet
*plugin_set
);
303 void move_track_down(Track
*track
);
304 void move_tracks_down();
305 void move_track_up(Track
*track
);
306 void move_tracks_up();
307 void mute_selection();
308 void new_folder(char *new_folder
);
309 void overwrite(EDL
*source
);
310 // For clipboard commands
312 // For splice and overwrite
313 int paste(double start
,
318 int paste_output(int64_t startproject
,
320 int64_t startsource_sample
,
321 int64_t endsource_sample
,
322 int64_t startsource_frame
,
323 int64_t endsource_frame
,
325 RecordLabels
*new_labels
);
326 void paste_silence();
328 void paste_transition();
329 void paste_transition_cwindow(Track
*dest_track
);
330 void paste_audio_transition();
331 void paste_video_transition();
332 void rebuild_indices();
333 // Asset removal from caches
335 void remove_asset_from_caches(Asset
*asset
);
336 void remove_assets_from_project(int push_undo
= 0);
337 void remove_assets_from_disk();
338 void resize_track(Track
*track
, int w
, int h
);
339 void set_auto_keyframes(int value
);
340 // Update the editing mode
341 int set_editing_mode(int new_editing_mode
);
342 void set_inpoint(int is_mwindow
);
343 void set_outpoint(int is_mwindow
);
344 void splice(EDL
*source
);
345 void toggle_loop_playback();
346 void trim_selection();
347 // Synchronize EDL settings with all playback engines depending on current
348 // operation. Doesn't redraw anything.
349 void sync_parameters(int change_type
= CHANGE_PARAMS
);
351 int toggle_label(int is_mwindow
);
352 void undo_entry(BC_WindowBase
*calling_window_gui
);
353 void redo_entry(BC_WindowBase
*calling_window_gui
);
356 int cut_automation();
357 int copy_automation();
358 int paste_automation();
359 void clear_automation();
360 void straighten_automation();
361 int cut_default_keyframe();
362 int copy_default_keyframe();
363 // Use paste_automation to paste the default keyframe in other position.
364 // Use paste_default_keyframe to replace the default keyframe with whatever is
366 int paste_default_keyframe();
367 int clear_default_keyframe();
369 int modify_edithandles();
370 int modify_pluginhandles();
371 void finish_modify_handles();
379 // Send new EDL to caches
381 int optimize_assets(); // delete unused assets from the cache and assets
384 void select_point(double position
);
385 int set_loop_boundaries(); // toggle loop playback and set boundaries for loop playback
388 Playback3D
*playback_3d
;
390 SplashGUI
*splash_window
;
395 // CICaches for drawing timeline only
396 CICache
*audio_cache
, *video_cache
;
397 Preferences
*preferences
;
398 PreferencesThread
*preferences_thread
;
399 MainSession
*session
;
401 MainIndexes
*mainindexes
;
402 MainProgress
*mainprogress
;
406 ArrayList
<ColormodelItem
*> colormodels
;
407 ArrayList
<InterlaceautofixoptionItem
*> interlace_asset_autofixoptions
;
408 ArrayList
<InterlacemodeItem
*> interlace_project_modes
;
409 ArrayList
<InterlacemodeItem
*> interlace_asset_modes
;
410 ArrayList
<InterlacefixmethodItem
*> interlace_asset_fixmethods
;
414 // Channel DB for playback only. Record channel DB's are in record.C
415 ChannelDB
*channeldb_buz
;
416 ChannelDB
*channeldb_v4l2jpeg
;
418 // ====================================== plugins ==============================
420 // Contain file descriptors for all the dlopens
421 ArrayList
<PluginServer
*> *plugindb
;
422 // Currently visible plugins
423 ArrayList
<PluginServer
*> *plugin_guis
;
426 // Adjust sample position to line up with frames.
427 int fix_timing(int64_t &samples_out
,
432 BatchRenderThread
*batch_render
;
435 ExportEDL
*exportedl
;
453 LevelWindow
*lwindow
;
454 // Lock during creation and destruction of GUI
455 Mutex
*plugin_gui_lock
;
456 // Lock during creation and destruction of brender so playback doesn't use it.
460 // Initialize channel DB's for playback
461 void init_channeldb();
463 void init_exportedl();
464 // These three happen synchronously with each other
465 // Make sure this is called after synchronizing EDL's.
467 // Restart brender after testing its existence
468 void restart_brender();
469 // Stops brender after testing its existence
471 // This one happens asynchronously of the others. Used by playback to
472 // see what frame is background rendered.
473 int brender_available(int position
);
474 void set_brender_start();
477 static void init_defaults(BC_Hash
* &defaults
,
482 void init_tipwindow();
483 // Used by MWindow and RenderFarmClient
484 static void init_plugins(Preferences
*preferences
,
485 ArrayList
<PluginServer
*>* &plugindb
,
486 SplashGUI
*splash_window
);
487 static void init_plugin_path(Preferences
*preferences
,
488 ArrayList
<PluginServer
*>* &plugindb
,
490 SplashGUI
*splash_window
,
492 void init_preferences();
495 void init_compositor();
496 void init_levelwindow();
503 void init_playbackcursor();
504 void delete_plugins();
506 void clean_indexes();
507 // TimeBomb timebomb;
508 SigHandler
*sighandler
;