1 /***************************************************************************
2 * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
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. *
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. *
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 ***************************************************************************/
25 #include "effectslist.h"
29 #include <QTreeWidgetItem>
30 #include <QtCore/QString>
32 const int MAXCLIPDURATION = 15000;
35 enum MONITORID { noMonitor, clipMonitor, projectMonitor, recordMonitor, stopmotionMonitor, dvdMonitor };
36 /*const QString clipMonitor("clipMonitor");
37 const QString recordMonitor("recordMonitor");
38 const QString projectMonitor("projectMonitor");
39 const QString stopmotionMonitor("stopmotionMonitor");*/
42 enum OPERATIONTYPE { NONE = 0, MOVE = 1, RESIZESTART = 2, RESIZEEND = 3, FADEIN = 4, FADEOUT = 5, TRANSITIONSTART = 6, TRANSITIONEND = 7, MOVEGUIDE = 8, KEYFRAME = 9, SEEK = 10, SPACER = 11, RUBBERSELECTION = 12};
43 enum CLIPTYPE { UNKNOWN = 0, AUDIO = 1, VIDEO = 2, AV = 3, COLOR = 4, IMAGE = 5, TEXT = 6, SLIDESHOW = 7, VIRTUAL = 8, PLAYLIST = 9 };
45 enum PROJECTITEMTYPE { PROJECTCLIPTYPE = QTreeWidgetItem::UserType, PROJECTFOLDERTYPE, PROJECTSUBCLIPTYPE };
47 enum GRAPHICSRECTITEM { AVWIDGET = 70000 , LABELWIDGET , TRANSITIONWIDGET , GROUPWIDGET};
49 enum PROJECTTOOL { SELECTTOOL = 0 , RAZORTOOL = 1 , SPACERTOOL = 2 };
52 /** TRANSITIONTYPE: between 0-99: video trans, 100-199: video+audio trans, 200-299: audio trans */
54 COMPOSITE_TRANSITION = 1,
56 LUMAFILE_TRANSITION = 3,
62 OperationCompletedMessage,
68 enum TRACKTYPE { AUDIOTRACK = 0, VIDEOTRACK = 1 };
70 enum CLIPJOBSTATUS { NOJOB = 0, JOBWAITING = -1, JOBWORKING = -2, JOBDONE = -3, JOBCRASHED = -4, JOBABORTED = -5};
78 EffectsList effectsList;
82 typedef QMap<QString, QString> stringMap;
83 typedef QMap <int, QMap <int, QByteArray> > audioByteArray;
86 /** startPos is the position where the clip starts on the track */
88 /** endPos is the duration where the clip ends on the track */
90 /** cropStart is the position where the sub-clip starts, relative to the clip's 0 position */
92 /** cropDuration is the duration of the clip */
97 struct MltVideoProfile {
105 int sample_aspect_num;
106 int sample_aspect_den;
107 int display_aspect_num;
108 int display_aspect_den;
110 bool operator==(const MltVideoProfile& point) const
112 if (!description.isEmpty() && point.description == description) return true;
113 return point.frame_rate_num == frame_rate_num &&
114 point.frame_rate_den == frame_rate_den &&
115 point.width == width &&
116 point.height == height &&
117 point.progressive == progressive &&
118 point.sample_aspect_num == sample_aspect_num &&
119 point.sample_aspect_den == sample_aspect_den &&
120 point.display_aspect_den == display_aspect_den &&
121 point.colorspace == colorspace;
123 bool operator!=(const MltVideoProfile &other) const {
124 return !(*this == other);
129 class EffectParameter
132 EffectParameter(const QString &name, const QString &value): m_name(name), m_value(value) {}
133 QString name() const {
136 QString value() const {
139 void setValue(const QString &value) {
148 /** Use our own list for effect parameters so that they are not sorted in any ways, because
149 some effects like sox need a precise order
151 class EffectsParameterList: public QList < EffectParameter >
154 EffectsParameterList(): QList < EffectParameter >() {}
155 bool hasParam(const QString &name) const {
156 for (int i = 0; i < size(); i++)
157 if (at(i).name() == name) return true;
160 QString paramValue(const QString &name, QString defaultValue = QString()) const {
161 for (int i = 0; i < size(); i++) {
162 if (at(i).name() == name) return at(i).value();
166 void addParam(const QString &name, const QString &value) {
167 if (name.isEmpty()) return;
168 append(EffectParameter(name, value));
170 void removeParam(const QString &name) {
171 for (int i = 0; i < size(); i++)
172 if (at(i).name() == name) {
182 CommentedTime(): t(GenTime(0)) {}
183 CommentedTime(const GenTime &time, QString comment)
184 : t(time), c(comment) { }
186 QString comment() const {
187 return (c.isEmpty() ? i18n("Marker") : c);
189 GenTime time() const {
192 void setComment(QString comm) {
196 /* Implementation of > operator; Works identically as with basic types. */
197 bool operator>(CommentedTime op) const {
198 return t > op.time();
200 /* Implementation of < operator; Works identically as with basic types. */
201 bool operator<(CommentedTime op) const {
202 return t < op.time();
204 /* Implementation of >= operator; Works identically as with basic types. */
205 bool operator>=(CommentedTime op) const {
206 return t >= op.time();
208 /* Implementation of <= operator; Works identically as with basic types. */
209 bool operator<=(CommentedTime op) const {
210 return t <= op.time();
212 /* Implementation of == operator; Works identically as with basic types. */
213 bool operator==(CommentedTime op) const {
214 return t == op.time();
216 /* Implementation of != operator; Works identically as with basic types. */
217 bool operator!=(CommentedTime op) const {
218 return t != op.time();