]> git.sesse.net Git - kdenlive/blob - src/definitions.h
Big update to the proxy clips, fixing several issues. They can now be deleted in...
[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 enum PROXYSTATUS { NOPROXY = 0, PROXYWAITING = 1, CREATINGPROXY = 2, PROXYDONE = 3, PROXYCRASHED = 4};
62
63 struct TrackInfo {
64     TRACKTYPE type;
65     QString trackName;
66     bool isMute;
67     bool isBlind;
68     bool isLocked;
69     EffectsList effectsList;
70     int duration;
71 };
72
73 struct ItemInfo {
74     /** startPos is the position where the clip starts on the track */
75     GenTime startPos;
76     /** endPos is the duration where the clip ends on the track */
77     GenTime endPos;
78     /** cropStart is the position where the sub-clip starts, relative to the clip's 0 position */
79     GenTime cropStart;
80     /** cropDuration is the duration of the clip */
81     GenTime cropDuration;
82     int track;
83 };
84
85 struct MltVideoProfile {
86     QString path;
87     QString description;
88     int frame_rate_num;
89     int frame_rate_den;
90     int width;
91     int height;
92     bool progressive;
93     int sample_aspect_num;
94     int sample_aspect_den;
95     int display_aspect_num;
96     int display_aspect_den;
97     int colorspace;
98 };
99
100
101 class EffectParameter
102 {
103 public:
104     EffectParameter(const QString name, const QString value): m_name(name), m_value(value) {}
105     QString name()   const          {
106         return m_name;
107     }
108     QString value() const          {
109         return m_value;
110     }
111     void setValue(const QString value) {
112         m_value = value;
113     }
114
115 private:
116     QString m_name;
117     QString m_value;
118 };
119
120 /** Use our own list for effect parameters so that they are not sorted in any ways, because
121     some effects like sox need a precise order
122 */
123 class EffectsParameterList: public QList < EffectParameter >
124 {
125 public:
126     EffectsParameterList(): QList < EffectParameter >() {}
127     bool hasParam(const QString name) const {
128         for (int i = 0; i < size(); i++)
129             if (at(i).name() == name) return true;
130         return false;
131     }
132     QString paramValue(const QString name, QString defaultValue = QString()) const {
133         for (int i = 0; i < size(); i++) {
134             if (at(i).name() == name) return at(i).value();
135         }
136         return defaultValue;
137     }
138     void addParam(const QString &name, const QString &value) {
139         if (name.isEmpty()) return;
140         append(EffectParameter(name, value));
141     }
142     void removeParam(const QString name) {
143         for (int i = 0; i < size(); i++)
144             if (at(i).name() == name) {
145                 removeAt(i);
146                 break;
147             }
148     }
149 };
150
151 class CommentedTime
152 {
153 public:
154     CommentedTime(): t(GenTime(0)) {}
155     CommentedTime(const GenTime time, QString comment)
156         : t(time), c(comment) { }
157
158     QString comment()   const          {
159         return (c.isEmpty() ? i18n("Marker") : c);
160     }
161     GenTime time() const          {
162         return t;
163     }
164     void    setComment(QString comm) {
165         c = comm;
166     }
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     /* Implementation of != operator; Works identically as with basic types. */
189     bool operator!=(CommentedTime op) const {
190         return t != op.time();
191     }
192
193 private:
194     GenTime t;
195     QString c;
196
197
198 };
199
200
201 #endif