31 #include "../../include/Qt/VideoCacheThread.h"
37 VideoCacheThread::VideoCacheThread()
38 : Thread(
"video-cache"), speed(1), is_playing(false), position(1)
44 VideoCacheThread::~VideoCacheThread()
49 int64_t VideoCacheThread::getCurrentFramePosition()
58 void VideoCacheThread::setCurrentFramePosition(int64_t current_frame_number)
60 current_display_frame = current_frame_number;
64 void VideoCacheThread::Seek(int64_t new_position)
66 position = new_position;
70 void VideoCacheThread::Play() {
76 void VideoCacheThread::Stop() {
82 void VideoCacheThread::run()
84 while (!threadShouldExit() && is_playing) {
91 while (speed == 1 && (position - current_display_frame) < max_frames)
97 ZmqLogger::Instance()->
AppendDebugMethod(
"VideoCacheThread::run (cache frame)",
"position", position,
"current_display_frame", current_display_frame,
"max_frames", max_frames,
"needed_frames", (position - current_display_frame));
104 catch (
const OutOfBoundsFrame & e)
110 if (position < current_display_frame) {
112 position = current_display_frame;
120 usleep(frame_time * 1000);