Loading...
Searching...
No Matches
openshot::EffectBase Class Reference

This abstract class is the base class, used by all effects in libopenshot. More...

`#include <EffectBase.h>`

Inheritance diagram for openshot::EffectBase:

## Public Member Functions

Json::Value | BasePropertiesJSON (int64_t requested_frame) const
| Generate JSON object of base properties (recommended to be used by all effects)
int | constrain (int color_value)
| Constrain a color value from 0 to 255.
void | DisplayInfo (std::ostream *out=&std::cout)
| Display effect information in the standard output stream (stdout)
virtual std::string | GetVisibleObjects (int64_t frame_number) const
| Get the indexes and IDs of all visible objects in the given frame.
void | InitEffectInfo ()
virtual std::string | Json () const
| Generate JSON string of this object.
virtual std::string | Json (int64_t requested_frame) const
Json::Value | JsonInfo () const
| Generate JSON object of meta data / info.
virtual Json::Value | JsonValue () const
| Generate Json::Value for this object.
int | Order () const
| Get the order that this effect should be executed.
void | Order (int new_order)
| Set the order that this effect should be executed.
openshot::ClipBase * | ParentClip ()
| Parent clip object of this effect (which can be unparented and NULL)
void | ParentClip (openshot::ClipBase *new_clip)
| Set parent clip object of this effect.
std::string | ParentClipId () const
| Return the ID of this effect's parent clip.
virtual void | SetJson (const std::string value)
| Load JSON string into this object.
virtual void | SetJson (int64_t requested_frame, const std::string value)
virtual void | SetJsonValue (const Json::Value root)
| Load Json::Value into this object.
void | SetParentEffect (std::string parentEffect_id)
| Set the parent effect from which this properties will be set to.
virtual | ~EffectBase ()=default
Public Member Functions inherited from openshot::ClipBase
| ClipBase ()
| Constructor for the base clip.
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)
virtual void | End (float value)
| Set end position (in seconds) of clip (trim end of video)
virtual std::shared_ptr< openshot::Frame > | GetFrame (int64_t frame_number)=0
| This method is required for all derived classes of ClipBase, and returns a new openshot::Frame object. All Clip keyframes and effects are resolved into pixels.
virtual std::shared_ptr< openshot::Frame > | GetFrame (std::shared_ptr< openshot::Frame > frame, int64_t frame_number)=0
| This method is required for all derived classes of ClipBase, and returns a modified openshot::Frame object.
std::string | Id () const
| Get the Id of this clip object.
void | Id (std::string value)
int | Layer () const
| Get layer of clip on timeline (lower number is covered by higher numbers)
void | Layer (int value)
| Set layer of clip on timeline (lower number is covered by higher numbers)
bool | operator< (ClipBase &a)
bool | operator<= (ClipBase &a)
bool | operator> (ClipBase &a)
bool | operator>= (ClipBase &a)
virtual openshot::TimelineBase * | ParentTimeline ()
| Get the associated Timeline pointer (if any)
virtual void | ParentTimeline (openshot::TimelineBase *new_timeline)
| Set associated Timeline pointer.
float | Position () const
| Get position on timeline (in seconds)
void | Position (float value)

> ‍Set the Id of this clip object

virtual std::string | PropertiesJSON (int64_t requested_frame) const =0
float | Start () const
| Get start position (in seconds) of clip (trim start of video)
void | Start (float value)
| Set start position (in seconds) of clip (trim start of video)
virtual | ~ClipBase ()=default

## Public Attributes

EffectInfoStruct | info
| Information about the current effect.
EffectBase * | parentEffect
| Parent effect (which properties will set this effect properties)
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)

## Protected Attributes

openshot::ClipBase * | clip
| Pointer to the parent clip instance (if any)
Protected Attributes inherited from openshot::ClipBase
float | end
| The position in seconds to end playing (used to trim the ending of a clip)
std::string | id
| ID Property for all derived Clip and Effect classes.
int | layer
| The layer this clip is on. Lower clips are covered up by higher clips.
float | position
| The position on the timeline where this clip should start playing.
std::string | previous_properties
| This string contains the previous JSON properties.
float | start
| The position in seconds to start playing (used to trim the beginning of a clip)
openshot::TimelineBase * | timeline
| Pointer to the parent timeline instance (if any)

## Additional Inherited Members

Protected Member Functions inherited from openshot::ClipBase
Json::Value | add_property_choice_json (std::string name, int value, int selected_value) const
| Generate JSON choice for a property (dropdown properties)
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.

## Detailed Description

This abstract class is the base class, used by all effects in libopenshot.

Effects are types of classes that manipulate the image or audio data of an openshot::Frame object. The only requirements for an 'effect', is to derive from this base class, implement the Apply() method, and call the InitEffectInfo() method.

