OpenShot Library | libopenshot
0.4.0
|
This class represents a clip (used to arrange readers on the timeline) More...
#include <Clip.h>
Public Member Functions | |
void | AddEffect (openshot::EffectBase *effect) |
Add an effect to the clip. More... | |
void | AttachToObject (std::string object_id) |
Attach clip to Tracked Object or to another Clip. More... | |
Clip () | |
Default Constructor. More... | |
Clip (openshot::ReaderBase *new_reader) | |
Constructor with reader. More... | |
Clip (std::string path) | |
Constructor with filepath (reader is automatically created... by guessing file extensions) More... | |
void | Close () override |
Close the internal reader. More... | |
std::list< openshot::EffectBase * > | Effects () |
Return the list of effects on the timeline. More... | |
float | End () const override |
Get end position (in seconds) of clip (trim end of video), which can be affected by the time curve. More... | |
void | End (float value) override |
Set end position (in seconds) of clip (trim end of video) More... | |
Clip * | GetAttachedClip () const |
Return a pointer to the clip this clip is attached to. More... | |
std::string | GetAttachedId () const |
Get and set the object id that this clip is attached to. More... | |
std::shared_ptr< openshot::TrackedObjectBase > | GetAttachedObject () const |
Return a pointer to the trackedObject this clip is attached to. More... | |
openshot::CacheMemory * | GetCache () override |
Get the cache object (always return NULL for this reader) More... | |
openshot::EffectBase * | GetEffect (const std::string &id) |
Look up an effect by ID. More... | |
std::shared_ptr< openshot::Frame > | GetFrame (int64_t clip_frame_number) override |
Get an openshot::Frame object for a specific frame number of this clip. The image size and number of samples match the source reader. More... | |
std::shared_ptr< openshot::Frame > | GetFrame (std::shared_ptr< openshot::Frame > background_frame, int64_t clip_frame_number) override |
Get an openshot::Frame object for a specific frame number of this clip. The image size and number of samples match the background_frame passed in and the timeline (if available). More... | |
std::shared_ptr< openshot::Frame > | GetFrame (std::shared_ptr< openshot::Frame > background_frame, int64_t clip_frame_number, openshot::TimelineInfoStruct *options) |
Get an openshot::Frame object for a specific frame number of this clip. The image size and number of samples match the background_frame passed in and the timeline (if available). More... | |
openshot::Clip * | GetParentClip () |
Return the associated ParentClip (if any) More... | |
std::shared_ptr< openshot::TrackedObjectBase > | GetParentTrackedObject () |
Return the associated Parent Tracked Object (if any) More... | |
bool | IsOpen () override |
Determine if reader is open or closed. More... | |
std::string | Json () const override |
Generate JSON string of this object. More... | |
Json::Value | JsonValue () const override |
Generate Json::Value for this object. More... | |
std::string | Name () override |
Return the type name of the class. More... | |
void | Open () override |
Open the internal reader. More... | |
void | ParentTimeline (openshot::TimelineBase *new_timeline) override |
Set associated Timeline pointer. More... | |
std::string | PropertiesJSON (int64_t requested_frame) const override |
openshot::ReaderBase * | Reader () |
Get the current reader. More... | |
void | Reader (openshot::ReaderBase *new_reader) |
Set the current reader. More... | |
void | RemoveEffect (openshot::EffectBase *effect) |
Remove an effect from the clip. More... | |
void | SetAttachedClip (Clip *clipObject) |
Set the pointer to the clip this clip is attached to. More... | |
void | SetAttachedId (std::string value) |
Set id of the object id that this clip is attached to. More... | |
void | SetAttachedObject (std::shared_ptr< openshot::TrackedObjectBase > trackedObject) |
Set the pointer to the trackedObject this clip is attached to. More... | |
void | SetJson (const std::string value) override |
Load JSON string into this object. More... | |
void | SetJsonValue (const Json::Value root) override |
Load Json::Value into this object. More... | |
virtual | ~Clip () |
Destructor. More... | |
Public Member Functions inherited from openshot::ClipBase | |
ClipBase () | |
Constructor for the base clip. 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... | |
void | Start (float value) |
Set start position (in seconds) of clip (trim start of video) More... | |
virtual | ~ClipBase ()=default |
Public Member Functions inherited from openshot::ReaderBase | |
void | DisplayInfo (std::ostream *out=&std::cout) |
Display file information in the standard output stream (stdout) More... | |
openshot::ClipBase * | ParentClip () |
Parent clip object of this reader (which can be unparented and NULL) More... | |
void | ParentClip (openshot::ClipBase *new_clip) |
Set parent clip object of this reader. More... | |
ReaderBase () | |
Constructor for the base reader, where many things are initialized. More... | |
virtual | ~ReaderBase ()=default |
Public Attributes | |
openshot::Keyframe | alpha |
Curve representing the alpha (1 to 0) More... | |
openshot::AnchorType | anchor |
The anchor determines what parent a clip should snap to. More... | |
openshot::Keyframe | channel_filter |
A number representing an audio channel to filter (clears all other channels) More... | |
openshot::Keyframe | channel_mapping |
A number representing an audio channel to output (only works when filtering a channel) More... | |
bool | COMPILED_WITH_CV = true |
openshot::FrameDisplayType | display |
The format to display the frame number (if any) More... | |
openshot::GravityType | gravity |
The gravity of a clip determines where it snaps to its parent. More... | |
openshot::Keyframe | has_audio |
An optional override to determine if this clip has audio (-1=undefined, 0=no, 1=yes) More... | |
openshot::Keyframe | has_video |
An optional override to determine if this clip has video (-1=undefined, 0=no, 1=yes) More... | |
openshot::Keyframe | location_x |
Curve representing the relative X position in percent based on the gravity (-1 to 1) More... | |
openshot::Keyframe | location_y |
Curve representing the relative Y position in percent based on the gravity (-1 to 1) More... | |
openshot::VolumeMixType | mixing |
What strategy should be followed when mixing audio with other clips. More... | |
openshot::Keyframe | origin_x |
Curve representing X origin point (0.0=0% (left), 1.0=100% (right)) More... | |
openshot::Keyframe | origin_y |
Curve representing Y origin point (0.0=0% (top), 1.0=100% (bottom)) More... | |
openshot::Keyframe | perspective_c1_x |
Curves representing X for coordinate 1. More... | |
openshot::Keyframe | perspective_c1_y |
Curves representing Y for coordinate 1. More... | |
openshot::Keyframe | perspective_c2_x |
Curves representing X for coordinate 2. More... | |
openshot::Keyframe | perspective_c2_y |
Curves representing Y for coordinate 2. More... | |
openshot::Keyframe | perspective_c3_x |
Curves representing X for coordinate 3. More... | |
openshot::Keyframe | perspective_c3_y |
Curves representing Y for coordinate 3. More... | |
openshot::Keyframe | perspective_c4_x |
Curves representing X for coordinate 4. More... | |
openshot::Keyframe | perspective_c4_y |
Curves representing Y for coordinate 4. More... | |
openshot::Keyframe | rotation |
Curve representing the rotation (0 to 360) More... | |
openshot::ScaleType | scale |
The scale determines how a clip should be resized to fit its parent. More... | |
openshot::Keyframe | scale_x |
Curve representing the horizontal scaling in percent (0 to 1) More... | |
openshot::Keyframe | scale_y |
Curve representing the vertical scaling in percent (0 to 1) More... | |
openshot::Keyframe | shear_x |
Curve representing X shear angle in degrees (-45.0=left, 45.0=right) More... | |
openshot::Keyframe | shear_y |
Curve representing Y shear angle in degrees (-45.0=down, 45.0=up) More... | |
openshot::Keyframe | time |
Curve representing the frames over time to play (used for speed and direction of video) More... | |
openshot::Keyframe | volume |
Curve representing the volume (0 to 1) More... | |
openshot::Color | wave_color |
Curve representing the color of the audio wave form. More... | |
Public Attributes inherited from openshot::ReaderBase | |
openshot::ReaderInfo | info |
Information about the current media file. More... | |
Protected Member Functions | |
void | init_reader_rotation () |
Update default rotation from reader. More... | |
void | init_reader_settings () |
Init reader info details. More... | |
void | init_settings () |
Init default settings for a clip. 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 | |
std::recursive_mutex | getFrameMutex |
Mutex for multiple threads. More... | |
AudioLocation | previous_location |
Previous time-mapped audio location. 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... | |
Protected Attributes inherited from openshot::ReaderBase | |
openshot::ClipBase * | clip |
Pointer to the parent clip instance (if any) More... | |
std::recursive_mutex | getFrameMutex |
Mutex for multiple threads. More... | |
This class represents a clip (used to arrange readers on the timeline)
Each image, video, or audio file is represented on a layer as a clip. A clip has many properties that affect how it behaves on the timeline, such as its size, position, transparency, rotation, speed, volume, etc...
Clip::Clip | ( | std::string | path | ) |
Clip::Clip | ( | openshot::ReaderBase * | new_reader | ) |
void Clip::AddEffect | ( | openshot::EffectBase * | effect | ) |
Add an effect to the clip.
effect | Add an effect to the clip. An effect can modify the audio or video of an openshot::Frame. |
Definition at line 1117 of file Clip.cpp.
Referenced by SetJsonValue().
void Clip::AttachToObject | ( | std::string | object_id | ) |
Attach clip to Tracked Object or to another Clip.
Definition at line 241 of file Clip.cpp.
Referenced by GetParentClip(), GetParentTrackedObject(), and SetJsonValue().
|
overridevirtual |
Close the internal reader.
Implements openshot::ReaderBase.
|
inline |
|
override |
Get end position (in seconds) of clip (trim end of video), which can be affected by the time curve.
Definition at line 356 of file Clip.cpp.
Referenced by openshot::CVObjectDetection::detectObjectsClip(), PropertiesJSON(), CVStabilization::stabilizeClip(), and openshot::CVTracker::trackClip().
|
overridevirtual |
Set end position (in seconds) of clip (trim end of video)
Reimplemented from openshot::ClipBase.
|
inline |
|
inline |
|
inline |
|
inlineoverridevirtual |
Get the cache object (always return NULL for this reader)
Implements openshot::ReaderBase.
openshot::EffectBase * Clip::GetEffect | ( | const std::string & | id | ) |
|
overridevirtual |
Get an openshot::Frame object for a specific frame number of this clip. The image size and number of samples match the source reader.
clip_frame_number | The frame number (starting at 1) of the clip |
Implements openshot::ClipBase.
Definition at line 391 of file Clip.cpp.
Referenced by openshot::CVObjectDetection::detectObjectsClip(), GetFrame(), CVStabilization::stabilizeClip(), and openshot::CVTracker::trackClip().
|
overridevirtual |
Get an openshot::Frame object for a specific frame number of this clip. The image size and number of samples match the background_frame passed in and the timeline (if available).
A new openshot::Frame objects is returned, based on a copy from the source image, with all keyframes and clip effects rendered/rasterized.
background_frame | The frame object to use as a background canvas (i.e. an existing Timeline openshot::Frame instance) |
clip_frame_number | The frame number (starting at 1) of the clip. The image size and number of samples match the background_frame passed in and the timeline (if available) |
Implements openshot::ClipBase.
std::shared_ptr< Frame > Clip::GetFrame | ( | std::shared_ptr< openshot::Frame > | background_frame, |
int64_t | clip_frame_number, | ||
openshot::TimelineInfoStruct * | options | ||
) |
Get an openshot::Frame object for a specific frame number of this clip. The image size and number of samples match the background_frame passed in and the timeline (if available).
A new openshot::Frame objects is returned, based on a copy from the source image, with all keyframes and clip effects rendered/rasterized.
background_frame | The frame object to use as a background canvas (i.e. an existing Timeline openshot::Frame instance) |
clip_frame_number | The frame number (starting at 1) of the clip on the timeline. The image size and number of samples match the timeline. |
options | The openshot::TimelineInfoStruct pointer, with more details about this specific timeline clip, such as, if it's a top clip. This info is used to apply global transitions and masks, if needed. |
openshot::Clip * Clip::GetParentClip | ( | ) |
std::shared_ptr< openshot::TrackedObjectBase > Clip::GetParentTrackedObject | ( | ) |
|
protected |
Update default rotation from reader.
Definition at line 115 of file Clip.cpp.
Referenced by init_reader_settings().
|
protected |
Init reader info details.
Definition at line 101 of file Clip.cpp.
Referenced by Clip(), init_settings(), and Reader().
|
protected |
|
inlineoverridevirtual |
Determine if reader is open or closed.
Implements openshot::ReaderBase.
|
overridevirtual |
Generate JSON string of this object.
Implements openshot::ClipBase.
|
overridevirtual |
Generate Json::Value for this object.
Implements openshot::ClipBase.
Definition at line 851 of file Clip.cpp.
Referenced by Json().
|
inlineoverridevirtual |
Return the type name of the class.
Implements openshot::ReaderBase.
|
overridevirtual |
Open the internal reader.
Implements openshot::ReaderBase.
Definition at line 320 of file Clip.cpp.
Referenced by Clip(), openshot::CVObjectDetection::detectObjectsClip(), CVStabilization::stabilizeClip(), and openshot::CVTracker::trackClip().
|
override |
Set associated Timeline pointer.
Definition at line 383 of file Clip.cpp.
Referenced by AddEffect(), AttachToObject(), and openshot::Timeline::SetJsonValue().
|
overridevirtual |
Get all properties for a specific frame (perfect for a UI to display the current state of all properties at any time)
Implements openshot::ClipBase.
ReaderBase * Clip::Reader | ( | ) |
void Clip::Reader | ( | openshot::ReaderBase * | new_reader | ) |
Set the current reader.
new_reader | The reader to be used by this clip |
Definition at line 274 of file Clip.cpp.
Referenced by openshot::CVObjectDetection::detectObjectsClip(), CVStabilization::stabilizeClip(), and openshot::CVTracker::trackClip().
void Clip::RemoveEffect | ( | openshot::EffectBase * | effect | ) |
void Clip::SetAttachedClip | ( | Clip * | clipObject | ) |
Set the pointer to the clip this clip is attached to.
Definition at line 269 of file Clip.cpp.
Referenced by AttachToObject().
|
inline |
void Clip::SetAttachedObject | ( | std::shared_ptr< openshot::TrackedObjectBase > | trackedObject | ) |
Set the pointer to the trackedObject this clip is attached to.
Definition at line 264 of file Clip.cpp.
Referenced by AttachToObject().
|
overridevirtual |
Load JSON string into this object.
Implements openshot::ClipBase.
|
overridevirtual |
Load Json::Value into this object.
Implements openshot::ClipBase.
Definition at line 924 of file Clip.cpp.
Referenced by SetJson(), and openshot::Timeline::SetJsonValue().
openshot::Keyframe openshot::Clip::alpha |
Curve representing the alpha (1 to 0)
Definition at line 310 of file Clip.h.
Referenced by init_settings(), JsonValue(), PropertiesJSON(), and SetJsonValue().
openshot::AnchorType openshot::Clip::anchor |
The anchor determines what parent a clip should snap to.
Definition at line 169 of file Clip.h.
Referenced by init_settings(), JsonValue(), and SetJsonValue().
openshot::Keyframe openshot::Clip::channel_filter |
A number representing an audio channel to filter (clears all other channels)
Definition at line 337 of file Clip.h.
Referenced by init_settings(), JsonValue(), PropertiesJSON(), and SetJsonValue().
openshot::Keyframe openshot::Clip::channel_mapping |
A number representing an audio channel to output (only works when filtering a channel)
Definition at line 338 of file Clip.h.
Referenced by init_settings(), JsonValue(), PropertiesJSON(), and SetJsonValue().
openshot::FrameDisplayType openshot::Clip::display |
The format to display the frame number (if any)
Definition at line 170 of file Clip.h.
Referenced by init_settings(), JsonValue(), PropertiesJSON(), and SetJsonValue().
|
protected |
openshot::GravityType openshot::Clip::gravity |
The gravity of a clip determines where it snaps to its parent.
Definition at line 167 of file Clip.h.
Referenced by init_settings(), JsonValue(), PropertiesJSON(), and SetJsonValue().
openshot::Keyframe openshot::Clip::has_audio |
An optional override to determine if this clip has audio (-1=undefined, 0=no, 1=yes)
Definition at line 341 of file Clip.h.
Referenced by init_settings(), JsonValue(), PropertiesJSON(), and SetJsonValue().
openshot::Keyframe openshot::Clip::has_video |
An optional override to determine if this clip has video (-1=undefined, 0=no, 1=yes)
Definition at line 342 of file Clip.h.
Referenced by init_settings(), JsonValue(), PropertiesJSON(), and SetJsonValue().
openshot::Keyframe openshot::Clip::location_x |
Curve representing the relative X position in percent based on the gravity (-1 to 1)
Definition at line 308 of file Clip.h.
Referenced by init_settings(), JsonValue(), PropertiesJSON(), and SetJsonValue().
openshot::Keyframe openshot::Clip::location_y |
Curve representing the relative Y position in percent based on the gravity (-1 to 1)
Definition at line 309 of file Clip.h.
Referenced by init_settings(), JsonValue(), PropertiesJSON(), and SetJsonValue().
openshot::VolumeMixType openshot::Clip::mixing |
What strategy should be followed when mixing audio with other clips.
Definition at line 171 of file Clip.h.
Referenced by init_settings(), JsonValue(), PropertiesJSON(), and SetJsonValue().
openshot::Keyframe openshot::Clip::origin_x |
Curve representing X origin point (0.0=0% (left), 1.0=100% (right))
Definition at line 316 of file Clip.h.
Referenced by init_settings(), JsonValue(), PropertiesJSON(), and SetJsonValue().
openshot::Keyframe openshot::Clip::origin_y |
Curve representing Y origin point (0.0=0% (top), 1.0=100% (bottom))
Definition at line 317 of file Clip.h.
Referenced by init_settings(), JsonValue(), PropertiesJSON(), and SetJsonValue().
openshot::Keyframe openshot::Clip::perspective_c1_x |
Curves representing X for coordinate 1.
Definition at line 327 of file Clip.h.
Referenced by init_settings(), JsonValue(), and SetJsonValue().
openshot::Keyframe openshot::Clip::perspective_c1_y |
Curves representing Y for coordinate 1.
Definition at line 328 of file Clip.h.
Referenced by init_settings(), JsonValue(), and SetJsonValue().
openshot::Keyframe openshot::Clip::perspective_c2_x |
Curves representing X for coordinate 2.
Definition at line 329 of file Clip.h.
Referenced by init_settings(), JsonValue(), and SetJsonValue().
openshot::Keyframe openshot::Clip::perspective_c2_y |
Curves representing Y for coordinate 2.
Definition at line 330 of file Clip.h.
Referenced by init_settings(), JsonValue(), and SetJsonValue().
openshot::Keyframe openshot::Clip::perspective_c3_x |
Curves representing X for coordinate 3.
Definition at line 331 of file Clip.h.
Referenced by init_settings(), JsonValue(), and SetJsonValue().
openshot::Keyframe openshot::Clip::perspective_c3_y |
Curves representing Y for coordinate 3.
Definition at line 332 of file Clip.h.
Referenced by init_settings(), JsonValue(), and SetJsonValue().
openshot::Keyframe openshot::Clip::perspective_c4_x |
Curves representing X for coordinate 4.
Definition at line 333 of file Clip.h.
Referenced by init_settings(), JsonValue(), and SetJsonValue().
openshot::Keyframe openshot::Clip::perspective_c4_y |
Curves representing Y for coordinate 4.
Definition at line 334 of file Clip.h.
Referenced by init_settings(), JsonValue(), and SetJsonValue().
|
protected |
openshot::Keyframe openshot::Clip::rotation |
Curve representing the rotation (0 to 360)
Definition at line 313 of file Clip.h.
Referenced by init_reader_rotation(), JsonValue(), PropertiesJSON(), and SetJsonValue().
openshot::ScaleType openshot::Clip::scale |
The scale determines how a clip should be resized to fit its parent.
Definition at line 168 of file Clip.h.
Referenced by init_settings(), JsonValue(), PropertiesJSON(), and SetJsonValue().
openshot::Keyframe openshot::Clip::scale_x |
Curve representing the horizontal scaling in percent (0 to 1)
Definition at line 306 of file Clip.h.
Referenced by init_settings(), JsonValue(), PropertiesJSON(), and SetJsonValue().
openshot::Keyframe openshot::Clip::scale_y |
Curve representing the vertical scaling in percent (0 to 1)
Definition at line 307 of file Clip.h.
Referenced by init_settings(), JsonValue(), PropertiesJSON(), and SetJsonValue().
openshot::Keyframe openshot::Clip::shear_x |
Curve representing X shear angle in degrees (-45.0=left, 45.0=right)
Definition at line 314 of file Clip.h.
Referenced by init_settings(), JsonValue(), PropertiesJSON(), and SetJsonValue().
openshot::Keyframe openshot::Clip::shear_y |
Curve representing Y shear angle in degrees (-45.0=down, 45.0=up)
Definition at line 315 of file Clip.h.
Referenced by init_settings(), JsonValue(), PropertiesJSON(), and SetJsonValue().
openshot::Keyframe openshot::Clip::time |
Curve representing the frames over time to play (used for speed and direction of video)
Definition at line 320 of file Clip.h.
Referenced by End(), openshot::FrameMapper::GetFrame(), init_settings(), JsonValue(), PropertiesJSON(), and SetJsonValue().
openshot::Keyframe openshot::Clip::volume |
Curve representing the volume (0 to 1)
Definition at line 321 of file Clip.h.
Referenced by init_settings(), JsonValue(), PropertiesJSON(), and SetJsonValue().
openshot::Color openshot::Clip::wave_color |
Curve representing the color of the audio wave form.
Definition at line 324 of file Clip.h.
Referenced by init_settings(), JsonValue(), PropertiesJSON(), and SetJsonValue().