1/***************************************************************************
2 * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
19
20
21#ifndef DEFINITIONS_H
22#define DEFINITIONS_H
23
24#include "gentime.h"
25#include "effectslist/effectslist.h"
26
27#include <KLocalizedString>
28#include <QDebug>
29
30#include <QTreeWidgetItem>
31#include <QString>
32
33const int MAXCLIPDURATION = 15000;
34
35namespace Kdenlive {
36
37enum MonitorId {
38 NoMonitor,
39 ClipMonitor,
40 ProjectMonitor,
41 RecordMonitor,
42 StopMotionMonitor,
43 DvdMonitor
44};
45
46const int DefaultThumbHeight = 100;
47/*
48const QString clipMonitor("clipMonitor");
49const QString recordMonitor("recordMonitor");
50const QString projectMonitor("projectMonitor");
51const QString stopmotionMonitor("stopmotionMonitor");
52*/
53
54}
55
56enum OperationType {
57 None = 0,
58 MoveOperation = 1,
59 ResizeStart = 2,
60 ResizeEnd = 3,
61 FadeIn = 4,
62 FadeOut = 5,
63 TransitionStart = 6,
64 TransitionEnd = 7,
65 MoveGuide = 8,
66 KeyFrame = 9,
67 Seek = 10,
68 Spacer = 11,
69 RubberSelection = 12,
70 ScrollTimeline = 13
71};
72
73enum ClipType {
74 Unknown = 0,
75 Audio = 1,
76 Video = 2,
77 AV = 3,
78 Color = 4,
79 Image = 5,
80 Text = 6,
81 SlideShow = 7,
82 Virtual = 8,
83 Playlist = 9
84};
85
86enum ProjectItemType {
87 ProjectClipType = QTreeWidgetItem::UserType,
88 ProjectFoldeType,
89 ProjectSubclipType
90};
91
92enum GraphicsRectItem {
93 AVWidget = 70000,
94 LabelWidget,
95 TransitionWidget,
96 GroupWidget
97};
98
99enum ProjectTool {
100 SelectTool = 0,
101 RazorTool = 1,
102 SpacerTool = 2
103};
104
105enum TransitionType {
106 /** TRANSITIONTYPE: between 0-99: video trans, 100-199: video+audio trans, 200-299: audio trans */
107 LumaTransition = 0,
108 CompositeTransition = 1,
109 PipTransition = 2,
110 LumaFileTransition = 3,
111 MixTransition = 200
112};
113
114enum MessageType {
115 DefaultMessage,
116 ProcessingJobMessage,
117 OperationCompletedMessage,
118 InformationMessage,
119 ErrorMessage,
120 MltError
121};
122
123enum TrackType {
124 AudioTrack = 0,
125 VideoTrack = 1
126};
127
128enum ClipJobStatus {
129 NoJob = 0,
130 JobWaiting = -1,
131 JobWorking = -2,
132 JobDone = -3,
133 JobCrashed = -4,
134 JobAborted = -5
135};
136
137class TrackInfo {
138
139public:
140 TrackType type;
141 QString trackName;
142 bool isMute;
143 bool isBlind;
144 bool isLocked;
145 EffectsList effectsList;
146 int duration;
147 TrackInfo() :
148 type(VideoTrack),
149 isMute(0),
150 isBlind(0),
151 isLocked(0),
152 duration(0) {}
153};
154
155typedef QMap<QString, QString> stringMap;
156typedef QMap <int, QMap <int, QByteArray> > audioByteArray;
157
158class ItemInfo {
159public:
160 /** startPos is the position where the clip starts on the track */
161 GenTime startPos;
162 /** endPos is the duration where the clip ends on the track */
163 GenTime endPos;
164 /** cropStart is the position where the sub-clip starts, relative to the clip's 0 position */
165 GenTime cropStart;
166 /** cropDuration is the duration of the clip */
167 GenTime cropDuration;
168 int track;
169 ItemInfo() : track(0) {}
170};
171
172class TransitionInfo {
173public:
174 /** startPos is the position where the clip starts on the track */
175 GenTime startPos;
176 /** endPos is the duration where the clip ends on the track */
177 GenTime endPos;
178 /** the track on which the transition is (b_track)*/
179 int b_track;
180 /** the track on which the transition is applied (a_track)*/
181 int a_track;
182 /** Does the user request for a special a_track */
183 bool forceTrack;
184 TransitionInfo() :
185 b_track(0),
186 a_track(0),
187 forceTrack(0) {}
188};
189
190class MltVideoProfile {
191public:
192 QString path;
193 QString description;
194 int frame_rate_num;
195 int frame_rate_den;
196 int width;
197 int height;
198 bool progressive;
199 int sample_aspect_num;
200 int sample_aspect_den;
201 int display_aspect_num;
202 int display_aspect_den;
203 int colorspace;
204 MltVideoProfile();
205 bool operator==(const MltVideoProfile& point) const;
206 bool operator!=(const MltVideoProfile &other) const;
207};
208
209/**)
210 * @class EffectInfo
211 * @brief A class holding some meta info for effects widgets, like state (collapsed or not, ...)
212 * @author Jean-Baptiste Mardelle
213 */
214
215class EffectInfo
216{
217public:
218 EffectInfo();
219 bool isCollapsed;
220 bool groupIsCollapsed;
221 int groupIndex;
222 QString groupName;
223 QString toString() const;
224 void fromString(QString value);
225};
226
227class EffectParameter
228{
229public:
230 EffectParameter(const QString &name, const QString &value);
231 QString name() const;
232 QString value() const;
233 void setValue(const QString &value);
234
235private:
236 QString m_name;
237 QString m_value;
238};
239
240/** Use our own list for effect parameters so that they are not sorted in any ways, because
241 some effects like sox need a precise order
242*/
243class EffectsParameterList: public QList < EffectParameter >
244{
245public:
246 EffectsParameterList();
247 bool hasParam(const QString &name) const;
248
249 QString paramValue(const QString &name, const QString &defaultValue = QString()) const;
250 void addParam(const QString &name, const QString &value);
251 void removeParam(const QString &name);
252};
253
254class CommentedTime
255{
256public:
257 CommentedTime();
258 CommentedTime(const GenTime &time, const QString& comment, int markerType = 0);
259
260 QString comment() const;
261 GenTime time() const;
262 void setComment(const QString &comm);
263 void setMarkerType(int t);
264 int markerType() const;
265 static QColor markerColor(int type);
266
267 /* Implementation of > operator; Works identically as with basic types. */
268 bool operator>(CommentedTime op) const;
269 /* Implementation of < operator; Works identically as with basic types. */
270 bool operator<(CommentedTime op) const;
271 /* Implementation of >= operator; Works identically as with basic types. */
272 bool operator>=(CommentedTime op) const;
273 /* Implementation of <= operator; Works identically as with basic types. */
274 bool operator<=(CommentedTime op) const;
275 /* Implementation of == operator; Works identically as with basic types. */
276 bool operator==(CommentedTime op) const;
277 /* Implementation of != operator; Works identically as with basic types. */
278 bool operator!=(CommentedTime op) const;
279
280private:
281 GenTime t;
282 QString c;
283 int type;
284};
285
286QDebug operator << (QDebug qd, const ItemInfo &info);
287
288#endif
289