Commit 383a36e0 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Cleaned VideoClipWorkflow.cpp

parent 128b1eae
...@@ -46,7 +46,6 @@ void WorkflowFileRendererDialog::setProgressBarValue( int val ) ...@@ -46,7 +46,6 @@ void WorkflowFileRendererDialog::setProgressBarValue( int val )
void WorkflowFileRendererDialog::updatePreview( const uchar* buff ) void WorkflowFileRendererDialog::updatePreview( const uchar* buff )
{ {
qDebug() << "Using QPixmap from workflow file renderer";
m_ui.previewLabel->setPixmap( QPixmap::fromImage( QImage( buff, VIDEOWIDTH, VIDEOHEIGHT, QImage::Format_RGB888 ).rgbSwapped() ) ); m_ui.previewLabel->setPixmap( QPixmap::fromImage( QImage( buff, VIDEOWIDTH, VIDEOHEIGHT, QImage::Format_RGB888 ).rgbSwapped() ) );
} }
......
...@@ -150,7 +150,6 @@ void MetaDataWorker::renderSnapshot() ...@@ -150,7 +150,6 @@ void MetaDataWorker::renderSnapshot()
void MetaDataWorker::setSnapshot() void MetaDataWorker::setSnapshot()
{ {
qDebug() << "Using QPixmap from setSnapshot";
QPixmap* pixmap = new QPixmap( m_tmpSnapshotFilename ); QPixmap* pixmap = new QPixmap( m_tmpSnapshotFilename );
if ( pixmap->isNull() ) if ( pixmap->isNull() )
delete pixmap; delete pixmap;
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
#include "vlmc.h"
#include "VideoClipWorkflow.h" #include "VideoClipWorkflow.h"
#include "MainWorkflow.h" #include "MainWorkflow.h"
#include "StackedBuffer.hpp" #include "StackedBuffer.hpp"
...@@ -60,10 +59,7 @@ VideoClipWorkflow::initVlcOutput() ...@@ -60,10 +59,7 @@ VideoClipWorkflow::initVlcOutput()
m_vlcMedia->setVideoUnlockCallback( reinterpret_cast<void*>( getUnlockCallback() ) ); m_vlcMedia->setVideoUnlockCallback( reinterpret_cast<void*>( getUnlockCallback() ) );
m_vlcMedia->addOption( ":sout-transcode-vcodec=RV24" ); m_vlcMedia->addOption( ":sout-transcode-vcodec=RV24" );
m_vlcMedia->addOption( ":sout-transcode-acodec=s16l" ); m_vlcMedia->addOption( ":sout-transcode-acodec=s16l" );
// m_vlcMedia->addOption( ":no-sout-keep" );
m_vlcMedia->addOption( ":sout-smem-time-sync" ); m_vlcMedia->addOption( ":sout-smem-time-sync" );
// m_vlcMedia->addOption( ":no-sout-smem-time-sync" );
sprintf( buffer, ":sout-transcode-width=%i", sprintf( buffer, ":sout-transcode-width=%i",
MainWorkflow::getInstance()->getWidth() ); MainWorkflow::getInstance()->getWidth() );
...@@ -90,51 +86,33 @@ VideoClipWorkflow::getUnlockCallback() ...@@ -90,51 +86,33 @@ VideoClipWorkflow::getUnlockCallback()
void* void*
VideoClipWorkflow::getOutput( ClipWorkflow::GetMode mode ) VideoClipWorkflow::getOutput( ClipWorkflow::GetMode mode )
{ {
// qDebug() << "entering video get output";
QMutexLocker lock( m_renderLock ); QMutexLocker lock( m_renderLock );
// qDebug() << "got video render lock";
QMutexLocker lock2( m_computedBuffersMutex ); QMutexLocker lock2( m_computedBuffersMutex );
// qDebug() << "got video computer buffers lock";
if ( preGetOutput() == false ) if ( preGetOutput() == false )
{
// qDebug() << "video preGetOutput() returned false";
return NULL; return NULL;
}
// qWarning() << "Video::getOutput(). Available:" << m_availableBuffers.count() <<
// "Computed:" << m_computedBuffers.count();
if ( isEndReached() == true ) if ( isEndReached() == true )
{
// qDebug() << "video end reached was true";
return NULL; return NULL;
}
::StackedBuffer<LightVideoFrame*>* buff; ::StackedBuffer<LightVideoFrame*>* buff;
if ( mode == ClipWorkflow::Pop ) if ( mode == ClipWorkflow::Pop )
{
buff = new StackedBuffer( m_computedBuffers.dequeue(), this, true ); buff = new StackedBuffer( m_computedBuffers.dequeue(), this, true );
}
else if ( mode == ClipWorkflow::Get ) else if ( mode == ClipWorkflow::Get )
buff = new StackedBuffer( m_computedBuffers.head(), NULL, false ); buff = new StackedBuffer( m_computedBuffers.head(), NULL, false );
// qDebug() << "calling video postGetOutput();";
postGetOutput(); postGetOutput();
// qDebug() << "returning videobuff";
return buff; return buff;
} }
void void
VideoClipWorkflow::lock( VideoClipWorkflow *cw, void **pp_ret, int size ) VideoClipWorkflow::lock( VideoClipWorkflow *cw, void **pp_ret, int size )
{ {
// qDebug() << "Entering VideoClipWorkflow::lock";
Q_UNUSED( size ); Q_UNUSED( size );
QMutexLocker lock( cw->m_availableBuffersMutex ); QMutexLocker lock( cw->m_availableBuffersMutex );
LightVideoFrame* lvf = NULL;
cw->m_renderLock->lock(); cw->m_renderLock->lock();
cw->m_computedBuffersMutex->lock(); cw->m_computedBuffersMutex->lock();
// qDebug() << "Got all videoclipworkflow::lock mutexs acquired.";
LightVideoFrame* lvf = NULL;
if ( cw->m_availableBuffers.isEmpty() == true ) if ( cw->m_availableBuffers.isEmpty() == true )
{ {
// qCritical() << "Late buffer generation. Spawning new video buffer";
lvf = new LightVideoFrame( MainWorkflow::getInstance()->getWidth() lvf = new LightVideoFrame( MainWorkflow::getInstance()->getWidth()
* MainWorkflow::getInstance()->getHeight() * MainWorkflow::getInstance()->getHeight()
* Pixel::NbComposantes ); * Pixel::NbComposantes );
...@@ -142,9 +120,6 @@ VideoClipWorkflow::lock( VideoClipWorkflow *cw, void **pp_ret, int size ) ...@@ -142,9 +120,6 @@ VideoClipWorkflow::lock( VideoClipWorkflow *cw, void **pp_ret, int size )
else else
lvf = cw->m_availableBuffers.dequeue(); lvf = cw->m_availableBuffers.dequeue();
cw->m_computedBuffers.enqueue( lvf ); cw->m_computedBuffers.enqueue( lvf );
// qWarning() << ">>>VideoGeneration. Available:" <<
// cw->m_availableBuffers.count() << "Computed:" << cw->m_computedBuffers.count() << "position" << cw->m_mediaPlayer->getPosition();
// qWarning() << "feeding video buffer";
*pp_ret = (*(lvf))->frame.octets; *pp_ret = (*(lvf))->frame.octets;
} }
...@@ -161,15 +136,6 @@ VideoClipWorkflow::unlock( VideoClipWorkflow *cw, void *buffer, int width, ...@@ -161,15 +136,6 @@ VideoClipWorkflow::unlock( VideoClipWorkflow *cw, void *buffer, int width,
cw->computePtsDiff( pts ); cw->computePtsDiff( pts );
LightVideoFrame *lvf = cw->m_computedBuffers.last(); LightVideoFrame *lvf = cw->m_computedBuffers.last();
(*(lvf))->ptsDiff = cw->m_currentPts - cw->m_previousPts; (*(lvf))->ptsDiff = cw->m_currentPts - cw->m_previousPts;
// qWarning() << "Computed ptsDiff:" << (*(lvf))->ptsDiff;
// if ( (*(lvf))->ptsDiff > 100000 )
// {
// qWarning() << "Probably invalid pts diff. pts:" << pts << "m_currentPts:" <<
// cw->m_currentPts << "m_previousPts:" << cw->m_previousPts
// << "state:" << cw->m_state;
// }
// If this is the first buffer that has been rendered,
// there may be a waiting TrackWorkflow.
cw->commonUnlock(); cw->commonUnlock();
cw->m_renderLock->unlock(); cw->m_renderLock->unlock();
cw->m_computedBuffersMutex->unlock(); cw->m_computedBuffersMutex->unlock();
...@@ -201,9 +167,7 @@ VideoClipWorkflow::flushComputedBuffers() ...@@ -201,9 +167,7 @@ VideoClipWorkflow::flushComputedBuffers()
QMutexLocker lock2( m_availableBuffersMutex ); QMutexLocker lock2( m_availableBuffersMutex );
while ( m_computedBuffers.isEmpty() == false ) while ( m_computedBuffers.isEmpty() == false )
{
m_availableBuffers.enqueue( m_computedBuffers.dequeue() ); m_availableBuffers.enqueue( m_computedBuffers.dequeue() );
}
} }
VideoClipWorkflow::StackedBuffer::StackedBuffer( LightVideoFrame *lvf, VideoClipWorkflow::StackedBuffer::StackedBuffer( LightVideoFrame *lvf,
......
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