2015-08-06 20:01:34 -05:00
|
|
|
/**
|
|
|
|
|
* @file
|
|
|
|
|
* @brief Source file for EffectInfo class
|
|
|
|
|
* @author Jonathan Thomas <jonathan@openshot.org>
|
|
|
|
|
*
|
|
|
|
|
* @section LICENSE
|
|
|
|
|
*
|
|
|
|
|
* Copyright (c) 2008-2014 OpenShot Studios, LLC
|
|
|
|
|
* <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/>.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "../include/EffectInfo.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using namespace openshot;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Generate JSON string of this object
|
|
|
|
|
string EffectInfo::Json() {
|
|
|
|
|
|
|
|
|
|
// Return formatted string
|
|
|
|
|
return JsonValue().toStyledString();
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-16 22:40:51 -05:00
|
|
|
// Create a new effect instance
|
|
|
|
|
EffectBase* EffectInfo::CreateEffect(string effect_type) {
|
|
|
|
|
// 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();
|
|
|
|
|
|
|
|
|
|
else if (effect_type == "ChromaKey")
|
|
|
|
|
return new ChromaKey();
|
|
|
|
|
|
2018-03-03 18:02:14 -06:00
|
|
|
else if (effect_type == "Color Shift")
|
|
|
|
|
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();
|
2018-09-11 00:40:31 -05:00
|
|
|
return NULL;
|
2016-08-16 22:40:51 -05:00
|
|
|
}
|
|
|
|
|
|
2015-08-06 20:01:34 -05:00
|
|
|
// Generate Json::JsonValue for this object
|
|
|
|
|
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());
|
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());
|
2015-08-06 20:01:34 -05:00
|
|
|
|
|
|
|
|
// return JsonValue
|
|
|
|
|
return root;
|
|
|
|
|
|
|
|
|
|
}
|