diff --git a/app/AboutDialog.cpp b/app/AboutDialog.cpp index e07a6d3..cd67614 100644 --- a/app/AboutDialog.cpp +++ b/app/AboutDialog.cpp @@ -23,6 +23,8 @@ * Based on the work of Glad Deschrijver in KTikZ project */ +#include + #include "AboutDialog.h" #include #include @@ -30,24 +32,46 @@ #include #include +#define TAB_FROM_SPACES "   " + AboutDialog::AboutDialog( QWidget *parent ) : QDialog( parent ) { - QPixmap logo = QPixmap( ":/images/playuver-backgroud-logo.png" ).scaled( QSize( 350, 350 ), Qt::KeepAspectRatio ); + QPixmap logo = QPixmap( ":/images/playuver-backgroud-logo.png" ).scaled( QSize( 500, 350 ), Qt::KeepAspectRatio ); QLabel *pixmapLabel = new QLabel; pixmapLabel->setPixmap( logo ); - QLabel *label = new QLabel( QString( "

%1 Version %2

%3

%4

" ) + QLabel *label = new QLabel( QString( "

%1 Version %2

%3

" ) .arg( QApplication::applicationName() ) .arg( QApplication::applicationVersion() ) - .arg( tr( "Enhanced open-source Qt-based raw video player" ) ) - .arg( tr( "Copyright © 2014–2015 Luis Lucas and Joao Carreira" ) ) ); + .arg( tr( "Enhanced open-source Qt-based raw video player" ) ) ); label->setWordWrap( true ); + + QString featuresList = QStringLiteral( "

Features:

    " ); + +#ifdef USE_QTDBUS + featuresList.append( QStringLiteral( "
  • Support for Qt DBus messages" ) ); +#endif +#ifdef USE_FFMPEG + featuresList.append( QStringLiteral( "
  • Support for FFmpeg" ) ); +#endif +#ifdef USE_OPENCV + featuresList.append( QStringLiteral( "
  • Support for OpenCV" ) ); +#endif + featuresList.append( QStringLiteral( "

" ) ); + + QLabel *labelFeatures = new QLabel( featuresList ); + + + QLabel *labelCopyright = new QLabel( QStringLiteral( "Copyright © 2014–2015 Luis Lucas and Joao Carreira" ) ); + QWidget *topWidget = new QWidget; QVBoxLayout *topLayout = new QVBoxLayout; topLayout->addWidget( pixmapLabel ); topLayout->addWidget( label ); + topLayout->addWidget( labelFeatures ); + topLayout->addWidget( labelCopyright ); topWidget->setLayout( topLayout ); // QTextEdit *textEdit = new QTextEdit(tr("

