add grouping, default proxy vcodec h264.mp4, default titlebar alpha=1, green bar bug
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / tracks.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2010 Adam Williams <broadcast at earthling dot net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  */
21
22 #ifndef TRACKS_H
23 #define TRACKS_H
24
25 #include <stdio.h>
26 #include <stdint.h>
27
28 #include "autoconf.h"
29 #include "edl.inc"
30 #include "file.inc"
31 #include "filexml.inc"
32 #include "linklist.h"
33 #include "pluginserver.inc"
34 #include "threadindexer.inc"
35 #include "track.h"
36 #include "trackcanvas.inc"
37 #include "transition.inc"
38
39
40
41 class Tracks : public List<Track>
42 {
43 public:
44         Tracks();
45         Tracks(EDL *edl);
46         virtual ~Tracks();
47
48         Tracks& operator=(Tracks &tracks);
49         int load(FileXML *xml,
50                 int &track_offset,
51                 uint32_t load_flags);
52         void move_edits(ArrayList<Edit*> *edits, Track *track, double position,
53                 int edit_labels, int edit_plugins, int edit_autos, int behaviour);
54         void move_group(EDL *group, Track *first_track, double position);
55         void move_effect(Plugin *plugin, Track *track, int64_t position);
56         void move_effect(Plugin *plugin, PluginSet *plugin_set, int64_t position);
57
58 // Construct a list of all the recordable edits which start on position
59         void clear_selected_edits();
60         void select_affected_edits(double position, Track *start_track);
61         void get_selected_edits(ArrayList<Edit*> *drag_edits);
62         int next_group_id();
63         int new_group(int id);
64         int set_group_selected(int id, int v);
65         int del_group(int id);
66
67         void get_automation_extents(float *min,
68                 float *max,
69                 double start,
70                 double end,
71                 int autogrouptype);
72
73         void equivalent_output(Tracks *tracks, double *result);
74
75         int move_track_up(Track *track);        // move recordable tracks up
76         int move_track_down(Track *track);      // move recordable tracks down
77         int move_tracks_up();                   // move recordable tracks up
78         int move_tracks_down();                 // move recordable tracks down
79         void paste_audio_transition(PluginServer *server);
80         void paste_video_transition(PluginServer *server, int first_track = 0);
81
82 // Only tests effects
83         int plugin_exists(Plugin *plugin);
84         int track_exists(Track *track);
85
86         void paste_transition(PluginServer *server, Edit *dest_edit);
87 // Return the numbers of tracks with the play patch enabled
88         int playable_audio_tracks();
89         int playable_video_tracks();
90 // Return number of tracks with the record patch enabled
91         int recordable_audio_tracks();
92         int recordable_video_tracks();
93         int total_audio_tracks();
94         int total_video_tracks();
95 // return the longest track in all the tracks in seconds
96         double total_length();
97         double total_audio_length();
98         double total_video_length();
99         double total_length_framealigned(double fps);
100 // Update y pixels after a zoom
101         void update_y_pixels(Theme *theme);
102 // Total number of tracks where the following toggles are selected
103         void select_all(int type,
104                 int value);
105         void translate_projector(float offset_x, float offset_y);
106                 int total_of(int type);
107 // add a track
108         Track* add_audio_track(int above, Track *dst_track);
109         Track* add_video_track(int above, Track *dst_track);
110         Track* add_subttl_track(int above, Track *dst_track);
111 //      Track* add_audio_track(int to_end = 1);
112 //      Track* add_video_track(int to_end = 1);
113 // delete any track
114         int delete_track(Track* track);
115 // detach shared effects referencing module
116         int detach_shared_effects(int module);
117
118         EDL *edl;
119
120
121
122
123
124 // Types for drag toggle behavior
125         enum
126         {
127                 NONE,
128                 PLAY,
129                 RECORD,
130                 GANG,
131                 DRAW,
132                 MUTE,
133                 EXPAND
134         };
135
136
137
138
139
140
141
142
143
144         int change_channels(int oldchannels, int newchannels);
145         int dump(FILE *fp);
146
147
148
149 // Change references to shared modules in all tracks from old to new.
150 // If do_swap is true values of new are replaced with old.
151         void change_modules(int old_location, int new_location, int do_swap);
152 // Append all the tracks to the end of the recordable tracks
153         int concatenate_tracks(int edit_plugins, int edit_autos);
154 // Change references to shared plugins in all tracks
155         void change_plugins(SharedLocation &old_location, SharedLocation &new_location, int do_swap);
156
157         int delete_tracks();     // delete all the recordable tracks
158         int delete_all_tracks();      // delete just the tracks
159
160         void copy_from(Tracks *tracks);
161
162 // ================================== EDL editing
163         int copy(double start,
164                 double end,
165                 int all,
166                 FileXML *file,
167                 const char *output_path = "");
168
169
170
171         int copy_assets(FileXML *xml,
172                 double start,
173                 double end,
174                 int all);
175         int blade(double position);
176         int clear(double start, double end, int clear_plugins, int edit_autos);
177         void clear_automation(double selectionstart,
178                 double selectionend);
179         void set_automation_mode(double selectionstart,
180                 double selectionend,
181                 int mode);
182         int clear_default_keyframe();
183         int clear_handle(double start,
184                 double end,
185                 double &longest_distance,
186                 int clear_labels,
187                 int clear_plugins,
188                 int edit_autos);
189         int copy_automation(double selectionstart,
190                 double selectionend,
191                 FileXML *file,
192                 int default_only,
193                 int autos_only);
194 //      int copy_default_keyframe(FileXML *file);
195         void paste_automation(double selectionstart,
196                 FileXML *xml,
197                 int default_only,
198                 int active_only,
199                 int typeless);
200 //      int paste_default_keyframe(FileXML *file);
201         int paste(int64_t start, int64_t end);
202 // all units are samples by default
203         int paste_output(int64_t startproject,
204                                 int64_t endproject,
205                                 int64_t startsource_sample,
206                                 int64_t endsource_sample,
207                                 int64_t startsource_frame,
208                                 int64_t endsource_frame,
209                                 Asset *asset);
210         int paste_silence(double start,
211                 double end,
212                 int edit_plugins,
213                 int edit_autos);
214         int purge_asset(Asset *asset);
215         int asset_used(Asset *asset);
216 // Transition popup
217         int popup_transition(int cursor_x, int cursor_y);
218         int select_auto(int cursor_x, int cursor_y);
219         int move_auto(int cursor_x, int cursor_y, int shift_down);
220         int modify_edithandles(double &oldposition,
221                 double &newposition,
222                 int currentend,
223                 int handle_mode,
224                 int edit_labels,
225                 int edit_plugins,
226                 int edit_autos);
227         int modify_pluginhandles(double &oldposition,
228                 double &newposition,
229                 int currentend,
230                 int handle_mode,
231                 int edit_labels,
232                 int edit_autos,
233                 Edits *trim_edits);
234         int select_handles();
235         int select_region();
236         int select_edit(int64_t cursor_position, int cursor_x, int cursor_y, int64_t &new_start, int64_t &new_end);
237         int feather_edits(int64_t start, int64_t end, int64_t samples, int audio, int video);
238         int64_t get_feather(int64_t selectionstart, int64_t selectionend, int audio, int video);
239 // Move edit boundaries and automation during a framerate change
240         int scale_time(float rate_scale, int ignore_record, int scale_edits, int scale_autos, int64_t start, int64_t end);
241
242         void clear_transitions(double start, double end);
243         void shuffle_edits(double start, double end);
244         void reverse_edits(double start, double end);
245         void align_edits(double start, double end);
246         void set_edit_length(double start, double end, double length);
247         void set_transition_length(double start, double end, double length);
248         void set_transition_length(Transition *transition, double length);
249         void paste_transitions(double start, double end, int track_type, char* title);
250
251 // ================================== accounting
252
253         int handles, titles;     // show handles or titles
254         int show_output;         // what type of video to draw
255         AutoConf auto_conf;      // which autos are visible
256         int overlays_visible;
257         double total_playable_length();     // Longest track.
258 // Used by equivalent_output
259         int total_playable_vtracks();
260         double total_recordable_length();   // Longest track with recording on
261         int totalpixels();       // height of all tracks in pixels
262         int number_of(Track *track);        // track number of pointer
263         Track* number(int number);      // pointer to track number
264         Track *get(int idx, int data_type);
265
266
267 private:
268 };
269
270 #endif