OpenShot Library | libopenshot 1.1.1
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
openshot::VideoCacheThread Class Reference

Handles prefetching and caching of video/audio frames for smooth playback. More...

#include <Qt/VideoCacheThread.h>

Inheritance diagram for openshot::VideoCacheThread:

Public Member Functions

void AcknowledgeAudioCacheMiss ()
 
int64_t CancellationAcknowledgementUs () const
 
void EnableRequestDiagnostics (bool enabled)
 
int64_t FirstCurrentFrameUs () const
 
int getSpeed () const
 
bool isReady ()
 Shared startup gate; bounded fallback resumes established video decoding.
 
void NotifyAudioCacheMiss ()
 
void NotifyPlaybackPosition (int64_t new_position)
 Update playback position without triggering seek behavior or cache invalidation.
 
int64_t ObsoleteCompletionUs () const
 
void Play ()
 Play method is unimplemented.
 
void Reader (ReaderBase *new_reader)
 Attach a ReaderBase (e.g. Timeline, FFmpegReader) and begin caching.
 
void Seek (int64_t new_position)
 Backward-compatible alias for playback position updates (no seek side effects).
 
void Seek (int64_t new_position, bool start_preroll)
 Seek to a specific frame and optionally start a preroll (cache reset).
 
void setSpeed (int new_speed)
 Set playback speed/direction. Positive = forward, negative = rewind, zero = pause.
 
bool StartThread ()
 Start the cache thread at high priority. Returns true if it’s actually running.
 
void Stop ()
 Stop method is unimplemented.
 
bool StopThread (int timeoutMs=0)
 Stop the cache thread (wait up to timeoutMs ms). Returns true if it stopped.
 
bool UsesCachedAudio () const
 Callback miss holds the shared gate until the player resynchronizes audio.
 
 VideoCacheThread ()
 Constructor: initializes member variables and assumes forward direction on first launch.
 
 ~VideoCacheThread () override
 

Protected Member Functions

void acknowledgeRequest (int64_t started_us)
 
int64_t clampToTimelineRange (int64_t frame, int64_t timeline_end) const
 Clamp frame index to [1, timeline_end] when timeline_end is valid.
 
bool clearCacheIfPaused (int64_t playhead, bool paused, CacheBase *cache)
 When paused and playhead is outside current cache, clear all frames.
 
int computeDirection () const
 
int64_t computePrerollFrames (const Settings *settings) const
 Compute preroll frame count from settings.
 
void computeWindowBounds (int64_t playhead, int dir, int64_t ahead_count, int64_t timeline_end, int64_t &window_begin, int64_t &window_end) const
 Compute the “window” of frames to cache around playhead.
 
int64_t getBytes (int width, int height, int sample_rate, int channels, float fps)
 Estimate memory usage for a single frame (video + audio).
 
void handleUserSeek (int64_t playhead, int dir)
 If userSeeked is true, reset last_cached_index just behind the playhead.
 
void handleUserSeekWithPreroll (int64_t playhead, int dir, int64_t timeline_end, int64_t preroll_frames)
 Reset last_cached_index to start caching with a directional preroll offset.
 
bool prefetchWindow (CacheBase *cache, int64_t window_begin, int64_t window_end, int dir, ReaderBase *reader, int64_t max_frames_to_fetch=-1, uint64_t generation=UINT64_MAX)
 Prefetch all missing frames in [window_begin ... window_end] or [window_end ... window_begin].
 
void resetReadiness ()
 
int64_t resolveTimelineEnd () const
 Resolve timeline end frame from reader/timeline metadata.
 
void run () override
 Thread entry point: loops until threadShouldExit() is true.
 
void updateReadiness (CacheBase *cache, int64_t playhead, int dir)
 Worker-only cache probing; never runs in the audio callback.
 

Static Protected Member Functions

static int64_t monotonicUs ()
 

Protected Attributes

std::atomic< int64_t > acknowledgement_us {0}
 
std::atomic< bool > audio_cache_miss {false}
 
std::atomic< bool > cache_audio_only {false}
 
std::atomic< int64_t > cached_frame_count
 Estimated count of frames currently stored in cache.
 