Definition at line 53 of file EffectBase.h.

## Constructor & Destructor Documentation

## ~EffectBase()

virtual openshot::EffectBase::~EffectBase | ( |  | ) |

virtual default

## Member Function Documentation

## BasePropertiesJSON()

Json::Value EffectBase::BasePropertiesJSON | ( | int64_t | requested_frame | ) | const

Generate JSON object of base properties (recommended to be used by all effects)

Definition at line 179 of file EffectBase.cpp.

Referenced by openshot::Compressor::PropertiesJSON(), openshot::Delay::PropertiesJSON(), openshot::Distortion::PropertiesJSON(), openshot::Echo::PropertiesJSON(), openshot::Expander::PropertiesJSON(), openshot::Noise::PropertiesJSON(), openshot::ParametricEQ::PropertiesJSON(), openshot::Robotization::PropertiesJSON(), openshot::Whisperization::PropertiesJSON(), openshot::Bars::PropertiesJSON(), openshot::Blur::PropertiesJSON(), openshot::Brightness::PropertiesJSON(), openshot::Caption::PropertiesJSON(), openshot::ChromaKey::PropertiesJSON(), openshot::ColorShift::PropertiesJSON(), openshot::Crop::PropertiesJSON(), openshot::Deinterlace::PropertiesJSON(), openshot::Hue::PropertiesJSON(), openshot::Mask::PropertiesJSON(), openshot::Negate::PropertiesJSON(), openshot::ObjectDetection::PropertiesJSON(), openshot::Pixelate::PropertiesJSON(), openshot::Saturation::PropertiesJSON(), openshot::Shift::PropertiesJSON(), openshot::Stabilizer::PropertiesJSON(), openshot::Tracker::PropertiesJSON(), and openshot::Wave::PropertiesJSON().

## constrain()

int EffectBase::constrain | ( | int | color_value | ) |

Constrain a color value from 0 to 255.

Definition at line 60 of file EffectBase.cpp.

Referenced by openshot::Brightness::GetFrame(), openshot::Hue::GetFrame(), openshot::Mask::GetFrame(), and openshot::Saturation::GetFrame().

## DisplayInfo()

void EffectBase::DisplayInfo | ( | std::ostream * | out = `&std::cout` | ) |

Display effect information in the standard output stream (stdout)

Definition at line 45 of file EffectBase.cpp.

## GetVisibleObjects()

virtual std::string openshot::EffectBase::GetVisibleObjects | ( | int64_t | frame_number | ) | const

inline virtual

Get the indexes and IDs of all visible objects in the given frame.

Reimplemented in openshot::ObjectDetection, and openshot::Tracker.

Definition at line 94 of file EffectBase.h.

## InitEffectInfo()

void EffectBase::InitEffectInfo | ( |  | ) |

Initialize the values of the EffectInfo struct. It is important for derived classes to call this method, or the EffectInfo struct values will not be initialized.

Definition at line 24 of file EffectBase.cpp.

Referenced by openshot::Negate::Negate().

## Json() [1/2]

std::string EffectBase::Json | ( |  | ) | const

virtual

Generate JSON string of this object.

Implements openshot::ClipBase.

Reimplemented in openshot::Compressor, openshot::Delay, openshot::Distortion, openshot::Echo, openshot::Expander, openshot::Noise, openshot::ParametricEQ, openshot::Robotization, openshot::Whisperization, openshot::Bars, openshot::Blur, openshot::Brightness, openshot::Caption, openshot::ChromaKey, openshot::ColorShift, openshot::Crop, openshot::Deinterlace, openshot::Hue, openshot::Mask, openshot::Negate, openshot::ObjectDetection, openshot::Pixelate, openshot::Saturation, openshot::Shift, openshot::Stabilizer, openshot::Tracker, and openshot::Wave.

Definition at line 72 of file EffectBase.cpp.

## Json() [2/2]

virtual std::string openshot::EffectBase::Json | ( | int64_t | requested_frame | ) | const

inline virtual

Definition at line 102 of file EffectBase.h.

## JsonInfo()

Json::Value EffectBase::JsonInfo | ( |  | ) | const

Generate JSON object of meta data / info.

Definition at line 164 of file EffectBase.cpp.

## JsonValue()

Json::Value EffectBase::JsonValue | ( |  | ) | const

virtual

Generate Json::Value for this object.

Implements openshot::ClipBase.

Reimplemented in openshot::Compressor, openshot::Delay, openshot::Distortion, openshot::Echo, openshot::Expander, openshot::Noise, openshot::ParametricEQ, openshot::Robotization, openshot::Whisperization, openshot::Bars, openshot::Blur, openshot::Brightness, openshot::Caption, openshot::ChromaKey, openshot::ColorShift, openshot::Crop, openshot::Deinterlace, openshot::Hue, openshot::Mask, openshot::Negate, openshot::ObjectDetection, openshot::Pixelate, openshot::Saturation, openshot::Shift, openshot::Stabilizer, openshot::Tracker, and openshot::Wave.

