Added pausing, rewind, fast forward, and playing (and different speeds). Still a bit buggy and experimental with fast forward and rewinding (due to seek bugs in readers).

This commit is contained in:
Jonathan Thomas
2014-03-23 01:12:29 -05:00
parent 2ba83486c9
commit a77de842e4
13 changed files with 346 additions and 54 deletions

View File

@@ -31,16 +31,19 @@
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)
int VideoPlaybackThread::getCurrentFramePosition()
{
if (frame)
@@ -49,11 +52,15 @@ namespace openshot
return 0;
}
// Start the thread
void VideoPlaybackThread::run()
{
while (!threadShouldExit()) {
render.wait();
// Make other threads wait on the render event
render.wait();
// Render the frame to the screen
renderer->paint(frame);
// Signal to other threads that the rendered event has completed
rendered.signal();
}
}