35 info.has_video =
false;
36 info.has_audio =
false;
37 info.has_tracked_object =
false;
39 info.description =
"";
40 info.parent_effect_id =
"";
41 info.apply_before_clip =
true;
46 *out << std::fixed << std::setprecision(2) << std::boolalpha;
47 *out <<
"----------------------------" << std::endl;
48 *out <<
"----- Effect Information -----" << std::endl;
49 *out <<
"----------------------------" << std::endl;
50 *out <<
"--> Name: " <<
info.name << std::endl;
51 *out <<
"--> Description: " <<
info.description << std::endl;
52 *out <<
"--> Has Video: " <<
info.has_video << std::endl;
53 *out <<
"--> Has Audio: " <<
info.has_audio << std::endl;
54 *out <<
"--> Apply Before Clip Keyframes: " <<
info.apply_before_clip << std::endl;
55 *out <<
"--> Order: " << order << std::endl;
56 *out <<
"----------------------------" << std::endl;
65 else if (color_value > 255)
83 root[
"name"] =
info.name;
84 root[
"class_name"] =
info.class_name;
85 root[
"description"] =
info.description;
86 root[
"parent_effect_id"] =
info.parent_effect_id;
87 root[
"has_video"] =
info.has_video;
88 root[
"has_audio"] =
info.has_audio;
89 root[
"has_tracked_object"] =
info.has_tracked_object;
90 root[
"apply_before_clip"] =
info.apply_before_clip;
91 root[
"order"] =
Order();
107 catch (
const std::exception& e)
110 throw InvalidJSON(
"JSON is invalid (missing keys or invalid data types)");
122 std::list<EffectBase*> effects = parentTimeline->
ClipEffects();
127 for (
auto const& effect : effects){
129 if ((effect->info.parent_effect_id == this->Id()) && (effect->Id() != this->Id()))
130 effect->SetJsonValue(root);
138 my_root[
"id"] = this->
Id();
139 my_root[
"parent_effect_id"] = this->
info.parent_effect_id;
148 if (!my_root[
"order"].isNull())
149 Order(my_root[
"order"].asInt());
151 if (!my_root[
"apply_before_clip"].isNull())
152 info.apply_before_clip = my_root[
"apply_before_clip"].asBool();
154 if (!my_root[
"parent_effect_id"].isNull()){
155 info.parent_effect_id = my_root[
"parent_effect_id"].asString();
168 root[
"name"] =
info.name;
169 root[
"class_name"] =
info.class_name;
170 root[
"description"] =
info.description;
171 root[
"has_video"] =
info.has_video;
172 root[
"has_audio"] =
info.has_audio;
182 root[
"id"] =
add_property_json(
"ID", 0.0,
"string",
Id(), NULL, -1, -1,
true, requested_frame);
183 root[
"position"] =
add_property_json(
"Position",
Position(),
"float",
"", NULL, 0, 30 * 60 * 60 * 48,
false, requested_frame);
185 root[
"start"] =
add_property_json(
"Start",
Start(),
"float",
"", NULL, 0, 30 * 60 * 60 * 48,
false, requested_frame);
186 root[
"end"] =
add_property_json(
"End",
End(),
"float",
"", NULL, 0, 30 * 60 * 60 * 48,
false, requested_frame);
187 root[
"duration"] =
add_property_json(
"Duration",
Duration(),
"float",
"", NULL, 0, 30 * 60 * 60 * 48,
true, requested_frame);
190 root[
"apply_before_clip"] =
add_property_json(
"Apply Before Clip Keyframes",
info.apply_before_clip,
"int",
"", NULL, 0, 1,
false, requested_frame);
195 root[
"parent_effect_id"] =
add_property_json(
"Parent", 0.0,
"string",
info.parent_effect_id, NULL, -1, -1,
false, requested_frame);
221 if (parentEffectPtr){
227 EffectJSON[
"id"] = this->
Id();
228 EffectJSON[
"parent_effect_id"] = this->
info.parent_effect_id;
Header file for EffectBase class.
Header file for all Exception classes.
Header file for Timeline class.
This abstract class is the base class, used by all clips in libopenshot.
float Start() const
Get start position (in seconds) of clip (trim start of video).
float Duration() const
Get the length of this clip (in seconds).
virtual float End() const
Get end position (in seconds) of clip (trim end of video).
std::string Id() const
Get the Id of this clip object.
virtual Json::Value JsonValue() const =0
Generate Json::Value for this object.
Json::Value add_property_choice_json(std::string name, int value, int selected_value) const
Generate JSON choice for a property (dropdown properties).
int Layer() const
Get layer of clip on timeline (lower number is covered by higher numbers).
virtual void SetJsonValue(const Json::Value root)=0
Load Json::Value into this object.
float Position() const
Get position on timeline (in seconds).
virtual openshot::TimelineBase * ParentTimeline()
Get the associated Timeline pointer (if any).
Json::Value add_property_json(std::string name, float value, std::string type, std::string memo, const Keyframe *keyframe, float min_value, float max_value, bool readonly, int64_t requested_frame) const
Generate JSON for a property.
This abstract class is the base class, used by all effects in libopenshot.
virtual void SetJson(const std::string value)
Load JSON string into this object.
EffectBase * parentEffect
Parent effect (which properties will set this effect properties).
Json::Value JsonInfo() const
Generate JSON object of meta data / info.
std::string ParentClipId() const
Return the ID of this effect's parent clip.
void SetParentEffect(std::string parentEffect_id)
Set the parent effect from which this properties will be set to.
virtual Json::Value JsonValue() const
Generate Json::Value for this object.
openshot::ClipBase * ParentClip()
Parent clip object of this effect (which can be unparented and NULL).
int constrain(int color_value)
Constrain a color value from 0 to 255.
virtual std::string Json() const
Generate JSON string of this object.
Json::Value BasePropertiesJSON(int64_t requested_frame) const
Generate JSON object of base properties (recommended to be used by all effects).
virtual void SetJsonValue(const Json::Value root)
Load Json::Value into this object.
int Order() const
Get the order that this effect should be executed.
openshot::ClipBase * clip
Pointer to the parent clip instance (if any).
EffectInfoStruct info
Information about the current effect.
void DisplayInfo(std::ostream *out=&std::cout)
Display effect information in the standard output stream (stdout).
Exception for invalid JSON.
This class represents a timeline.
openshot::EffectBase * GetClipEffect(const std::string &id)
Look up a clip effect by ID.
std::list< openshot::EffectBase * > ClipEffects() const
Return the list of effects on all clips.
This namespace is the default namespace for all code in the openshot library.
const Json::Value stringToJson(const std::string value)