Definition at line 79 of file EffectBase.cpp.

Referenced by Json(), openshot::Compressor::JsonValue(), openshot::Delay::JsonValue(), openshot::Distortion::JsonValue(), openshot::Echo::JsonValue(), openshot::Expander::JsonValue(), openshot::Noise::JsonValue(), openshot::ParametricEQ::JsonValue(), openshot::Robotization::JsonValue(), openshot::Whisperization::JsonValue(), openshot::Bars::JsonValue(), openshot::Blur::JsonValue(), openshot::Brightness::JsonValue(), openshot::Caption::JsonValue(), openshot::ChromaKey::JsonValue(), openshot::ColorShift::JsonValue(), openshot::Crop::JsonValue(), openshot::Deinterlace::JsonValue(), openshot::Hue::JsonValue(), openshot::Mask::JsonValue(), openshot::Negate::JsonValue(), openshot::ObjectDetection::JsonValue(), openshot::Pixelate::JsonValue(), openshot::Saturation::JsonValue(), openshot::Shift::JsonValue(), openshot::Stabilizer::JsonValue(), openshot::Tracker::JsonValue(), openshot::Wave::JsonValue(), SetJsonValue(), and SetParentEffect().

## Order() [1/2]

int openshot::EffectBase::Order | ( |  | ) | const

inline

Get the order that this effect should be executed.

Definition at line 116 of file EffectBase.h.

Referenced by InitEffectInfo(), JsonValue(), openshot::CompareClipEffects::operator()(), openshot::CompareEffects::operator()(), and SetJsonValue().

## Order() [2/2]

void openshot::EffectBase::Order | ( | int | new_order | ) |

inline

Set the order that this effect should be executed.

Definition at line 119 of file EffectBase.h.

## ParentClip() [1/2]

openshot::ClipBase * EffectBase::ParentClip | ( |  | ) |

Parent clip object of this effect (which can be unparented and NULL)

Parent clip object of this reader (which can be unparented and NULL)

Definition at line 201 of file EffectBase.cpp.

Referenced by openshot::Clip::AddEffect(), openshot::Caption::GetFrame(), InitEffectInfo(), openshot::ObjectDetection::LoadObjDetectdData(), openshot::Tracker::Tracker(), and openshot::Tracker::Tracker().

## ParentClip() [2/2]

void EffectBase::ParentClip | ( | openshot::ClipBase * | new_clip | ) |

Set parent clip object of this effect.

Set parent clip object of this reader.

Definition at line 206 of file EffectBase.cpp.

## ParentClipId()

std::string EffectBase::ParentClipId | ( |  | ) | const

Return the ID of this effect's parent clip.

Definition at line 236 of file EffectBase.cpp.

## SetJson() [1/2]

void EffectBase::SetJson | ( | const std::string | value | ) |

virtual

Load JSON string into this object.

Implements openshot::ClipBase.

Reimplemented in openshot::Compressor, openshot::Delay, openshot::Distortion, openshot::Echo, openshot::Expander, openshot::Noise, openshot::ParametricEQ, openshot::Robotization, openshot::Whisperization, openshot::Bars, openshot::Blur, openshot::Brightness, openshot::Caption, openshot::ChromaKey, openshot::ColorShift, openshot::Crop, openshot::Deinterlace, openshot::Hue, openshot::Mask, openshot::Negate, openshot::ObjectDetection, openshot::Pixelate, openshot::Saturation, openshot::Shift, openshot::Stabilizer, openshot::Tracker, and openshot::Wave.

Definition at line 98 of file EffectBase.cpp.

## SetJson() [2/2]

virtual void openshot::EffectBase::SetJson | ( | int64_t | requested_frame,
|  | const std::string | value
| ) |  |

inline virtual

Definition at line 105 of file EffectBase.h.

## SetJsonValue()

void EffectBase::SetJsonValue | ( | const Json::Value | root | ) |

virtual

Load Json::Value into this object.

Implements openshot::ClipBase.

Reimplemented in openshot::Compressor, openshot::Delay, openshot::Distortion, openshot::Echo, openshot::Expander, openshot::Noise, openshot::ParametricEQ, openshot::Robotization, openshot::Whisperization, openshot::Bars, openshot::Blur, openshot::Brightness, openshot::Caption, openshot::ChromaKey, openshot::ColorShift, openshot::Crop, openshot::Deinterlace, openshot::Hue, openshot::Mask, openshot::Negate, openshot::ObjectDetection, openshot::Pixelate, openshot::Saturation, openshot::Shift, openshot::Stabilizer, openshot::Tracker, and openshot::Wave.

