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
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* LICENSE
|
2015-08-06 20:01:34 -05:00
|
|
|
*
|
2019-06-11 06:48:32 -04:00
|
|
|
* Copyright (c) 2008-2019 OpenShot Studios, LLC
|
2015-08-06 20:01:34 -05:00
|
|
|
* <http://www.openshotstudios.com/>. This file is part of
|
|
|
|
|
* OpenShot Library (libopenshot), an open-source project dedicated to
|
|
|
|
|
* delivering high quality video editing and animation solutions to the
|
|
|
|
|
* world. For more information visit <http://www.openshot.org/>.
|
|
|
|
|
*
|
|
|
|
|
* OpenShot Library (libopenshot) is free software: you can redistribute it
|
|
|
|
|
* and/or modify it under the terms of the GNU Lesser General Public License
|
|
|
|
|
* as published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* OpenShot Library (libopenshot) is distributed in the hope that it will be
|
|
|
|
|
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU Lesser General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
|
* along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
2020-10-18 07:43:37 -04:00
|
|
|
#include "EffectInfo.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
|
|
|
|
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();
|
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());
|
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;
|
|
|
|
|
|
|
|
|
|
}
|