OpenShot Library | libopenshot 0.3.3
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
openshot::ClipBase Class Referenceabstract

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

#include <ClipBase.h>

Inheritance diagram for openshot::ClipBase:
openshot::Clip openshot::EffectBase openshot::Bars openshot::Blur openshot::Brightness openshot::Caption openshot::ChromaKey openshot::ColorShift openshot::Compressor openshot::Crop openshot::Deinterlace openshot::Delay openshot::Distortion openshot::Echo openshot::Expander openshot::Hue openshot::Mask openshot::Negate openshot::Noise openshot::ObjectDetection openshot::ParametricEQ openshot::Pixelate openshot::Robotization openshot::Saturation openshot::Shift openshot::Stabilizer openshot::Tracker openshot::Wave openshot::Whisperization

Public Member Functions

 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::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.
 
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.
 
std::string Id () const
 Get the Id of this clip object.
 
void Id (std::string value)
 
virtual std::string Json () const =0
 Generate JSON string of this object.
 
virtual Json::Value JsonValue () const =0
 Generate Json::Value for this object.
 
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::TimelineBaseParentTimeline ()
 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
 
virtual void SetJson (const std::string value)=0
 Load JSON string into this object.
 
virtual void SetJsonValue (const Json::Value root)=0
 Load Json::Value into this object.
 
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
 

Protected Member Functions

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.
 

Protected Attributes

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::TimelineBasetimeline
 Pointer to the parent timeline instance (if any)
 

Detailed Description

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

Clips are objects that attach to the timeline and can be layered and positioned together. There are 2 primary types of clips: Effects and Video/Audio Clips.

Definition at line 33 of file ClipBase.h.

Constructor & Destructor Documentation

◆ ClipBase()

openshot::ClipBase::ClipBase ( )
inline

Constructor for the base clip.

Definition at line 51 of file ClipBase.h.

◆ ~ClipBase()

virtual openshot::ClipBase::~ClipBase ( )
virtualdefault

Member Function Documentation

◆ add_property_choice_json()

Json::Value ClipBase::add_property_choice_json ( std::string  name,
int  value,
int  selected_value 
) const
protected

◆ add_property_json()

Json::Value ClipBase::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
protected

◆ Duration()

float openshot::ClipBase::Duration ( ) const
inline

◆ End() [1/2]

virtual float openshot::ClipBase::End ( ) const
inlinevirtual

◆ End() [2/2]

void ClipBase::End ( float  value)
virtual

Set end position (in seconds) of clip (trim end of video)

Reimplemented in openshot::Clip.

Definition at line 53 of file ClipBase.cpp.

◆ GetFrame() [1/2]

virtual std::shared_ptr< openshot::Frame > openshot::ClipBase::GetFrame ( int64_t  frame_number)
pure virtual

◆ GetFrame() [2/2]

virtual std::shared_ptr< openshot::Frame > openshot::ClipBase::GetFrame ( std::shared_ptr< openshot::Frame frame,
int64_t  frame_number 
)
pure virtual

This method is required for all derived classes of ClipBase, and returns a modified openshot::Frame object.

The frame object is passed into this method and used as a starting point / background (pixels). All Clip keyframes and effects are resolved into pixels.

Returns
The modified openshot::Frame object
Parameters
frameThis is ignored on Clip, due to caching optimizations. This frame instance is clobbered with the source frame.
frame_numberThe frame number (starting at 1) of the clip or effect on the timeline.

Implemented in openshot::Clip, 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::Pixelate, openshot::Saturation, openshot::Shift, and openshot::Wave.

◆ Id() [1/2]

std::string openshot::ClipBase::Id ( ) const
inline

◆ Id() [2/2]

void openshot::ClipBase::Id ( std::string  value)
inline

Definition at line 94 of file ClipBase.h.

◆ Json()

virtual std::string openshot::ClipBase::Json ( ) const
pure virtual

◆ JsonValue()

Json::Value ClipBase::JsonValue ( ) const
pure virtual

◆ Layer() [1/2]