std::atomic< bool > clear_cache_on_next_fill
 True if next cache loop should clear existing cache ranges.
 
int64_t contiguous_ahead = 0
 
int64_t current_display_frame
 Currently displayed frame (unused here, reserved).
 
std::atomic< bool > diagnostics_enabled {false}
 
std::atomic< int64_t > first_current_frame_us {0}
 
bool force_directional_cache
 (Reserved for future use).
 
std::shared_ptr< Frame > last_cached_frame
 Last frame pointer added to cache.
 
std::atomic< int64_t > last_cached_index
 Index of the most recently cached frame.
 
std::atomic< int > last_dir
 Last direction sign (+1 forward, –1 backward).
 
std::atomic< int > last_speed
 Last non-zero speed (for tracking).
 
std::mutex lifecycle_mutex
 Start/stop/reader drain; never acquired by worker.
 
std::atomic< int64_t > min_frames_ahead
 Minimum number of frames considered “ready” (pre-roll).
 
int64_t observed_frame_bytes = 0
 
std::atomic< int64_t > obsolete_completion_us {0}
 
std::atomic< bool > preroll_on_next_fill
 True if next cache rebuild should include preroll offset.
 
AdaptivePreroll preroll_policy
 
std::atomic< uint64_t > processed_generation {UINT64_MAX}
 Last request whose scheduling baseline was consumed.
 
ReaderBase * reader
 The source reader (e.g., Timeline, FFmpegReader).
 
int64_t readiness_bytes_per_frame = 0
 
int64_t readiness_capacity = 0
 
int readiness_direction = 1
 
uint64_t readiness_epoch = 0
 
uint64_t readiness_generation = UINT64_MAX
 Request covered by the readiness snapshot.
 
int64_t readiness_minimum_step = 0
 
int64_t readiness_physical_capacity = 0
 
int64_t readiness_playhead = 1
 
int64_t readiness_timeline_end = 0
 
std::atomic< uint64_t > request_generation {0}
 Invalidates obsolete fills, including seeks retaining cache.
 
std::atomic< int64_t > request_time_us {0}
 
std::atomic< int64_t > requested_display_frame
 Frame index the user requested.
 
std::atomic< bool > scrub_active
 True while user is dragging/scrubbing the playhead.
 
std::mutex seek_state_mutex
 Protects coherent seek state updates/consumption.
 
uint64_t seen_timeline_cache_epoch
 Last observed Timeline cache invalidation epoch.
 
std::atomic< int > speed
 Current playback speed (0=paused, >0 forward, <0 backward).
 
bool timeline_cache_epoch_initialized
 True once an initial epoch snapshot has been taken.
 
int64_t timeline_max_frame
 Highest valid frame index in the timeline.
 
std::atomic< bool > userSeeked
 True if Seek(..., true) was called (forces a cache reset).
 

Detailed Description

Handles prefetching and caching of video/audio frames for smooth playback.

This thread continuously maintains a “window” of cached frames in the current playback direction (forward or backward). When paused, it continues to fill that same window; when seeking, it resets to cache around the new position.

Definition at line 38 of file VideoCacheThread.h.

Constructor & Destructor Documentation

◆ VideoCacheThread()

openshot::VideoCacheThread::VideoCacheThread ( )

Constructor: initializes member variables and assumes forward direction on first launch.

Definition at line 26 of file VideoCacheThread.cpp.

◆ ~VideoCacheThread()

openshot::VideoCacheThread::~VideoCacheThread ( )
override

Definition at line 49 of file VideoCacheThread.cpp.

Member Function Documentation

◆ AcknowledgeAudioCacheMiss()

void openshot::VideoCacheThread::AcknowledgeAudioCacheMiss ( )
inline

Definition at line 50 of file VideoCacheThread.h.

◆ acknowledgeRequest()

void openshot::VideoCacheThread::acknowledgeRequest ( int64_t  started_us)
protected

Definition at line 155 of file VideoCacheThread.cpp.

Referenced by Seek(), and Stop().

◆ CancellationAcknowledgementUs()

int64_t openshot::VideoCacheThread::CancellationAcknowledgementUs ( ) const
inline

