From bda951126d37fd40d4898a0b8f9ba95820f3bfc4 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Sat, 5 Apr 2014 03:12:12 +0100 Subject: [PATCH] Show codec and format inforamtion in sidebar and title bar --- source/app/InputStream.cpp | 9 ++++++--- source/app/InputStream.h | 5 +++++ source/app/PropertiesSidebar.cpp | 24 ++++++++++++++++++------ source/app/PropertiesSidebar.h | 1 + 4 files changed, 30 insertions(+), 9 deletions(-) diff --git a/source/app/InputStream.cpp b/source/app/InputStream.cpp index 20cf1a7..cbab9f8 100755 --- a/source/app/InputStream.cpp +++ b/source/app/InputStream.cpp @@ -134,8 +134,8 @@ Bool InputStream::open( QString filename, UInt width, UInt height, Int input_for if( QFileInfo( filename ).completeSuffix().compare( QString( "yuv" ) ) ) { avStatus = m_cLibAvContext.initAvFormat( m_cFilename.toLocal8Bit().data(), m_uiWidth, m_uiHeight, m_iPixelFormat, m_uiFrameRate ); - m_cFormatName = QString::fromUtf8( m_cLibAvContext.getCodecName() ); - + m_cFormatName = QFileInfo( filename ).completeSuffix().toUpper(); + m_cCodedName = QString::fromUtf8( m_cLibAvContext.getCodecName() ).toUpper(); m_uiTotalFrameNum = 100; } #endif @@ -173,7 +173,8 @@ Bool InputStream::open( QString filename, UInt width, UInt height, Int input_for fseek( m_pFile, 0, SEEK_END ); m_uiTotalFrameNum = ftell( m_pFile ) / ( frame_bytes_input ); fseek( m_pFile, 0, SEEK_SET ); - m_cFormatName = QString::fromUtf8( "Raw Video" ); + m_cFormatName = QString::fromUtf8( "YUV" ); + m_cCodedName = QString::fromUtf8( "Raw Video" ); } if( !getMem1D( &m_pInputBuffer, m_pcCurrFrame->getBytesPerFrame() ) ) { @@ -184,6 +185,8 @@ Bool InputStream::open( QString filename, UInt width, UInt height, Int input_for m_cStreamInformationString = QString( "[" ); m_cStreamInformationString.append( m_cFormatName ); m_cStreamInformationString.append( QString( " / " ) ); + m_cStreamInformationString.append( m_cCodedName ); + m_cStreamInformationString.append( QString( " / " ) ); m_cStreamInformationString.append( PlaYUVerFrame::supportedPixelFormatList().at( m_iPixelFormat ) ); m_cStreamInformationString.append( "] " ); m_cStreamInformationString.append( QFileInfo( m_cFilename ).fileName() ); diff --git a/source/app/InputStream.h b/source/app/InputStream.h index 0dc1636..9915a85 100755 --- a/source/app/InputStream.h +++ b/source/app/InputStream.h @@ -62,6 +62,7 @@ private: QString m_cFilename; QString m_cFormatName; + QString m_cCodedName; QString m_cStreamInformationString; QTime m_cTimer; @@ -142,6 +143,10 @@ public: { return m_cFormatName; } + QString getCodecName() + { + return m_cCodedName; + } UInt getFrameNum() { return m_uiTotalFrameNum; diff --git a/source/app/PropertiesSidebar.cpp b/source/app/PropertiesSidebar.cpp index 8b67963..a72deb1 100755 --- a/source/app/PropertiesSidebar.cpp +++ b/source/app/PropertiesSidebar.cpp @@ -53,6 +53,11 @@ StreamPropertiesSideBar::StreamPropertiesSideBar( QWidget* parent ) : labelFormatValue = new QLabel; labelFormatValue->setAlignment( Qt::AlignRight | Qt::AlignVCenter ); + QLabel *codecLabel = new QLabel( tr( "Codec:" ) ); + codecLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter ); + labelCodecValue = new QLabel; + labelCodecValue->setAlignment( Qt::AlignRight | Qt::AlignVCenter ); + QLabel *sizeLabel = new QLabel( tr( "Size (pixels):" ) ); sizeLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter ); labelSizeValue = new QLabel; @@ -64,12 +69,18 @@ StreamPropertiesSideBar::StreamPropertiesSideBar( QWidget* parent ) : labelColorSpaceValue->setAlignment( Qt::AlignRight | Qt::AlignVCenter ); QGridLayout *propertiesLayout = new QGridLayout; - propertiesLayout->addWidget( formatLabel, 0, 0 ); - propertiesLayout->addWidget( labelFormatValue, 0, 1 ); - propertiesLayout->addWidget( sizeLabel, 1, 0 ); - propertiesLayout->addWidget( labelSizeValue, 1, 1 ); - propertiesLayout->addWidget( colorSpaceLabel, 2, 0 ); - propertiesLayout->addWidget( labelColorSpaceValue, 2, 1 ); + Int layout_line = 0; + propertiesLayout->addWidget( formatLabel, layout_line, 0 ); + propertiesLayout->addWidget( labelFormatValue, layout_line, 1 ); + layout_line++; + propertiesLayout->addWidget( codecLabel, layout_line, 0 ); + propertiesLayout->addWidget( labelCodecValue, layout_line, 1 ); + layout_line++; + propertiesLayout->addWidget( sizeLabel, layout_line, 0 ); + propertiesLayout->addWidget( labelSizeValue, layout_line, 1 ); + layout_line++; + propertiesLayout->addWidget( colorSpaceLabel, layout_line, 0 ); + propertiesLayout->addWidget( labelColorSpaceValue, layout_line, 1 ); QGroupBox *propertiesGroup = new QGroupBox( tr( "Properties" ) ); propertiesGroup->setLayout( propertiesLayout ); @@ -110,6 +121,7 @@ Void StreamPropertiesSideBar::setData( InputStream* pcStream ) QString value; labelFormatValue->setText( m_pcStream->getFormatName() ); + labelCodecValue->setText( m_pcStream->getCodecName() ); uint width = m_pcStream->getWidth(); uint height = m_pcStream->getHeight(); value = QString( tr( "%1 x %2" ) ).arg( width ).arg( height ); diff --git a/source/app/PropertiesSidebar.h b/source/app/PropertiesSidebar.h index d645641..35855c9 100755 --- a/source/app/PropertiesSidebar.h +++ b/source/app/PropertiesSidebar.h @@ -52,6 +52,7 @@ private: InputStream* m_pcStream; QLabel* labelFormatValue; + QLabel* labelCodecValue; QLabel* labelSizeValue; QLabel* labelColorSpaceValue; };