Commit 54c27179 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

"""Refactored""" loop mode

parent 667ced01
......@@ -28,6 +28,8 @@
#include "Timeline.h"
#include "SettingsManager.h"
#define LOOP_MODE
WorkflowRenderer::WorkflowRenderer() :
m_mainWorkflow( MainWorkflow::getInstance() ),
m_stopping( false ),
......@@ -96,6 +98,13 @@ void* WorkflowRenderer::lock( void* datas )
if ( self->m_stopping == false )
{
#ifdef LOOP_MODE
if ( self->m_mainWorkflow->getCurrentFrame() == self->m_mainWorkflow->getLengthFrame() )
{
self->m_mainWorkflow->stop();
self->m_mainWorkflow->startRender();
}
#endif
MainWorkflow::OutputBuffers* ret = self->m_mainWorkflow->getSynchroneOutput();
memcpy( self->m_renderVideoFrame, (*(ret->video))->frame.octets, (*(ret->video))->nboctets );
self->m_renderAudioSample = ret->audio;
......
......@@ -72,7 +72,9 @@ void ClipWorkflow::checkStateChange()
void ClipWorkflow::initialize( bool preloading /*= false*/ )
{
// qDebug() << "Setting state to initializing";
setState( Initializing );
// qDebug() << "State is Initializing.";
if ( m_clip->getParent()->getFileType() == Media::Image )
m_vlcMedia = new LibVLCpp::Media( "fake://" + m_clip->getParent()->getFileInfo()->absoluteFilePath() );
else
......@@ -100,9 +102,11 @@ void ClipWorkflow::pauseAfterPlaybackStarted()
void ClipWorkflow::loadingComplete()
{
// qDebug() << "Loading complete, setting begin.";
adjustBegin();
disconnect( m_mediaPlayer, SIGNAL( playing() ), this, SLOT( loadingComplete() ) );
setState( Ready );
// qDebug() << "State is Ready";
}
void ClipWorkflow::initializedMediaPlayer()
......
......@@ -32,8 +32,6 @@
//FIXME: remove this !
#include "ClipWorkflow.h"
#define LOOP_MODE
LightVideoFrame* MainWorkflow::blackOutput = NULL;
MainWorkflow::MainWorkflow( int trackCount ) :
......@@ -148,10 +146,6 @@ void MainWorkflow::unpause()
void MainWorkflow::nextFrame()
{
++m_currentFrame;
#ifdef LOOP_MODE
if ( m_currentFrame == m_lengthFrame )
m_currentFrame = 0;
#endif
emit frameChanged( m_currentFrame );
emit positionChanged( (float)m_currentFrame / (float)m_lengthFrame );
......
......@@ -210,6 +210,7 @@ void TrackWorkflow::preloadClip( ClipWorkflow* cw )
void TrackWorkflow::stopClipWorkflow( ClipWorkflow* cw )
{
// qDebug() << "Stopping clip workflow";
cw->getStateLock()->lockForRead();
if ( cw->getState() == ClipWorkflow::Stopped )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment