Commit 0fb8f30c authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Setting time seems to works, but it's still a bit long...

parent 1ada948d
......@@ -74,7 +74,7 @@ void WorkflowRenderer::initializeRenderer()
strcat( inputSlave, audioParameters );
m_media = new LibVLCpp::Media( "imem://" + QString( videoString ) );
m_media->addOption( inputSlave );
// m_media->addOption( inputSlave );
sprintf( callbacks, "imem-get=%lld", (qint64)WorkflowRenderer::lock );
m_media->addOption( callbacks );
......
......@@ -131,11 +131,19 @@ void ClipWorkflow::stop()
qDebug() << "ClipWorkflow has already been stopped";
}
void ClipWorkflow::setTime( qint64 time )
void
ClipWorkflow::setTime( qint64 time )
{
// qDebug() << "setting clipworkflow time:" << time;
qDebug() << "setting clipworkflow time:" << time;
m_mediaPlayer->setTime( time );
flushComputedBuffers();
QWriteLocker lock( m_stateLock );
if ( m_state == ClipWorkflow::Paused )
{
qDebug() << "Unpausing media player after set time";
m_mediaPlayer->pause();
m_state = ClipWorkflow::PauseRequired;
}
}
bool ClipWorkflow::isRendering() const
......@@ -180,7 +188,7 @@ void ClipWorkflow::preGetOutput()
// qWarning() << "Waiting for buffer to be fed";
m_renderLock->unlock();
m_computedBuffersMutex->unlock();
// qDebug() << "Unlocked render lock, entering cond wait";
qDebug() << "Unlocked render lock, entering cond wait";
m_feedingCondWait->waitLocked();
m_computedBuffersMutex->lock();
m_renderLock->lock();
......@@ -215,7 +223,7 @@ void ClipWorkflow::commonUnlock()
setState( ClipWorkflow::PauseRequired );
m_mediaPlayer->pause();
}
if ( getNbComputedBuffers() == 1 )
// if ( getNbComputedBuffers() == 1 )
{
// qDebug() << "Waking feeding cont wait... acquiring lock. Type:" << debugType;
QMutexLocker lock( m_feedingCondWait->getMutex() );
......@@ -265,7 +273,7 @@ void ClipWorkflow::mediaPlayerPaused()
void ClipWorkflow::mediaPlayerUnpaused()
{
// qWarning() << "Media player unpaused. Go back to rendering. Type:" << debugType;
qWarning() << "Media player unpaused. Go back to rendering. Type:" << debugType;
setState( ClipWorkflow::Rendering );
m_pauseDuration = mdate() - m_beginPausePts;
// qDebug() << "pause duration:" << m_pauseDuration;
......
......@@ -448,6 +448,7 @@ void TrackWorkflow::clear()
void TrackWorkflow::adjustClipTime( qint64 currentFrame, qint64 start, ClipWorkflow* cw )
{
qDebug() << "Adjusting clip time.";
qint64 nbMs = ( currentFrame - start ) / cw->getClip()->getParent()->getFps() * 1000;
qint64 beginInMs = cw->getClip()->getBegin() / cw->getClip()->getParent()->getFps() * 1000;
qint64 startFrame = beginInMs + nbMs;
......
......@@ -93,8 +93,8 @@ VideoClipWorkflow::getOutput( ClipWorkflow::GetMode mode )
QMutexLocker lock2( m_computedBuffersMutex );
preGetOutput();
/*qWarning() << "Video::getOutput(). Available:" << m_availableBuffers.count() <<
"Computed:" << m_computedBuffers.count();*/
qWarning() << "Video::getOutput(). Available:" << m_availableBuffers.count() <<
"Computed:" << m_computedBuffers.count();
if ( isEndReached() == true )
return NULL;
::StackedBuffer<LightVideoFrame*>* buff;
......@@ -127,8 +127,8 @@ VideoClipWorkflow::lock( VideoClipWorkflow *cw, void **pp_ret, int size )
else
lvf = cw->m_availableBuffers.dequeue();
cw->m_computedBuffers.enqueue( lvf );
// qWarning() << ">>>VideoGeneration. Available:" <<
// cw->m_availableBuffers.count() << "Computed:" << cw->m_computedBuffers.count();
qWarning() << ">>>VideoGeneration. Available:" <<
cw->m_availableBuffers.count() << "Computed:" << cw->m_computedBuffers.count();
// qWarning() << "feeding video buffer";
*pp_ret = (*(lvf))->frame.octets;
}
......@@ -185,6 +185,7 @@ VideoClipWorkflow::flushComputedBuffers()
QMutexLocker lock( m_computedBuffersMutex );
QMutexLocker lock2( m_availableBuffersMutex );
qWarning() << "Flushing computed buffers. state:" << m_state;
while ( m_computedBuffers.isEmpty() == false )
{
m_availableBuffers.enqueue( m_computedBuffers.dequeue() );
......@@ -199,7 +200,8 @@ VideoClipWorkflow::StackedBuffer::StackedBuffer( LightVideoFrame *lvf,
{
}
void VideoClipWorkflow::StackedBuffer::release()
void
VideoClipWorkflow::StackedBuffer::release()
{
if ( m_mustRelease == true )
m_poolHandler->releaseBuffer( m_buff );
......
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