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) {
87 double frame_time = (1000.0 / reader->info.fps.ToDouble());
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));
100 reader->GetFrame(position);
104 catch (
const OutOfBoundsFrame & e)
110 if (position < current_display_frame) {
112 position = current_display_frame;
120 usleep(frame_time * 1000);
#define OPEN_MP_NUM_PROCESSORS
void AppendDebugMethod(std::string method_name, std::string arg1_name="", float arg1_value=-1.0, std::string arg2_name="", float arg2_value=-1.0, std::string arg3_name="", float arg3_value=-1.0, std::string arg4_name="", float arg4_value=-1.0, std::string arg5_name="", float arg5_value=-1.0, std::string arg6_name="", float arg6_value=-1.0)
Append debug information.
static ZmqLogger * Instance()
Create or get an instance of this logger singleton (invoke the class with this method) ...
This namespace is the default namespace for all code in the openshot library.