r602: Fix baver's code... don't insert timecode when show_tc is not set
[cinelerra_cv/mob.git] / cinelerra / track.h
bloba7513c1ce8baaf7f94253a7afb5fd4dcc16002bc
1 #ifndef TRACK_H
2 #define TRACK_H
4 #include "arraylist.h"
5 #include "asset.inc"
6 #include "autoconf.inc"
7 #include "automation.inc"
8 #include "datatype.h"
9 #include "defaults.inc"
10 #include "edit.inc"
11 #include "edits.inc"
12 #include "edl.inc"
13 #include "filexml.inc"
14 #include "floatautos.inc"
15 #include "guicast.h"
16 #include "keyframe.inc"
17 #include "linklist.h"
18 #include "module.inc"
19 #include "patch.inc"
20 #include "plugin.inc"
21 #include "pluginset.inc"
22 #include "renderengine.inc"
23 #include "sharedlocation.inc"
24 #include "theme.inc"
25 #include "intautos.inc"
26 #include "trackcanvas.inc"
27 #include "tracks.inc"
28 #include "transition.inc"
30 #include <stdint.h>
32 // UNITS ARE SAMPLES FOR ALL
34 class Track : public ListItem<Track>
36 public:
37 Track(EDL *edl, Tracks *tracks);
38 Track();
39 virtual ~Track();
41 int create_objects();
42 int get_id();
43 virtual int load_defaults(Defaults *defaults);
44 int load(FileXML *file, int track_offset, uint32_t load_flags);
45 virtual int save_header(FileXML *file) { return 0; };
46 virtual int save_derived(FileXML *file) { return 0; };
47 virtual int load_header(FileXML *file, uint32_t load_flags) { return 0; };
48 virtual int load_derived(FileXML *file, uint32_t load_flags) { return 0; };
49 void equivalent_output(Track *track, double *result);
51 virtual void copy_from(Track *track);
52 Track& operator=(Track& track);
53 virtual PluginSet* new_plugins() { return 0; };
54 // Synchronize playback numbers
55 virtual void synchronize_params(Track *track);
57 // Get number of pixels to display
58 virtual int vertical_span(Theme *theme);
59 int64_t horizontal_span();
60 void resample(double old_rate, double new_rate);
62 // Get length of track in seconds
63 double get_length();
64 // Get dimensions of source for convenience functions
65 void get_source_dimensions(double position, int &w, int &h);
67 // Editing
68 void insert_asset(Asset *asset,
69 double length,
70 double position,
71 int track_number);
72 Plugin* insert_effect(char *title,
73 SharedLocation *shared_location,
74 KeyFrame *keyframe,
75 PluginSet *plugin_set,
76 double start,
77 double length,
78 int plugin_type);
79 void insert_plugin_set(Track *track, double position);
80 void detach_effect(Plugin *plugin);
81 void detach_shared_effects(int module); // detach shared effects referencing module
82 // Insert a track from another EDL
83 void insert_track(Track *track,
84 double position,
85 int replace_default,
86 int edit_plugins);
87 // Optimize editing
88 void optimize();
89 int is_muted(int64_t position, int direction); // Test muting status
91 void move_plugins_up(PluginSet *plugin_set);
92 void move_plugins_down(PluginSet *plugin_set);
93 void remove_pluginset(PluginSet *plugin_set);
94 void remove_asset(Asset *asset);
96 // Used for determining a selection for editing so leave as int.
97 // converts the selection to SAMPLES OR FRAMES and stores in value
98 virtual int64_t to_units(double position, int round);
99 // For drawing
100 virtual double to_doubleunits(double position);
101 virtual double from_units(int64_t position);
105 // Positions are identical for handle modifications
106 virtual int identical(int64_t sample1, int64_t sample2) { return 0; };
108 // Get the plugin belonging to the set.
109 Plugin* get_current_plugin(double position,
110 int plugin_set,
111 int direction,
112 int convert_units,
113 int use_nudge);
114 Plugin* get_current_transition(double position,
115 int direction,
116 int convert_units,
117 int use_nudge);
121 // Called by playable tracks to test for playable server.
122 // Descends the plugin tree without creating a virtual console.
123 // Used by PlayableTracks::is_playable.
124 int is_synthesis(RenderEngine *renderengine,
125 int64_t position,
126 int direction);
128 // Used by PlayableTracks::is_playable
129 virtual int channel_is_playable(int64_t position,
130 int direction,
131 int *do_channel);
133 // Test direct copy conditions common to all the rendering routines
134 virtual int direct_copy_possible(int64_t start, int direction, int use_nudge);
136 // Used by PlayableTracks::is_playable
137 int plugin_used(int64_t position, int64_t direction);
143 virtual int copy_settings(Track *track);
144 void shift_keyframes(double position, double length, int convert_units);
145 void shift_effects(double position, double length, int convert_units);
146 void change_plugins(SharedLocation &old_location,
147 SharedLocation &new_location,
148 int do_swap);
149 void change_modules(int old_location,
150 int new_location,
151 int do_swap);
153 EDL *edl;
154 Tracks *tracks;
156 Edits *edits;
157 // Plugin set uses key frames for automation
158 ArrayList<PluginSet*> plugin_set;
159 Automation *automation;
161 // Vertical offset from top of timeline
162 int y_pixel;
163 int expand_view;
164 int draw;
165 // There is some debate on whether to expand gang from faders to
166 // dragging operations. This would allow every edit in a column to get dragged
167 // simultaneously.
168 int gang;
169 char title[BCTEXTLEN];
170 int play;
171 int record;
172 // Nudge in track units. Positive shifts track earlier in time. This way
173 // the position variables only need to add the nudge.
174 int64_t nudge;
175 // TRACK_AUDIO or TRACK_VIDEO
176 int data_type;
196 int load_automation(FileXML *file);
197 int load_edits(FileXML *file);
199 virtual int change_channels(int oldchannels, int newchannels) { return 0; };
200 virtual int dump();
204 // ===================================== editing
205 int copy(double start,
206 double end,
207 FileXML *file,
208 char *output_path = "");
209 int copy_assets(double start,
210 double end,
211 ArrayList<Asset*> *asset_list);
212 virtual int copy_derived(int64_t start, int64_t end, FileXML *file) { return 0; };
213 virtual int paste_derived(int64_t start, int64_t end, int64_t total_length, FileXML *file, int &current_channel) { return 0; };
214 int clear(double start,
215 double end,
216 int edit_edits,
217 int edit_labels,
218 int clear_plugins,
219 int convert_units,
220 Edits *trim_edits);
221 // Returns the point to restart background rendering at.
222 // -1 means nothing changed.
223 void clear_automation(double selectionstart,
224 double selectionend,
225 int shift_autos /* = 1 */,
226 int default_only /* = 0 */);
227 virtual int clear_automation_derived(AutoConf *auto_conf,
228 double selectionstart,
229 double selectionend,
230 int shift_autos = 1) { return 0; };
231 virtual int clear_derived(double start,
232 double end) { return 0; };
234 int copy_automation(double selectionstart,
235 double selectionend,
236 FileXML *file,
237 int default_only,
238 int autos_only);
239 virtual int copy_automation_derived(AutoConf *auto_conf,
240 double selectionstart,
241 double selectionend,
242 FileXML *file) { return 0; };
243 int paste_automation(double selectionstart,
244 double total_length,
245 double frame_rate,
246 int64_t sample_rate,
247 FileXML *file,
248 int default_only);
249 virtual int paste_automation_derived(double selectionstart,
250 double selectionend,
251 double total_length,
252 FileXML *file,
253 int shift_autos,
254 int &current_pan) { return 0; };
255 int paste_auto_silence(double start, double end);
256 virtual int paste_auto_silence_derived(int64_t start, int64_t end) { return 0; };
257 int scale_time(float rate_scale, int scale_edits, int scale_autos, int64_t start, int64_t end);
258 virtual int scale_time_derived(float rate_scale, int scale_edits, int scale_autos, int64_t start, int64_t end) { return 0; };
259 int purge_asset(Asset *asset);
260 int asset_used(Asset *asset);
261 int clear_handle(double start,
262 double end,
263 int clear_labels,
264 int clear_plugins,
265 double &distance);
266 int paste_silence(double start, double end, int edit_plugins);
267 virtual int select_translation(int cursor_x, int cursor_y) { return 0; }; // select video coordinates for frame
268 virtual int update_translation(int cursor_x, int cursor_y, int shift_down) { return 0; }; // move video coordinates
269 int select_auto(AutoConf *auto_conf, int cursor_x, int cursor_y);
270 virtual int select_auto_derived(float zoom_units, float view_start, AutoConf *auto_conf, int cursor_x, int cursor_y) { return 0; };
271 int move_auto(AutoConf *auto_conf, int cursor_x, int cursor_y, int shift_down);
272 virtual int move_auto_derived(float zoom_units, float view_start, AutoConf *auto_conf, int cursor_x, int cursor_y, int shift_down) { return 0; };
273 int release_auto();
274 virtual int release_auto_derived() { return 0; };
275 // Return whether automation would prevent direct frame copies. Not fully implemented.
276 int automation_is_used(int64_t start, int64_t end);
277 virtual int automation_is_used_derived(int64_t start, int64_t end) { return 0; }
279 int popup_transition(int cursor_x, int cursor_y);
281 // Return 1 if the left handle was selected 2 if the right handle was selected 3 if the track isn't recordable
282 int modify_edithandles(double oldposition,
283 double newposition,
284 int currentend,
285 int handle_mode,
286 int edit_labels,
287 int edit_plugins);
288 int modify_pluginhandles(double oldposition,
289 double newposition,
290 int currentend,
291 int handle_mode,
292 int edit_labels,
293 Edits *trim_edits);
294 int select_edit(int cursor_x,
295 int cursor_y,
296 double &new_start,
297 double &new_end);
298 virtual int end_translation() { return 0; };
299 virtual int reset_translation(int64_t start, int64_t end) { return 0; };
300 int feather_edits(int64_t start, int64_t end, int64_t units);
301 int64_t get_feather(int64_t selectionstart, int64_t selectionend);
304 // Absolute number of this track
305 int number_of();
307 // get_dimensions is used for getting drawing regions so use floats for partial frames
308 // get the display dimensions in SAMPLES OR FRAMES
309 virtual int get_dimensions(double &view_start,
310 double &view_units,
311 double &zoom_units) { return 0; };
312 // Longest time from current_position in which nothing changes
313 int64_t edit_change_duration(int64_t input_position,
314 int64_t input_length,
315 int reverse,
316 int test_transitions,
317 int use_nudge);
318 int64_t plugin_change_duration(int64_t input_position,
319 int64_t input_length,
320 int reverse,
321 int use_nudge);
322 // Utility for edit_change_duration.
323 int need_edit(Edit *current, int test_transitions);
324 // If the edit under position is playable.
325 // Used by PlayableTracks::is_playable.
326 int playable_edit(int64_t position, int direction);
328 // ===================================== for handles, titles, etc
330 int64_t old_view_start;
331 int pixel; // pixel position from top of track view
332 // Dimensions of this track if video
333 int track_w, track_h;
338 private:
339 // Identification of the track
340 int id;
343 #endif