4 * Copyright (C) 2008-2013 Adam Williams <broadcast at earthling dot net>
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.
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.
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
31 #include "filexml.inc"
34 #include "transition.inc"
36 // Generic list of edits of something
38 class Edits : public List<Edit>
41 Edits(EDL *edl, Track *track);
44 void equivalent_output(Edits *edits, int64_t *result);
45 virtual void copy_from(Edits *edits);
46 virtual Edits& operator=(Edits& edits);
47 // Insert edits from different EDL
48 void insert_edits(Edits *edits,
52 // Insert asset from same EDL
53 void insert_asset(Asset *asset,
58 // Split edit containing position.
59 // Return the second edit in the split.
60 Edit* split_edit(int64_t position);
61 // Create a blank edit in the native data format
62 int clear_handle(double start,
67 virtual Edit* create_edit() { return 0; };
68 // Insert a 0 length edit at the position
69 Edit* insert_new_edit(int64_t sample);
70 int save(FileXML *xml, const char *output_path);
71 int copy(int64_t start, int64_t end, FileXML *xml, const char *output_path);
72 // Clear region of edits
73 virtual void clear(int64_t start, int64_t end);
74 // Clear edits and plugins for a handle modification
75 virtual void clear_recursive(int64_t start,
82 virtual void shift_keyframes_recursive(int64_t position, int64_t length);
83 virtual void shift_effects_recursive(int64_t position, int64_t length, int edit_autos);
84 void paste_silence(int64_t start, int64_t end);
85 // Returns the newly created edit
86 Edit *create_silence(int64_t start, int64_t end);
87 double early_timecode();
88 void align_timecodes(double offset);
90 void resample(double old_rate, double new_rate);
91 // Shift edits on or after position by distance
92 // Return the edit now on the position.
93 virtual Edit* shift(int64_t position, int64_t difference);
99 // ================================== file operations
101 void load(FileXML *xml, int track_offset);
102 int load_edit(FileXML *xml, int64_t &startproject, int track_offset);
104 virtual Edit* append_new_edit() { return 0; }
105 virtual Edit* insert_edit_after(Edit *previous_edit) { return 0; }
106 virtual int load_edit_properties(FileXML *xml) { return 0; }
109 // ==================================== accounting
111 Edit* editof(int64_t position, int direction, int use_nudge);
112 Edit* get_edit(int id);
113 // Return an edit if position is over an edit and the edit has a source file
114 Edit* get_playable_edit(int64_t position, int use_nudge);
115 // int64_t total_length();
116 int64_t length(); // end position of last edit
117 // audio edit shorter than .5 frames is a glitch
118 int is_glitch(Edit *edit);
120 // ==================================== editing
122 int modify_handles(double oldposition, double newposition,
123 int currentend, int edit_mode, int edit_edits, int edit_labels,
124 int edit_plugins, int edit_autos, Edits *trim_edits, int group_id);
125 void update_idxbl_length(int id, int64_t du);
127 virtual int optimize();
129 virtual int clone_derived(Edit* new_edit, Edit* old_edit) { return 0; }