You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
- Protect AddClip(), RemoveClip(), update_open_clips(), sort_clips(), sort_effects() methods with mutex, making them thread safe
- Refactor sorting of clips & effects, and only sort these arrays when the arrays change (instead of each call to GetFrame) - Cache max timeline duration, and make Timeline::GetMaxTime() thread safe - New multi-threaded unit tests, which are designed to verify no seg faults on multi-threaded calls to Timeline::GetFrame(), Timeline::AddClip(), and Timeline::RemoveClip() - New public Timeline::SortTimeline() method which is called by child Clips automatically, when certain properties are changed
This commit is contained in:
@@ -11,9 +11,55 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#include "ClipBase.h"
|
||||
#include "Timeline.h"
|
||||
|
||||
using namespace openshot;
|
||||
|
||||
// Set position on timeline (in seconds)
|
||||
void ClipBase::Position(float value) {
|
||||
|
||||
position = value;
|
||||
|
||||
if (ParentTimeline()) {
|
||||
// Resort timeline items (internal clips/effects arrays)
|
||||
Timeline *parentTimeline = (Timeline *) ParentTimeline();
|
||||
parentTimeline->SortTimeline();
|
||||
}
|
||||
}
|
||||
|
||||
// Set layer of clip on timeline (lower number is covered by higher numbers)
|
||||
void ClipBase::Layer(int value) {
|
||||
layer = value;
|
||||
|
||||
if (ParentTimeline()) {
|
||||
// Resort timeline items (internal clips/effects arrays)
|
||||
Timeline *parentTimeline = (Timeline *) ParentTimeline();
|
||||
parentTimeline->SortTimeline();
|
||||
}
|
||||
}
|
||||
|
||||
// Set start position (in seconds) of clip (trim start of video)
|
||||
void ClipBase::Start(float value) {
|
||||
start = value;
|
||||
|
||||
if (ParentTimeline()) {
|
||||
// Resort timeline items (internal clips/effects arrays)
|
||||
Timeline *parentTimeline = (Timeline *) ParentTimeline();
|
||||
parentTimeline->SortTimeline();
|
||||
}
|
||||
}
|
||||
|
||||
// Set end position (in seconds) of clip (trim end of video)
|
||||
void ClipBase::End(float value) {
|
||||
end = value;
|
||||
|
||||
if (ParentTimeline()) {
|
||||
// Resort timeline items (internal clips/effects arrays)
|
||||
Timeline *parentTimeline = (Timeline *) ParentTimeline();
|
||||
parentTimeline->SortTimeline();
|
||||
}
|
||||
}
|
||||
|
||||
// Generate Json::Value for this object
|
||||
Json::Value ClipBase::JsonValue() const {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user