forked from OpenShot/libopenshot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEffectInfo.cpp
More file actions
185 lines (139 loc) · 4.2 KB
/
Copy pathEffectInfo.cpp
File metadata and controls
185 lines (139 loc) · 4.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
/**
* @file
* @brief Source file for EffectInfo class
* @author Jonathan Thomas <jonathan@openshot.org>
*
* @ref License
*/
// Copyright (c) 2008-2019 OpenShot Studios, LLC
//
// SPDX-License-Identifier: LGPL-3.0-or-later
#include "EffectInfo.h"
#include "Effects.h"
#include "effects/AnalogTape.h"
using namespace openshot;
// Generate JSON string of this object
std::string EffectInfo::Json() {
// Return formatted string
return JsonValue().toStyledString();
}
// Create a new effect instance
EffectBase* EffectInfo::CreateEffect(std::string effect_type) {
// Init the matching effect object
if (effect_type == "AnalogTape")
return new AnalogTape();
if (effect_type == "Bars")
return new Bars();
if (effect_type == "Blur")
return new Blur();
else if (effect_type == "Brightness")
return new Brightness();
else if (effect_type == "Caption")
return new Caption();
else if (effect_type == "ChromaKey")
return new ChromaKey();
else if (effect_type == "ColorMap")
return new ColorMap();
else if (effect_type == "ColorShift")
return new ColorShift();
else if (effect_type == "Crop")
return new Crop();
else if (effect_type == "Deinterlace")
return new Deinterlace();
else if (effect_type == "Hue")
return new Hue();
else if (effect_type == "LensFlare")
return new LensFlare();
else if (effect_type == "Mask")
return new Mask();
else if (effect_type == "Negate")
return new Negate();
else if (effect_type == "Pixelate")
return new Pixelate();
else if (effect_type == "Saturation")
return new Saturation();
else if (effect_type == "Sharpen")
return new Sharpen();
else if (effect_type == "Shift")
return new Shift();
else if (effect_type == "SphericalProjection")
return new SphericalProjection();
else if (effect_type == "Wave")
return new Wave();
else if(effect_type == "Noise")
return new Noise();
else if(effect_type == "Delay")
return new Delay();
else if(effect_type == "Echo")
return new Echo();
else if(effect_type == "Distortion")
return new Distortion();
else if(effect_type == "ParametricEQ")
return new ParametricEQ();
else if(effect_type == "Compressor")
return new Compressor();
else if(effect_type == "Expander")
return new Expander();
else if(effect_type == "Robotization")
return new Robotization();
else if(effect_type == "Whisperization")
return new Whisperization();
#ifdef USE_OPENCV
else if (effect_type == "Outline")
return new Outline();
else if (effect_type == "Shadow")
return new Shadow();
else if(effect_type == "Stabilizer")
return new Stabilizer();
else if(effect_type == "Tracker")
return new Tracker();
else if(effect_type == "ObjectDetection")
return new ObjectDetection();
#endif
return NULL;
}
// Generate Json::Value for this object
Json::Value EffectInfo::JsonValue() {
// Create root json object
Json::Value root;
// Append info JSON from each supported effect
root.append(AnalogTape().JsonInfo());
root.append(Bars().JsonInfo());
root.append(Blur().JsonInfo());
root.append(Brightness().JsonInfo());
root.append(Caption().JsonInfo());
root.append(ChromaKey().JsonInfo());
root.append(ColorMap().JsonInfo());
root.append(ColorShift().JsonInfo());
root.append(Crop().JsonInfo());
root.append(Deinterlace().JsonInfo());
root.append(Hue().JsonInfo());
root.append(LensFlare().JsonInfo());
root.append(Mask().JsonInfo());
root.append(Negate().JsonInfo());
root.append(Pixelate().JsonInfo());
root.append(Saturation().JsonInfo());
root.append(Sharpen().JsonInfo());
root.append(Shift().JsonInfo());
root.append(SphericalProjection().JsonInfo());
root.append(Wave().JsonInfo());
/* Audio */
root.append(Noise().JsonInfo());
root.append(Delay().JsonInfo());
root.append(Echo().JsonInfo());
root.append(Distortion().JsonInfo());
root.append(ParametricEQ().JsonInfo());
root.append(Compressor().JsonInfo());
root.append(Expander().JsonInfo());
root.append(Robotization().JsonInfo());
root.append(Whisperization().JsonInfo());
#ifdef USE_OPENCV
root.append(Outline().JsonInfo());
root.append(Shadow().JsonInfo());
root.append(Stabilizer().JsonInfo());
root.append(Tracker().JsonInfo());
root.append(ObjectDetection().JsonInfo());
#endif
// return JsonValue
return root;
}