Add support for QtConcurrent
This commit is contained in:
1 parent
fc8e6be9bc
commit
5262b4f14f
4 files changed
+20
-5
No files matched your search
+3
-3
@@ -30,10 +30,10 @@ IF( USE_QT4 )
|
||||
ENDIF()
|
||||
|
||||
IF( NOT USE_QT4 )
|
||||
FIND_PACKAGE( Qt5 REQUIRED COMPONENTS Core Gui Widgets PrintSupport )
|
||||
FIND_PACKAGE( Qt5 REQUIRED COMPONENTS Core Gui Widgets PrintSupport Concurrent )
|
||||
FIND_PACKAGE( Qt5DBus )
|
||||
LIST(APPEND QT_LINKER_LIBS Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport )
|
||||
LIST(APPEND QT_MODULES Core Gui Widgets )
|
||||
LIST(APPEND QT_LINKER_LIBS Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport Qt5::Concurrent )
|
||||
LIST(APPEND QT_MODULES Core Gui Widgets PrintSupport Concurrent )
|
||||
IF( ${Qt5DBus_FOUND} )
|
||||
SET( USE_QTDBUS ${Qt5DBus_FOUND} )
|
||||
LIST(APPEND QT_LINKER_LIBS Qt5::DBus )
|
||||
|
||||
@@ -454,16 +454,25 @@ Bool VideoSubWindow::play()
|
||||
return m_bIsPlaying;
|
||||
}
|
||||
|
||||
#include "QtConcurrent/qtconcurrentrun.h"
|
||||
|
||||
Bool VideoSubWindow::playEvent()
|
||||
{
|
||||
Bool bEndOfSeq = false;
|
||||
if( m_pCurrStream && m_bIsPlaying )
|
||||
{
|
||||
#ifndef QT_NO_CONCURRENT
|
||||
m_cReadResult.waitForFinished();
|
||||
#endif
|
||||
bEndOfSeq = m_pCurrStream->setNextFrame();
|
||||
if( !bEndOfSeq )
|
||||
{
|
||||
refreshFrame();
|
||||
#ifndef QT_NO_CONCURRENT
|
||||
m_cReadResult = QtConcurrent::run(m_pCurrStream, &PlaYUVerStream::readFrame);
|
||||
#else
|
||||
m_pCurrStream->readFrame();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return bEndOfSeq;
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#elif( QT_VERSION_PLAYUVER == 4 )
|
||||
#include <QtGui>
|
||||
#endif
|
||||
#include "QFuture"
|
||||
#include "lib/PlaYUVerStream.h"
|
||||
#include "SubWindowHandle.h"
|
||||
#include "ViewArea.h"
|
||||
@@ -83,6 +84,12 @@ private:
|
||||
Bool m_bIsPlaying;
|
||||
Bool m_bIsModule;
|
||||
|
||||
/**
|
||||
* Threads variables
|
||||
* QtConcurrent
|
||||
*/
|
||||
QFuture<Void> m_cReadResult;
|
||||
|
||||
static Bool guessFormat( QString filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rFrameRate );
|
||||
|
||||
/**
|
||||
|
||||
@@ -481,7 +481,7 @@ Void PlaYUVerStream::readFrame()
|
||||
if( !m_bInit || !m_bIsInput || m_bLoadAll )
|
||||
return;
|
||||
|
||||
if( m_uiCurrFrameFileIdx >= Int64( m_uiTotalFrameNum ) )
|
||||
if( m_uiCurrFrameFileIdx >= m_uiTotalFrameNum )
|
||||
{
|
||||
m_pcNextFrame = NULL;
|
||||
return;
|
||||
@@ -641,7 +641,6 @@ PlaYUVerFrame* PlaYUVerStream::getNextFrame()
|
||||
return m_pcNextFrame;
|
||||
}
|
||||
|
||||
|
||||
Bool PlaYUVerStream::seekInput( UInt64 new_frame_num )
|
||||
{
|
||||
if( !m_bInit || new_frame_num < 0 || new_frame_num >= m_uiTotalFrameNum || ( Int64 )new_frame_num == m_iCurrFrameNum )
|
||||
|
||||
Reference in new issue
Block a user