Definition at line 92 of file VideoCacheThread.h.

◆ clampToTimelineRange()

int64_t openshot::VideoCacheThread::clampToTimelineRange ( int64_t  frame,
int64_t  timeline_end 
) const
protected

Clamp frame index to [1, timeline_end] when timeline_end is valid.

Definition at line 460 of file VideoCacheThread.cpp.

Referenced by clearCacheIfPaused(), isReady(), prefetchWindow(), run(), and Seek().

◆ clearCacheIfPaused()

bool openshot::VideoCacheThread::clearCacheIfPaused ( int64_t  playhead,
bool  paused,
CacheBase *  cache 
)
protected

When paused and playhead is outside current cache, clear all frames.

Parameters
playheadCurrent requested_display_frame
pausedTrue if speed == 0
cachePointer to CacheBase
Returns
True if ClearAllCache() was invoked.

Definition at line 468 of file VideoCacheThread.cpp.

◆ computeDirection()

int openshot::VideoCacheThread::computeDirection ( ) const
protected
Returns
Effective playback direction (+1 forward, –1 backward), preserving last_dir if speed == 0.

Definition at line 396 of file VideoCacheThread.cpp.

Referenced by isReady(), Reader(), run(), Seek(), and setSpeed().

◆ computePrerollFrames()

int64_t openshot::VideoCacheThread::computePrerollFrames ( const Settings *  settings) const
protected

Compute preroll frame count from settings.

Definition at line 429 of file VideoCacheThread.cpp.

Referenced by run().

◆ computeWindowBounds()

void openshot::VideoCacheThread::computeWindowBounds ( int64_t  playhead,
int  dir,
int64_t  ahead_count,
int64_t  timeline_end,
int64_t &  window_begin,
int64_t &  window_end 
) const
protected

Compute the “window” of frames to cache around playhead.

Parameters
playheadCurrent requested_display_frame
dirEffective direction (±1)
ahead_countNumber of frames ahead/back to cache
timeline_endLast valid frame index
[out]window_beginLower bound (inclusive) of caching window
[out]window_endUpper bound (inclusive) of caching window

If dir > 0: window = [playhead ... playhead + ahead_count] If dir < 0: window = [playhead – ahead_count ... playhead] Always clamps to [1 ... timeline_end].

Definition at line 488 of file VideoCacheThread.cpp.

Referenced by run().

◆ EnableRequestDiagnostics()

void openshot::VideoCacheThread::EnableRequestDiagnostics ( bool  enabled)
inline

Optional request timings in microseconds (zero until observed). No per-frame logging; clocks are sampled only when enabled.

Definition at line 91 of file VideoCacheThread.h.

◆ FirstCurrentFrameUs()

int64_t openshot::VideoCacheThread::FirstCurrentFrameUs ( ) const
inline

Definition at line 94 of file VideoCacheThread.h.

◆ getBytes()

int64_t openshot::VideoCacheThread::getBytes ( int  width,
int  height,
int  sample_rate,
int  channels,
float  fps 
)
protected

Estimate memory usage for a single frame (video + audio).

Parameters
widthFrame width (pixels)
heightFrame height (pixels)
sample_rateAudio sample rate (e.g. 48000)
channelsNumber of audio channels
fpsFrames per second
Returns
Approximate size in bytes for one frame

Definition at line 136 of file VideoCacheThread.cpp.

Referenced by run().

◆ getSpeed()

int openshot::VideoCacheThread::getSpeed ( ) const
inline
Returns
The current speed (1=normal, 2=fast, –1=rewind, etc.)

Definition at line 68 of file VideoCacheThread.h.

◆ handleUserSeek()

void openshot::VideoCacheThread::handleUserSeek ( int64_t  playhead,
int  dir 
)
protected

If userSeeked is true, reset last_cached_index just behind the playhead.

Parameters
playheadCurrent requested_display_frame
dirEffective direction (±1)

Definition at line 406 of file VideoCacheThread.cpp.

Referenced by run().

◆ handleUserSeekWithPreroll()

void openshot::VideoCacheThread::handleUserSeekWithPreroll ( int64_t  playhead,
int  dir,
int64_t  timeline_end,
int64_t  preroll_frames 
)
protected

