OpenShot Library | libopenshot
0.3.3
|
Go to the documentation of this file.
13 #ifndef OPENSHOT_TIMELINE_H
14 #define OPENSHOT_TIMELINE_H
20 #include <QtGui/QImage>
21 #include <QtGui/QPainter>
22 #include <QtCore/QRegularExpression>
71 return (lhs->
Position() + lhs->Duration()) <= (rhs->
Position() + rhs->Duration());
77 return (lhs->
Position() + lhs->Duration()) <= (rhs->
Position() + rhs->Duration());
152 std::list<openshot::Clip*> clips;
153 std::list<openshot::Clip*> closing_clips;
154 std::map<openshot::Clip*, openshot::Clip*> open_clips;
155 std::set<openshot::Clip*> allocated_clips;
156 std::list<openshot::EffectBase*> effects;
157 std::set<openshot::EffectBase*> allocated_effects;
159 std::set<openshot::FrameMapper*> allocated_frame_mappers;
162 int max_concurrent_frames;
166 std::map<std::string, std::shared_ptr<openshot::TrackedObjectBase>> tracked_objects;
169 void add_layer(std::shared_ptr<openshot::Frame> new_frame,
openshot::Clip* source_clip, int64_t clip_frame_number,
bool is_top_clip,
float max_volume);
175 void apply_json_to_clips(Json::Value change);
176 void apply_json_to_effects(Json::Value change);
178 void apply_json_to_timeline(Json::Value change);
181 void calculate_max_duration();
192 std::vector<openshot::Clip*> find_intersecting_clips(int64_t requested_frame,
int number_of_frames,
bool include);
198 bool isEqual(
double a,
double b);
231 Timeline(
const std::string& projectPath,
bool convert_absolute_paths);
236 void AddTrackedObject(std::shared_ptr<openshot::TrackedObjectBase> trackedObject);
238 std::shared_ptr<openshot::TrackedObjectBase>
GetTrackedObject(std::string
id)
const;
255 std::shared_ptr<openshot::Frame>
apply_effects(std::shared_ptr<openshot::Frame> frame, int64_t timeline_frame_number,
int layer,
TimelineInfoStruct* options);
274 std::list<openshot::Clip*>
Clips()
override {
return clips; };
296 void Close()
override;
299 std::list<openshot::EffectBase*>
Effects() {
return effects; };
302 std::list<openshot::EffectBase*>
ClipEffects()
const;
315 std::shared_ptr<openshot::Frame>
GetFrame(int64_t requested_frame)
override;
326 bool IsOpen()
override {
return is_open; };
329 std::string
Name()
override {
return "Timeline"; };
332 std::string
Json()
const override;
333 void SetJson(
const std::string value)
override;
348 void Open()
override;
365 #endif // OPENSHOT_TIMELINE_H
void RemoveClip(openshot::Clip *clip)
Remove an openshot::Clip from the timeline.
bool operator()(const openshot::Clip *lhs, const openshot::Clip *rhs)
Header file for Timeline class.
std::shared_ptr< openshot::Frame > GetFrame(int64_t requested_frame) override
This abstract class is the base class, used by all effects in libopenshot.
openshot::Keyframe viewport_x
Curve representing the x coordinate for the viewport.
void SetMaxSize(int width, int height)
Header file for Clip class.
Header file for Fraction class.
bool operator()(const openshot::EffectBase *lhs, const openshot::EffectBase *rhs)
std::list< openshot::Clip * > Clips() override
Return a list of clips on the timeline.
This namespace is the default namespace for all code in the openshot library.
void ApplyJsonDiff(std::string value)
Apply a special formatted JSON object, which represents a change to the timeline (add,...
This class represents a clip (used to arrange readers on the timeline)
This class represents a fraction.
openshot::ReaderInfo info
Information about the current media file.
int64_t GetMinFrame()
Look up the start frame number of the first element on the timeline (first frame is 1)
void ClearAllCache(bool deep=false)
std::list< std::string > GetTrackedObjectsIds() const
Return the ID's of the tracked objects as a list of strings.
Like CompareClipEndFrames, but for effects.
Header file for EffectBase class.
void Position(float value)
Set the Id of this clip object
Header file for the Keyframe class.
All cache managers in libopenshot are based on this CacheBase class.
std::shared_ptr< openshot::Frame > apply_effects(std::shared_ptr< openshot::Frame > frame, int64_t timeline_frame_number, int layer, TimelineInfoStruct *options)
Apply global/timeline effects to the source frame (if any)
openshot::ClipBase * clip
Pointer to the parent clip instance (if any)
This class represents a color (used on the timeline and clips)
openshot::CacheBase * GetCache() override
Get the cache object used by this reader.
void AutoMapClips(bool auto_map)
Automatically map all clips to the timeline's framerate and samplerate.
openshot::Clip * GetClip(const std::string &id)
Look up a single clip by ID.
bool operator()(openshot::Clip *lhs, openshot::Clip *rhs)
A Keyframe is a collection of Point instances, which is used to vary a number or property over time.
void Open() override
Open the reader (and start consuming resources)
void SetJson(const std::string value) override
Load JSON string into this object.
std::string GetTrackedObjectValues(std::string id, int64_t frame_number) const
Return the trackedObject's properties as a JSON string.
double GetMaxTime()
Look up the end time of the latest timeline element.
This class represents a timeline.
std::list< openshot::EffectBase * > ClipEffects() const
Return the list of effects on all clips.
This struct contains info about a media file, such as height, width, frames per second,...
bool operator()(openshot::EffectBase *lhs, openshot::EffectBase *rhs)
This struct contains info about the current Timeline clip instance.
void Clear()
Clear all clips, effects, and frame mappers from timeline (and free memory)
std::string Name() override
Return the type name of the class.
void RemoveEffect(openshot::EffectBase *effect)
Remove an effect from the timeline.
Header file for Frame class.
void Close() override
Close the timeline reader (and any resources it was consuming)
void AddClip(openshot::Clip *clip)
Add an openshot::Clip to the timeline.
int Order() const
Get the order that this effect should be executed.
void AddTrackedObject(std::shared_ptr< openshot::TrackedObjectBase > trackedObject)
Add to the tracked_objects map a pointer to a tracked object (TrackedObjectBBox)
Header file for ReaderBase class.
void SortTimeline()
Sort all clips and effects on timeline - which affects the internal order of clips and effects arrays...
openshot::Color color
Background color of timeline canvas.
openshot::EffectBase * GetEffect(const std::string &id)
Look up a timeline effect by ID.
This class represents a timeline (used for building generic timeline implementations)
Timeline(int width, int height, openshot::Fraction fps, int sample_rate, int channels, openshot::ChannelLayout channel_layout)
Constructor for the timeline (which configures the default frame properties)
This abstract class is the base class, used by all readers in libopenshot.
std::list< openshot::EffectBase * > Effects()
Return the list of effects on the timeline.
std::string Json() const override
Generate JSON string of this object.
int64_t GetMaxFrame()
Look up the end frame number of the latest element on the timeline.
bool IsOpen() override
Determine if reader is open or closed.
bool AutoMapClips()
Determine if clips are automatically mapped to the timeline's framerate and samplerate.
Header file for Color class.
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
void ApplyMapperToClips()
Apply the timeline's framerate and samplerate to all clips.
openshot::Keyframe viewport_y
Curve representing the y coordinate for the viewport.
ChannelLayout
This enumeration determines the audio channel layout (such as stereo, mono, 5 point surround,...
Header file for the TrackedObjectBBox class.
openshot::EffectBase * GetClipEffect(const std::string &id)
Look up a clip effect by ID.
Header file for the TrackedObjectBase class.
void Layer(int value)
Set layer of clip on timeline (lower number is covered by higher numbers)
openshot::Keyframe viewport_scale
Curve representing the scale of the viewport (0 to 100)
void AddEffect(openshot::EffectBase *effect)
Add an effect to the timeline.
Json::Value JsonValue() const override
Generate Json::Value for this object.
std::shared_ptr< openshot::TrackedObjectBase > GetTrackedObject(std::string id) const
Return tracked object pointer by it's id.
double GetMinTime()
Look up the position/start time of the first timeline element.
void SetCache(openshot::CacheBase *new_cache)