r956: README.BUILD - add more library recommendations
[cinelerra_cv/ct.git] / cinelerra / edl.h
blobe0df14a54cc490631b4c177a50079667f48510dc
1 #ifndef EDL_H
2 #define EDL_H
4 #include "asset.inc"
5 #include "assets.inc"
6 #include "autoconf.inc"
7 #include "bchash.inc"
8 #include "edits.inc"
9 #include "edl.inc"
10 #include "edlsession.inc"
11 #include "filexml.inc"
12 #include "labels.inc"
13 #include "localsession.inc"
14 #include "maxchannels.h"
15 #include "mutex.inc"
16 #include "playbackconfig.h"
17 #include "pluginserver.h"
18 #include "preferences.inc"
19 #include "recordlabel.inc"
20 #include "sharedlocation.inc"
21 #include "theme.inc"
22 #include "tracks.inc"
25 // Loading and saving are built on load and copy except for automation:
27 // Storage:
28 // Load: load new -> paste into master
29 // Save: copy all of master
30 // Undo: selective load into master
31 // Copy: copy from master
32 // Paste: load new -> paste into master
33 // Copy automation: copy just automation from master
34 // Paste automation: paste functions in automation
46 class EDL
48 public:
49 EDL(EDL *parent_edl = 0);
50 ~EDL();
52 int create_objects();
53 EDL& operator=(EDL &edl);
55 // Load configuration and track counts
56 int load_defaults(BC_Hash *defaults);
57 int save_defaults(BC_Hash *defaults);
58 // Clip default settings to boundaries.
59 void boundaries();
60 // Create tracks using existing configuration
61 int create_default_tracks();
62 int load_xml(ArrayList<PluginServer*> *plugindb,
63 FileXML *file,
64 uint32_t load_flags);
65 int save_xml(ArrayList<PluginServer*> *plugindb,
66 FileXML *xml,
67 char *output_path,
68 int is_clip,
69 int is_vwindow);
70 int load_audio_config(FileXML *file, int append_mode, uint32_t load_flags);
71 int load_video_config(FileXML *file, int append_mode, uint32_t load_flags);
75 // Convert position to frames if cursor alignment is enabled
76 double align_to_frame(double position, int round);
80 // Scale all sample values since everything is locked to audio
81 void rechannel();
82 void resample(double old_rate, double new_rate, int data_type);
83 void copy_tracks(EDL *edl);
84 // Copies project path, folders, EDLSession, and LocalSession from edl argument.
85 // session_only - used by preferences and format specify
86 // whether to only copy EDLSession
87 void copy_session(EDL *edl, int session_only = 0);
88 int copy_all(EDL *edl);
89 void copy_assets(EDL *edl);
90 void copy_clips(EDL *edl);
91 // Copy pan and fade settings from edl
92 void synchronize_params(EDL *edl);
93 // Determine if the positions are equivalent if they're within half a frame
94 // of each other.
95 int equivalent(double position1, double position2);
96 // Determine if the EDL's produce equivalent video output to the old EDL.
97 // The new EDL is this and the old EDL is the argument.
98 // Return the number of seconds from the beginning of this which are
99 // equivalent to the argument.
100 // If they're completely equivalent, -1 is returned;
101 // This is used by BRender.
102 double equivalent_output(EDL *edl);
103 // Set project path for saving a backup
104 void set_project_path(char *path);
105 // Set points and labels
106 void set_inpoint(double position);
107 void set_outpoint(double position);
108 // Redraw resources during index builds
109 void set_index_file(Asset *asset);
110 // Add assets from the src to the destination
111 void update_assets(EDL *src);
112 void optimize();
113 // Debug
114 int dump();
115 static int next_id();
116 // Create a new folder if it doesn't exist already
117 void new_folder(char *folder);
118 void delete_folder(char *folder);
119 void modify_edithandles(double oldposition,
120 double newposition,
121 int currentend,
122 int handle_mode,
123 int edit_labels,
124 int edit_plugins);
126 void modify_pluginhandles(double oldposition,
127 double newposition,
128 int currentend,
129 int handle_mode,
130 int edit_labels,
131 Edits *trim_edits);
133 int trim_selection(double start,
134 double end,
135 int edit_labels,
136 int edit_plugins);
138 // Editing functions
139 int copy_assets(double start,
140 double end,
141 FileXML *file,
142 int all,
143 ArrayList<PluginServer*> *plugindb,
144 char *output_path);
145 int copy(double start,
146 double end,
147 int all, // Ignore recordable status of tracks for saving
148 int is_clip,
149 int is_vwindow,
150 FileXML *file,
151 ArrayList<PluginServer*> *plugindb,
152 char *output_path,
153 int rewind_it); // Rewind EDL for easy pasting
154 void paste_silence(double start,
155 double end,
156 int edit_labels /* = 1 */,
157 int edit_plugins);
158 void remove_from_project(ArrayList<Asset*> *assets);
159 void remove_from_project(ArrayList<EDL*> *clips);
160 int clear(double start,
161 double end,
162 int clear_labels,
163 int clear_plugins);
164 // Insert the asset at a point in the EDL
165 void insert_asset(Asset *asset,
166 double position,
167 Track *first_track = 0,
168 RecordLabels *labels = 0);
169 // Insert the clip at a point in the EDL
170 int insert_clips(ArrayList<EDL*> *new_edls, int load_mode, Track *first_track = 0);
171 // Add a copy of EDL* to the clip array. Returns the copy.
172 EDL* add_clip(EDL *edl);
174 void get_shared_plugins(Track *source, ArrayList<SharedLocation*> *plugin_locations);
175 void get_shared_tracks(Track *track, ArrayList<SharedLocation*> *module_locations);
178 int get_tracks_height(Theme *theme);
179 int64_t get_tracks_width();
180 // Return the dimension for a single pane if single_channel is set.
181 // Otherwise add all panes.
183 * int calculate_output_w(int single_channel);
184 * int calculate_output_h(int single_channel);
186 // Return dimensions for canvas if smaller dimensions has zoom of 1
187 void calculate_conformed_dimensions(int single_channel, float &w, float &h);
188 // Get the total output size scaled to aspect ratio
189 void output_dimensions_scaled(int &w, int &h);
190 float get_aspect_ratio();
192 // Titles of all subfolders
193 ArrayList<char*> folders;
194 // Clips
195 ArrayList<EDL*> clips;
196 // VWindow
197 EDL *vwindow_edl;
198 // is the vwindow_edl shared and therefore should not be deleted in destructor
199 int vwindow_edl_shared;
201 // Media files
202 // Shared between all EDLs
203 Assets *assets;
207 Tracks *tracks;
208 Labels *labels;
209 // Shared between all EDLs in a tree, for projects.
210 EDLSession *session;
211 // Specific to this EDL, for clips.
212 LocalSession *local_session;
214 // In the top EDL, this is the path it was loaded from. Restores
215 // project titles from backups. This is only used for loading backups.
216 // All other loads keep the path in mainsession->filename.
217 // This can't use the output_path argument to save_xml because that points
218 // to the backup file, not the project file.
219 char project_path[BCTEXTLEN];
223 // Use parent Assets if nonzero
224 EDL *parent_edl;
227 static Mutex *id_lock;
229 // unique ID of this EDL for resource window
230 int id;
233 #endif