Loading...
Searching...
No Matches
VideoPlaybackThread.cpp
Go to the documentation of this file.
// Copyright (c) 2008-2019 OpenShot Studios, LLC
//
// SPDX-License-Identifier: LGPL-3.0-or-later
#include "VideoPlaybackThread.h"
#include "ZmqLogger.h"
#include "Frame.h"
#include "RendererBase.h"
#include "ZmqLogger.h"
namespace openshot
{
// Constructor
VideoPlaybackThread::VideoPlaybackThread(RendererBase *rb)
: Thread("video-playback"), renderer(rb)
, render(), reset(false)
{
}
// Destructor
VideoPlaybackThread::~VideoPlaybackThread()
{
}
// Get the currently playing frame number (if any)
int64_t VideoPlaybackThread::getCurrentFramePosition()
{
if (frame)
return frame->number;
else
return 0;
}
// Start the thread
void VideoPlaybackThread::run()
{
while (!threadShouldExit()) {
// Make other threads wait on the render event
bool need_render = render.wait(500);
if (need_render && frame)
{
// Debug
ZmqLogger::Instance()->AppendDebugMethod(
"VideoPlaybackThread::run (before render)",
"frame->number", frame->number,
"need_render", need_render);
// Render the frame to the screen
renderer->paint(frame);
}
// Signal to other threads that the rendered event has completed
rendered.signal();
}
return;
}
}
Frame.h
Header file for Frame class.
RendererBase.h
Header file for RendererBase class.
VideoPlaybackThread.h
Source file for VideoPlaybackThread class.
ZmqLogger.h
Header file for ZeroMQ-based Logger class.
openshot::RendererBase
This is the base class of all Renderers in libopenshot.
Definition RendererBase.h:31
openshot::Thread
openshot
This namespace is the default namespace for all code in the openshot library.
Definition Compressor.h:29