Reset last_cached_index to start caching with a directional preroll offset.

Parameters
playheadCurrent requested_display_frame
dirEffective direction (±1)
timeline_endLast valid frame index
preroll_framesNumber of frames to offset the cache start

Definition at line 412 of file VideoCacheThread.cpp.

Referenced by run().

◆ isReady()

bool openshot::VideoCacheThread::isReady ( )

Shared startup gate; bounded fallback resumes established video decoding.

Definition at line 56 of file VideoCacheThread.cpp.

Referenced by openshot::AudioReaderSource::getNextAudioBlock().

◆ monotonicUs()

int64_t openshot::VideoCacheThread::monotonicUs ( )
staticprotected

◆ NotifyAudioCacheMiss()

void openshot::VideoCacheThread::NotifyAudioCacheMiss ( )
inline

Definition at line 49 of file VideoCacheThread.h.

Referenced by openshot::AudioReaderSource::getNextAudioBlock().

◆ NotifyPlaybackPosition()

void openshot::VideoCacheThread::NotifyPlaybackPosition ( int64_t  new_position)

Update playback position without triggering seek behavior or cache invalidation.

Definition at line 376 of file VideoCacheThread.cpp.

Referenced by Seek().

◆ ObsoleteCompletionUs()

int64_t openshot::VideoCacheThread::ObsoleteCompletionUs ( ) const
inline

Definition at line 93 of file VideoCacheThread.h.

◆ Play()

void openshot::VideoCacheThread::Play ( )
inline

Play method is unimplemented.

Definition at line 53 of file VideoCacheThread.h.

◆ prefetchWindow()

bool openshot::VideoCacheThread::prefetchWindow ( CacheBase *  cache,
int64_t  window_begin,
int64_t  window_end,
int  dir,
ReaderBase *  reader,
int64_t  max_frames_to_fetch = -1,
uint64_t  generation = UINT64_MAX 
)
protected

Prefetch all missing frames in [window_begin ... window_end] or [window_end ... window_begin].

Parameters
cachePointer to CacheBase
window_beginInclusive lower bound of the window
window_endInclusive upper bound of the window
dirEffective direction (±1)
readerPointer to ReaderBase to call GetFrame()
Returns
True if the window was already full (no new frames added)

Internally, this method iterates from last_cached_index + dir toward window_end (or window_begin) and calls GetFrame()/Add() for each missing frame until hitting the window boundary or an OOB. It also breaks early if threadShouldExit() or userSeeked becomes true.

Definition at line 510 of file VideoCacheThread.cpp.

Referenced by run().

◆ Reader()

void openshot::VideoCacheThread::Reader ( ReaderBase *  new_reader)

Attach a ReaderBase (e.g. Timeline, FFmpegReader) and begin caching.

Parameters
new_reader

Definition at line 195 of file VideoCacheThread.cpp.

Referenced by openshot::QtPlayer::Reader().

◆ resetReadiness()

void openshot::VideoCacheThread::resetReadiness ( )
protected

Definition at line 94 of file VideoCacheThread.cpp.

Referenced by isReady(), Reader(), run(), Seek(), and setSpeed().

◆ resolveTimelineEnd()

int64_t openshot::VideoCacheThread::resolveTimelineEnd ( ) const
protected

Resolve timeline end frame from reader/timeline metadata.

Definition at line 445 of file VideoCacheThread.cpp.

Referenced by clearCacheIfPaused(), prefetchWindow(), run(), and Seek().

◆ run()

void openshot::VideoCacheThread::run ( )
overrideprotected

Thread entry point: loops until threadShouldExit() is true.

Definition at line 604 of file VideoCacheThread.cpp.

◆ Seek() [1/2]

void openshot::VideoCacheThread::Seek ( int64_t  new_position)

Backward-compatible alias for playback position updates (no seek side effects).

Definition at line 371 of file VideoCacheThread.cpp.

Referenced by openshot::QtPlayer::Seek().

◆ Seek() [2/2]

void openshot::VideoCacheThread::Seek ( int64_t  new_position,
bool  start_preroll 
)

