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