5 #include "audiodevice.inc"
10 #include "channel.inc"
11 #include "cwindow.inc"
12 #include "defaults.inc"
15 #include "filesystem.inc"
16 #include "filexml.inc"
17 #include "levelwindow.inc"
18 #include "loadmode.inc"
19 #include "mainindexes.inc"
20 #include "mainprogress.inc"
21 #include "mainsession.inc"
22 #include "mainundo.inc"
23 #include "maxchannels.h"
25 #include "mwindowgui.inc"
26 #include "mwindow.inc"
28 #include "patchbay.inc"
29 #include "playbackengine.inc"
31 #include "pluginserver.inc"
32 #include "pluginset.inc"
33 #include "preferences.inc"
34 #include "preferencesthread.inc"
35 #include "recordlabel.inc"
37 #include "sharedlocation.inc"
38 #include "sighandler.inc"
39 #include "splashgui.inc"
41 #include "threadloader.inc"
42 #include "timebar.inc"
45 #include "tracking.inc"
47 #include "transition.inc"
48 #include "transportque.inc"
49 #include "videowindow.inc"
50 #include "vwindow.inc"
55 // All entry points for commands except for window locking should be here.
56 // This allows scriptability.
64 // ======================================== initialization commands
65 void create_objects(int want_gui
, int want_new
);
69 static void init_tuner(ArrayList
<Channel
*> &channeldb
, char *path
);
71 int run_script(FileXML
*script
);
73 int delete_project(int flash
= 1);
77 int set_filename(char *filename
);
78 // Total vertical pixels in timeline
79 int get_tracks_height();
80 // Total horizontal pixels in timeline
81 int get_tracks_width();
88 void set_titles(int value
);
89 int asset_to_edl(EDL
*new_edl
, Asset
*new_asset
, RecordLabels
*labels
= 0);
91 // Entry point to insert assets and insert edls. Called by TrackCanvas
92 // and AssetPopup when assets are dragged in from AWindow.
93 // Takes the drag vectors from MainSession and
94 // pastes either assets or clips depending on which is full.
95 // Returns 1 if the vectors were full
96 int paste_assets(double position
, Track
*dest_track
);
98 // Insert the assets at a point in the EDL. Called by menueffects,
99 // render, and CWindow drop but recording calls paste_edls directly for
101 void load_assets(ArrayList
<Asset
*> *new_assets
,
104 Track
*first_track
/* = 0 */,
105 RecordLabels
*labels
/* = 0 */,
108 int paste_edls(ArrayList
<EDL
*> *new_edls
,
110 Track
*first_track
/* = 0 */,
111 double current_position
/* = -1 */,
114 // Reset everything for a load
115 void update_project(int load_mode
);
116 void fit_selection();
117 // move the window to include the cursor
119 // Append a plugindb with pointers to the master plugindb
120 void create_plugindb(int do_audio
,
125 ArrayList
<PluginServer
*> &plugindb
);
126 // Find the plugin whose title matches title and return it
127 PluginServer
* scan_plugindb(char *title
);
133 int load_filenames(ArrayList
<char*> *filenames
,
134 int load_mode
= LOAD_REPLACE
);
136 int interrupt_indexes(); // Stop index building
139 int redraw_time_dependancies(); // after reconfiguring the time format, sample rate, frame rate
141 // =========================================== movement
143 void next_time_format();
144 int reposition_timebar(int new_pixel
, int new_height
);
146 int zoom_in_sample();
147 int zoom_sample(int64_t zoom_sample
);
148 void zoom_amp(int64_t zoom_amp
);
149 void zoom_track(int64_t zoom_track
);
151 int move_left(int64_t distance
= 0);
152 int move_right(int64_t distance
= 0);
153 void move_up(int64_t distance
= 0);
154 void move_down(int64_t distance
= 0);
155 int next_label(); // seek to labels
157 void trackmovement(int track_start
);
158 int samplemovement(int64_t view_start
); // view_start is pixels
167 void update_plugins();
168 // Call after every edit operation
170 void show_plugin(Plugin
*plugin
);
171 void hide_plugin(Plugin
*plugin
, int lock
);
173 // Update plugins with configuration changes
174 void update_plugin_guis();
175 void update_plugin_states();
176 void update_plugin_titles();
177 // Called by Attachmentpoint during playback.
178 // Searches for matching plugin and renders data in it.
179 void render_plugin_gui(void *data
, Plugin
*plugin
);
180 void render_plugin_gui(void *data
, int size
, Plugin
*plugin
);
183 // ============================= editing commands ========================
185 void add_audio_track_entry(int above
, Track
*dst
);
186 int add_audio_track(int above
, Track
*dst
);
187 void add_clip_to_edl(EDL
*edl
);
188 void add_video_track_entry(Track
*dst
= 0);
189 int add_video_track(int above
, Track
*dst
);
191 void asset_to_size();
192 // Entry point for clear operations.
194 // Clears active region in EDL.
195 // If clear_handle, edit boundaries are cleared if the range is 0.
196 // Called by paste, record, menueffects, render, and CWindow drop.
197 void clear(int clear_handle
);
199 int clear_labels(double start
, double end
);
200 void concatenate_tracks();
202 int copy(double start
, double end
);
203 static int create_aspect_ratio(float &w
, float &h
, int width
, int height
);
206 void delete_folder(char *folder
);
207 void delete_inpoint();
208 void delete_outpoint();
211 void delete_track(Track
*track
);
212 void delete_tracks();
213 void detach_transition(Transition
*transition
);
214 int feather_edits(int64_t feather_samples
, int audio
, int video
);
215 int64_t get_feather(int audio
, int video
);
216 float get_aspect_ratio();
217 void insert(double position
,
221 EDL
*parent_edl
= 0);
223 // TrackCanvas calls this to insert multiple effects from the drag_pluginservers
224 // into pluginset_highlighted.
225 void insert_effects_canvas(double start
,
228 // CWindow calls this to insert multiple effects from
229 // the drag_pluginservers array.
230 void insert_effects_cwindow(Track
*dest_track
);
232 // This is called multiple times by the above functions.
233 // It can't sync parameters.
234 void insert_effect(char *title
,
235 SharedLocation
*shared_location
,
237 PluginSet
*plugin_set
,
242 void match_output_size(Track
*track
);
243 // Move edit to new position
244 void move_edits(ArrayList
<Edit
*> *edits
,
247 // Move effect to position
248 void move_effect(Plugin
*plugin
,
249 PluginSet
*plugin_set
,
252 void move_plugins_up(PluginSet
*plugin_set
);
253 void move_plugins_down(PluginSet
*plugin_set
);
254 void move_track_down(Track
*track
);
255 void move_tracks_down();
256 void move_track_up(Track
*track
);
257 void move_tracks_up();
258 void mute_selection();
259 void new_folder(char *new_folder
);
260 void overwrite(EDL
*source
);
261 // For clipboard commands
263 // For splice and overwrite
264 int paste(double start
,
269 int paste_output(int64_t startproject
,
271 int64_t startsource_sample
,
272 int64_t endsource_sample
,
273 int64_t startsource_frame
,
274 int64_t endsource_frame
,
276 RecordLabels
*new_labels
);
277 void paste_silence();
279 void paste_transition();
280 void paste_transition_cwindow(Track
*dest_track
);
281 void paste_audio_transition();
282 void paste_video_transition();
283 void rebuild_indices();
284 void redo_entry(int is_mwindow
);
286 void remove_assets_from_project(int push_undo
= 0);
287 void remove_assets_from_disk();
288 void render_single();
290 void resize_track(Track
*track
, int w
, int h
);
291 void set_auto_keyframes(int value
);
292 // Update the editing mode
293 int set_editing_mode(int new_editing_mode
);
294 void set_inpoint(int is_mwindow
);
295 void set_outpoint(int is_mwindow
);
296 void splice(EDL
*source
);
297 void toggle_loop_playback();
298 void trim_selection();
299 // Synchronize EDL settings with all playback engines depending on current
300 // operation. Doesn't redraw anything.
301 void sync_parameters(int change_type
= CHANGE_PARAMS
);
303 int toggle_label(int is_mwindow
);
304 void undo_entry(int is_mwindow
);
306 int cut_automation();
307 int copy_automation();
308 int paste_automation();
309 void clear_automation();
310 int cut_default_keyframe();
311 int copy_default_keyframe();
312 // Use paste_automation to paste the default keyframe in other position.
313 // Use paste_default_keyframe to replace the default keyframe with whatever is
315 int paste_default_keyframe();
316 int clear_default_keyframe();
318 int modify_edithandles();
319 int modify_pluginhandles();
320 void finish_modify_handles();
328 // Send new EDL to caches
329 void update_caches();
330 int optimize_assets(); // delete unused assets from the cache and assets
332 // ================================= cursor selection ======================
334 void select_point(double position
);
335 int set_loop_boundaries(); // toggle loop playback and set boundaries for loop playback
337 // ================================ handle selection =======================
341 SplashGUI
*splash_window
;
342 LevelWindow
*level_window
;
349 // CICaches for drawing timeline only
350 CICache
*audio_cache
, *video_cache
;
351 ThreadLoader
*threadloader
;
352 VideoWindow
*video_window
;
353 Preferences
*preferences
;
354 PreferencesThread
*preferences_thread
;
355 MainSession
*session
;
357 MainIndexes
*mainindexes
;
358 MainProgress
*mainprogress
;
362 ArrayList
<ColormodelItem
*> colormodels
;
368 // ====================================== plugins ==============================
370 // Contain file descriptors for all the dlopens
371 ArrayList
<PluginServer
*> *plugindb
;
372 // Currently visible plugins
373 ArrayList
<PluginServer
*> *plugin_guis
;
376 // TV stations to record from
377 ArrayList
<Channel
*> channeldb_v4l
;
378 ArrayList
<Channel
*> channeldb_buz
;
379 // Adjust sample position to line up with frames.
380 int fix_timing(int64_t &samples_out
, int64_t &frames_out
, int64_t samples_in
);
397 LevelWindow
*lwindow
;
398 // Lock during creation and destruction of GUI
399 Mutex
*plugin_gui_lock
;
400 // Lock during creation and destruction of brender so playback doesn't use it.
404 // These three happen synchronously with each other
405 // Make sure this is called after synchronizing EDL's.
407 // Restart brender after testing its existence
408 void restart_brender();
409 // Stops brender after testing its existence
411 // This one happens asynchronously of the others. Used by playback to
412 // see what frame is background rendered.
413 int brender_available(int position
);
414 void set_brender_start();
416 static void init_defaults(Defaults
* &defaults
);
419 // Used by MWindow and RenderFarmClient
420 static void init_plugins(Preferences
*preferences
,
421 ArrayList
<PluginServer
*>* &plugindb
,
422 SplashGUI
*splash_window
);
423 static void init_plugin_path(Preferences
*preferences
,
424 ArrayList
<PluginServer
*>* &plugindb
,
426 SplashGUI
*splash_window
,
428 void init_preferences();
431 void init_compositor();
432 void init_levelwindow();
438 void init_playbackcursor();
439 void delete_plugins();
440 void clean_indexes();
441 void save_tuner(ArrayList
<Channel
*> &channeldb
, char *path
);
442 // TimeBomb timebomb;
443 SigHandler
*sighandler
;