|
OpenShot Library | libopenshot
0.5.0
|
This abstract class is the base class, used by all effects in libopenshot. More...
#include <EffectBase.h>
Public Types | |
| enum | MaskLoopMode { MASK_LOOP_PLAY_ONCE = 0, MASK_LOOP_REPEAT = 1, MASK_LOOP_PING_PONG = 2 } |
| enum | MaskTimeMode { MASK_TIME_TIMELINE = 0, MASK_TIME_SOURCE_FPS = 1 } |
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... | |
| ReaderBase * | MaskReader () |
| Get the common mask reader. More... | |
| const ReaderBase * | MaskReader () const |
| void | MaskReader (ReaderBase *new_reader) |
| Set or replace the common mask reader. 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::ClipBase * | ParentClip () |
| 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... | |
| std::shared_ptr< openshot::Frame > | ProcessFrame (std::shared_ptr< openshot::Frame > frame, int64_t frame_number) |
| Apply effect processing with common mask support (if enabled). 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 () |
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::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. More... | |
| 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. 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) |
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... | |
| bool | mask_invert = false |
| Invert grayscale mask values before blending. More... | |
| int | mask_loop_mode = MASK_LOOP_PLAY_ONCE |
| Behavior when mask range reaches the end. More... | |
| int | mask_time_mode = MASK_TIME_SOURCE_FPS |
| How effect frames map to mask source frames. More... | |
| EffectBase * | parentEffect |
| 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 Member Functions | |
| virtual void | ApplyCustomMaskBlend (std::shared_ptr< QImage > original_image, std::shared_ptr< QImage > effected_image, std::shared_ptr< QImage > mask_image, int64_t frame_number) const |
| Optional override for effects with custom mask implementation. More... | |
| ReaderBase * | CreateReaderFromJson (const Json::Value &reader_json) const |
| Create a reader instance from reader JSON. More... | |
| virtual bool | HandlesMaskInternally () const |
| Optional override for effects that apply mask processing inside GetFrame(). More... | |
| int64_t | MapMaskFrameNumber (int64_t frame_number) |
| Convert an effect frame number to a mask source frame number. More... | |
| double | ResolveMaskHostFps () |
| Determine host FPS used to convert timeline frames to mask source FPS. More... | |
| std::shared_ptr< QImage > | ResolveMaskImage (std::shared_ptr< QImage > target_image, int64_t frame_number) |
| Resolve a cached/scaled mask image for the target frame dimensions. More... | |
| double | ResolveMaskSourceDuration () const |
| Determine mask source duration in seconds. More... | |
| virtual bool | UseCustomMaskBlend (int64_t frame_number) const |
| Optional override for effects that need custom mask behavior. More... | |
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... | |
Protected Attributes | |
| openshot::ClipBase * | clip |
| 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::TimelineBase * | timeline |
| Pointer to the parent timeline instance (if any) More... | |
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 56 of file EffectBase.h.
| Enumerator | |
|---|---|
| MASK_LOOP_PLAY_ONCE | |
| MASK_LOOP_REPEAT | |
| MASK_LOOP_PING_PONG | |
Definition at line 118 of file EffectBase.h.
| Enumerator | |
|---|---|
| MASK_TIME_TIMELINE | |
| MASK_TIME_SOURCE_FPS | |
Definition at line 113 of file EffectBase.h.
|
virtual |
Definition at line 593 of file EffectBase.cpp.
|
inlineprotectedvirtual |
Optional override for effects with custom mask implementation.
Reimplemented in openshot::Saturation, openshot::Blur, openshot::Hue, openshot::Brightness, openshot::Pixelate, and openshot::Sharpen.
Definition at line 96 of file EffectBase.h.
Referenced by ProcessFrame().
| 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 236 of file EffectBase.cpp.
Referenced by openshot::LensFlare::PropertiesJSON(), openshot::Noise::PropertiesJSON(), openshot::Negate::PropertiesJSON(), openshot::Distortion::PropertiesJSON(), openshot::ParametricEQ::PropertiesJSON(), openshot::Delay::PropertiesJSON(), openshot::Whisperization::PropertiesJSON(), openshot::Echo::PropertiesJSON(), openshot::Robotization::PropertiesJSON(), openshot::Deinterlace::PropertiesJSON(), openshot::Shift::PropertiesJSON(), openshot::Compressor::PropertiesJSON(), openshot::Expander::PropertiesJSON(), openshot::Wave::PropertiesJSON(), openshot::Hue::PropertiesJSON(), openshot::Mask::PropertiesJSON(), openshot::Bars::PropertiesJSON(), openshot::Outline::PropertiesJSON(), openshot::Brightness::PropertiesJSON(), openshot::Sharpen::PropertiesJSON(), openshot::ColorShift::PropertiesJSON(), openshot::ColorMap::PropertiesJSON(), openshot::Crop::PropertiesJSON(), openshot::SphericalProjection::PropertiesJSON(), openshot::Pixelate::PropertiesJSON(), openshot::Blur::PropertiesJSON(), openshot::Saturation::PropertiesJSON(), openshot::ChromaKey::PropertiesJSON(), openshot::Stabilizer::PropertiesJSON(), openshot::Caption::PropertiesJSON(), openshot::ObjectDetection::PropertiesJSON(), and openshot::AnalogTape::PropertiesJSON().
| int EffectBase::constrain | ( | int | color_value | ) |
Constrain a color value from 0 to 255.
Definition at line 77 of file EffectBase.cpp.
Referenced by openshot::Hue::GetFrame(), and openshot::ColorMap::GetFrame().
|
protected |
Create a reader instance from reader JSON.
Definition at line 277 of file EffectBase.cpp.
Referenced by openshot::Mask::Mask(), openshot::Mask::Reader(), and SetJsonValue().
| void EffectBase::DisplayInfo | ( | std::ostream * | out = &std::cout | ) |
Display effect information in the standard output stream (stdout)
Definition at line 62 of file EffectBase.cpp.
|
inlinevirtual |
Get the indexes and IDs of all visible objects in the given frame.
Reimplemented in openshot::ObjectDetection, and openshot::Tracker.
Definition at line 150 of file EffectBase.h.
|
inlineprotectedvirtual |
Optional override for effects that apply mask processing inside GetFrame().
Reimplemented in openshot::Mask.
Definition at line 100 of file EffectBase.h.
Referenced by ProcessFrame().
| 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 37 of file EffectBase.cpp.
Referenced by openshot::Negate::Negate().
|
virtual |
Generate JSON string of this object.
Implements openshot::ClipBase.
Reimplemented in openshot::AnalogTape, openshot::ObjectDetection, openshot::Caption, openshot::ChromaKey, openshot::Stabilizer, openshot::Saturation, openshot::SphericalProjection, openshot::Blur, openshot::Pixelate, openshot::Crop, openshot::ColorMap, openshot::ColorShift, openshot::Sharpen, openshot::Brightness, openshot::Outline, openshot::Bars, openshot::Hue, openshot::Mask, openshot::Wave, openshot::Expander, openshot::Compressor, openshot::Shift, openshot::Tracker, openshot::Deinterlace, openshot::Robotization, openshot::Echo, openshot::Whisperization, openshot::Delay, openshot::ParametricEQ, openshot::Distortion, openshot::Negate, openshot::Noise, and openshot::LensFlare.
Definition at line 89 of file EffectBase.cpp.
|
inlinevirtual |
Definition at line 158 of file EffectBase.h.
| Json::Value EffectBase::JsonInfo | ( | ) | const |
Generate JSON object of meta data / info.
Definition at line 221 of file EffectBase.cpp.
|
virtual |
Generate Json::Value for this object.
Implements openshot::ClipBase.
Reimplemented in openshot::AnalogTape, openshot::ObjectDetection, openshot::Caption, openshot::ChromaKey, openshot::Stabilizer, openshot::Saturation, openshot::SphericalProjection, openshot::Blur, openshot::Pixelate, openshot::Crop, openshot::ColorMap, openshot::ColorShift, openshot::Brightness, openshot::Sharpen, openshot::Outline, openshot::Bars, openshot::Hue, openshot::Mask, openshot::Wave, openshot::Expander, openshot::Compressor, openshot::Tracker, openshot::Shift, openshot::Deinterlace, openshot::Robotization, openshot::Echo, openshot::Whisperization, openshot::Delay, openshot::ParametricEQ, openshot::Distortion, openshot::Negate, openshot::Noise, and openshot::LensFlare.
Definition at line 96 of file EffectBase.cpp.
Referenced by Json(), openshot::LensFlare::JsonValue(), 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::Shift::JsonValue(), openshot::Compressor::JsonValue(), openshot::Expander::JsonValue(), openshot::Wave::JsonValue(), openshot::Hue::JsonValue(), openshot::Mask::JsonValue(), openshot::Bars::JsonValue(), openshot::Outline::JsonValue(), openshot::Brightness::JsonValue(), openshot::Sharpen::JsonValue(), openshot::ColorShift::JsonValue(), openshot::ColorMap::JsonValue(), openshot::Crop::JsonValue(), openshot::Pixelate::JsonValue(), openshot::Blur::JsonValue(), openshot::SphericalProjection::JsonValue(), openshot::Saturation::JsonValue(), openshot::ChromaKey::JsonValue(), openshot::Stabilizer::JsonValue(), openshot::Caption::JsonValue(), openshot::ObjectDetection::JsonValue(), openshot::AnalogTape::JsonValue(), SetJsonValue(), and SetParentEffect().
|
protected |
Convert an effect frame number to a mask source frame number.
Definition at line 357 of file EffectBase.cpp.
|
inline |
Get the common mask reader.
Definition at line 175 of file EffectBase.h.
Referenced by openshot::Mask::Mask(), openshot::Mask::Reader(), SetJsonValue(), and ~EffectBase().
|
inline |
Definition at line 176 of file EffectBase.h.
| void EffectBase::MaskReader | ( | ReaderBase * | new_reader | ) |
Set or replace the common mask reader.
Definition at line 308 of file EffectBase.cpp.
|
inline |
Get the order that this effect should be executed.
Definition at line 182 of file EffectBase.h.
Referenced by InitEffectInfo(), JsonValue(), openshot::CompareClipEffects::operator()(), openshot::CompareEffects::operator()(), and SetJsonValue().
|
inline |
Set the order that this effect should be executed.
Definition at line 185 of file EffectBase.h.
| 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 549 of file EffectBase.cpp.
Referenced by openshot::Clip::AddEffect(), openshot::Caption::GetFrame(), InitEffectInfo(), and openshot::ObjectDetection::LoadObjDetectdData().
| void EffectBase::ParentClip | ( | openshot::ClipBase * | new_clip | ) |
Set parent clip object of this effect.
Set parent clip object of this reader.
Definition at line 554 of file EffectBase.cpp.
| std::string EffectBase::ParentClipId | ( | ) | const |
Return the ID of this effect's parent clip.
Definition at line 586 of file EffectBase.cpp.
| std::shared_ptr< openshot::Frame > EffectBase::ProcessFrame | ( | std::shared_ptr< openshot::Frame > | frame, |
| int64_t | frame_number | ||
| ) |
Apply effect processing with common mask support (if enabled).
Definition at line 514 of file EffectBase.cpp.
|
protected |
Determine host FPS used to convert timeline frames to mask source FPS.
Definition at line 325 of file EffectBase.cpp.
Referenced by MapMaskFrameNumber().
|
inlineprotected |
Resolve a cached/scaled mask image for the target frame dimensions.
Definition at line 88 of file EffectBase.h.
Referenced by openshot::Mask::GetFrame().
|
protected |
Determine mask source duration in seconds.
Definition at line 342 of file EffectBase.cpp.
Referenced by MapMaskFrameNumber().
|
virtual |
Load JSON string into this object.
Implements openshot::ClipBase.
Reimplemented in openshot::SphericalProjection, openshot::AnalogTape, openshot::ObjectDetection, openshot::Caption, openshot::ChromaKey, openshot::Stabilizer, openshot::Saturation, openshot::Blur, openshot::Pixelate, openshot::Crop, openshot::ColorMap, openshot::ColorShift, openshot::Sharpen, openshot::Brightness, openshot::Outline, openshot::Bars, openshot::Hue, openshot::Mask, openshot::Wave, openshot::Expander, openshot::Compressor, openshot::Shift, openshot::Tracker, openshot::Deinterlace, openshot::Robotization, openshot::Echo, openshot::Whisperization, openshot::Delay, openshot::ParametricEQ, openshot::Distortion, openshot::Negate, openshot::Noise, and openshot::LensFlare.
Definition at line 122 of file EffectBase.cpp.
|
inlinevirtual |
Definition at line 161 of file EffectBase.h.
|
virtual |
Load Json::Value into this object.
Implements openshot::ClipBase.
Reimplemented in openshot::SphericalProjection, openshot::AnalogTape, openshot::ObjectDetection, openshot::Caption, openshot::ChromaKey, openshot::Stabilizer, openshot::Saturation, openshot::Blur, openshot::Pixelate, openshot::Crop, openshot::ColorMap, openshot::ColorShift, openshot::Sharpen, openshot::Brightness, openshot::Outline, openshot::Bars, openshot::Hue, openshot::Mask, openshot::Wave, openshot::Expander, openshot::Compressor, openshot::Tracker, openshot::Shift, openshot::Deinterlace, openshot::Robotization, openshot::Echo, openshot::Whisperization, openshot::Delay, openshot::ParametricEQ, openshot::Distortion, openshot::Negate, openshot::Noise, and openshot::LensFlare.
Definition at line 139 of file EffectBase.cpp.
Referenced by SetJson(), openshot::LensFlare::SetJsonValue(), 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::Shift::SetJsonValue(), openshot::Compressor::SetJsonValue(), openshot::Expander::SetJsonValue(), openshot::Wave::SetJsonValue(), openshot::Hue::SetJsonValue(), openshot::Mask::SetJsonValue(), openshot::Bars::SetJsonValue(), openshot::Outline::SetJsonValue(), openshot::Brightness::SetJsonValue(), openshot::Sharpen::SetJsonValue(), openshot::ColorShift::SetJsonValue(), openshot::ColorMap::SetJsonValue(), openshot::Crop::SetJsonValue(), openshot::Pixelate::SetJsonValue(), openshot::Blur::SetJsonValue(), openshot::SphericalProjection::SetJsonValue(), openshot::Saturation::SetJsonValue(), openshot::ChromaKey::SetJsonValue(), openshot::Stabilizer::SetJsonValue(), openshot::Caption::SetJsonValue(), openshot::ObjectDetection::SetJsonValue(), openshot::AnalogTape::SetJsonValue(), openshot::Clip::SetJsonValue(), openshot::Timeline::SetJsonValue(), and SetParentEffect().
| void EffectBase::SetParentEffect | ( | std::string | parentEffect_id | ) |
Set the parent effect from which this properties will be set to.
Definition at line 561 of file EffectBase.cpp.
Referenced by SetJsonValue().
|
inlineprotectedvirtual |
Optional override for effects that need custom mask behavior.
Reimplemented in openshot::Saturation, openshot::Blur, openshot::Hue, openshot::Brightness, openshot::Pixelate, and openshot::Sharpen.
Definition at line 93 of file EffectBase.h.
Referenced by ProcessFrame().
|
protected |
Pointer to the parent clip instance (if any)
Definition at line 73 of file EffectBase.h.
Referenced by openshot::Caption::GetFrame(), MapMaskFrameNumber(), MaskReader(), ParentClip(), ParentClipId(), and ResolveMaskHostFps().
| EffectInfoStruct openshot::EffectBase::info |
Information about the current effect.
Definition at line 110 of file EffectBase.h.
Referenced by openshot::Clip::AddEffect(), BasePropertiesJSON(), DisplayInfo(), InitEffectInfo(), JsonInfo(), openshot::LensFlare::JsonValue(), 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::Shift::JsonValue(), openshot::Compressor::JsonValue(), openshot::Expander::JsonValue(), openshot::Bars::JsonValue(), openshot::Wave::JsonValue(), openshot::Hue::JsonValue(), openshot::Mask::JsonValue(), openshot::Outline::JsonValue(), openshot::Sharpen::JsonValue(), openshot::Brightness::JsonValue(), openshot::ColorShift::JsonValue(), openshot::ColorMap::JsonValue(), openshot::Crop::JsonValue(), openshot::Blur::JsonValue(), openshot::Pixelate::JsonValue(), openshot::SphericalProjection::JsonValue(), openshot::Saturation::JsonValue(), openshot::Stabilizer::JsonValue(), openshot::ChromaKey::JsonValue(), openshot::Caption::JsonValue(), openshot::ObjectDetection::JsonValue(), openshot::AnalogTape::JsonValue(), JsonValue(), openshot::Negate::Negate(), ProcessFrame(), SetJsonValue(), and SetParentEffect().
| bool openshot::EffectBase::mask_invert = false |
Invert grayscale mask values before blending.
Definition at line 111 of file EffectBase.h.
Referenced by openshot::Sharpen::ApplyCustomMaskBlend(), openshot::Brightness::ApplyCustomMaskBlend(), openshot::Pixelate::ApplyCustomMaskBlend(), openshot::Hue::ApplyCustomMaskBlend(), openshot::Blur::ApplyCustomMaskBlend(), openshot::Saturation::ApplyCustomMaskBlend(), BasePropertiesJSON(), openshot::Mask::GetFrame(), InitEffectInfo(), JsonValue(), and SetJsonValue().
| int openshot::EffectBase::mask_loop_mode = MASK_LOOP_PLAY_ONCE |
Behavior when mask range reaches the end.
Definition at line 125 of file EffectBase.h.
Referenced by BasePropertiesJSON(), InitEffectInfo(), JsonValue(), MapMaskFrameNumber(), and SetJsonValue().
| int openshot::EffectBase::mask_time_mode = MASK_TIME_SOURCE_FPS |
How effect frames map to mask source frames.
Definition at line 124 of file EffectBase.h.
Referenced by BasePropertiesJSON(), InitEffectInfo(), JsonValue(), MapMaskFrameNumber(), and SetJsonValue().
| EffectBase* openshot::EffectBase::parentEffect |
Parent effect (which properties will set this effect properties)
Definition at line 104 of file EffectBase.h.
Referenced by InitEffectInfo(), SetJsonValue(), and SetParentEffect().
| 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 107 of file EffectBase.h.
Referenced by openshot::Clip::AddEffect(), openshot::ObjectDetection::GetFrame(), openshot::ObjectDetection::GetVisibleObjects(), openshot::ObjectDetection::JsonValue(), openshot::ObjectDetection::LoadObjDetectdData(), openshot::ObjectDetection::PropertiesJSON(), and openshot::ObjectDetection::SetJsonValue().
1.8.17