Commit fd564d38 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

More independent Clip workflow

It now starts, load, and pause all by itself, without any intervention
of the TrackWorkflow, nor anything else.
Added some debug to detect a crash, the problem is probably inside of
the metadatamanager.
parent ad6ea0b9
......@@ -78,7 +78,9 @@ void MetaDataManager::run()
m_mediaPlayer->play();
}
usleep( 10000 );
qDebug() << "New metadata threaad mainloop iteration";
}
qDebug() << "End of metamanager thread";
return;
}
......
......@@ -67,7 +67,7 @@ void ClipWorkflow::lock( ClipWorkflow* clipWorkflow, void** pp_ret )
//In any case, we give vlc a buffer to render in...
//If we don't, segmentation fault will catch us and eat our brain !! ahem...
// qDebug() << "Locking in ClipWorkflow::lock";
qDebug() << "Locking in ClipWorkflow::lock";
*pp_ret = clipWorkflow->m_buffer;
}
......@@ -124,20 +124,14 @@ void ClipWorkflow::initialize( LibVLCpp::MediaPlayer* mediaPlayer )
m_mediaPlayer = mediaPlayer;
m_mediaPlayer->setMedia( m_clip->getParent()->getVLCMedia() );
if ( m_clip->getBegin() == 0.0f )
{
connect( m_mediaPlayer, SIGNAL( playing() ), this, SLOT( pauseAfterPlaybackStarted() ), Qt::DirectConnection );
}
else
{
//The last parameter is NOT here for decoration ;)
connect( m_mediaPlayer, SIGNAL( playing() ), this, SLOT( setPosition() ), Qt::DirectConnection );
}
connect( m_mediaPlayer, SIGNAL( playing() ), this, SLOT( setPosition() ), Qt::DirectConnection );
qDebug() << "Launching playback";
m_mediaPlayer->play();
}
void ClipWorkflow::setPosition()
{
qDebug() << "Setting position";
disconnect( m_mediaPlayer, SIGNAL( playing() ), this, SLOT( setPosition() ) );
connect( m_mediaPlayer, SIGNAL( positionChanged() ), this, SLOT( pauseAfterPlaybackStarted() ), Qt::DirectConnection );
m_mediaPlayer->setPosition( m_clip->getBegin() );
......@@ -149,6 +143,7 @@ void ClipWorkflow::pauseAfterPlaybackStarted()
disconnect( m_mediaPlayer, SIGNAL( playing() ), this, SLOT( pauseAfterPlaybackStarted() ) );
connect( m_mediaPlayer, SIGNAL( paused() ), this, SLOT( pausedMediaPlayer() ), Qt::DirectConnection );
qDebug() << "pausing media";
m_mediaPlayer->pause();
}
......@@ -171,3 +166,10 @@ bool ClipWorkflow::isEndReached() const
QReadLocker lock( m_endReachedLock );
return m_endReached;
}
void ClipWorkflow::startRender()
{
Q_ASSERT( m_isReady == true);
m_mediaPlayer->play();
}
......@@ -50,6 +50,7 @@ class ClipWorkflow : public QObject
void initialize( LibVLCpp::MediaPlayer* mediaPlayer );
bool isReady() const;
bool isEndReached() const;
void startRender();
private:
static void lock( ClipWorkflow* clipWorkflow, void** pp_ret );
......
......@@ -41,6 +41,8 @@ void TrackWorkflow::startRender()
m_currentClipWorkflow->initialize( m_mediaPlayer );
while ( m_currentClipWorkflow->isReady() == false )
usleep( 150 );
m_currentClipWorkflow->startRender();
qDebug() << "Renderer ready";
}
unsigned char* TrackWorkflow::getOutput()
......
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