OpenShot Library | libopenshot  0.5.0
EffectInfo.cpp
Go to the documentation of this file.
1 
9 // Copyright (c) 2008-2019 OpenShot Studios, LLC
10 //
11 // SPDX-License-Identifier: LGPL-3.0-or-later
12 
13 #include "EffectInfo.h"
14 #include "Effects.h"
15 #include "effects/AnalogTape.h"
16 
17 using namespace openshot;
18 
19 // Generate JSON string of this object
20 std::string EffectInfo::Json() {
21 
22  // Return formatted string
23  return JsonValue().toStyledString();
24 }
25 
26 // Create a new effect instance
27 EffectBase* EffectInfo::CreateEffect(std::string effect_type) {
28  // Init the matching effect object
29  if (effect_type == "AnalogTape")
30  return new AnalogTape();
31 
32  if (effect_type == "Bars")
33  return new Bars();
34 
35  if (effect_type == "Blur")
36  return new Blur();
37 
38  else if (effect_type == "Brightness")
39  return new Brightness();
40 
41  else if (effect_type == "Caption")
42  return new Caption();
43 
44  else if (effect_type == "ChromaKey")
45  return new ChromaKey();
46 
47  else if (effect_type == "ColorMap")
48  return new ColorMap();
49 
50  else if (effect_type == "ColorShift")
51  return new ColorShift();
52 
53  else if (effect_type == "Crop")
54  return new Crop();
55 
56  else if (effect_type == "Deinterlace")
57  return new Deinterlace();
58 
59  else if (effect_type == "Hue")
60  return new Hue();
61 
62  else if (effect_type == "LensFlare")
63  return new LensFlare();
64 
65  else if (effect_type == "Mask")
66  return new Mask();
67 
68  else if (effect_type == "Negate")
69  return new Negate();
70 
71  else if (effect_type == "Pixelate")
72  return new Pixelate();
73 
74  else if (effect_type == "Saturation")
75  return new Saturation();
76 
77  else if (effect_type == "Sharpen")
78  return new Sharpen();
79 
80  else if (effect_type == "Shift")
81  return new Shift();
82 
83  else if (effect_type == "SphericalProjection")
84  return new SphericalProjection();
85 
86  else if (effect_type == "Wave")
87  return new Wave();
88 
89  else if(effect_type == "Noise")
90  return new Noise();
91 
92  else if(effect_type == "Delay")
93  return new Delay();
94 
95  else if(effect_type == "Echo")
96  return new Echo();
97 
98  else if(effect_type == "Distortion")
99  return new Distortion();
100 
101  else if(effect_type == "ParametricEQ")
102  return new ParametricEQ();
103 
104  else if(effect_type == "Compressor")
105  return new Compressor();
106 
107  else if(effect_type == "Expander")
108  return new Expander();
109 
110  else if(effect_type == "Robotization")
111  return new Robotization();
112 
113  else if(effect_type == "Whisperization")
114  return new Whisperization();
115 
116  #ifdef USE_OPENCV
117  else if (effect_type == "Outline")
118  return new Outline();
119 
120  else if(effect_type == "Stabilizer")
121  return new Stabilizer();
122 
123  else if(effect_type == "Tracker")
124  return new Tracker();
125 
126  else if(effect_type == "ObjectDetection")
127  return new ObjectDetection();
128  #endif
129 
130  return NULL;
131 }
132 
133 // Generate Json::Value for this object
134 Json::Value EffectInfo::JsonValue() {
135 
136  // Create root json object
137  Json::Value root;
138 
139  // Append info JSON from each supported effect
140  root.append(AnalogTape().JsonInfo());
141  root.append(Bars().JsonInfo());
142  root.append(Blur().JsonInfo());
143  root.append(Brightness().JsonInfo());
144  root.append(Caption().JsonInfo());
145  root.append(ChromaKey().JsonInfo());
146  root.append(ColorMap().JsonInfo());
147  root.append(ColorShift().JsonInfo());
148  root.append(Crop().JsonInfo());
149  root.append(Deinterlace().JsonInfo());
150  root.append(Hue().JsonInfo());
151  root.append(LensFlare().JsonInfo());
152  root.append(Mask().JsonInfo());
153  root.append(Negate().JsonInfo());
154  root.append(Pixelate().JsonInfo());
155  root.append(Saturation().JsonInfo());
156  root.append(Sharpen().JsonInfo());
157  root.append(Shift().JsonInfo());
158  root.append(SphericalProjection().JsonInfo());
159  root.append(Wave().JsonInfo());
160  /* Audio */
161  root.append(Noise().JsonInfo());
162  root.append(Delay().JsonInfo());
163  root.append(Echo().JsonInfo());
164  root.append(Distortion().JsonInfo());
165  root.append(ParametricEQ().JsonInfo());
166  root.append(Compressor().JsonInfo());
167  root.append(Expander().JsonInfo());
168  root.append(Robotization().JsonInfo());
169  root.append(Whisperization().JsonInfo());
170 
171  #ifdef USE_OPENCV
172  root.append(Outline().JsonInfo());
173  root.append(Stabilizer().JsonInfo());
174  root.append(Tracker().JsonInfo());
175  root.append(ObjectDetection().JsonInfo());
176  #endif
177 
178  // return JsonValue
179  return root;
180 
181 }
openshot::EffectBase
This abstract class is the base class, used by all effects in libopenshot.
Definition: EffectBase.h:53
openshot::Mask
This class uses the image libraries to apply alpha (or transparency) masks to any frame....
Definition: Mask.h:36
openshot::EffectInfo::CreateEffect
EffectBase * CreateEffect(std::string effect_type)
Create an instance of an effect (factory style)
Definition: EffectInfo.cpp:27
openshot::Stabilizer
This class stabilizes a video clip to remove undesired shaking and jitter.
Definition: Stabilizer.h:66
openshot
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:28
openshot::Delay
This class adds a delay into the audio.
Definition: Delay.h:35
openshot::ParametricEQ
This class adds a equalization into the audio.
Definition: ParametricEQ.h:37
openshot::LensFlare
Definition: LensFlare.h:24
openshot::Brightness
This class adjusts the brightness and contrast of an image, and can be animated with openshot::Keyfra...
Definition: Brightness.h:34
openshot::Saturation
This class adjusts the saturation of color on a frame's image.
Definition: Saturation.h:42
openshot::Expander
This class adds a expander (or noise gate) into the audio.
Definition: Expander.h:36
openshot::Distortion
This class adds a distortion into the audio.
Definition: Distortion.h:37
openshot::Blur
This class adjusts the blur of an image, and can be animated with openshot::Keyframe curves over time...
Definition: Blur.h:36
openshot::Deinterlace
This class uses the ImageMagick++ libraries, to de-interlace the image, which removes the EVEN or ODD...
Definition: Deinterlace.h:34
openshot::EffectInfo::Json
static std::string Json()
Generate JSON string of this object.
Definition: EffectInfo.cpp:20
openshot::Sharpen
This class provides a sharpen effect for video frames.
Definition: Sharpen.h:31
openshot::Pixelate
This class pixelates an image, and can be animated with openshot::Keyframe curves over time.
Definition: Pixelate.h:34
openshot::ChromaKey
This class removes (i.e. keys out) a color (i.e. greenscreen)
Definition: ChromaKey.h:36
Effects.h
This header includes all commonly used effects for libopenshot, for ease-of-use.
openshot::Caption
This class adds captions/text over a video, based on timestamps. You can also animate some limited as...
Definition: Caption.h:38
openshot::Whisperization
This class adds a whisperization effect into the audio.
Definition: Whisperization.h:41
openshot::Bars
This class draws black bars around your video (from any side), and can be animated with openshot::Key...
Definition: Bars.h:36
EffectInfo.h
Header file for the EffectInfo class.
openshot::Shift
This class shifts the pixels of an image up, down, left, or right, and can be animated with openshot:...
Definition: Shift.h:36
openshot::ColorMap
Applies a 1D or 3D LUT (.cube) color transform to each frame.
Definition: ColorMap.h:35
openshot::Tracker
This class tracks a given object through the clip, draws a box around it and allow the user to attach...
Definition: Tracker.h:41
openshot::Crop
This class crops a frame image (from any side), and can be animated with openshot::Keyframe curves ov...
Definition: Crop.h:37
openshot::Negate
This class uses the ImageMagick++ libraries, to negate image (i.e. negative)
Definition: Negate.h:34
openshot::Hue
This class shifts the hue of an image, and can be animated with openshot::Keyframe curves over time.
Definition: Hue.h:35
openshot::ObjectDetection
This effect displays all the detected objects on a clip.
Definition: ObjectDetection.h:57
openshot::EffectInfo::JsonValue
static Json::Value JsonValue()
Generate Json::Value for this object.
Definition: EffectInfo.cpp:134
openshot::SphericalProjection
Projects 360° or fisheye video through a virtual camera. Supports yaw, pitch, roll,...
Definition: SphericalProjection.h:32
openshot::Robotization
This class adds a robotization effect into the audio.
Definition: Robotization.h:42
openshot::AnalogTape
Analog video tape simulation effect.
Definition: AnalogTape.h:41
openshot::ColorShift
This class shifts the pixels of an image up, down, left, or right, and can be animated with openshot:...
Definition: ColorShift.h:35
AnalogTape.h
Header file for AnalogTape effect class.
openshot::Echo
This class adds a echo into the audio.
Definition: Echo.h:35
openshot::Compressor
This class adds a compressor into the audio.
Definition: Compressor.h:35
openshot::Wave
This class distorts an image using a wave pattern.
Definition: Wave.h:35
openshot::Outline
This class add an outline around image with transparent background and can be animated with openshot:...
Definition: Outline.h:37
openshot::Noise
This class adds a noise into the audio.
Definition: Noise.h:35