Change formating and copyrights
This commit is contained in:
122 files changed
+14058
-12613
No files matched your search
+61
-36
@@ -1,6 +1,6 @@
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@gmail.com)
|
||||
/* This file is a part of PlaYUVer project
|
||||
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -23,12 +23,12 @@
|
||||
*/
|
||||
|
||||
#include "VideoSubWindow.h"
|
||||
#include "ConfigureFormatDialog.h"
|
||||
#include "ModulesHandle.h"
|
||||
#include "SubWindowAbstract.h"
|
||||
#include <QScrollArea>
|
||||
#include <QStaticText>
|
||||
#include "ConfigureFormatDialog.h"
|
||||
#include "ModulesHandle.h"
|
||||
#include "QtConcurrent/qtconcurrentrun.h"
|
||||
#include "SubWindowAbstract.h"
|
||||
|
||||
/**
|
||||
* \brief Functions to control data stream from stream information
|
||||
@@ -38,10 +38,11 @@ QDataStream& operator<<( QDataStream& out, const PlaYUVerStreamInfoVector& array
|
||||
{
|
||||
PlaYUVerStreamInfo 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 << d.m_uiFrameRate
|
||||
<< d.m_uiFileSize;
|
||||
out << d.m_cFilename << d.m_uiWidth << d.m_uiHeight << d.m_iPelFormat << d.m_uiBitsPelPixel << d.m_iEndianness
|
||||
<< d.m_uiFrameRate << d.m_uiFileSize;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
@@ -51,7 +52,8 @@ QDataStream& operator>>( QDataStream& in, PlaYUVerStreamInfoVector& array )
|
||||
PlaYUVerStreamInfo 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;
|
||||
in >> d.m_uiHeight;
|
||||
@@ -87,7 +89,8 @@ private:
|
||||
Bool m_bBusyWindow;
|
||||
|
||||
public:
|
||||
VideoInformation( QWidget* parent ) : QWidget( parent ), m_bBusyWindow( false )
|
||||
VideoInformation( QWidget* parent )
|
||||
: QWidget( parent ), m_bBusyWindow( false )
|
||||
{
|
||||
setPalette( Qt::transparent );
|
||||
setAttribute( Qt::WA_TransparentForMouseEvents );
|
||||
@@ -97,7 +100,8 @@ public:
|
||||
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( textLines.at( i ) );
|
||||
}
|
||||
}
|
||||
@@ -111,7 +115,8 @@ 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 );
|
||||
}
|
||||
@@ -137,19 +142,24 @@ VideoSubWindow::VideoSubWindow( enum VideoSubWindowCategories category, QWidget*
|
||||
{
|
||||
// Create a new scroll area inside the sub-window
|
||||
m_pcScrollArea = new QScrollArea;
|
||||
connect( m_pcScrollArea->horizontalScrollBar(), SIGNAL( actionTriggered( int ) ), this, SLOT( updateCurScrollValues() ) );
|
||||
connect( m_pcScrollArea->verticalScrollBar(), SIGNAL( actionTriggered( int ) ), this, SLOT( updateCurScrollValues() ) );
|
||||
connect( m_pcScrollArea->horizontalScrollBar(), SIGNAL( actionTriggered( int ) ), this,
|
||||
SLOT( updateCurScrollValues() ) );
|
||||
connect( m_pcScrollArea->verticalScrollBar(), SIGNAL( actionTriggered( int ) ), this,
|
||||
SLOT( updateCurScrollValues() ) );
|
||||
|
||||
// Create a new interface to show images
|
||||
m_cViewArea = new ViewArea;
|
||||
connect( m_cViewArea, SIGNAL( zoomFactorChanged_byWheel( double, QPoint ) ), this, SLOT( adjustScrollBarByScale( double, QPoint ) ) );
|
||||
connect( m_cViewArea, SIGNAL( zoomFactorChanged_byWheel( double, QPoint ) ), this, SIGNAL( zoomFactorChanged_SWindow( double, QPoint ) ) );
|
||||
connect( m_cViewArea, SIGNAL( zoomFactorChanged_byWheel( double, QPoint ) ), this,
|
||||
SLOT( adjustScrollBarByScale( double, QPoint ) ) );
|
||||
connect( m_cViewArea, SIGNAL( zoomFactorChanged_byWheel( double, QPoint ) ), this,
|
||||
SIGNAL( zoomFactorChanged_SWindow( double, QPoint ) ) );
|
||||
|
||||
connect( m_cViewArea, SIGNAL( scrollBarMoved( QPoint ) ), this, SLOT( adjustScrollBarByOffset( QPoint ) ) );
|
||||
connect( m_cViewArea, SIGNAL( scrollBarMoved( QPoint ) ), this, SIGNAL( scrollBarMoved_SWindow( QPoint ) ) );
|
||||
|
||||
connect( m_cViewArea, SIGNAL( selectionChanged( QRect ) ), this, SLOT( updateSelectedArea( QRect ) ) );
|
||||
connect( m_cViewArea, SIGNAL( positionChanged( const QPoint& ) ), this, SLOT( updatePixelValueStatusBar( const QPoint& ) ) );
|
||||
connect( m_cViewArea, SIGNAL( positionChanged( const QPoint& ) ), this,
|
||||
SLOT( updatePixelValueStatusBar( const QPoint& ) ) );
|
||||
|
||||
// m_pcScrollArea->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
|
||||
// m_pcScrollArea->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
|
||||
@@ -305,16 +315,18 @@ Bool VideoSubWindow::loadFile( QString cFilename, Bool bForceDialog )
|
||||
|
||||
Bool bConfig = guessFormat( cFilename, Width, Height, InputFormat, BitsPel, Endianness ) || bForceDialog;
|
||||
Bool bRet = false;
|
||||
for( Int iPass = 0; iPass < 2 && !bRet; iPass++ ) {
|
||||
for( Int iPass = 0; iPass < 2 && !bRet; iPass++ )
|
||||
{
|
||||
if( iPass || bConfig )
|
||||
{
|
||||
if( formatDialog.runConfigureFormatDialog( QFileInfo( cFilename ).fileName(), Width, Height, InputFormat, BitsPel, Endianness, FrameRate ) ==
|
||||
QDialog::Rejected )
|
||||
if( formatDialog.runConfigureFormatDialog( QFileInfo( cFilename ).fileName(), Width, Height, InputFormat, BitsPel,
|
||||
Endianness, FrameRate ) == QDialog::Rejected )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
bRet = m_pCurrStream->open( cFilename.toStdString(), Width, Height, InputFormat, BitsPel, Endianness, FrameRate, true );
|
||||
bRet = m_pCurrStream->open( cFilename.toStdString(), Width, Height, InputFormat, BitsPel, Endianness, FrameRate,
|
||||
true );
|
||||
}
|
||||
|
||||
m_sStreamInfo.m_cFilename = cFilename;
|
||||
@@ -344,8 +356,9 @@ Bool VideoSubWindow::loadFile( PlaYUVerStreamInfo* streamInfo )
|
||||
m_pCurrStream = new PlaYUVerStream;
|
||||
}
|
||||
|
||||
if( !m_pCurrStream->open( streamInfo->m_cFilename.toStdString(), streamInfo->m_uiWidth, streamInfo->m_uiHeight, streamInfo->m_iPelFormat,
|
||||
streamInfo->m_uiBitsPelPixel, streamInfo->m_iEndianness, streamInfo->m_uiFrameRate, true ) )
|
||||
if( !m_pCurrStream->open( streamInfo->m_cFilename.toStdString(), streamInfo->m_uiWidth, streamInfo->m_uiHeight,
|
||||
streamInfo->m_iPelFormat, streamInfo->m_uiBitsPelPixel, streamInfo->m_iEndianness,
|
||||
streamInfo->m_uiFrameRate, true ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -372,7 +385,8 @@ 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() )
|
||||
{
|
||||
sourceWindowList.append( QString( "Input %1 - " + arraySubWindows.at( i )->getWindowName() ).arg( i + 1 ) );
|
||||
@@ -404,7 +418,8 @@ Void VideoSubWindow::updateVideoWindowInfo()
|
||||
}
|
||||
}
|
||||
|
||||
Bool VideoSubWindow::guessFormat( QString filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rBitsPerPixel, Int& rEndianness )
|
||||
Bool VideoSubWindow::guessFormat( QString filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rBitsPerPixel,
|
||||
Int& rEndianness )
|
||||
{
|
||||
std::vector<PlaYUVerStdResolution> stdResList = PlaYUVerStream::stdResolutionSizes();
|
||||
Bool bGuessed = true;
|
||||
@@ -422,7 +437,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++ ) {
|
||||
for( Int i = 0; i < formats_list.size(); i++ )
|
||||
{
|
||||
if( FilenameShort.contains( formats_list.at( i ).c_str(), Qt::CaseInsensitive ) )
|
||||
{
|
||||
rInputFormat = i;
|
||||
@@ -434,7 +450,8 @@ Bool VideoSubWindow::guessFormat( QString filename, UInt& rWidth, UInt& rHeight,
|
||||
{
|
||||
// Guess resolution - match resolution name
|
||||
Int iMatch = -1;
|
||||
for( UInt i = 0; i < stdResList.size(); i++ ) {
|
||||
for( UInt i = 0; i < stdResList.size(); i++ )
|
||||
{
|
||||
if( FilenameShort.contains( QString::fromStdString( stdResList[i].shortName ) ) )
|
||||
{
|
||||
iMatch = i;
|
||||
@@ -475,8 +492,10 @@ Bool VideoSubWindow::guessFormat( QString filename, UInt& rWidth, UInt& rHeight,
|
||||
fclose( pF );
|
||||
|
||||
Int count = 0, module, frame_bytes, match;
|
||||
for( UInt i = 0; i < stdResList.size(); i++ ) {
|
||||
frame_bytes = PlaYUVerFrame::getBytesPerFrame( stdResList[i].uiWidth, stdResList[i].uiHeight, rInputFormat, 8 );
|
||||
for( UInt i = 0; i < stdResList.size(); i++ )
|
||||
{
|
||||
frame_bytes =
|
||||
PlaYUVerFrame::getBytesPerFrame( stdResList[i].uiWidth, stdResList[i].uiHeight, rInputFormat, 8 );
|
||||
module = uiFileSize % frame_bytes;
|
||||
if( module == 0 )
|
||||
{
|
||||
@@ -566,7 +585,8 @@ Void VideoSubWindow::disableModule( PlaYUVerAppModuleIf* pcModule )
|
||||
else
|
||||
{
|
||||
QList<PlaYUVerAppModuleIf*> apcCurrentModule = m_apcCurrentModule;
|
||||
for( Int i = 0; i < apcCurrentModule.size(); i++ ) {
|
||||
for( Int i = 0; i < apcCurrentModule.size(); i++ )
|
||||
{
|
||||
m_apcCurrentModule.removeOne( apcCurrentModule.at( i ) );
|
||||
ModulesHandle::destroyModuleIf( apcCurrentModule.at( i ) );
|
||||
bRefresh |= true;
|
||||
@@ -600,7 +620,8 @@ Bool VideoSubWindow::hasRunningModule()
|
||||
{
|
||||
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;
|
||||
@@ -635,7 +656,8 @@ Void VideoSubWindow::refreshFrameOperation()
|
||||
{
|
||||
m_cViewArea->setImage( m_pcCurrFrame );
|
||||
}
|
||||
for( Int i = 0; i < m_apcCurrentModule.size() && !m_bIsPlaying; i++ ) {
|
||||
for( Int i = 0; i < m_apcCurrentModule.size() && !m_bIsPlaying; i++ )
|
||||
{
|
||||
m_apcCurrentModule.at( i )->update();
|
||||
}
|
||||
}
|
||||
@@ -689,7 +711,8 @@ Bool VideoSubWindow::save( QString filename )
|
||||
PlaYUVerFrame* 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 PlaYUVerFrame( m_pcCurrFrame, m_cSelectedArea.x(), m_cSelectedArea.y(), m_cSelectedArea.width(),
|
||||
m_cSelectedArea.height() );
|
||||
}
|
||||
if( !saveFrame )
|
||||
{
|
||||
@@ -965,13 +988,15 @@ Void VideoSubWindow::updatePixelValueStatusBar( const QPoint& pos )
|
||||
if( ColorSpace == PlaYUVerPixel::COLOR_YUV )
|
||||
{
|
||||
sPixelValue = m_pcCurrFrame->getPixelValue( pos.x(), pos.y() );
|
||||
strStatus.append( QString( "Y: %1 U: %2 V: %3" ).arg( sPixelValue.Y() ).arg( sPixelValue.Cb() ).arg( sPixelValue.Cr() ) );
|
||||
strStatus.append(
|
||||
QString( "Y: %1 U: %2 V: %3" ).arg( sPixelValue.Y() ).arg( sPixelValue.Cb() ).arg( sPixelValue.Cr() ) );
|
||||
}
|
||||
|
||||
if( ( ColorSpace == PlaYUVerPixel::COLOR_RGB ) )
|
||||
{
|
||||
sPixelValue = m_pcCurrFrame->getPixelValue( pos.x(), pos.y() );
|
||||
strStatus.append( QString( "R: %1 G: %2 B: %3" ).arg( sPixelValue.R() ).arg( sPixelValue.G() ).arg( sPixelValue.B() ) );
|
||||
strStatus.append(
|
||||
QString( "R: %1 G: %2 B: %3" ).arg( sPixelValue.R() ).arg( sPixelValue.G() ).arg( sPixelValue.B() ) );
|
||||
}
|
||||
emit updateStatusBar( strStatus );
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user