]> git.sesse.net Git - kdenlive/blob - src/definitions.h
Progress on track effects
[kdenlive] / src / definitions.h
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.h"
26
27 #include <QTreeWidgetItem>
28 #include <KLocale>
29
30 const int FRAME_SIZE = 90;
31 const int MAXCLIPDURATION = 15000;
32
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 };
35
36 enum PROJECTITEMTYPE { PROJECTCLIPTYPE = QTreeWidgetItem::UserType, PROJECTFOLDERTYPE, PROJECTSUBCLIPTYPE };
37
38 enum GRAPHICSRECTITEM { AVWIDGET = 70000 , LABELWIDGET , TRANSITIONWIDGET  , GROUPWIDGET};
39
40 enum PROJECTTOOL { SELECTTOOL = 0 , RAZORTOOL = 1 , SPACERTOOL = 2 };
41
42 enum TRANSITIONTYPE {
43     /** TRANSITIONTYPE: between 0-99: video trans, 100-199: video+audio trans, 200-299: audio trans */
44     LUMA_TRANSITION = 0,
45     COMPOSITE_TRANSITION = 1,
46     PIP_TRANSITION = 2,
47     LUMAFILE_TRANSITION = 3,
48     MIX_TRANSITION = 200
49 };
50
51 enum MessageType {
52     DefaultMessage,
53     OperationCompletedMessage,
54     InformationMessage,
55     ErrorMessage,
56     MltError
57 };
58
59 enum TRACKTYPE { AUDIOTRACK = 0, VIDEOTRACK = 1 };
60
61 struct TrackInfo {
62     TRACKTYPE type;
63     QString trackName;
64     bool isMute;
65     bool isBlind;
66     bool isLocked;
67     EffectsList effectsList;
68 };
69
70 struct ItemInfo {
71     /** startPos is the position where the clip starts on the track */
72     GenTime startPos;
73     /** endPos is the duration where the clip ends on the track */
74     GenTime endPos;
75     /** cropStart is the position where the sub-clip starts, relative to the clip's 0 position */
76     GenTime cropStart;
77     /** cropDuration is the duration of the clip */
78     GenTime cropDuration;
79     int track;
80 };
81
82 struct MltVideoProfile {
83     QString path;
84     QString description;
85     int frame_rate_num;
86     int frame_rate_den;
87     int width;
88     int height;
89     bool progressive;
90     int sample_aspect_num;
91     int sample_aspect_den;
92     int display_aspect_num;
93     int display_aspect_den;
94 };
95
96
97 class EffectParameter
98 {
99 public:
100     EffectParameter(const QString name, const QString value): m_name(name), m_value(value) {}
101     QString name()   const          {
102         return m_name;
103     }
104     QString value() const          {
105         return m_value;
106     }
107     void setValue(const QString value) {
108         m_value = value;
109     }
110
111 private:
112     QString m_name;
113     QString m_value;
114 };
115
116 /** Use our own list for effect parameters so that they are not sorted in any ways, because
117     some effects like sox need a precise order
118 */
119 class EffectsParameterList: public QList < EffectParameter >
120 {
121 public:
122     EffectsParameterList(): QList < EffectParameter >() {}
123     bool hasParam(const QString name) const {
124         for (int i = 0; i < size(); i++)
125             if (at(i).name() == name) return true;
126         return false;
127     }
128     QString paramValue(const QString name, QString defaultValue = QString()) const {
129         for (int i = 0; i < size(); i++) {
130             if (at(i).name() == name) return at(i).value();
131         }
132         return defaultValue;
133     }
134     void addParam(const QString &name, const QString &value) {
135         if (name.isEmpty()) return;
136         append(EffectParameter(name, value));
137     }
138     void removeParam(const QString name) {
139         for (int i = 0; i < size(); i++)
140             if (at(i).name() == name) {
141                 removeAt(i);
142                 break;
143             }
144     }
145 };
146
147 class CommentedTime
148 {
149 public:
150     CommentedTime(): t(GenTime(0)) {}
151     CommentedTime(const GenTime time, QString comment)
152             : t(time), c(comment) { }
153
154     QString comment()   const          {
155         return (c.isEmpty() ? i18n("Marker") : c);
156     }
157     GenTime time() const          {
158         return t;
159     }
160     void    setComment(QString comm) {
161         c = comm;
162     }
163
164     /* Implementation of > operator; Works identically as with basic types. */
165     bool operator>(CommentedTime op) const {
166         return t > op.time();
167     }
168     /* Implementation of < operator; Works identically as with basic types. */
169     bool operator<(CommentedTime op) const {
170         return t < op.time();
171     }
172     /* Implementation of >= operator; Works identically as with basic types. */
173     bool operator>=(CommentedTime op) const {
174         return t >= op.time();
175     }
176     /* Implementation of <= operator; Works identically as with basic types. */
177     bool operator<=(CommentedTime op) const {
178         return t <= op.time();
179     }
180     /* Implementation of == operator; Works identically as with basic types. */
181     bool operator==(CommentedTime op) const {
182         return t == op.time();
183     }
184     /* Implementation of != operator; Works identically as with basic types. */
185     bool operator!=(CommentedTime op) const {
186         return t != op.time();
187     }
188
189 private:
190     GenTime t;
191     QString c;
192
193
194 };
195
196
197 #endif