2015-08-06 20:01:34 -05:00
|
|
|
/**
|
|
|
|
|
* @file
|
|
|
|
|
* @brief Source file for EffectInfo class
|
|
|
|
|
* @author Jonathan Thomas <jonathan@openshot.org>
|
|
|
|
|
*
|
2019-06-09 08:31:04 -04:00
|
|
|
* @ref License
|
|
|
|
|
*/
|
|
|
|
|
|
2021-10-16 01:26:26 -04:00
|
|
|
// Copyright (c) 2008-2019 OpenShot Studios, LLC
|
|
|
|
|
//
|
|
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
2015-08-06 20:01:34 -05:00
|
|
|
|
2020-10-18 07:43:37 -04:00
|
|
|
#include "EffectInfo.h"
|
2021-10-27 14:34:05 -04:00
|
|
|
#include "Effects.h"
|
2015-08-06 20:01:34 -05:00
|
|
|
|
|
|
|
|
using namespace openshot;
|
|
|
|
|
|
|
|
|
|
// Generate JSON string of this object
|
2019-08-04 23:04:19 -04:00
|
|
|
std::string EffectInfo::Json() {
|
2015-08-06 20:01:34 -05:00
|
|
|
|
|
|
|
|
// Return formatted string
|
|
|
|
|
return JsonValue().toStyledString();
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-16 22:40:51 -05:00
|
|
|
// Create a new effect instance
|
2019-08-04 23:04:19 -04:00
|
|
|
EffectBase* EffectInfo::CreateEffect(std::string effect_type) {
|
2016-08-16 22:40:51 -05:00
|
|
|
// Init the matching effect object
|
2018-02-09 02:37:05 -06:00
|
|
|
if (effect_type == "Bars")
|
|
|
|
|
return new Bars();
|
|
|
|
|
|
2016-08-16 22:40:51 -05:00
|
|
|
if (effect_type == "Blur")
|
|
|
|
|
return new Blur();
|
|
|
|
|
|
|
|
|
|
else if (effect_type == "Brightness")
|
|
|
|
|
return new Brightness();
|
|
|
|
|
|
2020-10-06 03:00:58 -05:00
|
|
|
else if (effect_type == "Caption")
|
|
|
|
|
return new Caption();
|
|
|
|
|
|
2016-08-16 22:40:51 -05:00
|
|
|
else if (effect_type == "ChromaKey")
|
|
|
|
|
return new ChromaKey();
|
|
|
|
|
|
2020-03-02 23:14:20 -05:00
|
|
|
else if (effect_type == "ColorShift")
|
2018-03-03 18:02:14 -06:00
|
|
|
return new ColorShift();
|
|
|
|
|
|
2018-03-05 02:12:37 -06:00
|
|
|
else if (effect_type == "Crop")
|
|
|
|
|
return new Crop();
|
|
|
|
|
|
2016-08-16 22:40:51 -05:00
|
|
|
else if (effect_type == "Deinterlace")
|
|
|
|
|
return new Deinterlace();
|
|
|
|
|
|
2018-02-06 02:26:35 -06:00
|
|
|
else if (effect_type == "Hue")
|
|
|
|
|
return new Hue();
|
|
|
|
|
|
2016-08-16 22:40:51 -05:00
|
|
|
else if (effect_type == "Mask")
|
|
|
|
|
return new Mask();
|
|
|
|
|
|
|
|
|
|
else if (effect_type == "Negate")
|
|
|
|
|
return new Negate();
|
|
|
|
|
|
2018-02-09 16:43:43 -06:00
|
|
|
else if (effect_type == "Pixelate")
|
|
|
|
|
return new Pixelate();
|
|
|
|
|
|
2016-08-16 22:40:51 -05:00
|
|
|
else if (effect_type == "Saturation")
|
|
|
|
|
return new Saturation();
|
2018-02-06 00:51:59 -06:00
|
|
|
|
|
|
|
|
else if (effect_type == "Shift")
|
|
|
|
|
return new Shift();
|
2018-02-08 03:51:32 -06:00
|
|
|
|
|
|
|
|
else if (effect_type == "Wave")
|
|
|
|
|
return new Wave();
|
2020-07-15 10:29:08 -03:00
|
|
|
|
2021-06-20 15:33:58 -03:00
|
|
|
else if(effect_type == "Noise")
|
|
|
|
|
return new Noise();
|
|
|
|
|
|
2021-07-16 16:51:52 -03:00
|
|
|
else if(effect_type == "Delay")
|
|
|
|
|
return new Delay();
|
|
|
|
|
|
|
|
|
|
else if(effect_type == "Echo")
|
|
|
|
|
return new Echo();
|
|
|
|
|
|
2021-06-20 15:33:58 -03:00
|
|
|
else if(effect_type == "Distortion")
|
|
|
|
|
return new Distortion();
|
|
|
|
|
|
|
|
|
|
else if(effect_type == "ParametricEQ")
|
|
|
|
|
return new ParametricEQ();
|
|
|
|
|
|
|
|
|
|
else if(effect_type == "Compressor")
|
|
|
|
|
return new Compressor();
|
|
|
|
|
|
2021-07-10 19:49:10 -03:00
|
|
|
else if(effect_type == "Expander")
|
|
|
|
|
return new Expander();
|
2021-07-10 19:43:09 -03:00
|
|
|
|
|
|
|
|
else if(effect_type == "Robotization")
|
|
|
|
|
return new Robotization();
|
|
|
|
|
|
2021-07-10 19:49:10 -03:00
|
|
|
else if(effect_type == "Whisperization")
|
|
|
|
|
return new Whisperization();
|
|
|
|
|
|
2020-08-01 14:06:38 -03:00
|
|
|
#ifdef USE_OPENCV
|
2020-07-15 10:29:08 -03:00
|
|
|
else if(effect_type == "Stabilizer")
|
|
|
|
|
return new Stabilizer();
|
|
|
|
|
|
|
|
|
|
else if(effect_type == "Tracker")
|
|
|
|
|
return new Tracker();
|
2021-10-27 14:34:05 -04:00
|
|
|
|
2020-07-26 16:19:55 -03:00
|
|
|
else if(effect_type == "Object Detector")
|
|
|
|
|
return new ObjectDetection();
|
2020-08-01 14:06:38 -03:00
|
|
|
#endif
|
2020-07-15 10:29:08 -03:00
|
|
|
|
2018-09-11 00:40:31 -05:00
|
|
|
return NULL;
|
2016-08-16 22:40:51 -05:00
|
|
|
}
|
|
|
|
|
|
2019-12-27 08:51:51 -05:00
|
|
|
// Generate Json::Value for this object
|
2015-08-06 20:01:34 -05:00
|
|
|
Json::Value EffectInfo::JsonValue() {
|
|
|
|
|
|
|
|
|
|
// Create root json object
|
|
|
|
|
Json::Value root;
|
|
|
|
|
|
|
|
|
|
// Append info JSON from each supported effect
|
2018-02-09 02:37:05 -06:00
|
|
|
root.append(Bars().JsonInfo());
|
2015-11-09 00:12:21 -06:00
|
|
|
root.append(Blur().JsonInfo());
|
2015-08-16 22:58:07 -05:00
|
|
|
root.append(Brightness().JsonInfo());
|
2020-10-06 03:00:58 -05:00
|
|
|
root.append(Caption().JsonInfo());
|
2015-08-06 20:01:34 -05:00
|
|
|
root.append(ChromaKey().JsonInfo());
|
2018-03-03 18:02:14 -06:00
|
|
|
root.append(ColorShift().JsonInfo());
|
2018-03-05 02:12:37 -06:00
|
|
|
root.append(Crop().JsonInfo());
|
2015-08-06 20:01:34 -05:00
|
|
|
root.append(Deinterlace().JsonInfo());
|
2018-02-06 02:26:35 -06:00
|
|
|
root.append(Hue().JsonInfo());
|
2015-08-06 20:01:34 -05:00
|
|
|
root.append(Mask().JsonInfo());
|
|
|
|
|
root.append(Negate().JsonInfo());
|
2018-02-09 16:43:43 -06:00
|
|
|
root.append(Pixelate().JsonInfo());
|
2015-08-16 22:58:07 -05:00
|
|
|
root.append(Saturation().JsonInfo());
|
2018-02-06 00:51:59 -06:00
|
|
|
root.append(Shift().JsonInfo());
|
2018-02-08 03:51:32 -06:00
|
|
|
root.append(Wave().JsonInfo());
|
2021-06-20 15:33:58 -03:00
|
|
|
/* Audio */
|
|
|
|
|
root.append(Noise().JsonInfo());
|
2021-07-16 16:51:52 -03:00
|
|
|
root.append(Delay().JsonInfo());
|
|
|
|
|
root.append(Echo().JsonInfo());
|
2021-06-20 15:33:58 -03:00
|
|
|
root.append(Distortion().JsonInfo());
|
|
|
|
|
root.append(ParametricEQ().JsonInfo());
|
|
|
|
|
root.append(Compressor().JsonInfo());
|
2021-07-10 19:49:10 -03:00
|
|
|
root.append(Expander().JsonInfo());
|
2021-07-10 19:43:09 -03:00
|
|
|
root.append(Robotization().JsonInfo());
|
2021-07-10 19:49:10 -03:00
|
|
|
root.append(Whisperization().JsonInfo());
|
2020-08-01 14:06:38 -03:00
|
|
|
|
|
|
|
|
#ifdef USE_OPENCV
|
2020-07-15 10:29:08 -03:00
|
|
|
root.append(Stabilizer().JsonInfo());
|
|
|
|
|
root.append(Tracker().JsonInfo());
|
2020-07-26 16:19:55 -03:00
|
|
|
root.append(ObjectDetection().JsonInfo());
|
2020-08-01 14:06:38 -03:00
|
|
|
#endif
|
2015-08-06 20:01:34 -05:00
|
|
|
|
|
|
|
|
// return JsonValue
|
|
|
|
|
return root;
|
|
|
|
|
|
|
|
|
|
}
|