Seek to a specific frame and optionally start a preroll (cache reset).

Parameters
new_positionFrame index to jump to.
start_prerollIf true, forces cache to rebuild around new_position.

Definition at line 219 of file VideoCacheThread.cpp.

◆ setSpeed()

void openshot::VideoCacheThread::setSpeed ( int  new_speed)

Set playback speed/direction. Positive = forward, negative = rewind, zero = pause.

Parameters
new_speed

If new_speed != 0, last_speed and last_dir are updated. If new_speed == 0, last_dir is left unchanged so that pausing does not flip direction.

Definition at line 112 of file VideoCacheThread.cpp.

Referenced by openshot::QtPlayer::Speed().

◆ StartThread()

bool openshot::VideoCacheThread::StartThread ( )

Start the cache thread at high priority. Returns true if it’s actually running.

Definition at line 167 of file VideoCacheThread.cpp.

◆ Stop()

void openshot::VideoCacheThread::Stop ( )

Stop method is unimplemented.

Definition at line 177 of file VideoCacheThread.cpp.

Referenced by Reader(), openshot::QtPlayer::Stop(), and StopThread().

◆ StopThread()

bool openshot::VideoCacheThread::StopThread ( int  timeoutMs = 0)

Stop the cache thread (wait up to timeoutMs ms). Returns true if it stopped.

Definition at line 186 of file VideoCacheThread.cpp.

Referenced by ~VideoCacheThread().

◆ updateReadiness()

void openshot::VideoCacheThread::updateReadiness ( CacheBase *  cache,
int64_t  playhead,
int  dir 
)
protected

Worker-only cache probing; never runs in the audio callback.

Definition at line 100 of file VideoCacheThread.cpp.

Referenced by prefetchWindow(), run(), and Seek().

◆ UsesCachedAudio()

bool openshot::VideoCacheThread::UsesCachedAudio ( ) const
inline

Callback miss holds the shared gate until the player resynchronizes audio.

Definition at line 48 of file VideoCacheThread.h.

Referenced by openshot::AudioReaderSource::getNextAudioBlock().

Member Data Documentation

◆ acknowledgement_us

std::atomic<int64_t> openshot::VideoCacheThread::acknowledgement_us {0}
protected

Definition at line 248 of file VideoCacheThread.h.

Referenced by acknowledgeRequest(), and CancellationAcknowledgementUs().

◆ audio_cache_miss

std::atomic<bool> openshot::VideoCacheThread::audio_cache_miss {false}
protected

◆ cache_audio_only

std::atomic<bool> openshot::VideoCacheThread::cache_audio_only {false}
protected

Definition at line 209 of file VideoCacheThread.h.

Referenced by Reader(), run(), and UsesCachedAudio().

◆ cached_frame_count

std::atomic<int64_t> openshot::VideoCacheThread::cached_frame_count
protected

Estimated count of frames currently stored in cache.

Definition at line 233 of file VideoCacheThread.h.

Referenced by clearCacheIfPaused(), NotifyPlaybackPosition(), prefetchWindow(), run(), and Seek().

◆ clear_cache_on_next_fill

std::atomic<bool> openshot::VideoCacheThread::clear_cache_on_next_fill
protected

True if next cache loop should clear existing cache ranges.

Definition at line 228 of file VideoCacheThread.h.

Referenced by run(), and Seek().

◆ contiguous_ahead

int64_t openshot::VideoCacheThread::contiguous_ahead = 0
protected

Definition at line 205 of file VideoCacheThread.h.

Referenced by isReady(), resetReadiness(), run(), and updateReadiness().

◆ current_display_frame

int64_t openshot::VideoCacheThread::current_display_frame
protected

Currently displayed frame (unused here, reserved).

Definition at line 232 of file VideoCacheThread.h.

◆ diagnostics_enabled

std::atomic<bool> openshot::VideoCacheThread::diagnostics_enabled {false}
protected

Definition at line 246 of file VideoCacheThread.h.

Referenced by EnableRequestDiagnostics(), prefetchWindow(), Seek(), and Stop().

◆ first_current_frame_us

