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"
16 #include "defaults.inc"
19 #include "filesystem.inc"
20 #include "filexml.inc"
21 #include "gwindow.inc"
22 #include "levelwindow.inc"
23 #include "loadmode.inc"
24 #include "mainindexes.inc"
25 #include "mainprogress.inc"
26 #include "mainsession.inc"
27 #include "mainundo.inc"
28 #include "maxchannels.h"
30 #include "mwindow.inc"
31 #include "mwindowgui.inc"
33 #include "patchbay.inc"
34 #include "playbackengine.inc"
36 #include "pluginserver.inc"
37 #include "pluginset.inc"
38 #include "preferences.inc"
39 #include "preferencesthread.inc"
40 #include "recordlabel.inc"
42 #include "sharedlocation.inc"
43 #include "sighandler.inc"
44 #include "splashgui.inc"
46 #include "threadloader.inc"
47 #include "timebar.inc"
49 #include "tipwindow.inc"
51 #include "tracking.inc"
53 #include "transition.inc"
54 #include "transportque.inc"
55 #include "videowindow.inc"
56 #include "vwindow.inc"
57 #include "bcwindowbase.inc"
61 // All entry points for commands except for window locking should be here.
62 // This allows scriptability.
70 // ======================================== initialization commands
71 void create_objects(int want_gui
,
78 int run_script(FileXML
*script
);
80 int delete_project(int flash
= 1);
84 int set_filename(char *filename
);
85 // Total vertical pixels in timeline
86 int get_tracks_height();
87 // Total horizontal pixels in timeline
88 int get_tracks_width();
96 void set_titles(int value
);
97 int asset_to_edl(EDL
*new_edl
, Asset
*new_asset
, RecordLabels
*labels
= 0);
99 // Entry point to insert assets and insert edls. Called by TrackCanvas
100 // and AssetPopup when assets are dragged in from AWindow.
101 // Takes the drag vectors from MainSession and
102 // pastes either assets or clips depending on which is full.
103 // Returns 1 if the vectors were full
104 int paste_assets(double position
, Track
*dest_track
);
106 // Insert the assets at a point in the EDL. Called by menueffects,
107 // render, and CWindow drop but recording calls paste_edls directly for
109 void load_assets(ArrayList
<Asset
*> *new_assets
,
112 Track
*first_track
/* = 0 */,
113 RecordLabels
*labels
/* = 0 */,
116 int paste_edls(ArrayList
<EDL
*> *new_edls
,
118 Track
*first_track
/* = 0 */,
119 double current_position
/* = -1 */,
122 // Reset everything for a load
123 void update_project(int load_mode
);
124 // Fit selected time to horizontal display range
125 void fit_selection();
126 // Fit selected autos to the vertical display range
130 // move the window to include the cursor
132 // Append a plugindb with pointers to the master plugindb
133 void create_plugindb(int do_audio
,
138 ArrayList
<PluginServer
*> &plugindb
);
139 // Find the plugin whose title matches title and return it
140 PluginServer
* scan_plugindb(char *title
,
147 int load_filenames(ArrayList
<char*> *filenames
,
148 int load_mode
= LOAD_REPLACE
,
149 // Cause the project filename on the top of the window to be updated.
150 // Not wanted for loading backups.
151 int update_filename
= 1,
152 char *reel_name
= "cin0000",
154 int overwrite_reel
= 0);
157 // Print out plugins which are referenced in the EDL but not loaded.
158 void test_plugins(EDL
*new_edl
, char *path
);
160 int interrupt_indexes(); // Stop index building
163 int redraw_time_dependancies(); // after reconfiguring the time format, sample rate, frame rate
165 // =========================================== movement
167 void next_time_format();
168 void prev_time_format();
169 void time_format_common();
170 int reposition_timebar(int new_pixel
, int new_height
);
171 int expand_sample(double fixed_sample
= -1); // fixed_sample is the sample that should hold fixed position on the screen after zooming, -1 = selection
172 int zoom_in_sample(double fixed_sample
= -1);
173 int zoom_sample(int64_t zoom_sample
, int64_t view_start
= -1); // what's the supposed view start
174 void zoom_amp(int64_t zoom_amp
);
175 void zoom_track(int64_t zoom_track
);
177 int move_left(int64_t distance
= 0);
178 int move_right(int64_t distance
= 0);
179 void move_up(int64_t distance
= 0);
180 void move_down(int64_t distance
= 0);
181 int next_label(); // seek to labels
183 int next_edit_handle(); // seek to labels
184 int prev_edit_handle(); // seek to edit handles
185 void trackmovement(int track_start
);
186 int samplemovement(int64_t view_start
); // view_start is pixels
195 void update_plugins();
196 // Call after every edit operation
198 void show_plugin(Plugin
*plugin
);
199 void hide_plugin(Plugin
*plugin
, int lock
);
201 // Update plugins with configuration changes.
202 // Called by TrackCanvas::cursor_motion_event.
203 void update_plugin_guis();
204 void update_plugin_states();
205 void update_plugin_titles();
206 // Called by Attachmentpoint during playback.
207 // Searches for matching plugin and renders data in it.
208 void render_plugin_gui(void *data
, Plugin
*plugin
);
209 void render_plugin_gui(void *data
, int size
, Plugin
*plugin
);
212 // ============================= editing commands ========================
214 void add_audio_track_entry(int above
, Track
*dst
);
215 int add_audio_track(int above
, Track
*dst
);
216 void add_clip_to_edl(EDL
*edl
);
217 void add_video_track_entry(Track
*dst
= 0);
218 int add_video_track(int above
, Track
*dst
);
220 void asset_to_size();
221 // Entry point for clear operations.
223 // Clears active region in EDL.
224 // If clear_handle, edit boundaries are cleared if the range is 0.
225 // Called by paste, record, menueffects, render, and CWindow drop.
226 void clear(int clear_handle
);
228 int clear_labels(double start
, double end
);
229 void concatenate_tracks();
231 int copy(double start
, double end
);
232 static int create_aspect_ratio(float &w
, float &h
, int width
, int height
);
235 void delete_folder(char *folder
);
236 void delete_inpoint();
237 void delete_outpoint();
240 void delete_track(Track
*track
);
241 void delete_tracks();
242 void detach_transition(Transition
*transition
);
243 int feather_edits(int64_t feather_samples
, int audio
, int video
);
244 int64_t get_feather(int audio
, int video
);
245 float get_aspect_ratio();
246 void insert(double position
,
250 EDL
*parent_edl
= 0);
252 // TrackCanvas calls this to insert multiple effects from the drag_pluginservers
253 // into pluginset_highlighted.
254 void insert_effects_canvas(double start
,
257 // CWindow calls this to insert multiple effects from
258 // the drag_pluginservers array.
259 void insert_effects_cwindow(Track
*dest_track
);
261 // This is called multiple times by the above functions.
262 // It can't sync parameters.
263 void insert_effect(char *title
,
264 SharedLocation
*shared_location
,
266 PluginSet
*plugin_set
,
271 void match_output_size(Track
*track
);
272 // Move edit to new position
273 void move_edits(ArrayList
<Edit
*> *edits
,
276 int behaviour
); // behaviour: 0 - old style (cut and insert elswhere), 1- new style - (clear and overwrite elsewere)
277 // Move effect to position
278 void move_effect(Plugin
*plugin
,
279 PluginSet
*plugin_set
,
282 void move_plugins_up(PluginSet
*plugin_set
);
283 void move_plugins_down(PluginSet
*plugin_set
);
284 void move_track_down(Track
*track
);
285 void move_tracks_down();
286 void move_track_up(Track
*track
);
287 void move_tracks_up();
288 void mute_selection();
289 void new_folder(char *new_folder
);
290 void overwrite(EDL
*source
);
291 // For clipboard commands
293 // For splice and overwrite
294 int paste(double start
,
299 int paste_output(int64_t startproject
,
301 int64_t startsource_sample
,
302 int64_t endsource_sample
,
303 int64_t startsource_frame
,
304 int64_t endsource_frame
,
306 RecordLabels
*new_labels
);
307 void paste_silence();
309 void paste_transition();
310 void paste_transition_cwindow(Track
*dest_track
);
311 void paste_audio_transition();
312 void paste_video_transition();
313 void rebuild_indices();
315 void remove_assets_from_project(int push_undo
= 0);
316 void remove_assets_from_disk();
317 void resize_track(Track
*track
, int w
, int h
);
318 void set_auto_keyframes(int value
);
319 // Update the editing mode
320 int set_editing_mode(int new_editing_mode
);
321 void set_inpoint(int is_mwindow
);
322 void set_outpoint(int is_mwindow
);
323 void splice(EDL
*source
);
324 void toggle_loop_playback();
325 void trim_selection();
326 // Synchronize EDL settings with all playback engines depending on current
327 // operation. Doesn't redraw anything.
328 void sync_parameters(int change_type
= CHANGE_PARAMS
);
330 int toggle_label(int is_mwindow
);
331 void undo_entry(BC_WindowBase
*calling_window_gui
);
332 void redo_entry(BC_WindowBase
*calling_window_gui
);
334 int cut_automation();
335 int copy_automation();
336 int paste_automation();
337 void clear_automation();
338 int cut_default_keyframe();
339 int copy_default_keyframe();
340 // Use paste_automation to paste the default keyframe in other position.
341 // Use paste_default_keyframe to replace the default keyframe with whatever is
343 int paste_default_keyframe();
344 int clear_default_keyframe();
346 int modify_edithandles();
347 int modify_pluginhandles();
348 void finish_modify_handles();
356 // Send new EDL to caches
357 void update_caches();
358 int optimize_assets(); // delete unused assets from the cache and assets
360 // ================================= cursor selection ======================
362 void select_point(double position
);
363 int set_loop_boundaries(); // toggle loop playback and set boundaries for loop playback
365 // ================================ handle selection =======================
369 SplashGUI
*splash_window
;
373 // CICaches for drawing timeline only
374 CICache
*audio_cache
, *video_cache
;
375 Preferences
*preferences
;
376 PreferencesThread
*preferences_thread
;
377 MainSession
*session
;
379 MainIndexes
*mainindexes
;
380 MainProgress
*mainprogress
;
384 ArrayList
<ColormodelItem
*> colormodels
;
385 ArrayList
<InterlaceautofixoptionItem
*> interlace_asset_autofixoptions
;
386 ArrayList
<InterlacemodeItem
*> interlace_project_modes
;
387 ArrayList
<InterlacemodeItem
*> interlace_asset_modes
;
388 ArrayList
<InterlacefixmethodItem
*> interlace_asset_fixmethods
;
392 // Channel DB for playback only. Record channel DB's are in record.C
393 ChannelDB
*channeldb_buz
;
394 ChannelDB
*channeldb_v4l2jpeg
;
396 // ====================================== plugins ==============================
398 // Contain file descriptors for all the dlopens
399 ArrayList
<PluginServer
*> *plugindb
;
400 // Currently visible plugins
401 ArrayList
<PluginServer
*> *plugin_guis
;
404 // Adjust sample position to line up with frames.
405 int fix_timing(int64_t &samples_out
,
410 BatchRenderThread
*batch_render
;
427 LevelWindow
*lwindow
;
428 // Lock during creation and destruction of GUI
429 Mutex
*plugin_gui_lock
;
430 // Lock during creation and destruction of brender so playback doesn't use it.
433 // Initialize channel DB's for playback
434 void init_channeldb();
436 // These three happen synchronously with each other
437 // Make sure this is called after synchronizing EDL's.
439 // Restart brender after testing its existence
440 void restart_brender();
441 // Stops brender after testing its existence
443 // This one happens asynchronously of the others. Used by playback to
444 // see what frame is background rendered.
445 int brender_available(int position
);
446 void set_brender_start();
448 static void init_defaults(Defaults
* &defaults
,
453 void init_tipwindow();
454 // Used by MWindow and RenderFarmClient
455 static void init_plugins(Preferences
*preferences
,
456 ArrayList
<PluginServer
*>* &plugindb
,
457 SplashGUI
*splash_window
);
458 static void init_plugin_path(Preferences
*preferences
,
459 ArrayList
<PluginServer
*>* &plugindb
,
461 SplashGUI
*splash_window
,
463 void init_preferences();
466 void init_compositor();
467 void init_levelwindow();
473 void init_playbackcursor();
474 void delete_plugins();
476 void clean_indexes();
477 // TimeBomb timebomb;
478 SigHandler
*sighandler
;