int openshot::ClipBase::Layer ( ) const
inline

◆ Layer() [2/2]

void ClipBase::Layer ( int  value)

Set layer of clip on timeline (lower number is covered by higher numbers)

Definition at line 31 of file ClipBase.cpp.

◆ operator<()

bool openshot::ClipBase::operator< ( ClipBase a)
inline

Definition at line 60 of file ClipBase.h.

◆ operator<=()

bool openshot::ClipBase::operator<= ( ClipBase a)
inline

Definition at line 61 of file ClipBase.h.

◆ operator>()

bool openshot::ClipBase::operator> ( ClipBase a)
inline

Definition at line 62 of file ClipBase.h.

◆ operator>=()

bool openshot::ClipBase::operator>= ( ClipBase a)
inline

Definition at line 63 of file ClipBase.h.

◆ ParentTimeline() [1/2]

virtual openshot::TimelineBase * openshot::ClipBase::ParentTimeline ( )
inlinevirtual

◆ ParentTimeline() [2/2]

virtual void openshot::ClipBase::ParentTimeline ( openshot::TimelineBase new_timeline)
inlinevirtual

Set associated Timeline pointer.

Reimplemented in openshot::Clip.

Definition at line 99 of file ClipBase.h.

◆ Position() [1/2]

float openshot::ClipBase::Position ( ) const
inline

◆ Position() [2/2]

void ClipBase::Position ( float  value)

‍Set the Id of this clip object

Set position on timeline (in seconds)

Definition at line 19 of file ClipBase.cpp.

◆ PropertiesJSON()

virtual std::string openshot::ClipBase::PropertiesJSON ( int64_t  requested_frame) const
pure virtual

◆ SetJson()

virtual void openshot::ClipBase::SetJson ( const std::string  value)
pure virtual

◆ SetJsonValue()

void ClipBase::SetJsonValue ( const Json::Value  root)
pure virtual

◆ Start() [1/2]

float openshot::ClipBase::Start ( ) const
inline

◆ Start() [2/2]

void ClipBase::Start ( float  value)

Set start position (in seconds) of clip (trim start of video)

Definition at line 42 of file ClipBase.cpp.

Member Data Documentation

◆ end

float openshot::ClipBase::end
protected

The position in seconds to end playing (used to trim the ending of a clip)

Definition at line 39 of file ClipBase.h.

Referenced by Duration(), End(), openshot::Clip::End(), End(), and openshot::Clip::Open().

◆ id

std::string openshot::ClipBase::id
protected

ID Property for all derived Clip and Effect classes.

Definition at line 35 of file ClipBase.h.

Referenced by openshot::Clip::GetEffect(), Id(), openshot::ObjectDetection::LoadObjDetectdData(), and openshot::Stabilizer::LoadStabilizedData().

◆ layer

int openshot::ClipBase::layer
protected

The layer this clip is on. Lower clips are covered up by higher clips.

Definition at line 37 of file ClipBase.h.

Referenced by Layer(), and Layer().

◆ position

float openshot::ClipBase::position
protected

The position on the timeline where this clip should start playing.

Definition at line 36 of file ClipBase.h.

Referenced by Position(), and Position().

◆ previous_properties

std::string openshot::ClipBase::previous_properties
protected

This string contains the previous JSON properties.

Definition at line 40 of file ClipBase.h.

Referenced by openshot::Clip::init_settings().

◆ start

float openshot::ClipBase::start
protected

The position in seconds to start playing (used to trim the beginning of a clip)

Definition at line 38 of file ClipBase.h.

Referenced by Duration(), openshot::Deinterlace::GetFrame(), Start(), and Start().

◆ timeline

openshot::TimelineBase* openshot::ClipBase::timeline
protected

Pointer to the parent timeline instance (if any)

Definition at line 41 of file ClipBase.h.

Referenced by openshot::Caption::GetFrame(), ParentTimeline(), openshot::Clip::ParentTimeline(), ParentTimeline(), and openshot::Clip::ParentTimeline().


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