std::atomic<int64_t> openshot::VideoCacheThread::first_current_frame_us {0}
protected

Definition at line 250 of file VideoCacheThread.h.

Referenced by acknowledgeRequest(), FirstCurrentFrameUs(), and prefetchWindow().

◆ force_directional_cache

bool openshot::VideoCacheThread::force_directional_cache
protected

(Reserved for future use).

Definition at line 239 of file VideoCacheThread.h.

◆ last_cached_frame

std::shared_ptr<Frame> openshot::VideoCacheThread::last_cached_frame
protected

Last frame pointer added to cache.

Definition at line 221 of file VideoCacheThread.h.

◆ last_cached_index

std::atomic<int64_t> openshot::VideoCacheThread::last_cached_index
protected

Index of the most recently cached frame.

Definition at line 243 of file VideoCacheThread.h.

Referenced by handleUserSeek(), handleUserSeekWithPreroll(), prefetchWindow(), Reader(), run(), Seek(), and setSpeed().

◆ last_dir

std::atomic<int> openshot::VideoCacheThread::last_dir
protected

Last direction sign (+1 forward, –1 backward).

Definition at line 225 of file VideoCacheThread.h.

Referenced by computeDirection(), and setSpeed().

◆ last_speed

std::atomic<int> openshot::VideoCacheThread::last_speed
protected

Last non-zero speed (for tracking).

Definition at line 224 of file VideoCacheThread.h.

Referenced by setSpeed().

◆ lifecycle_mutex

std::mutex openshot::VideoCacheThread::lifecycle_mutex
mutableprotected

Start/stop/reader drain; never acquired by worker.

Definition at line 253 of file VideoCacheThread.h.

Referenced by Reader(), StartThread(), and StopThread().

◆ min_frames_ahead

std::atomic<int64_t> openshot::VideoCacheThread::min_frames_ahead
protected

Minimum number of frames considered “ready” (pre-roll).

Definition at line 235 of file VideoCacheThread.h.

Referenced by isReady(), prefetchWindow(), run(), and updateReadiness().

◆ observed_frame_bytes

int64_t openshot::VideoCacheThread::observed_frame_bytes = 0
protected

Definition at line 210 of file VideoCacheThread.h.

Referenced by prefetchWindow(), and run().

◆ obsolete_completion_us

std::atomic<int64_t> openshot::VideoCacheThread::obsolete_completion_us {0}
protected

Definition at line 249 of file VideoCacheThread.h.

Referenced by acknowledgeRequest(), ObsoleteCompletionUs(), and prefetchWindow().

◆ preroll_on_next_fill

std::atomic<bool> openshot::VideoCacheThread::preroll_on_next_fill
protected

True if next cache rebuild should include preroll offset.

Definition at line 227 of file VideoCacheThread.h.

Referenced by run(), and Seek().

◆ preroll_policy

AdaptivePreroll openshot::VideoCacheThread::preroll_policy
protected

Definition at line 204 of file VideoCacheThread.h.

Referenced by isReady(), prefetchWindow(), resetReadiness(), and run().

◆ processed_generation

std::atomic<uint64_t> openshot::VideoCacheThread::processed_generation {UINT64_MAX}
protected

Last request whose scheduling baseline was consumed.

Definition at line 244 of file VideoCacheThread.h.

Referenced by isReady(), and run().

◆ reader

ReaderBase* openshot::VideoCacheThread::reader
protected

◆ readiness_bytes_per_frame

int64_t openshot::VideoCacheThread::readiness_bytes_per_frame = 0
protected

Definition at line 214 of file VideoCacheThread.h.

Referenced by run().

◆ readiness_capacity

int64_t openshot::VideoCacheThread::readiness_capacity = 0
protected

Definition at line 211 of file VideoCacheThread.h.

Referenced by prefetchWindow(), and run().

◆ readiness_direction

int openshot::VideoCacheThread::readiness_direction = 1
protected

Definition at line 207 of file VideoCacheThread.h.

Referenced by isReady(), and updateReadiness().

◆ readiness_epoch

uint64_t openshot::VideoCacheThread::readiness_epoch = 0
protected

Definition at line 215 of file VideoCacheThread.h.

