OpenShot Library | libopenshot
0.2.4
|
This class represents a timeline. More...
#include <Timeline.h>
Public Member Functions | |
void | AddClip (Clip *clip) |
Add an openshot::Clip to the timeline. More... | |
void | AddEffect (EffectBase *effect) |
Add an effect to the timeline. More... | |
void | ApplyJsonDiff (std::string value) |
Apply a special formatted JSON object, which represents a change to the timeline (add, update, delete) This is primarily designed to keep the timeline (and its child objects... such as clips and effects) in sync with another application... such as OpenShot Video Editor (http://www.openshot.org). More... | |
void | ApplyMapperToClips () |
Apply the timeline's framerate and samplerate to all clips. More... | |
bool | AutoMapClips () |
Determine if clips are automatically mapped to the timeline's framerate and samplerate. More... | |
void | AutoMapClips (bool auto_map) |
Automatically map all clips to the timeline's framerate and samplerate. More... | |
void | ClearAllCache () |
Clear all cache for this timeline instance, and all clips, mappers, and readers under it. More... | |
std::list< Clip * > | Clips () |
Return a list of clips on the timeline. More... | |
void | Close () |
Close the timeline reader (and any resources it was consuming) More... | |
std::list< EffectBase * > | Effects () |
Return the list of effects on the timeline. More... | |
CacheBase * | GetCache () |
Get the cache object used by this reader. More... | |
std::shared_ptr< Frame > | GetFrame (int64_t requested_frame) |
bool | IsOpen () |
Determine if reader is open or closed. More... | |
std::string | Json () |
Get and Set JSON methods. More... | |
Json::Value | JsonValue () |
Generate Json::JsonValue for this object. More... | |
std::string | Name () |
Return the type name of the class. More... | |
void | Open () |
Open the reader (and start consuming resources) More... | |
void | RemoveClip (Clip *clip) |
Remove an openshot::Clip from the timeline. More... | |
void | RemoveEffect (EffectBase *effect) |
Remove an effect from the timeline. More... | |
void | SetCache (CacheBase *new_cache) |
void | SetJson (std::string value) |
Load JSON string into this object. More... | |
void | SetJsonValue (Json::Value root) |
Load Json::JsonValue into this object. More... | |
void | SetMaxSize (int width, int height) |
Timeline (int width, int height, Fraction fps, int sample_rate, int channels, ChannelLayout channel_layout) | |
Default Constructor for the timeline (which sets the canvas width and height and FPS) More... | |
virtual | ~Timeline () |
![]() | |
void | DisplayInfo () |
Display file information in the standard output stream (stdout) More... | |
openshot::ClipBase * | GetClip () |
Parent clip object of this reader (which can be unparented and NULL) More... | |
ReaderBase () | |
Constructor for the base reader, where many things are initialized. More... | |
void | SetClip (openshot::ClipBase *clip) |
Set parent clip object of this reader. More... | |
virtual | ~ReaderBase ()=default |
Public Attributes | |
Color | color |
Background color of timeline canvas. More... | |
Keyframe | viewport_scale |
Curve representing the scale of the viewport (0 to 100) More... | |
Keyframe | viewport_x |
Curve representing the x coordinate for the viewport. More... | |
Keyframe | viewport_y |
Curve representing the y coordinate for the viewport. More... | |
![]() | |
openshot::ReaderInfo | info |
Information about the current media file. More... | |
Additional Inherited Members | |
![]() | |
juce::CriticalSection | getFrameCriticalSection |
Section lock for multiple threads. More... | |
openshot::ClipBase * | parent |
juce::CriticalSection | processingCriticalSection |
This class represents a timeline.
The timeline is one of the most important features of a video editor, and controls all aspects of how video, image, and audio clips are combined together, and how the final video output will be rendered. It has a collection of layers and clips, that arrange, sequence, and generate the final video output.
The following graphic displays a timeline, and how clips can be arranged, scaled, and layered together. It also demonstrates how the viewport can be scaled smaller than the canvas, which can be used to zoom and pan around the canvas (i.e. pan & scan).
The following graphic displays how the playhead determines which frames to combine and layer.
Lets take a look at what the code looks like:
Definition at line 148 of file Timeline.h.
Timeline::Timeline | ( | int | width, |
int | height, | ||
Fraction | fps, | ||
int | sample_rate, | ||
int | channels, | ||
ChannelLayout | channel_layout | ||
) |
Default Constructor for the timeline (which sets the canvas width and height and FPS)
width | The width of the timeline (and thus, the generated openshot::Frame objects) |
height | The height of the timeline (and thus, the generated openshot::Frame objects) |
fps | The frames rate of the timeline |
sample_rate | The sample rate of the timeline's audio |
channels | The number of audio channels of the timeline |
channel_layout | The channel layout (i.e. mono, stereo, 3 point surround, etc...) |
Definition at line 36 of file Timeline.cpp.
|
virtual |
Definition at line 76 of file Timeline.cpp.
void Timeline::AddClip | ( | Clip * | clip | ) |
Add an openshot::Clip to the timeline.
clip | Add an openshot::Clip to the timeline. A clip can contain any type of Reader. |
Definition at line 101 of file Timeline.cpp.
Referenced by ApplyJsonDiff(), SetJsonValue(), and openshot::QtPlayer::SetSource().
void Timeline::AddEffect | ( | EffectBase * | effect | ) |
Add an effect to the timeline.
effect | Add an effect to the timeline. An effect can modify the audio or video of an openshot::Frame. |
Definition at line 116 of file Timeline.cpp.
Referenced by ApplyJsonDiff(), and SetJsonValue().
void Timeline::ApplyJsonDiff | ( | std::string | value | ) |
Apply a special formatted JSON object, which represents a change to the timeline (add, update, delete) This is primarily designed to keep the timeline (and its child objects... such as clips and effects) in sync with another application... such as OpenShot Video Editor (http://www.openshot.org).
value | A JSON string containing a key, value, and type of change. |
Definition at line 1104 of file Timeline.cpp.
void Timeline::ApplyMapperToClips | ( | ) |
Apply the timeline's framerate and samplerate to all clips.
Definition at line 167 of file Timeline.cpp.
|
inline |
Determine if clips are automatically mapped to the timeline's framerate and samplerate.
Definition at line 226 of file Timeline.h.
|
inline |
Automatically map all clips to the timeline's framerate and samplerate.
Definition at line 229 of file Timeline.h.
void Timeline::ClearAllCache | ( | ) |
Clear all cache for this timeline instance, and all clips, mappers, and readers under it.
Definition at line 1491 of file Timeline.cpp.
Referenced by ApplyMapperToClips().
|
inline |
Return a list of clips on the timeline.
Definition at line 235 of file Timeline.h.
|
virtual |
Close the timeline reader (and any resources it was consuming)
Implements openshot::ReaderBase.
Definition at line 694 of file Timeline.cpp.
Referenced by SetJsonValue(), and ~Timeline().
|
inline |
Return the list of effects on the timeline.
Definition at line 241 of file Timeline.h.
|
inlinevirtual |
Get the cache object used by this reader.
Implements openshot::ReaderBase.
Definition at line 244 of file Timeline.h.
|
virtual |
Get an openshot::Frame object for a specific frame number of this timeline.
requested_frame | The frame number that is requested. |
Implements openshot::ReaderBase.
Definition at line 725 of file Timeline.cpp.
|
inlinevirtual |
Determine if reader is open or closed.
Implements openshot::ReaderBase.
Definition at line 265 of file Timeline.h.
|
virtual |
Get and Set JSON methods.
Generate JSON string of this object
Implements openshot::ReaderBase.
Definition at line 971 of file Timeline.cpp.
|
virtual |
Generate Json::JsonValue for this object.
Implements openshot::ReaderBase.
Definition at line 978 of file Timeline.cpp.
Referenced by Json().
|
inlinevirtual |
Return the type name of the class.
Implements openshot::ReaderBase.
Definition at line 268 of file Timeline.h.
|
virtual |
Open the reader (and start consuming resources)
Implements openshot::ReaderBase.
Definition at line 713 of file Timeline.cpp.
Referenced by SetJsonValue(), and openshot::QtPlayer::SetSource().
void Timeline::RemoveClip | ( | Clip * | clip | ) |
Remove an openshot::Clip from the timeline.
clip | Remove an openshot::Clip from the timeline. |
Definition at line 132 of file Timeline.cpp.
Referenced by ApplyJsonDiff().
void Timeline::RemoveEffect | ( | EffectBase * | effect | ) |
Remove an effect from the timeline.
effect | Remove an effect from the timeline. |
Definition at line 126 of file Timeline.cpp.
Referenced by ApplyJsonDiff().
void Timeline::SetCache | ( | CacheBase * | new_cache | ) |
Set the cache object used by this reader. You must now manage the lifecycle of this cache object though (Timeline will not delete it for you).
Definition at line 958 of file Timeline.cpp.
|
virtual |
Load JSON string into this object.
Implements openshot::ReaderBase.
Definition at line 1011 of file Timeline.cpp.
|
virtual |
Load Json::JsonValue into this object.
Implements openshot::ReaderBase.
Definition at line 1043 of file Timeline.cpp.
Referenced by SetJson().
void Timeline::SetMaxSize | ( | int | width, |
int | height | ||
) |
Set Max Image Size (used for performance optimization). Convenience function for setting Settings::Instance()->MAX_WIDTH and Settings::Instance()->MAX_HEIGHT.
Definition at line 1517 of file Timeline.cpp.
Referenced by Timeline().
Color openshot::Timeline::color |
Background color of timeline canvas.
Definition at line 262 of file Timeline.h.
Referenced by ApplyJsonDiff(), GetFrame(), JsonValue(), and Timeline().
Keyframe openshot::Timeline::viewport_scale |
Curve representing the scale of the viewport (0 to 100)
Definition at line 257 of file Timeline.h.
Referenced by ApplyJsonDiff(), JsonValue(), and Timeline().
Keyframe openshot::Timeline::viewport_x |
Curve representing the x coordinate for the viewport.
Definition at line 258 of file Timeline.h.
Referenced by ApplyJsonDiff(), JsonValue(), and Timeline().
Keyframe openshot::Timeline::viewport_y |
Curve representing the y coordinate for the viewport.
Definition at line 259 of file Timeline.h.
Referenced by ApplyJsonDiff(), JsonValue(), and Timeline().