r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / cinelerra / track.h
blob8954abe9c2794aed278bd67062d1c167ed3deb7d
1 #ifndef TRACK_H
2 #define TRACK_H
4 #include "arraylist.h"
5 #include "assets.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);
50 // Called by playable tracks to test for playable server.
51 // Descends the plugin tree without creating a virtual console.
52 int is_synthesis(RenderEngine *renderengine,
53 int64_t position,
54 int direction);
55 Track& operator=(Track& track);
56 virtual PluginSet* new_plugins() { return 0; };
57 // Synchronize playback numbers
58 virtual void synchronize_params(Track *track);
60 // Get number of pixels to display
61 virtual int vertical_span(Theme *theme);
62 int64_t horizontal_span();
63 void resample(double old_rate, double new_rate);
65 // Get length of track in seconds
66 double get_length();
67 // Get dimensions of source for convenience functions
68 void get_source_dimensions(double position, int &w, int &h);
70 // Editing
71 void insert_asset(Asset *asset,
72 double length,
73 double position,
74 int track_number);
75 Plugin* insert_effect(char *title,
76 SharedLocation *shared_location,
77 KeyFrame *keyframe,
78 PluginSet *plugin_set,
79 double start,
80 double length,
81 int plugin_type);
82 void insert_plugin_set(Track *track, double position);
83 void detach_effect(Plugin *plugin);
84 // Insert a track from another EDL
85 void insert_track(Track *track,
86 double position,
87 int replace_default,
88 int edit_plugins);
89 // Optimize editing
90 void optimize();
91 int is_muted(int64_t position, int direction); // Test muting status
93 void move_plugins_up(PluginSet *plugin_set);
94 void move_plugins_down(PluginSet *plugin_set);
95 void remove_pluginset(PluginSet *plugin_set);
96 void remove_asset(Asset *asset);
98 // Used for determining a selection for editing so leave as int.
99 // converts the selection to SAMPLES OR FRAMES and stores in value
100 virtual int64_t to_units(double position, int round);
101 // For drawing
102 virtual double to_doubleunits(double position);
103 virtual double from_units(int64_t position);
107 // Positions are identical for handle modifications
108 virtual int identical(int64_t sample1, int64_t sample2) { return 0; };
109 // Get the plugin belonging to the set.
110 Plugin* get_current_plugin(double position,
111 int plugin_set,
112 int direction,
113 int convert_units);
114 Plugin* get_current_transition(double position,
115 int direction,
116 int convert_units);
117 virtual int channel_is_playable(int64_t position, int direction, int *do_channel);
118 // Test direct copy conditions common to all the rendering routines
119 virtual int direct_copy_possible(int64_t start, int direction);
120 int plugin_used(int64_t position, int64_t direction);
121 virtual int copy_settings(Track *track);
122 void shift_keyframes(double position, double length, int convert_units);
123 void shift_effects(double position, double length, int convert_units);
124 void change_plugins(SharedLocation &old_location,
125 SharedLocation &new_location,
126 int do_swap);
127 void change_modules(int old_location, \
128 int new_location,
129 int do_swap);
130 int delete_module_pointers(int deleted_track);
132 EDL *edl;
133 Tracks *tracks;
135 Edits *edits;
136 // Plugin set uses key frames for automation
137 ArrayList<PluginSet*> plugin_set;
138 Automation *automation;
140 // Vertical offset from top of timeline
141 int y_pixel;
142 int expand_view;
143 int draw;
144 // There is some debate on whether to expand gang from faders to
145 // dragging operations. This would allow every edit in a column to get dragged
146 // simultaneously.
147 int gang;
148 char title[BCTEXTLEN];
149 int play;
150 int record;
151 // TRACK_AUDIO or TRACK_VIDEO
152 int data_type;
172 int load_automation(FileXML *file);
173 int load_edits(FileXML *file);
175 virtual int change_channels(int oldchannels, int newchannels) { return 0; };
176 virtual int dump();
180 // ===================================== editing
181 int copy(double start,
182 double end,
183 FileXML *file,
184 char *output_path = "");
185 int copy_assets(double start,
186 double end,
187 ArrayList<Asset*> *asset_list);
188 virtual int copy_derived(int64_t start, int64_t end, FileXML *file) { return 0; };
189 virtual int paste_derived(int64_t start, int64_t end, int64_t total_length, FileXML *file, int &current_channel) { return 0; };
190 int clear(double start,
191 double end,
192 int edit_edits,
193 int edit_labels,
194 int clear_plugins,
195 int convert_units /* = 1 */);
196 // Returns the point to restart background rendering at.
197 // -1 means nothing changed.
198 void clear_automation(double selectionstart,
199 double selectionend,
200 int shift_autos /* = 1 */,
201 int default_only /* = 0 */);
202 virtual int clear_automation_derived(AutoConf *auto_conf,
203 double selectionstart,
204 double selectionend,
205 int shift_autos = 1) { return 0; };
206 virtual int clear_derived(double start,
207 double end) { return 0; };
209 int copy_automation(double selectionstart,
210 double selectionend,
211 FileXML *file,
212 int default_only,
213 int autos_only);
214 virtual int copy_automation_derived(AutoConf *auto_conf,
215 double selectionstart,
216 double selectionend,
217 FileXML *file) { return 0; };
218 int paste_automation(double selectionstart,
219 double total_length,
220 double frame_rate,
221 int64_t sample_rate,
222 FileXML *file,
223 int default_only);
224 virtual int paste_automation_derived(double selectionstart,
225 double selectionend,
226 double total_length,
227 FileXML *file,
228 int shift_autos,
229 int &current_pan) { return 0; };
230 int paste_auto_silence(double start, double end);
231 virtual int paste_auto_silence_derived(int64_t start, int64_t end) { return 0; };
232 int scale_time(float rate_scale, int scale_edits, int scale_autos, int64_t start, int64_t end);
233 virtual int scale_time_derived(float rate_scale, int scale_edits, int scale_autos, int64_t start, int64_t end) { return 0; };
234 int purge_asset(Asset *asset);
235 int asset_used(Asset *asset);
236 int clear_handle(double start,
237 double end,
238 int clear_labels,
239 int clear_plugins,
240 double &distance);
241 int paste_silence(double start, double end, int edit_plugins);
242 virtual int select_translation(int cursor_x, int cursor_y) { return 0; }; // select video coordinates for frame
243 virtual int update_translation(int cursor_x, int cursor_y, int shift_down) { return 0; }; // move video coordinates
244 int select_auto(AutoConf *auto_conf, int cursor_x, int cursor_y);
245 virtual int select_auto_derived(float zoom_units, float view_start, AutoConf *auto_conf, int cursor_x, int cursor_y) { return 0; };
246 int move_auto(AutoConf *auto_conf, int cursor_x, int cursor_y, int shift_down);
247 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; };
248 int release_auto();
249 virtual int release_auto_derived() { return 0; };
250 // Return whether automation would prevent direct frame copies. Not fully implemented.
251 int automation_is_used(int64_t start, int64_t end);
252 virtual int automation_is_used_derived(int64_t start, int64_t end) { return 0; }
254 int popup_transition(int cursor_x, int cursor_y);
256 // Return 1 if the left handle was selected 2 if the right handle was selected 3 if the track isn't recordable
257 int modify_edithandles(double oldposition,
258 double newposition,
259 int currentend,
260 int handle_mode,
261 int edit_labels,
262 int edit_plugins);
263 int modify_pluginhandles(double oldposition,
264 double newposition,
265 int currentend,
266 int handle_mode,
267 int edit_labels);
268 int select_edit(int cursor_x,
269 int cursor_y,
270 double &new_start,
271 double &new_end);
272 virtual int end_translation() { return 0; };
273 virtual int reset_translation(int64_t start, int64_t end) { return 0; };
274 int feather_edits(int64_t start, int64_t end, int64_t units);
275 int64_t get_feather(int64_t selectionstart, int64_t selectionend);
276 int shift_module_pointers(int deleted_track);
279 // Absolute number of this track
280 int number_of();
282 // get_dimensions is used for getting drawing regions so use floats for partial frames
283 // get the display dimensions in SAMPLES OR FRAMES
284 virtual int get_dimensions(double &view_start,
285 double &view_units,
286 double &zoom_units) { return 0; };
287 // Longest time from current_position in which nothing changes
288 int64_t edit_change_duration(int64_t input_position,
289 int64_t input_length,
290 int reverse,
291 int test_transitions);
292 int64_t plugin_change_duration(int64_t input_position,
293 int64_t input_length,
294 int reverse);
295 // Utility for edit_change_duration.
296 int need_edit(Edit *current, int test_transitions);
297 // If the edit under position is playable
298 int playable_edit(int64_t position, int direction);
300 // ===================================== for handles, titles, etc
302 int64_t old_view_start;
303 int pixel; // pixel position from top of track view
304 // Dimensions of this track if video
305 int track_w, track_h;
310 private:
311 // Identification of the track
312 int id;
315 #endif