4 * Copyright (C) 2008 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
32 #include "filexml.inc"
33 #include "indexable.inc"
34 #include "mwindow.inc"
37 #include "transition.inc"
39 // UNITS ARE SAMPLES FOR AUDIO / FRAMES FOR VIDEO
40 // zoom_units was mwindow->zoom_sample for AEdit
42 // Generic edit of something
44 class Edit : public ListItem<Edit>
47 Edit(EDL *edl, Edits *edits);
48 Edit(EDL *edl, Track *track);
54 Indexable* get_source();
55 // Copy from different EDL
56 virtual void copy_from(Edit *edit);
57 virtual void clone_from(Edit *edit);
58 // Compare with edit in same EDL
59 virtual int identical(Edit &edit);
60 // Called by Edits and PluginSet.
61 // Compare with edit in different EDL
62 virtual void equivalent_output(Edit *edit, int64_t *result);
63 // When inherited by a plugin need to resample keyframes
64 virtual void synchronize_params(Edit *edit);
65 // Used by Edits::insert_edits to shift plugin keyframes
66 virtual void shift_keyframes(int64_t position) {};
68 // Get size of frame to draw on timeline
72 double frames_per_picon();
73 int copy(int64_t start, int64_t end, FileXML *xml, const char *output_path);
74 // When inherited by a plugin need to resample keyframes
75 virtual void resample(double old_rate, double new_rate) {};
78 virtual void shift(int64_t difference);
80 void trim(int64_t difference);
81 int shift_start(int edit_mode, int64_t newposition, int64_t oldposition,
82 int edit_labels, int edit_autos, int edit_plugins, Edits *trim_edits);
83 int shift_end(int edit_mode, int64_t newposition, int64_t oldposition,
84 int edit_labels, int edit_autos, int edit_plugins, Edits *trim_edits);
85 int follow_edits(int64_t start, int64_t end, int64_t cut_length,
86 int edits_moved, int rest_moved, int edit_labels, int edit_autos,
87 int edit_plugins, Edits *trim_edits);
89 void insert_transition(char *title);
90 void detach_transition();
91 // Determine if silence depending on existance of asset or plugin title
92 virtual int silence();
93 void set_selected(int v);
95 // Media edit information
96 // Units are native units for the track.
97 // Start of edit in source file normalized to project sample rate.
98 // Normalized because all the editing operations clip startsource relative
99 // to the project sample rate;
101 // Start of edit in project file.
102 int64_t startproject;
103 // # of units in edit.
105 // Channel or layer of source
107 // ID for resource pixmaps, plugins
109 // ID for selection groups
111 // User defined title for timeline
112 char user_title[BCTEXTLEN];
113 int is_plugin, is_selected;
114 // edge cannot be optimized
115 int hard_left, hard_right;
118 // Transition if one is present at the beginning of this edit
119 // This stores the length of the transition
120 Transition *transition;
125 // points to an object in edl->assets if set
127 // points to an object in edl->nested_edls if set
129 // Asset and nested_edl are 0 if silence
131 // Parent EDL of this edit
134 int load_properties(FileXML *xml, int64_t &startproject);
135 virtual int load_properties_derived(FileXML *xml) { return 0; };
137 virtual int copy_properties_derived(FileXML *xml,
138 int64_t length_in_selection) { return 0; }
140 int popup_transition(float view_start, float zoom_units, int cursor_x, int cursor_y);
142 // Return 1 if the left handle was selected 2 if the right handle was selected
143 int select_handle(float view_start, float zoom_units,
144 int cursor_x, int cursor_y, int64_t &selection);
145 virtual int get_handle_parameters(int64_t &left, int64_t &right,
146 int64_t &left_sample, int64_t &right_sample, float view_start,
147 float zoom_units) { return 0; }
148 virtual int64_t get_source_end(int64_t default_);
149 void get_title(char *title);
151 int dump(FILE *fp=stdout);
152 virtual int dump_derived() { return 0; }