OpenShot Library | libopenshot  0.3.3
Public Member Functions | Public Attributes | Protected Attributes | List of all members
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:
[legend]
Collaboration diagram for openshot::EffectBase:
[legend]

Public Member Functions

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

Set the Id of this clip object

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

Public Attributes

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

Protected Attributes

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

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) More...
 
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. More...
 

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 ( )
virtualdefault

Member Function Documentation

◆ BasePropertiesJSON()

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

◆ 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::Hue::GetFrame(), openshot::Brightness::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
inlinevirtual

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

◆ Json() [2/2]

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

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::ObjectDetection, openshot::Caption, openshot::Stabilizer, openshot::ChromaKey, openshot::Crop, openshot::ColorShift, openshot::Blur, openshot::Pixelate, openshot::Saturation, openshot::Mask, openshot::Bars, openshot::Wave, openshot::Expander, openshot::Compressor, openshot::Tracker, openshot::Shift, openshot::Brightness, openshot::Hue, openshot::Deinterlace, openshot::Robotization, openshot::Echo, openshot::Whisperization, openshot::Delay, openshot::ParametricEQ, openshot::Distortion, openshot::Negate, and openshot::Noise.

Definition at line 79 of file EffectBase.cpp.

Referenced by Json(), openshot::Noise::JsonValue(), openshot::Negate::JsonValue(), openshot::Distortion::JsonValue(), openshot::ParametricEQ::JsonValue(), openshot::Delay::JsonValue(), openshot::Whisperization::JsonValue(), openshot::Echo::JsonValue(), openshot::Robotization::JsonValue(), openshot::Deinterlace::JsonValue(), openshot::Hue::JsonValue(), openshot::Brightness::JsonValue(), openshot::Shift::JsonValue(), openshot::Compressor::JsonValue(), openshot::Expander::JsonValue(), openshot::Wave::JsonValue(), openshot::Bars::JsonValue(), openshot::Mask::JsonValue(), openshot::Blur::JsonValue(), openshot::Pixelate::JsonValue(), openshot::Saturation::JsonValue(), openshot::ColorShift::JsonValue(), openshot::Crop::JsonValue(), openshot::ChromaKey::JsonValue(), openshot::Stabilizer::JsonValue(), openshot::Caption::JsonValue(), openshot::ObjectDetection::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(), and openshot::ObjectDetection::LoadObjDetectdData().

◆ 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

◆ SetJson() [2/2]

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

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::ObjectDetection, openshot::Caption, openshot::Stabilizer, openshot::ChromaKey, openshot::Crop, openshot::ColorShift, openshot::Blur, openshot::Pixelate, openshot::Saturation, openshot::Mask, openshot::Bars, openshot::Wave, openshot::Expander, openshot::Compressor, openshot::Tracker, openshot::Shift, openshot::Brightness, openshot::Hue, openshot::Deinterlace, openshot::Robotization, openshot::Echo, openshot::Whisperization, openshot::Delay, openshot::ParametricEQ, openshot::Distortion, openshot::Negate, and openshot::Noise.

Definition at line 115 of file EffectBase.cpp.

Referenced by SetJson(), openshot::Noise::SetJsonValue(), openshot::Negate::SetJsonValue(), openshot::Distortion::SetJsonValue(), openshot::ParametricEQ::SetJsonValue(), openshot::Delay::SetJsonValue(), openshot::Whisperization::SetJsonValue(), openshot::Echo::SetJsonValue(), openshot::Robotization::SetJsonValue(), openshot::Deinterlace::SetJsonValue(), openshot::Hue::SetJsonValue(), openshot::Brightness::SetJsonValue(), openshot::Shift::SetJsonValue(), openshot::Compressor::SetJsonValue(), openshot::Expander::SetJsonValue(), openshot::Bars::SetJsonValue(), openshot::Wave::SetJsonValue(), openshot::Mask::SetJsonValue(), openshot::Blur::SetJsonValue(), openshot::Pixelate::SetJsonValue(), openshot::Saturation::SetJsonValue(), openshot::ColorShift::SetJsonValue(), openshot::Crop::SetJsonValue(), openshot::ChromaKey::SetJsonValue(), openshot::Stabilizer::SetJsonValue(), openshot::Caption::SetJsonValue(), openshot::ObjectDetection::SetJsonValue(), openshot::Clip::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(), and ParentClipId().

◆ info

EffectInfoStruct openshot::EffectBase::info

◆ 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

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