28 #include "../../include/Qt/VideoCacheThread.h"
33 VideoCacheThread::VideoCacheThread()
34 : Thread(
"video-cache"), speed(1), is_playing(false), position(1)
40 VideoCacheThread::~VideoCacheThread()
45 int64_t VideoCacheThread::getCurrentFramePosition()
54 void VideoCacheThread::setCurrentFramePosition(int64_t current_frame_number)
56 current_display_frame = current_frame_number;
60 void VideoCacheThread::Seek(int64_t new_position)
62 position = new_position;
66 void VideoCacheThread::Play() {
72 void VideoCacheThread::Stop() {
78 void VideoCacheThread::run()
80 while (!threadShouldExit() && is_playing) {
87 while (speed == 1 && (position - current_display_frame) < max_frames)
93 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),
"", -1,
"", -1);
100 catch (
const OutOfBoundsFrame &
e)
110 usleep(frame_time * 1000);
#define OPEN_MP_NUM_PROCESSORS
virtual std::shared_ptr< Frame > GetFrame(int64_t number)=0
void AppendDebugMethod(string method_name, string arg1_name, float arg1_value, string arg2_name, float arg2_value, string arg3_name, float arg3_value, string arg4_name, float arg4_value, string arg5_name, float arg5_value, string arg6_name, float arg6_value)
Append debug information.
ReaderInfo info
Information about the current media file.
Fraction fps
Frames per second, as a fraction (i.e. 24/1 = 24 fps)
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.
double ToDouble()
Return this fraction as a double (i.e. 1/2 = 0.5)