Add support to refresh frame in a different thread - currently disable
This commit is contained in:
+24
-9
@@ -26,6 +26,7 @@
|
||||
#include "ModulesHandle.h"
|
||||
#include "SubWindowHandle.h"
|
||||
#include "ConfigureFormatDialog.h"
|
||||
#include "QtConcurrent/qtconcurrentrun.h"
|
||||
|
||||
namespace plaYUVer
|
||||
{
|
||||
@@ -399,7 +400,7 @@ Void VideoSubWindow::setCurrFrame( PlaYUVerFrame* pcCurrFrame )
|
||||
m_cViewArea->setImage( m_pcCurrFrame );
|
||||
}
|
||||
|
||||
Void VideoSubWindow::refreshFrame()
|
||||
Void VideoSubWindow::refreshFrameOperation()
|
||||
{
|
||||
Bool bSetFrame = false;
|
||||
if( m_pCurrStream )
|
||||
@@ -422,6 +423,21 @@ Void VideoSubWindow::refreshFrame()
|
||||
}
|
||||
}
|
||||
|
||||
Void VideoSubWindow::refreshFrame( Bool bThreaded )
|
||||
{
|
||||
#ifndef QT_NO_CONCURRENT
|
||||
m_cRefreshResult.waitForFinished();
|
||||
if( bThreaded )
|
||||
{
|
||||
m_cRefreshResult = QtConcurrent::run( this, &VideoSubWindow::refreshFrameOperation );
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
refreshFrameOperation();
|
||||
}
|
||||
}
|
||||
|
||||
Bool VideoSubWindow::save( QString filename )
|
||||
{
|
||||
Bool iRet = false;
|
||||
@@ -454,14 +470,13 @@ 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_cRefreshResult.waitForFinished();
|
||||
m_cReadResult.waitForFinished();
|
||||
#endif
|
||||
bEndOfSeq = m_pCurrStream->setNextFrame();
|
||||
@@ -469,9 +484,9 @@ Bool VideoSubWindow::playEvent()
|
||||
{
|
||||
refreshFrame();
|
||||
#ifndef QT_NO_CONCURRENT
|
||||
m_cReadResult = QtConcurrent::run(m_pCurrStream, &PlaYUVerStream::readFrame);
|
||||
m_cReadResult = QtConcurrent::run( m_pCurrStream, &PlaYUVerStream::readFrameFillRGBBuffer );
|
||||
#else
|
||||
m_pCurrStream->readFrame();
|
||||
m_pCurrStream->readFrameFillRGBBuffer();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -527,7 +542,7 @@ Void VideoSubWindow::normalSize()
|
||||
|
||||
Void VideoSubWindow::zoomToFit()
|
||||
{
|
||||
// Scale to a smaller size that the real to a nicer look
|
||||
// Scale to a smaller size that the real to a nicer look
|
||||
scaleView( getScrollSize() );
|
||||
}
|
||||
|
||||
@@ -564,7 +579,7 @@ Void VideoSubWindow::scaleView( const QSize & size, QPoint center )
|
||||
QSize newSize = imgViewSize;
|
||||
newSize.scale( size, Qt::KeepAspectRatio );
|
||||
|
||||
// Calc the zoom factor
|
||||
// Calc the zoom factor
|
||||
Double wfactor = 1;
|
||||
Double hfactor = 1;
|
||||
Double factor;
|
||||
@@ -649,8 +664,8 @@ QSize VideoSubWindow::sizeHint( const QSize & maxSize ) const
|
||||
else if( m_pCurrStream )
|
||||
isize = QSize( m_pCurrStream->getWidth() + 50, m_pCurrStream->getHeight() + 50 );
|
||||
|
||||
// If the VideoSubWindow needs more space that the avaiable, we'll give
|
||||
// to the subwindow a reasonable size preserving the image aspect ratio.
|
||||
// If the VideoSubWindow needs more space that the avaiable, we'll give
|
||||
// to the subwindow a reasonable size preserving the image aspect ratio.
|
||||
if( !( isize.width() < maxSize.width() && isize.height() < maxSize.height() ) )
|
||||
{
|
||||
isize.scale( maxSize, Qt::KeepAspectRatio );
|
||||
|
||||
Reference in New Issue
Block a user