Referenced by isReady(), run(), and Seek().

◆ readiness_generation

uint64_t openshot::VideoCacheThread::readiness_generation = UINT64_MAX
protected

Request covered by the readiness snapshot.

Definition at line 216 of file VideoCacheThread.h.

Referenced by isReady(), and updateReadiness().

◆ readiness_minimum_step

int64_t openshot::VideoCacheThread::readiness_minimum_step = 0
protected

Definition at line 217 of file VideoCacheThread.h.

Referenced by isReady(), run(), and updateReadiness().

◆ readiness_physical_capacity

int64_t openshot::VideoCacheThread::readiness_physical_capacity = 0
protected

Definition at line 212 of file VideoCacheThread.h.

Referenced by isReady(), run(), and Seek().

◆ readiness_playhead

int64_t openshot::VideoCacheThread::readiness_playhead = 1
protected

Definition at line 206 of file VideoCacheThread.h.

Referenced by isReady(), and updateReadiness().

◆ readiness_timeline_end

int64_t openshot::VideoCacheThread::readiness_timeline_end = 0
protected

Definition at line 213 of file VideoCacheThread.h.

Referenced by isReady(), and run().

◆ request_generation

std::atomic<uint64_t> openshot::VideoCacheThread::request_generation {0}
protected

Invalidates obsolete fills, including seeks retaining cache.

Definition at line 245 of file VideoCacheThread.h.

Referenced by acknowledgeRequest(), isReady(), prefetchWindow(), Reader(), run(), setSpeed(), and updateReadiness().

◆ request_time_us

std::atomic<int64_t> openshot::VideoCacheThread::request_time_us {0}
protected

Definition at line 247 of file VideoCacheThread.h.

Referenced by acknowledgeRequest(), and prefetchWindow().

◆ requested_display_frame

std::atomic<int64_t> openshot::VideoCacheThread::requested_display_frame
protected

Frame index the user requested.

Definition at line 231 of file VideoCacheThread.h.

Referenced by isReady(), NotifyPlaybackPosition(), prefetchWindow(), Reader(), run(), Seek(), and setSpeed().

◆ scrub_active

std::atomic<bool> openshot::VideoCacheThread::scrub_active
protected

True while user is dragging/scrubbing the playhead.

Definition at line 229 of file VideoCacheThread.h.

Referenced by NotifyPlaybackPosition(), run(), Seek(), and setSpeed().

◆ seek_state_mutex

std::mutex openshot::VideoCacheThread::seek_state_mutex
mutableprotected

Protects coherent seek state updates/consumption.

Definition at line 254 of file VideoCacheThread.h.

Referenced by isReady(), NotifyPlaybackPosition(), prefetchWindow(), Reader(), run(), Seek(), setSpeed(), and Stop().

◆ seen_timeline_cache_epoch

uint64_t openshot::VideoCacheThread::seen_timeline_cache_epoch
protected

Last observed Timeline cache invalidation epoch.

Definition at line 240 of file VideoCacheThread.h.

Referenced by Reader(), and run().

◆ speed

std::atomic<int> openshot::VideoCacheThread::speed
protected

Current playback speed (0=paused, >0 forward, <0 backward).

Definition at line 223 of file VideoCacheThread.h.

Referenced by computeDirection(), getSpeed(), prefetchWindow(), run(), Seek(), and setSpeed().

◆ timeline_cache_epoch_initialized

bool openshot::VideoCacheThread::timeline_cache_epoch_initialized
protected

True once an initial epoch snapshot has been taken.

Definition at line 241 of file VideoCacheThread.h.

Referenced by Reader(), and run().

◆ timeline_max_frame

int64_t openshot::VideoCacheThread::timeline_max_frame
protected

Highest valid frame index in the timeline.

Definition at line 236 of file VideoCacheThread.h.

◆ userSeeked

std::atomic<bool> openshot::VideoCacheThread::userSeeked
protected

True if Seek(..., true) was called (forces a cache reset).

Definition at line 226 of file VideoCacheThread.h.

Referenced by prefetchWindow(), Reader(), run(), Seek(), and setSpeed().


The documentation for this class was generated from the following files: