Loading...
Searching...
No Matches
EffectBase.h
Go to the documentation of this file.
// Copyright (c) 2008-2019 OpenShot Studios, LLC
//
// SPDX-License-Identifier: LGPL-3.0-or-later
#ifndef OPENSHOT_EFFECT_BASE_H
#define OPENSHOT_EFFECT_BASE_H
#include "ClipBase.h"
#include "Json.h"
#include "TrackedObjectBase.h"
#include <memory>
#include <map>
#include <string>
namespace openshot
{
struct EffectInfoStruct
{
std::string class_name;
std::string name;
std::string description;
std::string parent_effect_id;
bool has_video;
bool has_audio;
bool has_tracked_object;
};
class EffectBase : public ClipBase
{
private:
int order;
protected:
openshot::ClipBase* clip;
public:
EffectBase* parentEffect;
std::map<int, std::shared_ptr<openshot::TrackedObjectBase> > trackedObjects;
EffectInfoStruct info;
void DisplayInfo(std::ostream* out=&std::cout);
int constrain(int color_value);
void InitEffectInfo();
openshot::ClipBase* ParentClip();
void ParentClip(openshot::ClipBase* new_clip);
void SetParentEffect(std::string parentEffect_id);
std::string ParentClipId() const;
virtual std::string GetVisibleObjects(int64_t frame_number) const {return {}; };
// Get and Set JSON methods
virtual std::string Json() const;
virtual void SetJson(const std::string value);
virtual Json::Value JsonValue() const;
virtual void SetJsonValue(const Json::Value root);
virtual std::string Json(int64_t requested_frame) const{
return "";
};
virtual void SetJson(int64_t requested_frame, const std::string value) {
return;
};
Json::Value JsonInfo() const;
int Order() const { return order; }
void Order(int new_order) { order = new_order; }
virtual ~EffectBase() = default;
};
}
#endif
ClipBase.h
Header file for ClipBase class.
Json.h
Header file for JSON class.
TrackedObjectBase.h
Header file for the TrackedObjectBase class.
openshot::ClipBase
This abstract class is the base class, used by all clips in libopenshot.
Definition ClipBase.h:33
openshot::EffectBase
This abstract class is the base class, used by all effects in libopenshot.
Definition EffectBase.h:53
openshot::EffectBase::SetJson
virtual void SetJson(const std::string value)
Load JSON string into this object.
Definition EffectBase.cpp:95
openshot::EffectBase::parentEffect
EffectBase * parentEffect
Parent effect (which properties will set this effect properties)
Definition EffectBase.h:63
openshot::EffectBase::Json
virtual std::string Json(int64_t requested_frame) const
Definition EffectBase.h:102
openshot::EffectBase::JsonInfo
Json::Value JsonInfo() const
Generate JSON object of meta data / info.
Definition EffectBase.cpp:158
openshot::EffectBase::SetJson
virtual void SetJson(int64_t requested_frame, const std::string value)
Definition EffectBase.h:105
openshot::EffectBase::ParentClipId
std::string ParentClipId() const
Return the ID of this effect's parent clip.
Definition EffectBase.cpp:208
openshot::EffectBase::SetParentEffect
void SetParentEffect(std::string parentEffect_id)
Set the parent effect from which this properties will be set to.
Definition EffectBase.cpp:183
openshot::EffectBase::JsonValue
virtual Json::Value JsonValue() const
Generate Json::Value for this object.
Definition EffectBase.cpp:77
openshot::EffectBase::~EffectBase
virtual ~EffectBase()=default
openshot::EffectBase::ParentClip
openshot::ClipBase * ParentClip()
Parent clip object of this effect (which can be unparented and NULL)
Definition EffectBase.cpp:173
openshot::EffectBase::constrain
int constrain(int color_value)
Constrain a color value from 0 to 255.
Definition EffectBase.cpp:58
openshot::EffectBase::Json
virtual std::string Json() const
Generate JSON string of this object.
Definition EffectBase.cpp:70
openshot::EffectBase::InitEffectInfo
void InitEffectInfo()
Definition EffectBase.cpp:24
openshot::EffectBase::GetVisibleObjects
virtual std::string GetVisibleObjects(int64_t frame_number) const
Get the indexes and IDs of all visible objects in the given frame.
Definition EffectBase.h:94
openshot::EffectBase::SetJsonValue
virtual void SetJsonValue(const Json::Value root)
Load Json::Value into this object.
Definition EffectBase.cpp:112
openshot::EffectBase::Order
int Order() const
Get the order that this effect should be executed.
Definition EffectBase.h:112
openshot::EffectBase::Order
void Order(int new_order)
Set the order that this effect should be executed.
Definition EffectBase.h:115
openshot::EffectBase::clip
openshot::ClipBase * clip
Pointer to the parent clip instance (if any)
Definition EffectBase.h:58
openshot::EffectBase::info
EffectInfoStruct info
Information about the current effect.
Definition EffectBase.h:69
openshot::EffectBase::trackedObjects
std::map< int, std::shared_ptr< openshot::TrackedObjectBase > > trackedObjects
Map of Tracked Object's by their indices (used by Effects that track objects on clips)
Definition EffectBase.h:66
openshot::EffectBase::DisplayInfo
void DisplayInfo(std::ostream *out=&std::cout)
Display effect information in the standard output stream (stdout)
Definition EffectBase.cpp:45
openshot
This namespace is the default namespace for all code in the openshot library.
Definition Compressor.h:29
openshot::EffectInfoStruct
This struct contains info about an effect, such as the name, video or audio effect,...
Definition EffectBase.h:35
openshot::EffectInfoStruct::has_video
bool has_video
Determines if this effect manipulates the image of a frame.
Definition EffectBase.h:40
openshot::EffectInfoStruct::parent_effect_id
std::string parent_effect_id
Id of the parent effect (if there is one)
Definition EffectBase.h:39
openshot::EffectInfoStruct::has_audio
bool has_audio
Determines if this effect manipulates the audio of a frame.
Definition EffectBase.h:41
openshot::EffectInfoStruct::class_name
std::string class_name
The class name of the effect.
Definition EffectBase.h:36
openshot::EffectInfoStruct::name
std::string name
The name of the effect.
Definition EffectBase.h:37
openshot::EffectInfoStruct::description
std::string description
The description of this effect and what it does.
Definition EffectBase.h:38
openshot::EffectInfoStruct::has_tracked_object
bool has_tracked_object
Determines if this effect track objects through the clip.
Definition EffectBase.h:42