Add a variable to control the number of bits per pixel

This commit is contained in:
jfmcarreira committed 2015-04-02 17:34:43 +01:00
1 parent 32c224a49d
commit d8952ce953
11 files changed
+84 -52

No files matched your search

+19 -1
View File
@@ -174,6 +174,21 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget *parent ) :
pixelGridLayout->addItem( new QSpacerItem( 10, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ), 1, 1 );
pixelGridLayout->addWidget( m_comboBoxPixelFormat, 1, 2 );
/*
* Frame rate format
*/
QHBoxLayout* bitsPerPelLayout = new QHBoxLayout();
QLabel* bitsPerPelLabel = new QLabel();
bitsPerPelLabel->setFont( menusFont );
bitsPerPelLabel->setText( "Frame Rate" );
m_spinBoxBits = new QSpinBox();
m_spinBoxBits->setMinimumWidth( 30 );
m_spinBoxBits->setRange( 0, 16 );
m_spinBoxBits->setValue( 8 );
bitsPerPelLayout->addWidget( bitsPerPelLabel );
bitsPerPelLayout->addItem( new QSpacerItem( 20, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
bitsPerPelLayout->addWidget( m_spinBoxBits );
/*
* Frame rate format
*/
@@ -204,6 +219,7 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget *parent ) :
MainLayout->addWidget( resolutionGroup );
MainLayout->addItem( new QSpacerItem( 10, 5, QSizePolicy::Minimum ) );
MainLayout->addWidget( pixelGroup );
MainLayout->addLayout( bitsPerPelLayout );
MainLayout->addItem( new QSpacerItem( 10, 5, QSizePolicy::Minimum ) );
MainLayout->addLayout( framerateFormatLayout );
MainLayout->addItem( new QSpacerItem( 10, 5, QSizePolicy::Minimum, QSizePolicy::Expanding ) );
@@ -218,7 +234,7 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget *parent ) :
}
Int ConfigureFormatDialog::runConfigureFormatDialog( QString Filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rFrameRate )
Int ConfigureFormatDialog::runConfigureFormatDialog( QString Filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rBits, UInt& rFrameRate )
{
// Set default values
//setWindowTitle( "Configure resolution for " + Filename );
@@ -246,6 +262,7 @@ Int ConfigureFormatDialog::runConfigureFormatDialog( QString Filename, UInt& rWi
}
m_comboBoxColorSpace->setCurrentIndex( colorSpace );
m_comboBoxPixelFormat->setCurrentIndex( sampling );
m_spinBoxBits->setValue( rBits );
m_spinBoxFrameRate->setValue( rFrameRate );
for( Int i = 0; i < standardResolutionSizes.size(); i++ )
{
@@ -270,6 +287,7 @@ Int ConfigureFormatDialog::runConfigureFormatDialog( QString Filename, UInt& rWi
rInputFormat = i;
}
}
rBits = m_spinBoxBits->value();
rFrameRate = m_spinBoxFrameRate->value();
return QDialog::Accepted;
}
+2 -3
View File
@@ -34,8 +34,6 @@
#endif
#include <QtCore>
class QPixmap;
class QColor;
@@ -52,7 +50,7 @@ Q_OBJECT
public:
ConfigureFormatDialog( QWidget *parent = 0 );
Int runConfigureFormatDialog ( QString Filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rFrameRate );
Int runConfigureFormatDialog( QString Filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rBits, UInt& rFrameRate );
private Q_SLOTS:
void StandardResolutionSelection();
@@ -68,6 +66,7 @@ private:
QSpinBox *m_spinBoxheight;
QComboBox *m_comboBoxColorSpace;
QComboBox *m_comboBoxPixelFormat;
QSpinBox *m_spinBoxBits;
QSpinBox *m_spinBoxFrameRate;
};
+9 -6
View File
@@ -44,6 +44,7 @@ QDataStream& operator<<( QDataStream& out, const PlaYUVerStreamInfoVector& array
<< d.m_uiHeight
<< d.m_iPelFormat
<< d.m_uiFrameRate
<< d.m_uiBitsPelPixel
<< d.m_uiFileSize;
}
return out;
@@ -60,6 +61,7 @@ QDataStream& operator>>( QDataStream& in, PlaYUVerStreamInfoVector& array )
in >> d.m_uiWidth;
in >> d.m_uiHeight;
in >> d.m_iPelFormat;
in >> d.m_uiBitsPelPixel;
in >> d.m_uiFrameRate;
in >> d.m_uiFileSize;
array.append( d );
@@ -141,16 +143,16 @@ Void VideoSubWindow::refreshSubWindow()
Bool VideoSubWindow::loadFile( QString cFilename, Bool bForceDialog )
{
UInt Width = 0, Height = 0, FrameRate = 30;
UInt Width = 0, Height = 0, BitsPel = 8, FrameRate = 30;
Int InputFormat = PlaYUVerFrame::YUV420p;
if( m_pCurrStream )
m_pCurrStream->getFormat( Width, Height, InputFormat, FrameRate );
m_pCurrStream->getFormat( Width, Height, InputFormat, BitsPel, FrameRate );
if( guessFormat( cFilename, Width, Height, InputFormat, FrameRate ) || bForceDialog )
{
ConfigureFormatDialog formatDialog( this );
if( formatDialog.runConfigureFormatDialog( QFileInfo( cFilename ).fileName(), Width, Height, InputFormat, FrameRate ) == QDialog::Rejected )
if( formatDialog.runConfigureFormatDialog( QFileInfo( cFilename ).fileName(), Width, Height, InputFormat, BitsPel, FrameRate ) == QDialog::Rejected )
{
return false;
}
@@ -166,12 +168,13 @@ Bool VideoSubWindow::loadFile( QString cFilename, Bool bForceDialog )
m_pCurrStream = new PlaYUVerStream;
}
m_pCurrStream->open( cFilename.toStdString(), Width, Height, InputFormat, FrameRate );
m_pCurrStream->open( cFilename.toStdString(), Width, Height, InputFormat, BitsPel, FrameRate );
m_sStreamInfo.m_cFilename = cFilename;
m_sStreamInfo.m_uiWidth = Width;
m_sStreamInfo.m_uiHeight = Height;
m_sStreamInfo.m_iPelFormat = InputFormat;
m_sStreamInfo.m_uiBitsPelPixel = BitsPel;
m_sStreamInfo.m_uiFrameRate = FrameRate;
m_sStreamInfo.m_uiFileSize = QFileInfo( cFilename ).size();
@@ -198,7 +201,7 @@ Bool VideoSubWindow::loadFile( PlaYUVerStreamInfo* streamInfo )
}
if( !m_pCurrStream->open( streamInfo->m_cFilename.toStdString(), streamInfo->m_uiWidth, streamInfo->m_uiHeight, streamInfo->m_iPelFormat,
streamInfo->m_uiFrameRate ) )
streamInfo->m_uiBitsPelPixel, streamInfo->m_uiFrameRate ) )
{
return false;
}
@@ -317,7 +320,7 @@ Bool VideoSubWindow::guessFormat( QString filename, UInt& rWidth, UInt& rHeight,
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 );
frame_bytes = PlaYUVerFrame::getBytesPerFrame( stdResList[i].uiWidth, stdResList[i].uiHeight, rInputFormat, 8 );
module = uiFileSize % frame_bytes;
if( module == 0 )
{
+1
View File
@@ -49,6 +49,7 @@ typedef struct
UInt m_uiWidth;
UInt m_uiHeight;
Int m_iPelFormat;
UInt m_uiBitsPelPixel;
UInt m_uiFrameRate;
UInt64 m_uiFileSize;
} PlaYUVerStreamInfo;