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 == "ColorShift")
44  return new ColorShift();
45 
46  else if (effect_type == "Crop")
47  return new Crop();
48 
49  else if (effect_type == "Deinterlace")
50  return new Deinterlace();
51 
52  else if (effect_type == "Hue")
53  return new Hue();
54 
55  else if (effect_type == "Mask")
56  return new Mask();
57 
58  else if (effect_type == "Negate")
59  return new Negate();
60 
61  else if (effect_type == "Pixelate")
62  return new Pixelate();
63 
64  else if (effect_type == "Saturation")
65  return new Saturation();
66 
67  else if (effect_type == "Shift")
68  return new Shift();
69 
70  else if (effect_type == "Wave")
71  return new Wave();
72 
73  else if(effect_type == "Noise")
74  return new Noise();
75 
76  else if(effect_type == "Delay")
77  return new Delay();
78 
79  else if(effect_type == "Echo")
80  return new Echo();
81 
82  else if(effect_type == "Distortion")
83  return new Distortion();
84 
85  else if(effect_type == "ParametricEQ")
86  return new ParametricEQ();
87 
88  else if(effect_type == "Compressor")
89  return new Compressor();
90 
91  else if(effect_type == "Expander")
92  return new Expander();
93 
94  else if(effect_type == "Robotization")
95  return new Robotization();
96 
97  else if(effect_type == "Whisperization")
98  return new Whisperization();
99 
100  #ifdef USE_OPENCV
101  else if(effect_type == "Stabilizer")
102  return new Stabilizer();
103 
104  else if(effect_type == "Tracker")
105  return new Tracker();
106 
107  else if(effect_type == "ObjectDetection")
108  return new ObjectDetection();
109  #endif
110 
111  return NULL;
112 }
113 
114 // Generate Json::Value for this object
115 Json::Value EffectInfo::JsonValue() {
116 
117  // Create root json object
118  Json::Value root;
119 
120  // Append info JSON from each supported effect
121  root.append(Bars().JsonInfo());
122  root.append(Blur().JsonInfo());
123  root.append(Brightness().JsonInfo());
124  root.append(Caption().JsonInfo());
125  root.append(ChromaKey().JsonInfo());
126  root.append(ColorShift().JsonInfo());
127  root.append(Crop().JsonInfo());
128  root.append(Deinterlace().JsonInfo());
129  root.append(Hue().JsonInfo());
130  root.append(Mask().JsonInfo());
131  root.append(Negate().JsonInfo());
132  root.append(Pixelate().JsonInfo());
133  root.append(Saturation().JsonInfo());
134  root.append(Shift().JsonInfo());
135  root.append(Wave().JsonInfo());
136  /* Audio */
137  root.append(Noise().JsonInfo());
138  root.append(Delay().JsonInfo());
139  root.append(Echo().JsonInfo());
140  root.append(Distortion().JsonInfo());
141  root.append(ParametricEQ().JsonInfo());
142  root.append(Compressor().JsonInfo());
143  root.append(Expander().JsonInfo());
144  root.append(Robotization().JsonInfo());
145  root.append(Whisperization().JsonInfo());
146 
147  #ifdef USE_OPENCV
148  root.append(Stabilizer().JsonInfo());
149  root.append(Tracker().JsonInfo());
150  root.append(ObjectDetection().JsonInfo());
151  #endif
152 
153  // return JsonValue
154  return root;
155 
156 }
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::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::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::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:115
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::Noise
This class adds a noise into the audio.
Definition: Noise.h:35