-
Notifications
You must be signed in to change notification settings - Fork 261
/
EffectInfo.cpp
134 lines (103 loc) · 3.37 KB
/
EffectInfo.cpp
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
/**
* @file
* @brief Source file for EffectInfo class
* @author Jonathan Thomas <jonathan@openshot.org>
*
* @ref License
*/
/* LICENSE
*
* Copyright (c) 2008-2019 OpenShot Studios, LLC
* <http://www.openshotstudios.com/>. This file is part of
* OpenShot Library (libopenshot), an open-source project dedicated to
* delivering high quality video editing and animation solutions to the
* world. For more information visit <http://www.openshot.org/>.
*
* OpenShot Library (libopenshot) is free software: you can redistribute it
* and/or modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* OpenShot Library (libopenshot) is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../include/EffectInfo.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 == "Bars")
return new Bars();
if (effect_type == "Blur")
return new Blur();
else if (effect_type == "Brightness")
return new Brightness();
else if (effect_type == "ChromaKey")
return new ChromaKey();
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 == "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 == "Shift")
return new Shift();
else if (effect_type == "Wave")
return new Wave();
#ifdef USE_OPENCV
else if(effect_type == "Stabilizer")
return new Stabilizer();
else if(effect_type == "Tracker")
return new Tracker();
else if(effect_type == "Object Detector")
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(Bars().JsonInfo());
root.append(Blur().JsonInfo());
root.append(Brightness().JsonInfo());
root.append(ChromaKey().JsonInfo());
root.append(ColorShift().JsonInfo());
root.append(Crop().JsonInfo());
root.append(Deinterlace().JsonInfo());
root.append(Hue().JsonInfo());
root.append(Mask().JsonInfo());
root.append(Negate().JsonInfo());
root.append(Pixelate().JsonInfo());
root.append(Saturation().JsonInfo());
root.append(Shift().JsonInfo());
root.append(Wave().JsonInfo());
#ifdef USE_OPENCV
root.append(Stabilizer().JsonInfo());
root.append(Tracker().JsonInfo());
root.append(ObjectDetection().JsonInfo());
#endif
// return JsonValue
return root;
}