Definition at line 115 of file EffectBase.cpp.

Referenced by SetJson(), openshot::Compressor::SetJsonValue(), openshot::Delay::SetJsonValue(), openshot::Distortion::SetJsonValue(), openshot::Echo::SetJsonValue(), openshot::Expander::SetJsonValue(), openshot::Noise::SetJsonValue(), openshot::ParametricEQ::SetJsonValue(), openshot::Robotization::SetJsonValue(), openshot::Whisperization::SetJsonValue(), openshot::Clip::SetJsonValue(), openshot::Bars::SetJsonValue(), openshot::Blur::SetJsonValue(), openshot::Brightness::SetJsonValue(), openshot::Caption::SetJsonValue(), openshot::ChromaKey::SetJsonValue(), openshot::ColorShift::SetJsonValue(), openshot::Crop::SetJsonValue(), openshot::Deinterlace::SetJsonValue(), openshot::Hue::SetJsonValue(), openshot::Mask::SetJsonValue(), openshot::Negate::SetJsonValue(), openshot::ObjectDetection::SetJsonValue(), openshot::Pixelate::SetJsonValue(), openshot::Saturation::SetJsonValue(), openshot::Shift::SetJsonValue(), openshot::Stabilizer::SetJsonValue(), openshot::Tracker::SetJsonValue(), openshot::Wave::SetJsonValue(), openshot::Timeline::SetJsonValue(), and SetParentEffect().

## SetParentEffect()

void EffectBase::SetParentEffect | ( | std::string | parentEffect_id | ) |

Set the parent effect from which this properties will be set to.

Definition at line 211 of file EffectBase.cpp.

Referenced by SetJsonValue().

## Member Data Documentation

## clip

openshot::ClipBase* openshot::EffectBase::clip

protected

Pointer to the parent clip instance (if any)

Definition at line 59 of file EffectBase.h.

Referenced by openshot::Caption::GetFrame(), ParentClip(), ParentClip(), and ParentClipId().

## info

EffectInfoStruct openshot::EffectBase::info

Information about the current effect.

Definition at line 69 of file EffectBase.h.

Referenced by openshot::Clip::AddEffect(), BasePropertiesJSON(), DisplayInfo(), InitEffectInfo(), JsonInfo(), JsonValue(), openshot::Compressor::JsonValue(), openshot::Delay::JsonValue(), openshot::Distortion::JsonValue(), openshot::Echo::JsonValue(), openshot::Expander::JsonValue(), openshot::Noise::JsonValue(), openshot::ParametricEQ::JsonValue(), openshot::Robotization::JsonValue(), openshot::Whisperization::JsonValue(), openshot::Bars::JsonValue(), openshot::Blur::JsonValue(), openshot::Brightness::JsonValue(), openshot::Caption::JsonValue(), openshot::ChromaKey::JsonValue(), openshot::ColorShift::JsonValue(), openshot::Crop::JsonValue(), openshot::Deinterlace::JsonValue(), openshot::Hue::JsonValue(), openshot::Mask::JsonValue(), openshot::Negate::JsonValue(), openshot::ObjectDetection::JsonValue(), openshot::Pixelate::JsonValue(), openshot::Saturation::JsonValue(), openshot::Shift::JsonValue(), openshot::Stabilizer::JsonValue(), openshot::Tracker::JsonValue(), openshot::Wave::JsonValue(), openshot::Negate::Negate(), SetJsonValue(), and SetParentEffect().

## parentEffect

EffectBase* openshot::EffectBase::parentEffect

Parent effect (which properties will set this effect properties)

Definition at line 63 of file EffectBase.h.

Referenced by InitEffectInfo(), SetJsonValue(), and SetParentEffect().

## trackedObjects

std::map<int, std::shared_ptr<openshot::TrackedObjectBase> > openshot::EffectBase::trackedObjects

Map of Tracked Object's by their indices (used by Effects that track objects on clips)

Definition at line 66 of file EffectBase.h.

Referenced by openshot::Clip::AddEffect(), openshot::ObjectDetection::GetFrame(), openshot::ObjectDetection::GetVisibleObjects(), openshot::Tracker::GetVisibleObjects(), openshot::ObjectDetection::JsonValue(), openshot::Tracker::JsonValue(), openshot::ObjectDetection::LoadObjDetectdData(), openshot::ObjectDetection::ObjectDetection(), openshot::ObjectDetection::ObjectDetection(), openshot::ObjectDetection::PropertiesJSON(), openshot::Tracker::PropertiesJSON(), openshot::ObjectDetection::SetJsonValue(), openshot::Tracker::SetJsonValue(), openshot::Tracker::Tracker(), and openshot::Tracker::Tracker().

The documentation for this class was generated from the following files:

- EffectBase.h
- EffectBase.cpp