Refactor Playuver into Calyp

commit 1fd9cf34f06ba2a156919b5c9b73c31d4c6c6257
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Mon Mar 12 18:06:39 2018 +0000

    Remove code style

commit 165588840126a7ab35b32e5be47f00c613829ef3
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Mon Mar 12 18:06:25 2018 +0000

    Update Mainpage.dox

commit 5b1a2773c48697346c7b0b64519b81a5aecc0150
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Mon Feb 19 03:46:24 2018 +0000

    Re-add CalypPixel.cpp but keep include with frame class

commit 2343be49ff4906c3171d2df7791e3cf34494eb21
Author: Joao Santos <joaompssantos@gmail.com>
Date:   Sun Feb 18 21:06:57 2018 +0000

    Fixed several things:
    - Removed unused define
    - Added: #include <cassert> to MainWindow.cpp
    - Fixed compilation issue when USE_FFMPEG is OFF on CalypStream.cpp

commit 8d1d64bac828a6bcdfa6af977a5d17d0792acb69
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Thu Feb 15 02:14:13 2018 +0000

    Fix several things:
    - Fix examples
    - Improve code formatting script
    - Change generated cmake config file

commit ea1d0265f1e9300f76fd3f0c8ca03d110ec13eaa
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Thu Feb 15 01:28:50 2018 +0000

    Fix dump of the module list: remove the use of char arrays

commit b4d19dda169715113a74713ca62d05f5a18fd0b5
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Wed Feb 14 23:20:56 2018 +0000

    Increase linesize of tools help

commit 8b3eab54e376863276b0d7e032f9e1de8aaf90e5
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Wed Feb 14 23:20:35 2018 +0000

    Fix CalypPixel

commit 1c6ba03c379518acf5fc6f1fdf328ca740a8851d
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Wed Feb 14 22:24:10 2018 +0000

    Enums CalypPixelFormats and CalypColorSpace are now class independent

commit 5dcc35e1716a70095e1720b01823c2e3a3980576
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Wed Feb 14 02:04:31 2018 +0000

    Change functions input and return types

commit 5514e3e24f9b428d5db71156561b2d8b6f61dd23
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Wed Feb 14 02:04:31 2018 +0000

    Change functions input and return types

commit fae7a9a91e1899e7a2833c634221f970d44b8fb6
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Wed Feb 14 01:39:14 2018 +0000

    Replace custom types with std ones

commit 0c3b62b8ea01903e213d9e8dd73a5b49c7c8c36e
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Wed Feb 14 00:37:18 2018 +0000

    Refactoring entries with Playuver name with Calyp
    Replace number of frames and add CLP tag into public definitions

commit e8cd8d7a219446513a5dda2c183dd892ec25a6f1
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Sat Feb 10 14:42:15 2018 +0000

    Fix min opencv version and missing ffmpeg module

commit 1233598af8ac15c88fa84569942cc6f865325452
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Sat Feb 10 03:10:12 2018 +0000

    Change version to 0.999.0 untill finishing refactoring

commit 1fe0cac8f0e70f352bf6c63b8cb2e06ab43fb633
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Sat Feb 10 00:21:47 2018 +0000

    Change project library

commit 44e9d330bc63b8b8a1687a14ff0be05af0bf2eb5
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Fri Feb 9 01:42:58 2018 +0000

    Change doxygen files and upload new ico

commit 0d6f3408a2682cfac1533a57a2f1b4e2cc1f0f29
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Thu Feb 8 21:25:31 2018 +0000

    Fix logos - different when it is icon or the full logo

commit 9f3561acd4b51c7de5f21d63d7e8f2b43c253148
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Thu Feb 8 01:25:39 2018 +0000

    fix install files

commit 832154e3e40f17a863898a77c929a6c6850ffded
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Thu Feb 8 01:21:23 2018 +0000

    rename calip to calyp

commit 341b32bfcc0133fdbceea9b8390d59190e495b79
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Thu Feb 8 00:58:29 2018 +0000

    Refactor lib, modules and tools

commit b4b988cf80052fdcfe0e1f9099d5435ef7945584
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Thu Feb 8 00:02:33 2018 +0000

    Refactor classes and filename in app

commit 6b4ab728202531ad00db1e6299ee69a01f3594ba
Author: Joao Carreira <jfmcarreira@gmail.com>
Date:   Wed Feb 7 17:49:53 2018 +0000

    Refactor about dialog and background logo

commit d5c954d39fb89d735c4feddf62f529077840ab6c
Author: João Santos <joaompssantos@gmail.com>
Date:   Wed Feb 7 15:05:19 2018 +0000

    Added the misteriously missing new logo.