This program is free " diff --git a/app/ConfigureFormatDialog.cpp b/app/ConfigureFormatDialog.cpp index 659ea58..f24955f 100644 --- a/app/ConfigureFormatDialog.cpp +++ b/app/ConfigureFormatDialog.cpp @@ -33,12 +33,13 @@ #include #include #include +#include #include "lib/PlaYUVerFrame.h" #include "ConfigureFormatDialog.h" -#define MAX_SUPPORTED_RESOLUTION 9999 +#define MAX_SUPPORTED_RESOLUTION 99999 QDataStream& operator<<( QDataStream& out, const PlaYUVerStdResolutionVector& array ) { @@ -423,19 +424,23 @@ Int ConfigureFormatDialog::runConfigureFormatDialog( const QString& Filename, UI m_widgetEndianness->setVisible( false ); } m_spinBoxFrameRate->setValue( rFrameRate ); - for( Int i = 0; i < standardResolutionSizes.size(); i++ ) + + for( Int i = 0; i < standardResolutionSizes.size() - 1; i++ ) { if( standardResolutionSizes.at( i ) == QSize( rWidth, rHeight ) ) { m_comboBoxStandardResolution->setCurrentIndex( i ); + qDebug() << "ola"; break; } } + if( exec() == QDialog::Rejected ) { writeSettings(); return QDialog::Rejected; } + rWidth = m_spinBoxWidth->value(); rHeight = m_spinBoxheight->value(); colorSpace = m_comboBoxColorSpace->currentIndex(); @@ -472,8 +477,8 @@ void ConfigureFormatDialog::slotStandardResolutionSelected( Int idx ) m_comboBoxStandardResolution->blockSignals( true ); m_comboBoxStandardResolution->insertItem( 0, name ); - m_comboBoxStandardResolution->setCurrentIndex( 0 ); m_comboBoxStandardResolution->blockSignals( false ); + m_comboBoxStandardResolution->setCurrentIndex( 0 ); } } if( idx >= 0 ) diff --git a/app/VideoSubWindow.cpp b/app/VideoSubWindow.cpp index 04a46a1..25229b9 100644 --- a/app/VideoSubWindow.cpp +++ b/app/VideoSubWindow.cpp @@ -317,7 +317,7 @@ Bool VideoSubWindow::loadFile( QString cFilename, Bool bForceDialog ) m_pCurrStream = new PlaYUVerStream; } - if( guessFormat( cFilename, Width, Height, InputFormat, FrameRate ) || bForceDialog ) + if( guessFormat( cFilename, Width, Height, InputFormat, BitsPel ) || bForceDialog ) { if( formatDialog.runConfigureFormatDialog( QFileInfo( cFilename ).fileName(), Width, Height, InputFormat, BitsPel, Endianness, FrameRate ) == QDialog::Rejected ) @@ -428,7 +428,7 @@ Void VideoSubWindow::updateVideoWindowInfo() } } -Bool VideoSubWindow::guessFormat( QString filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rFrameRate ) +Bool VideoSubWindow::guessFormat( QString filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rBitsPerPixel ) { std::vector stdResList = PlaYUVerStream::stdResolutionSizes(); Bool bGuessed = true; @@ -440,7 +440,7 @@ Bool VideoSubWindow::guessFormat( QString filename, UInt& rWidth, UInt& rHeight, { return false; } - if( !fileExtension.compare( "yuv" ) ) + if( !fileExtension.compare( "yuv" ) || !fileExtension.compare( "rgb" ) || !fileExtension.compare( "gray" ) ) { bGuessed = false; // Guess pixel format @@ -470,8 +470,9 @@ Bool VideoSubWindow::guessFormat( QString filename, UInt& rWidth, UInt& rHeight, rWidth = stdResList[iMatch].uiWidth; rHeight = stdResList[iMatch].uiHeight; } - // Guess resolution - match %dx%d + #if( QT_VERSION_PLAYUVER == 5 ) + // Guess resolution - match %dx%d QRegularExpressionMatch resolutionMatch = QRegularExpression( "_\\d*x\\d*" ).match( FilenameShort ); if( resolutionMatch.hasMatch() ) { @@ -487,6 +488,19 @@ Bool VideoSubWindow::guessFormat( QString filename, UInt& rWidth, UInt& rHeight, } } } + // Guess bits per pixel - match %dbpp + QRegularExpressionMatch BppMatch = QRegularExpression( "_\\d*bpp" ).match( FilenameShort ); + if( BppMatch.hasMatch() ) + { + QString matchString = BppMatch.captured( 0 ); + matchString.remove( "_" ); + matchString.remove( "bpp" ); + rBitsPerPixel = matchString.toUInt(); + if( !( rBitsPerPixel > 0 && rBitsPerPixel < 16 ) ) + { + rBitsPerPixel = -1; + } + } #endif } diff --git a/app/VideoSubWindow.h b/app/VideoSubWindow.h index c448eca..b803912 100644 --- a/app/VideoSubWindow.h +++ b/app/VideoSubWindow.h @@ -103,7 +103,7 @@ private: Void refreshFrameOperation(); - static Bool guessFormat( QString filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rFrameRate ); + static Bool guessFormat( QString filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rBitsPerPixel ); /** * Private zoom function to handle diff --git a/lib/PlaYUVerFrame.h b/lib/PlaYUVerFrame.h index dbe26bb..654d3ac 100644 --- a/lib/PlaYUVerFrame.h +++ b/lib/PlaYUVerFrame.h @@ -58,6 +58,7 @@ public: YUV422p, YUYV422, GRAY, + RGBp, RGB24, BGR24, NUMBER_PEL_FORMATS diff --git a/lib/PlaYUVerFramePixelFormats.cpp b/lib/PlaYUVerFramePixelFormats.cpp index 2bd4374..07c3b9e 100644 --- a/lib/PlaYUVerFramePixelFormats.cpp +++ b/lib/PlaYUVerFramePixelFormats.cpp @@ -268,7 +268,21 @@ const PlaYUVerPixFmtDescriptor g_PlaYUVerPixFmtDescriptorsList[PlaYUVerFrame::NU { { 0, 0, 1 } }, /* Y */ }, { - "RGB24", + "RGBp", + PlaYUVerPixel::COLOR_RGB, + 3, + 3, + 0, + 0, + ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_RGB24 ), + { + { 0, 0, 1 }, /* R */ + { 1, 0, 1 }, /* G */ + { 2, 0, 1 }, /* B */ + }, + }, + { + "RGB", PlaYUVerPixel::COLOR_RGB, 3, 1, @@ -282,7 +296,7 @@ const PlaYUVerPixFmtDescriptor g_PlaYUVerPixFmtDescriptorsList[PlaYUVerFrame::NU }, }, { - "BGR24", + "BGR", PlaYUVerPixel::COLOR_RGB, 3, 1, @@ -290,9 +304,9 @@ const PlaYUVerPixFmtDescriptor g_PlaYUVerPixFmtDescriptorsList[PlaYUVerFrame::NU 0, ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_BGR24 ), { - { 0, 2, 3}, /* R */ - { 0, 2, 2}, /* G */ - { 0, 2, 1}, /* B */ + { 0, 2, 3}, /* B */ + { 0, 2, 2}, /* R */ + { 0, 2, 1}, /* G */ }, } }; diff --git a/lib/PlaYUVerStream.cpp b/lib/PlaYUVerStream.cpp index efcb150..c9d6569 100644 --- a/lib/PlaYUVerStream.cpp +++ b/lib/PlaYUVerStream.cpp @@ -48,6 +48,7 @@ std::vector PlaYUVerStream::supportedReadFormats() INI_REGIST_PLAYUVER_SUPPORTED_FMT; REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerRaw::Create, "Raw Video", "yuv" ); REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerRaw::Create, "Raw Video", "gray" ); + REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerRaw::Create, "Raw Video", "rgb" ); REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerPortableMap::Create, "Portable BitMap ", "pbm" ); REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerPortableMap::Create, "Portable GrayMap ", "pgm" ); REGIST_PLAYUVER_SUPPORTED_FMT( &StreamHandlerPortableMap::Create, "Portable PixMap ", "ppm" );