OpenShot Library | libopenshot  0.2.6
EffectInfo.cpp
Go to the documentation of this file.
1 /**
2  * @file
3  * @brief Source file for EffectInfo class
4  * @author Jonathan Thomas <jonathan@openshot.org>
5  *
6  * @ref License
7  */
8 
9 /* LICENSE
10  *
11  * Copyright (c) 2008-2019 OpenShot Studios, LLC
12  * <http://www.openshotstudios.com/>. This file is part of
13  * OpenShot Library (libopenshot), an open-source project dedicated to
14  * delivering high quality video editing and animation solutions to the
15  * world. For more information visit <http://www.openshot.org/>.
16  *
17  * OpenShot Library (libopenshot) is free software: you can redistribute it
18  * and/or modify it under the terms of the GNU Lesser General Public License
19  * as published by the Free Software Foundation, either version 3 of the
20  * License, or (at your option) any later version.
21  *
22  * OpenShot Library (libopenshot) is distributed in the hope that it will be
23  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25  * GNU Lesser General Public License for more details.
26  *
27  * You should have received a copy of the GNU Lesser General Public License
28  * along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
29  */
30 
31 #include "EffectInfo.h"
32 
33 using namespace openshot;
34 
35 
36 // Generate JSON string of this object
37 std::string EffectInfo::Json() {
38 
39  // Return formatted string
40  return JsonValue().toStyledString();
41 }
42 
43 // Create a new effect instance
44 EffectBase* EffectInfo::CreateEffect(std::string effect_type) {
45  // Init the matching effect object
46  if (effect_type == "Bars")
47  return new Bars();
48 
49  if (effect_type == "Blur")
50  return new Blur();
51 
52  else if (effect_type == "Brightness")
53  return new Brightness();
54 
55  else if (effect_type == "Caption")
56  return new Caption();
57 
58  else if (effect_type == "ChromaKey")
59  return new ChromaKey();
60 
61  else if (effect_type == "ColorShift")
62  return new ColorShift();
63 
64  else if (effect_type == "Crop")
65  return new Crop();
66 
67  else if (effect_type == "Deinterlace")
68  return new Deinterlace();
69 
70  else if (effect_type == "Hue")
71  return new Hue();
72 
73  else if (effect_type == "Mask")
74  return new Mask();
75 
76  else if (effect_type == "Negate")
77  return new Negate();
78 
79  else if (effect_type == "Pixelate")
80  return new Pixelate();
81 
82  else if (effect_type == "Saturation")
83  return new Saturation();
84 
85  else if (effect_type == "Shift")
86  return new Shift();
87 
88  else if (effect_type == "Wave")
89  return new Wave();
90 
91  else if(effect_type == "Noise")
92  return new Noise();
93 
94  else if(effect_type == "Delay")
95  return new Delay();
96 
97  else if(effect_type == "Echo")
98  return new Echo();
99 
100  else if(effect_type == "Distortion")
101  return new Distortion();
102 
103  else if(effect_type == "ParametricEQ")
104  return new ParametricEQ();
105 
106  else if(effect_type == "Compressor")
107  return new Compressor();
108 
109  else if(effect_type == "Expander")
110  return new Expander();
111 
112  else if(effect_type == "Robotization")
113  return new Robotization();
114 
115  else if(effect_type == "Whisperization")
116  return new Whisperization();
117 
118  #ifdef USE_OPENCV
119  else if(effect_type == "Stabilizer")
120  return new Stabilizer();
121 
122  else if(effect_type == "Tracker")
123  return new Tracker();
124 
125  else if(effect_type == "Object Detector")
126  return new ObjectDetection();
127  #endif
128 
129  return NULL;
130 }
131 
132 // Generate Json::Value for this object
133 Json::Value EffectInfo::JsonValue() {
134 
135  // Create root json object
136  Json::Value root;
137 
138  // Append info JSON from each supported effect
139  root.append(Bars().JsonInfo());
140  root.append(Blur().JsonInfo());
141  root.append(Brightness().JsonInfo());
142  root.append(Caption().JsonInfo());
143  root.append(ChromaKey().JsonInfo());
144  root.append(ColorShift().JsonInfo());
145  root.append(Crop().JsonInfo());
146  root.append(Deinterlace().JsonInfo());
147  root.append(Hue().JsonInfo());
148  root.append(Mask().JsonInfo());
149  root.append(Negate().JsonInfo());
150  root.append(Pixelate().JsonInfo());
151  root.append(Saturation().JsonInfo());
152  root.append(Shift().JsonInfo());
153  root.append(Wave().JsonInfo());
154  /* Audio */
155  root.append(Noise().JsonInfo());
156  root.append(Delay().JsonInfo());
157  root.append(Echo().JsonInfo());
158  root.append(Distortion().JsonInfo());
159  root.append(ParametricEQ().JsonInfo());
160  root.append(Compressor().JsonInfo());
161  root.append(Expander().JsonInfo());
162  root.append(Robotization().JsonInfo());
163  root.append(Whisperization().JsonInfo());
164 
165  #ifdef USE_OPENCV
166  root.append(Stabilizer().JsonInfo());
167  root.append(Tracker().JsonInfo());
168  root.append(ObjectDetection().JsonInfo());
169  #endif
170 
171  // return JsonValue
172  return root;
173 
174 }
This class pixelates an image, and can be animated with openshot::Keyframe curves over time...
Definition: Pixelate.h:52
This class crops a frame image (from any side), and can be animated with openshot::Keyframe curves ov...
Definition: Crop.h:55
This abstract class is the base class, used by all effects in libopenshot.
Definition: EffectBase.h:70
This class shifts the pixels of an image up, down, left, or right, and can be animated with openshot:...
Definition: ColorShift.h:53
This class adjusts the blur of an image, and can be animated with openshot::Keyframe curves over time...
Definition: Blur.h:54
This class adds a compressor into the audio.
Definition: Compressor.h:53
This class uses the ImageMagick++ libraries, to remove (i.e. key out) a color (i.e. greenscreen)
Definition: ChromaKey.h:53
This class tracks a given object through the clip, draws a box around it and allow the user to attach...
Definition: Tracker.h:57
This class adds a distortion into the audio.
Definition: Distortion.h:55
static Json::Value JsonValue()
Generate Json::Value for this object.
Definition: EffectInfo.cpp:133
EffectBase * CreateEffect(std::string effect_type)
Create an instance of an effect (factory style)
Definition: EffectInfo.cpp:44
This effect displays all the detected objects on a clip.
This class shifts the hue of an image, and can be animated with openshot::Keyframe curves over time...
Definition: Hue.h:53
This class adds a echo into the audio.
Definition: Echo.h:53
This class uses the ImageMagick++ libraries, to negate image (i.e. negative)
Definition: Negate.h:52
static std::string Json()
Generate JSON string of this object.
Definition: EffectInfo.cpp:37
This class adjusts the saturation of color on a frame&#39;s image.
Definition: Saturation.h:60
This class uses the image libraries to apply alpha (or transparency) masks to any frame...
Definition: Mask.h:54
This class adds a noise into the audio.
Definition: Noise.h:53
This class adds a whisperization effect into the audio.
This class adjusts the brightness and contrast of an image, and can be animated with openshot::Keyfra...
Definition: Brightness.h:52
This class adds a expander (or noise gate) into the audio.
Definition: Expander.h:53
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:46
This class adds a equalization into the audio.
Definition: ParametricEQ.h:55
This class uses the ImageMagick++ libraries, to de-interlace the image, which removes the EVEN or ODD...
Definition: Deinterlace.h:52
This class stabilizes a video clip to remove undesired shaking and jitter.
Definition: Stabilizer.h:85
This class adds a delay into the audio.
Definition: Delay.h:53
This class distorts an image using a wave pattern.
Definition: Wave.h:53
This class adds captions/text over a video, based on timestamps. You can also animate some limited as...
Definition: Caption.h:56
Header file for the EffectInfo class.
This class adds a robotization effect into the audio.
Definition: Robotization.h:56
This class draws black bars around your video (from any side), and can be animated with openshot::Key...
Definition: Bars.h:54
This class shifts the pixels of an image up, down, left, or right, and can be animated with openshot:...
Definition: Shift.h:54