OpenShot Library | libopenshot  0.4.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 
16 using namespace openshot;
17 
18 // Generate JSON string of this object
19 std::string EffectInfo::Json() {
20 
21  // Return formatted string
22  return JsonValue().toStyledString();
23 }
24 
25 // Create a new effect instance
26 EffectBase* EffectInfo::CreateEffect(std::string effect_type) {
27  // Init the matching effect object
28  if (effect_type == "Bars")
29  return new Bars();
30 
31  if (effect_type == "Blur")
32  return new Blur();
33 
34  else if (effect_type == "Brightness")
35  return new Brightness();
36 
37  else if (effect_type == "Caption")
38  return new Caption();
39 
40  else if (effect_type == "ChromaKey")
41  return new ChromaKey();
42 
43  else if (effect_type == "ColorMap")
44  return new ColorMap();
45 
46  else if (effect_type == "ColorShift")
47  return new ColorShift();
48 
49  else if (effect_type == "Crop")
50  return new Crop();
51 
52  else if (effect_type == "Deinterlace")
53  return new Deinterlace();
54 
55  else if (effect_type == "Hue")
56  return new Hue();
57 
58  else if (effect_type == "LensFlare")
59  return new LensFlare();
60 
61  else if (effect_type == "Mask")
62  return new Mask();
63 
64  else if (effect_type == "Negate")
65  return new Negate();
66 
67  else if (effect_type == "Pixelate")
68  return new Pixelate();
69 
70  else if (effect_type == "Saturation")
71  return new Saturation();
72 
73  else if (effect_type == "Sharpen")
74  return new Sharpen();
75 
76  else if (effect_type == "Shift")
77  return new Shift();
78 
79  else if (effect_type == "SphericalProjection")
80  return new SphericalProjection();
81 
82  else if (effect_type == "Wave")
83  return new Wave();
84 
85  else if(effect_type == "Noise")
86  return new Noise();
87 
88  else if(effect_type == "Delay")
89  return new Delay();
90 
91  else if(effect_type == "Echo")
92  return new Echo();
93 
94  else if(effect_type == "Distortion")
95  return new Distortion();
96 
97  else if(effect_type == "ParametricEQ")
98  return new ParametricEQ();
99 
100  else if(effect_type == "Compressor")
101  return new Compressor();
102 
103  else if(effect_type == "Expander")
104  return new Expander();
105 
106  else if(effect_type == "Robotization")
107  return new Robotization();
108 
109  else if(effect_type == "Whisperization")
110  return new Whisperization();
111 
112  #ifdef USE_OPENCV
113  else if (effect_type == "Outline")
114  return new Outline();
115 
116  else if(effect_type == "Stabilizer")
117  return new Stabilizer();
118 
119  else if(effect_type == "Tracker")
120  return new Tracker();
121 
122  else if(effect_type == "ObjectDetection")
123  return new ObjectDetection();
124  #endif
125 
126  return NULL;
127 }
128 
129 // Generate Json::Value for this object
130 Json::Value EffectInfo::JsonValue() {
131 
132  // Create root json object
133  Json::Value root;
134 
135  // Append info JSON from each supported effect
136  root.append(Bars().JsonInfo());
137  root.append(Blur().JsonInfo());
138  root.append(Brightness().JsonInfo());
139  root.append(Caption().JsonInfo());
140  root.append(ChromaKey().JsonInfo());
141  root.append(ColorMap().JsonInfo());
142  root.append(ColorShift().JsonInfo());
143  root.append(Crop().JsonInfo());
144  root.append(Deinterlace().JsonInfo());
145  root.append(Hue().JsonInfo());
146  root.append(LensFlare().JsonInfo());
147  root.append(Mask().JsonInfo());
148  root.append(Negate().JsonInfo());
149  root.append(Pixelate().JsonInfo());
150  root.append(Saturation().JsonInfo());
151  root.append(Sharpen().JsonInfo());
152  root.append(Shift().JsonInfo());
153  root.append(SphericalProjection().JsonInfo());
154  root.append(Wave().JsonInfo());
155  /* Audio */
156  root.append(Noise().JsonInfo());
157  root.append(Delay().JsonInfo());
158  root.append(Echo().JsonInfo());
159  root.append(Distortion().JsonInfo());
160  root.append(ParametricEQ().JsonInfo());
161  root.append(Compressor().JsonInfo());
162  root.append(Expander().JsonInfo());
163  root.append(Robotization().JsonInfo());
164  root.append(Whisperization().JsonInfo());
165 
166  #ifdef USE_OPENCV
167  root.append(Outline().JsonInfo());
168  root.append(Stabilizer().JsonInfo());
169  root.append(Tracker().JsonInfo());
170  root.append(ObjectDetection().JsonInfo());
171  #endif
172 
173  // return JsonValue
174  return root;
175 
176 }
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:26
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:19
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 3D LUT (.cube) color transform to each frame.
Definition: ColorMap.h:34
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:130
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::ColorShift
This class shifts the pixels of an image up, down, left, or right, and can be animated with openshot:...
Definition: ColorShift.h:35
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