Credit Andrew - fix vorbis audio which was scratchy and ensure aging plugin does...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / edits.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008-2013 Adam Williams <broadcast at earthling dot net>
5  * Copyright (C) 2003-2016 Cinelerra CV contributors
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  *
21  */
22
23 #ifndef EDITS_H
24 #define EDITS_H
25
26
27 #include "asset.inc"
28 #include "assets.inc"
29 #include "edl.inc"
30 #include "guicast.h"
31 #include "edit.h"
32 #include "filexml.inc"
33 #include "linklist.h"
34 #include "track.inc"
35 #include "transition.inc"
36
37 // Generic list of edits of something
38
39 class Edits : public List<Edit>
40 {
41 public:
42         Edits(EDL *edl, Track *track);
43         virtual ~Edits();
44
45         void equivalent_output(Edits *edits, int64_t *result);
46         virtual void copy_from(Edits *edits);
47         virtual Edits& operator=(Edits& edits);
48 // Insert edits from different EDL
49         void insert_edits(Edits *edits,
50                 int64_t position,
51                 int64_t min_length,
52                 int edit_autos);
53 // Insert asset from same EDL
54         void insert_asset(Asset *asset,
55                 EDL *nested_edl,
56                 int64_t length,
57                 int64_t sample,
58                 int track_number);
59 // Split edit containing position.
60 // Return the second edit in the split.
61         Edit* split_edit(int64_t position);
62 // Create a blank edit in the native data format
63         int clear_handle(double start,
64                 double end,
65                 int edit_plugins,
66                 int edit_autos,
67                 double &distance);
68         virtual Edit* create_edit() { return 0; };
69 // Insert a 0 length edit at the position
70         Edit* insert_new_edit(int64_t sample);
71         int save(FileXML *xml, const char *output_path);
72         int copy(int64_t start, int64_t end, FileXML *xml, const char *output_path);
73 // Clear region of edits
74         virtual void clear(int64_t start, int64_t end);
75 // Clear edits and plugins for a handle modification
76         virtual void clear_recursive(int64_t start,
77                 int64_t end,
78                 int edit_edits,
79                 int edit_labels,
80                 int edit_plugins,
81                 int edit_autos,
82                 Edits *trim_edits);
83         virtual void shift_keyframes_recursive(int64_t position, int64_t length);
84         virtual void shift_effects_recursive(int64_t position, int64_t length, int edit_autos);
85         void paste_silence(int64_t start, int64_t end);
86 // Returns the newly created edit
87         Edit *create_silence(int64_t start, int64_t end);
88         double early_timecode();
89         void align_timecodes(double offset);
90
91         void resample(double old_rate, double new_rate);
92 // Shift edits on or after position by distance
93 // Return the edit now on the position.
94         virtual Edit* shift(int64_t position, int64_t difference);
95
96         EDL *edl;
97         Track *track;
98
99
100 // ================================== file operations
101
102         void load(FileXML *xml, int track_offset);
103         int load_edit(FileXML *xml, int64_t &startproject, int track_offset);
104
105         virtual Edit* append_new_edit() { return 0; }
106         virtual Edit* insert_edit_after(Edit *previous_edit) { return 0; }
107         virtual int load_edit_properties(FileXML *xml) { return 0; }
108
109
110 // ==================================== accounting
111
112         Edit* editof(int64_t position, int direction, int use_nudge);
113         Edit* get_edit(int id);
114 // Return an edit if position is over an edit and the edit has a source file
115         Edit* get_playable_edit(int64_t position, int use_nudge);
116 //      int64_t total_length();
117         int64_t length();         // end position of last edit
118 // audio edit shorter than .5 frames is a glitch
119         int is_glitch(Edit *edit);
120
121 // ==================================== editing
122
123         int modify_handles(double oldposition, double newposition,
124                 int currentend, int edit_mode, int edit_edits, int edit_labels,
125                 int edit_plugins, int edit_autos, Edits *trim_edits, int group_id);
126         void update_idxbl_length(int id, int64_t du);
127
128         virtual int optimize();
129
130         virtual int clone_derived(Edit* new_edit, Edit* old_edit) { return 0; }
131 };
132
133
134
135 #endif