commit f40d81f765bfdd2dc89c0647cf5f4a80eef845c7
Author: João Santos <joaompssantos@gmail.com>
Date:   Wed Feb 7 14:45:08 2018 +0000

    Added new logo to resource folder.

commit 52dc6d60d6590995d32de33f8199e954e0a6e120
Author: João Santos <joaompssantos@gmail.com>
Date:   Wed Feb 7 14:41:13 2018 +0000

    Added new logo where it was previously forgotten.

commit 6d8e064c3154e5202f01b1b10ba6ab3637383ecd
Author: João Santos <joaompssantos@gmail.com>
Date:   Tue Feb 6 17:44:11 2018 +0000

    About window no longer resizable. Added new logo.
This commit is contained in:
jfmcarreira committed 2018-03-12 18:21:07 +00:00
1 parent 5a701c83e7
commit 0b429a0c34
157 files changed
+16532 -17759

No files matched your search

+139 -139
View File
@@ -1,4 +1,4 @@
/* This file is a part of PlaYUVer project
/* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
@@ -36,11 +36,11 @@
* \brief Functions to control data stream from stream information
*/
QDataStream& operator<<( QDataStream& out, const PlaYUVerStreamInfoVector& array )
QDataStream& operator<<( QDataStream& out, const CalypFileInfoVector& array )
{
PlaYUVerStreamInfo d;
CalypFileInfo d;
out << array.size();
for( Int i = 0; i < array.size(); i++ )
for( int i = 0; i < array.size(); i++ )
{
d = array.at( i );
out << d.m_cFilename << d.m_uiWidth << d.m_uiHeight << d.m_iPelFormat << d.m_uiBitsPelPixel << d.m_iEndianness
@@ -49,12 +49,12 @@ QDataStream& operator<<( QDataStream& out, const PlaYUVerStreamInfoVector& array
return out;
}
QDataStream& operator>>( QDataStream& in, PlaYUVerStreamInfoVector& array )
QDataStream& operator>>( QDataStream& in, CalypFileInfoVector& array )
{
PlaYUVerStreamInfo d;
Int array_size;
CalypFileInfo d;
int array_size;
in >> array_size;
for( Int i = 0; i < array_size; i++ )
for( int i = 0; i < array_size; i++ )
{
in >> d.m_cFilename;
in >> d.m_uiWidth;
@@ -69,9 +69,9 @@ QDataStream& operator>>( QDataStream& in, PlaYUVerStreamInfoVector& array )
return in;
}
Int findPlaYUVerStreamInfo( PlaYUVerStreamInfoVector array, QString filename )
int findCalypStreamInfo( CalypFileInfoVector array, QString filename )
{
for( Int i = 0; i < array.size(); i++ )
for( int i = 0; i < array.size(); i++ )
if( array.at( i ).m_cFilename == filename )
return i;
return -1;
@@ -88,7 +88,7 @@ private:
QList<QStaticText> m_cTopLeftTextList;
QFont m_cTopLeftTextFont;
QFont m_cCenterTextFont;
Bool m_bBusyWindow;
bool m_bBusyWindow;
public:
VideoInformation( QWidget* parent )
@@ -99,15 +99,15 @@ public:
m_cTopLeftTextFont.setPointSize( 8 );
m_cCenterTextFont.setPointSize( 12 );
}
Void setInformationTopLeft( const QStringList& textLines )
void setInformationTopLeft( const QStringList& textLines )
{
m_cTopLeftTextList.clear();
for( Int i = 0; i < textLines.size(); i++ )
for( int i = 0; i < textLines.size(); i++ )
{
m_cTopLeftTextList.append( QStaticText( textLines.at( i ) ) );
}
}
Void setBusyWindow( Bool bFlag ) { m_bBusyWindow = bFlag; }
void setBusyWindow( bool bFlag ) { m_bBusyWindow = bFlag; }
protected:
void paintEvent( QPaintEvent* event )
@@ -117,7 +117,7 @@ protected:
if( !m_cTopLeftTextList.isEmpty() && size().width() > 300 )
{
QPoint topLeftCorner( 10, 10 );
for( Int i = 0; i < m_cTopLeftTextList.size(); i++ )
for( int i = 0; i < m_cTopLeftTextList.size(); i++ )
{
painter.drawStaticText( topLeftCorner, m_cTopLeftTextList.at( i ) );
topLeftCorner += QPoint( 0, 15 );
@@ -196,19 +196,19 @@ VideoSubWindow::~VideoSubWindow()
* Events handlers
*/
Void VideoSubWindow::closeEvent( QCloseEvent* event )
void VideoSubWindow::closeEvent( QCloseEvent* event )
{
stop();
SubWindowAbstract::closeEvent( event );
}
Void VideoSubWindow::keyPressEvent( QKeyEvent* event )
void VideoSubWindow::keyPressEvent( QKeyEvent* event )
{
if( m_pcCurrentDisplayModule )
{
if( m_pcCurrentDisplayModule->getModuleRequirements() & MODULE_USES_KEYS )
if( m_pcCurrentDisplayModule->getModuleRequirements() & CLP_MODULE_USES_KEYS )
{
Bool bRet = false;
bool bRet = false;
switch( event->key() )
{
case Qt::Key_A:
@@ -234,7 +234,7 @@ Void VideoSubWindow::keyPressEvent( QKeyEvent* event )
QWidget::keyPressEvent( event );
}
Void VideoSubWindow::resizeEvent( QResizeEvent* event )
void VideoSubWindow::resizeEvent( QResizeEvent* event )
{
m_pcVideoInfo->resize( event->size() );
}
@@ -276,12 +276,12 @@ QSize VideoSubWindow::sizeHint( const QSize& maxSize ) const
return isize;
}
Void VideoSubWindow::updateWindowOnTimeout()
void VideoSubWindow::updateWindowOnTimeout()
{
m_pcVideoInfo->update();
}
Void VideoSubWindow::loadAll()
void VideoSubWindow::loadAll()
{
QApplication::setOverrideCursor( Qt::WaitCursor );
m_pCurrStream->loadAll();
@@ -289,7 +289,7 @@ Void VideoSubWindow::loadAll()
QApplication::restoreOverrideCursor();
}
Void VideoSubWindow::refreshSubWindow()
void VideoSubWindow::refreshSubWindow()
{
if( getCategory() & SubWindowAbstract::VIDEO_STREAM_SUBWINDOW )
{
@@ -304,24 +304,24 @@ Void VideoSubWindow::refreshSubWindow()
refreshFrame();
}
Bool VideoSubWindow::loadFile( QString cFilename, Bool bForceDialog )
bool VideoSubWindow::loadFile( QString cFilename, bool bForceDialog )
{
ConfigureFormatDialog formatDialog( this );
UInt Width = 0, Height = 0, BitsPel = 8, FrameRate = 30;
Int Endianness = PLAYUVER_BIG_ENDIAN;
Int InputFormat = PlaYUVerFrame::YUV420p;
unsigned int Width = 0, Height = 0, BitsPel = 8, FrameRate = 30;
int Endianness = CLP_BIG_ENDIAN;
int InputFormat = CLP_YUV420P;
if( m_pCurrStream )
m_pCurrStream->getFormat( Width, Height, InputFormat, BitsPel, Endianness, FrameRate );
if( !m_pCurrStream )
{
m_pCurrStream = new PlaYUVerStream;
m_pCurrStream = new CalypStream;
}
Bool bConfig = guessFormat( cFilename, Width, Height, InputFormat, BitsPel, Endianness ) || bForceDialog;
Bool bRet = false;
for( Int iPass = 0; iPass < 2 && !bRet; iPass++ )
bool bConfig = guessFormat( cFilename, Width, Height, InputFormat, BitsPel, Endianness ) || bForceDialog;
bool bRet = false;
for( int iPass = 0; iPass < 2 && !bRet; iPass++ )
{
if( iPass || bConfig )
{
@@ -355,11 +355,11 @@ Bool VideoSubWindow::loadFile( QString cFilename, Bool bForceDialog )
return true;
}
Bool VideoSubWindow::loadFile( PlaYUVerStreamInfo* streamInfo )
bool VideoSubWindow::loadFile( CalypFileInfo* streamInfo )
{
if( !m_pCurrStream )
{
m_pCurrStream = new PlaYUVerStream;
m_pCurrStream = new CalypStream;
}
if( !m_pCurrStream->open( streamInfo->m_cFilename.toStdString(), streamInfo->m_uiWidth, streamInfo->m_uiHeight,
@@ -381,7 +381,7 @@ Bool VideoSubWindow::loadFile( PlaYUVerStreamInfo* streamInfo )
return true;
}
Void VideoSubWindow::updateVideoWindowInfo()
void VideoSubWindow::updateVideoWindowInfo()
{
m_cStreamInformation = "";
if( m_pcCurrentDisplayModule )
@@ -391,7 +391,7 @@ Void VideoSubWindow::updateVideoWindowInfo()
QStringList sourceWindowList;
if( arraySubWindows.size() > 0 )
{
for( Int i = 0; i < arraySubWindows.size(); i++ )
for( int i = 0; i < arraySubWindows.size(); i++ )
{
if( arraySubWindows.at( i )->getWindowName() != getWindowName() )
{
@@ -427,12 +427,12 @@ Void VideoSubWindow::updateVideoWindowInfo()
}
}
Bool VideoSubWindow::guessFormat( QString filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rBitsPerPixel,
Int& rEndianness )
bool VideoSubWindow::guessFormat( QString filename, unsigned int& rWidth, unsigned int& rHeight, int& rInputFormat, unsigned int& rBitsPerPixel,
int& rEndianness )
{
std::vector<PlaYUVerStdResolution> stdResList = PlaYUVerStream::stdResolutionSizes();
Bool bGuessed = true;
Bool bGuessedByFilesize = false;
std::vector<CalypStandardResolution> stdResList = CalypStream::stdResolutionSizes();
bool bGuessed = true;
bool bGuessedByFilesize = false;
QString FilenameShort = QFileInfo( filename ).fileName();
QString fileExtension = QFileInfo( filename ).suffix();
@@ -445,8 +445,8 @@ Bool VideoSubWindow::guessFormat( QString filename, UInt& rWidth, UInt& rHeight,
{
bGuessed = false;
// Guess pixel format
QVector<String> formats_list = QVector<String>::fromStdVector( PlaYUVerFrame::supportedPixelFormatListNames() );
for( Int i = 0; i < formats_list.size(); i++ )
QVector<ClpString> formats_list = QVector<ClpString>::fromStdVector( CalypFrame::supportedPixelFormatListNames() );
for( int i = 0; i < formats_list.size(); i++ )
{
if( FilenameShort.contains( formats_list.at( i ).c_str(), Qt::CaseInsensitive ) )
{
@@ -458,8 +458,8 @@ Bool VideoSubWindow::guessFormat( QString filename, UInt& rWidth, UInt& rHeight,
if( rWidth == 0 || rHeight == 0 )
{
// Guess resolution - match resolution name
Int iMatch = -1;
for( UInt i = 0; i < stdResList.size(); i++ )
int iMatch = -1;
for( unsigned int i = 0; i < stdResList.size(); i++ )
{
if( FilenameShort.contains( QString::fromStdString( stdResList[i].shortName ) ) )
{
@@ -497,14 +497,14 @@ Bool VideoSubWindow::guessFormat( QString filename, UInt& rWidth, UInt& rHeight,
if( pF )
{
fseek( pF, 0, SEEK_END );
UInt64 uiFileSize = ftell( pF );
unsigned long long int uiFileSize = ftell( pF );
fclose( pF );
Int count = 0, module, frame_bytes, match;
for( UInt i = 0; i < stdResList.size(); i++ )
int count = 0, module, frame_bytes, match;
for( unsigned int i = 0; i < stdResList.size(); i++ )
{
frame_bytes =
PlaYUVerFrame::getBytesPerFrame( stdResList[i].uiWidth, stdResList[i].uiHeight, rInputFormat, 8 );
CalypFrame::getBytesPerFrame( stdResList[i].uiWidth, stdResList[i].uiHeight, rInputFormat, 8 );
module = uiFileSize % frame_bytes;
if( module == 0 )
{
@@ -538,11 +538,11 @@ Bool VideoSubWindow::guessFormat( QString filename, UInt& rWidth, UInt& rHeight,
// Guess Endianness
if( FilenameShort.contains( QStringLiteral( "be" ), Qt::CaseInsensitive ) )
{
rEndianness = PLAYUVER_BIG_ENDIAN;
rEndianness = CLP_BIG_ENDIAN;
}
if( FilenameShort.contains( QStringLiteral( "le" ), Qt::CaseInsensitive ) )
{
rEndianness = PLAYUVER_LITTLE_ENDIAN;
rEndianness = CLP_LITTLE_ENDIAN;
}
if( rWidth > 0 && rHeight > 0 && rInputFormat >= 0 )
@@ -551,7 +551,7 @@ Bool VideoSubWindow::guessFormat( QString filename, UInt& rWidth, UInt& rHeight,
return !bGuessed;
}
Void VideoSubWindow::updateSelectedArea( QRect area )
void VideoSubWindow::updateSelectedArea( QRect area )
{
m_cSelectedArea = area;
}
@@ -560,7 +560,7 @@ Void VideoSubWindow::updateSelectedArea( QRect area )
* Functions to enable a module in the
* current SubWindow
*/
Void VideoSubWindow::enableModule( PlaYUVerAppModuleIf* pcModule )
void VideoSubWindow::enableModule( CalypAppModuleIf* pcModule )
{
if( m_pcCurrentDisplayModule )
{
@@ -570,12 +570,12 @@ Void VideoSubWindow::enableModule( PlaYUVerAppModuleIf* pcModule )
updateVideoWindowInfo();
}
Void VideoSubWindow::disableModule( PlaYUVerAppModuleIf* pcModule )
void VideoSubWindow::disableModule( CalypAppModuleIf* pcModule )
{
Bool bRefresh = false;
bool bRefresh = false;
if( pcModule )
{
Int modIdx = m_apcCurrentModule.indexOf( pcModule );
int modIdx = m_apcCurrentModule.indexOf( pcModule );
if( modIdx != -1 )
{
m_apcCurrentModule.removeAt( modIdx );
@@ -593,8 +593,8 @@ Void VideoSubWindow::disableModule( PlaYUVerAppModuleIf* pcModule )
}
else
{
QList<PlaYUVerAppModuleIf*> apcCurrentModule = m_apcCurrentModule;
for( Int i = 0; i < apcCurrentModule.size(); i++ )
QList<CalypAppModuleIf*> apcCurrentModule = m_apcCurrentModule;
for( int i = 0; i < apcCurrentModule.size(); i++ )
{
m_apcCurrentModule.removeOne( apcCurrentModule.at( i ) );
ModulesHandle::destroyModuleIf( apcCurrentModule.at( i ) );
@@ -617,39 +617,39 @@ Void VideoSubWindow::disableModule( PlaYUVerAppModuleIf* pcModule )
}
}
Void VideoSubWindow::associateModule( PlaYUVerAppModuleIf* pcModule )
void VideoSubWindow::associateModule( CalypAppModuleIf* pcModule )
{
m_apcCurrentModule.append( pcModule );
}
Bool VideoSubWindow::hasRunningModule()
bool VideoSubWindow::hasRunningModule()
{
Bool bRet = false;
bool bRet = false;
if( m_pcCurrentDisplayModule )
{
bRet |= m_pcCurrentDisplayModule->isRunning();
}
for( Int i = 0; i < m_apcCurrentModule.size() && !bRet; i++ )
for( int i = 0; i < m_apcCurrentModule.size() && !bRet; i++ )
{
bRet |= m_apcCurrentModule.at( i )->isRunning();
}
return bRet;
}
Void VideoSubWindow::setFillWindow( Bool bFlag )
void VideoSubWindow::setFillWindow( bool bFlag )
{
m_pcVideoInfo->setBusyWindow( bFlag );
}
Void VideoSubWindow::setCurrFrame( PlaYUVerFrame* pcCurrFrame )
void VideoSubWindow::setCurrFrame( CalypFrame* pcCurrFrame )
{
m_pcCurrFrame = pcCurrFrame;
m_cViewArea->setImage( m_pcCurrFrame );
}
Void VideoSubWindow::refreshFrameOperation()
void VideoSubWindow::refreshFrameOperation()
{
Bool bSetFrame = false;
bool bSetFrame = false;
if( m_pCurrStream )
{
m_pcCurrFrame = m_pCurrStream->getCurrFrame();
@@ -665,13 +665,13 @@ Void VideoSubWindow::refreshFrameOperation()
{
m_cViewArea->setImage( m_pcCurrFrame );
}
for( Int i = 0; i < m_apcCurrentModule.size(); i++ )
for( int i = 0; i < m_apcCurrentModule.size(); i++ )
{
m_apcCurrentModule.at( i )->update();
}
}
Void VideoSubWindow::refreshFrame( Bool bThreaded )
void VideoSubWindow::refreshFrame( bool bThreaded )
{
#ifndef QT_NO_CONCURRENT
m_cRefreshResult.waitForFinished();
@@ -686,13 +686,13 @@ Void VideoSubWindow::refreshFrame( Bool bThreaded )
}
}
Bool VideoSubWindow::goToNextFrame( Bool bThreaded )
bool VideoSubWindow::goToNextFrame( bool bThreaded )
{
#ifndef QT_NO_CONCURRENT
m_cRefreshResult.waitForFinished();
m_cReadResult.waitForFinished();
#endif
Bool bEndOfSeq = m_pCurrStream->setNextFrame();
bool bEndOfSeq = m_pCurrStream->setNextFrame();
if( !bEndOfSeq )
{
#ifndef QT_NO_CONCURRENT
@@ -700,7 +700,7 @@ Bool VideoSubWindow::goToNextFrame( Bool bThreaded )
if( bThreaded )
{
refreshFrame();
m_cReadResult = QtConcurrent::run( m_pCurrStream, &PlaYUVerStream::readNextFrameFillRGBBuffer );
m_cReadResult = QtConcurrent::run( m_pCurrStream, &CalypStream::readNextFrameFillRGBBuffer );
}
else
#endif
@@ -712,29 +712,29 @@ Bool VideoSubWindow::goToNextFrame( Bool bThreaded )
return bEndOfSeq;
}
Bool VideoSubWindow::save( QString filename )
bool VideoSubWindow::save( QString filename )
{
Bool iRet = false;
bool iRet = false;
QApplication::setOverrideCursor( Qt::WaitCursor );
PlaYUVerFrame* saveFrame = m_pcCurrFrame;
CalypFrame* saveFrame = m_pcCurrFrame;
if( m_cSelectedArea.isValid() )
{
saveFrame = new PlaYUVerFrame( m_pcCurrFrame, m_cSelectedArea.x(), m_cSelectedArea.y(), m_cSelectedArea.width(),
m_cSelectedArea.height() );
saveFrame = new CalypFrame( m_pcCurrFrame, m_cSelectedArea.x(), m_cSelectedArea.y(), m_cSelectedArea.width(),
m_cSelectedArea.height() );
}
if( !saveFrame )
{
return false;
}
iRet = PlaYUVerStream::saveFrame( filename.toStdString(), saveFrame );
iRet = CalypStream::saveFrame( filename.toStdString(), saveFrame );
QApplication::restoreOverrideCursor();
return iRet;
}
Bool VideoSubWindow::saveStream( QString filename )
bool VideoSubWindow::saveStream( QString filename )
{
Bool iRet = false;
bool iRet = false;
QApplication::setOverrideCursor( Qt::WaitCursor );
// TODO: implement this
@@ -742,7 +742,7 @@ Bool VideoSubWindow::saveStream( QString filename )
return iRet;
}
Bool VideoSubWindow::play()
bool VideoSubWindow::play()
{
if( m_pCurrStream && m_pCurrStream->getFrameNum() > 1 )
{
@@ -755,9 +755,9 @@ Bool VideoSubWindow::play()
return m_bIsPlaying;
}
Bool VideoSubWindow::playEvent()
bool VideoSubWindow::playEvent()
{
Bool bEndOfSeq = false;
bool bEndOfSeq = false;
if( m_pCurrStream && m_bIsPlaying )
{
bEndOfSeq = goToNextFrame( true );
@@ -765,22 +765,22 @@ Bool VideoSubWindow::playEvent()
return bEndOfSeq;
}
Void VideoSubWindow::pause()
void VideoSubWindow::pause()
{
m_bIsPlaying = false;
refreshFrame();
}
Void VideoSubWindow::seekAbsoluteEvent( UInt new_frame_num )
void VideoSubWindow::seekAbsoluteEvent( unsigned int new_frame_num )
{
if( m_pCurrStream )
if( m_pCurrStream->seekInput( new_frame_num ) )
refreshFrame();
}
Void VideoSubWindow::seekRelativeEvent( Bool bIsFoward )
void VideoSubWindow::seekRelativeEvent( bool bIsFoward )
{
Bool bRefresh = false;
bool bRefresh = false;
if( m_pCurrStream )
{
if( bIsFoward )
@@ -798,7 +798,7 @@ Void VideoSubWindow::seekRelativeEvent( Bool bIsFoward )
}
}
Void VideoSubWindow::stop()
void VideoSubWindow::stop()
{
#ifndef QT_NO_CONCURRENT
m_cRefreshResult.waitForFinished();
@@ -814,7 +814,7 @@ QSize VideoSubWindow::getScrollSize()
return QSize( m_pcScrollArea->viewport()->size().width() - 5, m_pcScrollArea->viewport()->size().height() - 5 );
}
Void VideoSubWindow::adjustScrollBarToRatio( const Double& horRatio, const Double& verRatio )
void VideoSubWindow::adjustScrollBarToRatio( const double& horRatio, const double& verRatio )
{
QScrollBar* scrollBarH = m_pcScrollArea->horizontalScrollBar();
QScrollBar* scrollBarV = m_pcScrollArea->verticalScrollBar();
@@ -823,14 +823,14 @@ Void VideoSubWindow::adjustScrollBarToRatio( const Double& horRatio, const Doubl
updateScrollValues();
}
Void VideoSubWindow::adjustScrollBarByOffset( QPoint Offset )
void VideoSubWindow::adjustScrollBarByOffset( QPoint Offset )
{
QPoint cLastScroll = m_cCurrScroll;
QScrollBar* scrollBarH = m_pcScrollArea->horizontalScrollBar();
QScrollBar* scrollBarV = m_pcScrollArea->verticalScrollBar();
Int valueX = int( cLastScroll.x() + Offset.x() );
Int valueY = int( cLastScroll.y() + Offset.y() );
int valueX = int( cLastScroll.x() + Offset.x() );
int valueY = int( cLastScroll.y() + Offset.y() );
scrollBarH->setValue( valueX );
scrollBarV->setValue( valueY );
@@ -842,7 +842,7 @@ Void VideoSubWindow::adjustScrollBarByOffset( QPoint Offset )
// This function was developed with help of the schematics presented in
// http://stackoverflow.com/questions/13155382/jscrollpane-zoom-relative-to-mouse-position
Void VideoSubWindow::adjustScrollBarByScale( Double scale, QPoint center )
void VideoSubWindow::adjustScrollBarByScale( double scale, QPoint center )
{
QPoint cLastScroll = m_cCurrScroll;
QScrollBar* scrollBarH = m_pcScrollArea->horizontalScrollBar();
@@ -855,13 +855,13 @@ Void VideoSubWindow::adjustScrollBarByScale( Double scale, QPoint center )
}
else
{
Int value;
int value;
Int x = center.x() - cLastScroll.x();
int x = center.x() - cLastScroll.x();
value = int( scale * cLastScroll.x() + ( ( scale - 1 ) * x ) );
m_cCurrScroll.setX( value );
Int y = center.y() - cLastScroll.y();
int y = center.y() - cLastScroll.y();
value = int( scale * cLastScroll.y() + ( ( scale - 1 ) * y ) );
m_cCurrScroll.setY( value );
}
@@ -875,10 +875,10 @@ Void VideoSubWindow::adjustScrollBarByScale( Double scale, QPoint center )
scrollBarMoved( m_dHorScroll, m_dVerScroll );
}
Void VideoSubWindow::updateScrollValues()
void VideoSubWindow::updateScrollValues()
{
Double xPos = m_pcScrollArea->horizontalScrollBar()->value();
Double yPos = m_pcScrollArea->verticalScrollBar()->value();
double xPos = m_pcScrollArea->horizontalScrollBar()->value();
double yPos = m_pcScrollArea->verticalScrollBar()->value();
m_cCurrScroll.setX( xPos );
m_cCurrScroll.setY( yPos );
@@ -886,13 +886,13 @@ Void VideoSubWindow::updateScrollValues()
m_dHorScroll = m_dVerScroll = 0;
if( xPos )
m_dHorScroll = xPos / Double( m_pcScrollArea->horizontalScrollBar()->maximum() );
m_dHorScroll = xPos / double( m_pcScrollArea->horizontalScrollBar()->maximum() );
if( yPos )
m_dVerScroll = yPos / Double( m_pcScrollArea->verticalScrollBar()->maximum() );
m_dVerScroll = yPos / double( m_pcScrollArea->verticalScrollBar()->maximum() );
}
//Void VideoSubWindow::setCurScrollValues()
//void VideoSubWindow::setCurScrollValues()
//{
// QScrollBar* scrollBar = m_pcScrollArea->horizontalScrollBar();
// scrollBar->setValue( m_cCurrScroll.x() );
@@ -900,48 +900,48 @@ Void VideoSubWindow::updateScrollValues()
// scrollBar->setValue( m_cCurrScroll.y() );
//}
Void VideoSubWindow::normalSize()
void VideoSubWindow::normalSize()
{
Double factor = 1.0;
Double curFactor = getScaleFactor();
double factor = 1.0;
double curFactor = getScaleFactor();
if( factor != curFactor )
{
Double usedScale;
double usedScale;
usedScale = m_cViewArea->scaleZoomFactor( factor / curFactor, QPoint(), QSize() );
adjustScrollBarByScale( usedScale, QPoint() );
}
}
Void VideoSubWindow::zoomToFit()
void VideoSubWindow::zoomToFit()
{
// Scale to a smaller size that the real to a nicer look
scaleView( getScrollSize() );
}
Void VideoSubWindow::zoomToFactor( Double factor, QPoint center )
void VideoSubWindow::zoomToFactor( double factor, QPoint center )
{
Double curFactor;
double curFactor;
curFactor = getScaleFactor();
if( factor != curFactor )
{
Double usedScale;
double usedScale;
usedScale = m_cViewArea->scaleZoomFactor( factor / curFactor, center, QSize() );
adjustScrollBarByScale( usedScale, center );
}
}
Void VideoSubWindow::scaleView( Double scale, QPoint center )
void VideoSubWindow::scaleView( double scale, QPoint center )
{
Q_ASSERT( !m_cViewArea->image().isNull() );
if( scale != 1.0 )
{
Double usedScale;
double usedScale;
usedScale = m_cViewArea->scaleZoomFactor( scale, center, getScrollSize() );
adjustScrollBarByScale( usedScale, center );
}
}
Void VideoSubWindow::scaleView( const QSize& size, QPoint center )
void VideoSubWindow::scaleView( const QSize& size, QPoint center )
{
QSize imgViewSize;
if( m_pcCurrFrame )
@@ -952,34 +952,34 @@ Void VideoSubWindow::scaleView( const QSize& size, QPoint center )
newSize.scale( size, Qt::KeepAspectRatio );
// Calc the zoom factor
Double wfactor = 1;
Double hfactor = 1;
Double factor;
double wfactor = 1;
double hfactor = 1;
double factor;
wfactor = (Double)newSize.width() / imgViewSize.width();
hfactor = (Double)newSize.height() / imgViewSize.height();
wfactor = (double)newSize.width() / imgViewSize.width();
hfactor = (double)newSize.height() / imgViewSize.height();
if( wfactor < hfactor )
factor = wfactor;
else
factor = hfactor;
Double curFactor = getScaleFactor();
double curFactor = getScaleFactor();
if( factor != curFactor )
{
Double usedScale;
double usedScale;
usedScale = m_cViewArea->scaleZoomFactor( factor / curFactor, center, getScrollSize() );
adjustScrollBarByScale( usedScale, center );
}
}
Void VideoSubWindow::updatePixelValueStatusBar( const QPoint& pos )
void VideoSubWindow::updatePixelValueStatusBar( const QPoint& pos )
{
if( m_pcCurrFrame )
{
Int iWidth, iHeight;
Int posX = pos.x();
Int posY = pos.y();
int iWidth, iHeight;
int posX = pos.x();
int posY = pos.y();
QString strStatus;
iWidth = m_pcCurrFrame->getWidth();
@@ -989,31 +989,31 @@ Void VideoSubWindow::updatePixelValueStatusBar( const QPoint& pos )
{
strStatus = QString( "(%1,%2) " ).arg( posX ).arg( posY );
Int colorSpace = m_pcCurrFrame->getColorSpace();
PlaYUVerPixel pixelValue = m_pcCurrFrame->getPixel( pos.x(), pos.y() );
int colorSpace = m_pcCurrFrame->getColorSpace();
CalypPixel pixelValue = m_pcCurrFrame->getPixel( pos.x(), pos.y() );
switch( colorSpace )
{
case PlaYUVerPixel::COLOR_GRAY:
strStatus.append( QString( "Y: %1" ).arg( pixelValue.Y() ) );
case CLP_COLOR_GRAY:
strStatus.append( QString( "Y: %1" ).arg( pixelValue[0] ) );
break;
case PlaYUVerPixel::COLOR_YUV:
case CLP_COLOR_YUV:
strStatus.append( QString( "Y: %1 U: %2 V: %3" )
.arg( pixelValue.Y() )
.arg( pixelValue.Cb() )
.arg( pixelValue.Cr() ) );
.arg( pixelValue[0] )
.arg( pixelValue[1] )
.arg( pixelValue[2] ) );
break;
case PlaYUVerPixel::COLOR_RGB:
case CLP_COLOR_RGB:
strStatus.append( QString( "R: %1 G: %2 B: %3" )
.arg( pixelValue.R() )
.arg( pixelValue.G() )
.arg( pixelValue.B() ) );
.arg( pixelValue[0] )
.arg( pixelValue[1] )
.arg( pixelValue[2] ) );
break;
case PlaYUVerPixel::COLOR_RGBA:
case CLP_COLOR_RGBA:
strStatus.append( QString( "R: %1 G: %2 B: %3 A: %4" )
.arg( pixelValue.R() )
.arg( pixelValue.G() )
.arg( pixelValue.B() )
.arg( pixelValue.A() ) );
.arg( pixelValue[0] )
.arg( pixelValue[1] )
.arg( pixelValue[2] )
.arg( pixelValue[3] ) );
break;
}