You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
Removing Play/Stop implementation from VideoCacheThread. Adding back in a ClearAllCache in Seek(), to handle updates via the UI correctly.
This commit is contained in:
@@ -28,7 +28,6 @@ namespace openshot
|
||||
, speed(0)
|
||||
, last_speed(1)
|
||||
, last_dir(1) // assume forward (+1) on first launch
|
||||
, is_playing(false)
|
||||
, userSeeked(false)
|
||||
, requested_display_frame(1)
|
||||
, current_display_frame(1)
|
||||
@@ -46,18 +45,6 @@ namespace openshot
|
||||
{
|
||||
}
|
||||
|
||||
// Play the video
|
||||
void VideoCacheThread::Play()
|
||||
{
|
||||
is_playing = true;
|
||||
}
|
||||
|
||||
// Stop the video
|
||||
void VideoCacheThread::Stop()
|
||||
{
|
||||
is_playing = false;
|
||||
}
|
||||
|
||||
// Is cache ready for playback (pre-roll)
|
||||
bool VideoCacheThread::isReady()
|
||||
{
|
||||
@@ -108,6 +95,13 @@ namespace openshot
|
||||
{
|
||||
if (start_preroll) {
|
||||
userSeeked = true;
|
||||
|
||||
if (!reader->GetCache()->Contains(new_position))
|
||||
{
|
||||
// If user initiated seek, and current frame not found (
|
||||
Timeline* timeline = static_cast<Timeline*>(reader);
|
||||
timeline->ClearAllCache();
|
||||
}
|
||||
}
|
||||
requested_display_frame = new_position;
|
||||
}
|
||||
@@ -218,7 +212,7 @@ namespace openshot
|
||||
CacheBase* cache = reader ? reader->GetCache() : nullptr;
|
||||
|
||||
// If caching disabled or no reader, sleep briefly
|
||||
if (!settings->ENABLE_PLAYBACK_CACHING || !cache || !is_playing) {
|
||||
if (!settings->ENABLE_PLAYBACK_CACHING || !cache) {
|
||||
std::this_thread::sleep_for(double_micro_sec(50000));
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user