Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

track.h

Go to the documentation of this file.
00001 #ifndef TRACK_H
00002 #define TRACK_H
00003 
00004 #include "arraylist.h"
00005 #include "asset.inc"
00006 #include "autoconf.inc"
00007 #include "automation.inc"
00008 #include "datatype.h"
00009 #include "defaults.inc"
00010 #include "edit.inc"
00011 #include "edits.inc"
00012 #include "edl.inc"
00013 #include "filexml.inc"
00014 #include "floatautos.inc"
00015 #include "guicast.h"
00016 #include "keyframe.inc"
00017 #include "linklist.h"
00018 #include "module.inc"
00019 #include "patch.inc"
00020 #include "plugin.inc"
00021 #include "pluginset.inc"
00022 #include "renderengine.inc"
00023 #include "sharedlocation.inc"
00024 #include "theme.inc"
00025 #include "intautos.inc"
00026 #include "trackcanvas.inc"
00027 #include "tracks.inc"
00028 #include "transition.inc"
00029 
00030 #include <stdint.h>
00031 
00032 // UNITS ARE SAMPLES FOR ALL
00033 
00034 class Track : public ListItem<Track>
00035 {
00036 public:
00037         Track(EDL *edl, Tracks *tracks);
00038         Track();
00039         virtual ~Track();
00040 
00041         int create_objects();
00042         int get_id();
00043         virtual int load_defaults(Defaults *defaults);
00044         int load(FileXML *file, int track_offset, uint32_t load_flags);
00045         virtual int save_header(FileXML *file) { return 0; };
00046         virtual int save_derived(FileXML *file) { return 0; };
00047         virtual int load_header(FileXML *file, uint32_t load_flags) { return 0; };
00048         virtual int load_derived(FileXML *file, uint32_t load_flags) { return 0; };
00049         void equivalent_output(Track *track, double *result);
00050 
00051         virtual void copy_from(Track *track);
00052         Track& operator=(Track& track);
00053         virtual PluginSet* new_plugins() { return 0; };
00054 // Synchronize playback numbers
00055         virtual void synchronize_params(Track *track);
00056 
00057 // Get number of pixels to display
00058         virtual int vertical_span(Theme *theme);
00059         int64_t horizontal_span();
00060         void resample(double old_rate, double new_rate);
00061 
00062 // Get length of track in seconds
00063         double get_length();
00064 // Get dimensions of source for convenience functions
00065         void get_source_dimensions(double position, int &w, int &h);
00066 
00067 // Editing
00068         void insert_asset(Asset *asset, 
00069                 double length, 
00070                 double position, 
00071                 int track_number);
00072         Plugin* insert_effect(char *title, 
00073                 SharedLocation *shared_location, 
00074                 KeyFrame *keyframe,
00075                 PluginSet *plugin_set,
00076                 double start,
00077                 double length,
00078                 int plugin_type);
00079         void insert_plugin_set(Track *track, double position);
00080         void detach_effect(Plugin *plugin);
00081 // Insert a track from another EDL
00082         void insert_track(Track *track, 
00083                 double position, 
00084                 int replace_default,
00085                 int edit_plugins);
00086 // Optimize editing
00087         void optimize();
00088         int is_muted(int64_t position, int direction);  // Test muting status
00089 
00090         void move_plugins_up(PluginSet *plugin_set);
00091         void move_plugins_down(PluginSet *plugin_set);
00092         void remove_pluginset(PluginSet *plugin_set);
00093         void remove_asset(Asset *asset);
00094 
00095 // Used for determining a selection for editing so leave as int.
00096 // converts the selection to SAMPLES OR FRAMES and stores in value
00097         virtual int64_t to_units(double position, int round);
00098 // For drawing
00099         virtual double to_doubleunits(double position);
00100         virtual double from_units(int64_t position);
00101 
00102 
00103 
00104 // Positions are identical for handle modifications
00105     virtual int identical(int64_t sample1, int64_t sample2) { return 0; };
00106 
00107 // Get the plugin belonging to the set.
00108         Plugin* get_current_plugin(double position, 
00109                 int plugin_set, 
00110                 int direction, 
00111                 int convert_units,
00112                 int use_nudge);
00113         Plugin* get_current_transition(double position, 
00114                 int direction, 
00115                 int convert_units,
00116                 int use_nudge);
00117 
00118 // detach shared effects referencing module
00119         void detach_shared_effects(int module); 
00120 
00121 
00122 // Called by playable tracks to test for playable server.
00123 // Descends the plugin tree without creating a virtual console.
00124 // Used by PlayableTracks::is_playable.
00125         int is_synthesis(RenderEngine *renderengine, 
00126                 int64_t position, 
00127                 int direction);
00128 
00129 // Used by PlayableTracks::is_playable
00130         virtual int channel_is_playable(int64_t position, 
00131                 int direction, 
00132                 int *do_channel);
00133 
00134 // Test direct copy conditions common to all the rendering routines
00135         virtual int direct_copy_possible(int64_t start, int direction, int use_nudge);
00136 
00137 // Used by PlayableTracks::is_playable
00138         int plugin_used(int64_t position, int64_t direction);
00139 
00140 
00141 
00142 
00143 
00144         virtual int copy_settings(Track *track);
00145         void shift_keyframes(double position, double length, int convert_units);
00146         void shift_effects(double position, double length, int convert_units);
00147         void change_plugins(SharedLocation &old_location, 
00148                 SharedLocation &new_location, 
00149                 int do_swap);
00150         void change_modules(int old_location, 
00151                 int new_location, 
00152                 int do_swap);
00153 
00154         EDL *edl;
00155         Tracks *tracks;
00156 
00157         Edits *edits;
00158 // Plugin set uses key frames for automation
00159         ArrayList<PluginSet*> plugin_set;
00160         Automation *automation;
00161 
00162 // Vertical offset from top of timeline
00163         int y_pixel;
00164         int expand_view;
00165         int draw;
00166 // There is some debate on whether to expand gang from faders to
00167 // dragging operations.  This would allow every edit in a column to get dragged
00168 // simultaneously.
00169         int gang;
00170         char title[BCTEXTLEN];
00171         int play;
00172         int record;
00173 // Nudge in track units.  Positive shifts track earlier in time.  This way
00174 // the position variables only need to add the nudge.
00175         int64_t nudge;
00176 // TRACK_AUDIO or TRACK_VIDEO
00177         int data_type;     
00178 
00179 
00180 
00181 
00182 
00183 
00184 
00185 
00186 
00187 
00188 
00189 
00190 
00191 
00192 
00193 
00194 
00195 
00196 
00197         int load_automation(FileXML *file);
00198         int load_edits(FileXML *file);
00199 
00200         virtual int change_channels(int oldchannels, int newchannels) { return 0; };
00201         virtual int dump();
00202 
00203 
00204 
00205 // ===================================== editing
00206         int copy(double start, 
00207                 double end, 
00208                 FileXML *file, 
00209                 char *output_path = "");
00210         int copy_assets(double start, 
00211                 double end, 
00212                 ArrayList<Asset*> *asset_list);
00213         virtual int copy_derived(int64_t start, int64_t end, FileXML *file) { return 0; };
00214         virtual int paste_derived(int64_t start, int64_t end, int64_t total_length, FileXML *file, int &current_channel) { return 0; };
00215         int clear(double start, 
00216                 double end, 
00217                 int edit_edits,
00218                 int edit_labels,
00219                 int clear_plugins, 
00220                 int convert_units,
00221                 Edits *trim_edits);
00222 // Returns the point to restart background rendering at.
00223 // -1 means nothing changed.
00224         void clear_automation(double selectionstart, 
00225                 double selectionend, 
00226                 int shift_autos   /* = 1 */,
00227                 int default_only  /* = 0 */);
00228         virtual int clear_automation_derived(AutoConf *auto_conf, 
00229                 double selectionstart, 
00230                 double selectionend, 
00231                 int shift_autos = 1) { return 0; };
00232         virtual int clear_derived(double start, 
00233                 double end) { return 0; };
00234 
00235         int copy_automation(double selectionstart, 
00236                 double selectionend, 
00237                 FileXML *file,
00238                 int default_only,
00239                 int autos_only);
00240         virtual int copy_automation_derived(AutoConf *auto_conf, 
00241                 double selectionstart, 
00242                 double selectionend, 
00243                 FileXML *file) { return 0; };
00244         int paste_automation(double selectionstart, 
00245                 double total_length, 
00246                 double frame_rate,
00247                 int64_t sample_rate,
00248                 FileXML *file,
00249                 int default_only);
00250         virtual int paste_automation_derived(double selectionstart, 
00251                 double selectionend, 
00252                 double total_length, 
00253                 FileXML *file, 
00254                 int shift_autos, 
00255                 int &current_pan) { return 0; };
00256         int paste_auto_silence(double start, double end);
00257         virtual int paste_auto_silence_derived(int64_t start, int64_t end) { return 0; };
00258         int scale_time(float rate_scale, int scale_edits, int scale_autos, int64_t start, int64_t end);
00259         virtual int scale_time_derived(float rate_scale, int scale_edits, int scale_autos, int64_t start, int64_t end) { return 0; };
00260         int purge_asset(Asset *asset);
00261         int asset_used(Asset *asset);
00262         int clear_handle(double start, 
00263                 double end, 
00264                 int clear_labels,
00265                 int clear_plugins, 
00266                 double &distance);
00267         int paste_silence(double start, double end, int edit_plugins);
00268         virtual int select_translation(int cursor_x, int cursor_y) { return 0; };  // select video coordinates for frame
00269         virtual int update_translation(int cursor_x, int cursor_y, int shift_down) { return 0; };  // move video coordinates
00270         int select_auto(AutoConf *auto_conf, int cursor_x, int cursor_y);
00271         virtual int select_auto_derived(float zoom_units, float view_start, AutoConf *auto_conf, int cursor_x, int cursor_y) { return 0; };
00272         int move_auto(AutoConf *auto_conf, int cursor_x, int cursor_y, int shift_down);
00273         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; };
00274         int release_auto();
00275         virtual int release_auto_derived() { return 0; };
00276 // Return whether automation would prevent direct frame copies.  Not fully implemented.
00277         int automation_is_used(int64_t start, int64_t end);
00278         virtual int automation_is_used_derived(int64_t start, int64_t end) { return 0; }
00279 
00280         int popup_transition(int cursor_x, int cursor_y);
00281 
00282 // Return 1 if the left handle was selected 2 if the right handle was selected 3 if the track isn't recordable
00283         int modify_edithandles(double oldposition, 
00284                 double newposition, 
00285                 int currentend, 
00286                 int handle_mode,
00287                 int edit_labels,
00288                 int edit_plugins);
00289         int modify_pluginhandles(double oldposition, 
00290                 double newposition, 
00291                 int currentend, 
00292                 int handle_mode,
00293                 int edit_labels,
00294                 Edits *trim_edits);
00295         int select_edit(int cursor_x, 
00296                 int cursor_y, 
00297                 double &new_start, 
00298                 double &new_end);
00299         virtual int end_translation() { return 0; };
00300         virtual int reset_translation(int64_t start, int64_t end) { return 0; };
00301         int feather_edits(int64_t start, int64_t end, int64_t units);
00302         int64_t get_feather(int64_t selectionstart, int64_t selectionend);
00303 
00304 
00305 // Absolute number of this track
00306         int number_of();           
00307 
00308 // get_dimensions is used for getting drawing regions so use floats for partial frames
00309 // get the display dimensions in SAMPLES OR FRAMES
00310         virtual int get_dimensions(double &view_start, 
00311                 double &view_units, 
00312                 double &zoom_units) { return 0; };   
00313 // Longest time from current_position in which nothing changes
00314         int64_t edit_change_duration(int64_t input_position, 
00315                 int64_t input_length, 
00316                 int reverse, 
00317                 int test_transitions,
00318                 int use_nudge);
00319         int64_t plugin_change_duration(int64_t input_position,
00320                 int64_t input_length,
00321                 int reverse,
00322                 int use_nudge);
00323 // Utility for edit_change_duration.
00324         int need_edit(Edit *current, int test_transitions);
00325 // If the edit under position is playable.
00326 // Used by PlayableTracks::is_playable.
00327         int playable_edit(int64_t position, int direction);
00328 
00329 // ===================================== for handles, titles, etc
00330 
00331         int64_t old_view_start;
00332         int pixel;   // pixel position from top of track view
00333 // Dimensions of this track if video
00334         int track_w, track_h;
00335 
00336 
00337 
00338 
00339 private:
00340 // Identification of the track
00341         int id;
00342 };
00343 
00344 #endif

Generated on Sun Jan 8 13:39:01 2006 for Cinelerra-svn by  doxygen 1.4.4