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"
27 #include <QTreeWidgetItem>
30 const int MAXCLIPDURATION = 15000;
32 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};
33 enum CLIPTYPE { UNKNOWN = 0, AUDIO = 1, VIDEO = 2, AV = 3, COLOR = 4, IMAGE = 5, TEXT = 6, SLIDESHOW = 7, VIRTUAL = 8, PLAYLIST = 9 };
35 enum PROJECTITEMTYPE { PROJECTCLIPTYPE = QTreeWidgetItem::UserType, PROJECTFOLDERTYPE, PROJECTSUBCLIPTYPE };
37 enum GRAPHICSRECTITEM { AVWIDGET = 70000 , LABELWIDGET , TRANSITIONWIDGET , GROUPWIDGET};
39 enum PROJECTTOOL { SELECTTOOL = 0 , RAZORTOOL = 1 , SPACERTOOL = 2 };
42 /** TRANSITIONTYPE: between 0-99: video trans, 100-199: video+audio trans, 200-299: audio trans */
44 COMPOSITE_TRANSITION = 1,
46 LUMAFILE_TRANSITION = 3,
52 OperationCompletedMessage,
58 enum TRACKTYPE { AUDIOTRACK = 0, VIDEOTRACK = 1 };
60 enum PROXYSTATUS { NOPROXY = 0, PROXYWAITING = 1, CREATINGPROXY = 2, PROXYDONE = 3, PROXYCRASHED = 4};
68 EffectsList effectsList;
73 /** startPos is the position where the clip starts on the track */
75 /** endPos is the duration where the clip ends on the track */
77 /** cropStart is the position where the sub-clip starts, relative to the clip's 0 position */
79 /** cropDuration is the duration of the clip */
84 struct MltVideoProfile {
92 int sample_aspect_num;
93 int sample_aspect_den;
94 int display_aspect_num;
95 int display_aspect_den;
100 class EffectParameter
103 EffectParameter(const QString &name, const QString &value): m_name(name), m_value(value) {}
104 QString name() const {
107 QString value() const {
110 void setValue(const QString &value) {
119 /** Use our own list for effect parameters so that they are not sorted in any ways, because
120 some effects like sox need a precise order
122 class EffectsParameterList: public QList < EffectParameter >
125 EffectsParameterList(): QList < EffectParameter >() {}
126 bool hasParam(const QString &name) const {
127 for (int i = 0; i < size(); i++)
128 if (at(i).name() == name) return true;
131 QString paramValue(const QString &name, QString defaultValue = QString()) const {
132 for (int i = 0; i < size(); i++) {
133 if (at(i).name() == name) return at(i).value();
137 void addParam(const QString &name, const QString &value) {
138 if (name.isEmpty()) return;
139 append(EffectParameter(name, value));
141 void removeParam(const QString &name) {
142 for (int i = 0; i < size(); i++)
143 if (at(i).name() == name) {
153 CommentedTime(): t(GenTime(0)) {}
154 CommentedTime(const GenTime &time, QString comment)
155 : t(time), c(comment) { }
157 QString comment() const {
158 return (c.isEmpty() ? i18n("Marker") : c);
160 GenTime time() const {
163 void setComment(QString comm) {
167 /* Implementation of > operator; Works identically as with basic types. */
168 bool operator>(CommentedTime op) const {
169 return t > op.time();
171 /* Implementation of < operator; Works identically as with basic types. */
172 bool operator<(CommentedTime op) const {
173 return t < op.time();
175 /* Implementation of >= operator; Works identically as with basic types. */
176 bool operator>=(CommentedTime op) const {
177 return t >= op.time();
179 /* Implementation of <= operator; Works identically as with basic types. */
180 bool operator<=(CommentedTime op) const {
181 return t <= op.time();
183 /* Implementation of == operator; Works identically as with basic types. */
184 bool operator==(CommentedTime op) const {
185 return t == op.time();
187 /* Implementation of != operator; Works identically as with basic types. */
188 bool operator!=(CommentedTime op) const {
189 return t != op.time();