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 FRAME_SIZE = 90;
31 const int MAXCLIPDURATION = 15000;
33 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};
34 enum CLIPTYPE { UNKNOWN = 0, AUDIO = 1, VIDEO = 2, AV = 3, COLOR = 4, IMAGE = 5, TEXT = 6, SLIDESHOW = 7, VIRTUAL = 8, PLAYLIST = 9 };
36 enum PROJECTITEMTYPE { PROJECTCLIPTYPE = QTreeWidgetItem::UserType, PROJECTFOLDERTYPE, PROJECTSUBCLIPTYPE };
38 enum GRAPHICSRECTITEM { AVWIDGET = 70000 , LABELWIDGET , TRANSITIONWIDGET , GROUPWIDGET};
40 enum PROJECTTOOL { SELECTTOOL = 0 , RAZORTOOL = 1 , SPACERTOOL = 2 };
43 /** TRANSITIONTYPE: between 0-99: video trans, 100-199: video+audio trans, 200-299: audio trans */
45 COMPOSITE_TRANSITION = 1,
47 LUMAFILE_TRANSITION = 3,
53 OperationCompletedMessage,
59 enum TRACKTYPE { AUDIOTRACK = 0, VIDEOTRACK = 1 };
67 EffectsList effectsList;
72 /** startPos is the position where the clip starts on the track */
74 /** endPos is the duration where the clip ends on the track */
76 /** cropStart is the position where the sub-clip starts, relative to the clip's 0 position */
78 /** cropDuration is the duration of the clip */
83 struct MltVideoProfile {
91 int sample_aspect_num;
92 int sample_aspect_den;
93 int display_aspect_num;
94 int display_aspect_den;
102 EffectParameter(const QString name, const QString value): m_name(name), m_value(value) {}
103 QString name() const {
106 QString value() const {
109 void setValue(const QString value) {
118 /** Use our own list for effect parameters so that they are not sorted in any ways, because
119 some effects like sox need a precise order
121 class EffectsParameterList: public QList < EffectParameter >
124 EffectsParameterList(): QList < EffectParameter >() {}
125 bool hasParam(const QString name) const {
126 for (int i = 0; i < size(); i++)
127 if (at(i).name() == name) return true;
130 QString paramValue(const QString name, QString defaultValue = QString()) const {
131 for (int i = 0; i < size(); i++) {
132 if (at(i).name() == name) return at(i).value();
136 void addParam(const QString &name, const QString &value) {
137 if (name.isEmpty()) return;
138 append(EffectParameter(name, value));
140 void removeParam(const QString name) {
141 for (int i = 0; i < size(); i++)
142 if (at(i).name() == name) {
152 CommentedTime(): t(GenTime(0)) {}
153 CommentedTime(const GenTime time, QString comment)
154 : t(time), c(comment) { }
156 QString comment() const {
157 return (c.isEmpty() ? i18n("Marker") : c);
159 GenTime time() const {
162 void setComment(QString comm) {
166 /* Implementation of > operator; Works identically as with basic types. */
167 bool operator>(CommentedTime op) const {
168 return t > op.time();
170 /* Implementation of < operator; Works identically as with basic types. */
171 bool operator<(CommentedTime op) const {
172 return t < op.time();
174 /* Implementation of >= operator; Works identically as with basic types. */
175 bool operator>=(CommentedTime op) const {
176 return t >= op.time();
178 /* Implementation of <= operator; Works identically as with basic types. */
179 bool operator<=(CommentedTime op) const {
180 return t <= op.time();
182 /* Implementation of == operator; Works identically as with basic types. */
183 bool operator==(CommentedTime op) const {
184 return t == op.time();
186 /* Implementation of != operator; Works identically as with basic types. */
187 bool operator!=(CommentedTime op) const {
188 return t != op.time();