Change endianness to Int
This commit is contained in:
@@ -194,16 +194,15 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget *parent ) :
|
||||
QLabel* endiannessLabel = new QLabel();
|
||||
endiannessLabel->setFont( menusFont );
|
||||
endiannessLabel->setText( "Endianness" );
|
||||
QComboBox* endiannessComboBox = new QComboBox();
|
||||
endiannessComboBox->setFont( normalFont );
|
||||
endiannessComboBox->setSizePolicy( sizePolicy );
|
||||
endiannessComboBox->clear();
|
||||
endiannessComboBox->addItem( QStringLiteral("Big Endian") );
|
||||
endiannessComboBox->addItem( QStringLiteral("Little Endian") );
|
||||
endiannessComboBox->setCurrentIndex( 0 );
|
||||
m_comboBoxEndianness = new QComboBox();
|
||||
m_comboBoxEndianness->setFont( normalFont );
|
||||
m_comboBoxEndianness->setSizePolicy( sizePolicy );
|
||||
m_comboBoxEndianness->clear();
|
||||
m_comboBoxEndianness->addItem( QStringLiteral("Big Endian") );
|
||||
m_comboBoxEndianness->addItem( QStringLiteral("Little Endian") );
|
||||
endiannessLayout->addWidget( endiannessLabel );
|
||||
endiannessLayout->addItem( new QSpacerItem( 20, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
|
||||
endiannessLayout->addWidget( endiannessComboBox );
|
||||
endiannessLayout->addWidget( m_comboBoxEndianness );
|
||||
m_widgetEndianness = new QWidget();
|
||||
m_widgetEndianness->setContentsMargins( 0,0,0,0 );
|
||||
m_widgetEndianness->setLayout( endiannessLayout );
|
||||
@@ -262,7 +261,7 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget *parent ) :
|
||||
|
||||
}
|
||||
|
||||
Int ConfigureFormatDialog::runConfigureFormatDialog( QString Filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rBits, UInt& rEndianess, UInt& rFrameRate )
|
||||
Int ConfigureFormatDialog::runConfigureFormatDialog( QString Filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rBits, Int& rEndianess, UInt& rFrameRate )
|
||||
{
|
||||
// Set default values
|
||||
//setWindowTitle( "Configure resolution for " + Filename );
|
||||
@@ -291,6 +290,7 @@ Int ConfigureFormatDialog::runConfigureFormatDialog( QString Filename, UInt& rWi
|
||||
m_comboBoxColorSpace->setCurrentIndex( colorSpace );
|
||||
m_comboBoxPixelFormat->setCurrentIndex( sampling );
|
||||
m_spinBoxBits->setValue( rBits );
|
||||
m_comboBoxEndianness->setCurrentIndex( rEndianess );
|
||||
if( rBits > 8 )
|
||||
{
|
||||
m_widgetEndianness->setVisible( true );
|
||||
@@ -326,6 +326,7 @@ Int ConfigureFormatDialog::runConfigureFormatDialog( QString Filename, UInt& rWi
|
||||
}
|
||||
}
|
||||
rBits = m_spinBoxBits->value();
|
||||
rEndianess = m_comboBoxEndianness->currentIndex();
|
||||
rFrameRate = m_spinBoxFrameRate->value();
|
||||
return QDialog::Accepted;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ Q_OBJECT
|
||||
public:
|
||||
|
||||
ConfigureFormatDialog( QWidget *parent = 0 );
|
||||
Int runConfigureFormatDialog( QString Filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rBits, UInt& rEndianess, UInt& rFrameRate );
|
||||
Int runConfigureFormatDialog( QString Filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rBits, Int& rEndianess, UInt& rFrameRate );
|
||||
|
||||
private Q_SLOTS:
|
||||
void slotStandardResolutionSelected( int );
|
||||
@@ -70,6 +70,7 @@ private:
|
||||
QComboBox *m_comboBoxPixelFormat;
|
||||
QSpinBox *m_spinBoxBits;
|
||||
QWidget* m_widgetEndianness;
|
||||
QComboBox* m_comboBoxEndianness;
|
||||
QHBoxLayout* framerateFormatLayout;
|
||||
QSpinBox *m_spinBoxFrameRate;
|
||||
|
||||
|
||||
@@ -308,7 +308,8 @@ Void VideoSubWindow::refreshSubWindow()
|
||||
Bool VideoSubWindow::loadFile( QString cFilename, Bool bForceDialog )
|
||||
{
|
||||
ConfigureFormatDialog formatDialog( this );
|
||||
UInt Width = 0, Height = 0, BitsPel = 8, Endianness = 0, FrameRate = 30;
|
||||
UInt Width = 0, Height = 0, BitsPel = 8, FrameRate = 30;
|
||||
Int Endianness = 0;
|
||||
Int InputFormat = PlaYUVerFrame::YUV420p;
|
||||
|
||||
if( m_pCurrStream )
|
||||
|
||||
@@ -112,7 +112,7 @@ Void LibAvContextHandle::closeAvFormat()
|
||||
m_bHasStream = false;
|
||||
}
|
||||
|
||||
Bool LibAvContextHandle::initAvFormat( const char* filename, UInt& width, UInt& height, Int& pixel_format, UInt& endianness, UInt& bits_pel, Double& frame_rate,
|
||||
Bool LibAvContextHandle::initAvFormat( const char* filename, UInt& width, UInt& height, Int& pixel_format, UInt& bits_pel, Int& endianness, Double& frame_rate,
|
||||
UInt64& num_frames )
|
||||
{
|
||||
fmt_ctx = NULL;
|
||||
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
m_bHasStream( false )
|
||||
{
|
||||
}
|
||||
Bool initAvFormat( const char* filename, UInt& width, UInt& height, Int& pixel_format, UInt& bits_pel, UInt& endianness, Double& frame_rate, UInt64& num_frames );
|
||||
Bool initAvFormat( const char* filename, UInt& width, UInt& height, Int& pixel_format, UInt& bits_pel, Int& endianness, Double& frame_rate, UInt64& num_frames );
|
||||
Void closeAvFormat();
|
||||
Bool decodeAvFormat();
|
||||
|
||||
|
||||
+10
-9
@@ -116,6 +116,7 @@ PlaYUVerStream::PlaYUVerStream()
|
||||
m_iCurrFrameNum = -1;
|
||||
m_iPixelFormat = -1;
|
||||
m_uiBitsPerPixel = 8;
|
||||
m_iEndianness = -1;
|
||||
m_dFrameRate = 30;
|
||||
m_pStreamBuffer = NULL;
|
||||
m_cFilename = "";
|
||||
@@ -190,7 +191,7 @@ Void PlaYUVerStream::findHandler()
|
||||
}
|
||||
}
|
||||
|
||||
Bool PlaYUVerStream::open( std::string filename, std::string resolution, std::string input_format_name, UInt bitsPel, UInt endianness, UInt frame_rate, Bool bInput )
|
||||
Bool PlaYUVerStream::open( std::string filename, std::string resolution, std::string input_format_name, UInt bitsPel, Int endianness, UInt frame_rate, Bool bInput )
|
||||
{
|
||||
UInt width;
|
||||
UInt height;
|
||||
@@ -215,7 +216,7 @@ Bool PlaYUVerStream::open( std::string filename, std::string resolution, std::st
|
||||
return open( filename, width, height, input_format, bitsPel, endianness, frame_rate, bInput );
|
||||
}
|
||||
|
||||
Bool PlaYUVerStream::open( std::string filename, UInt width, UInt height, Int input_format, UInt bitsPel, UInt endianness, UInt frame_rate, Bool bInput )
|
||||
Bool PlaYUVerStream::open( std::string filename, UInt width, UInt height, Int input_format, UInt bitsPel, Int endianness, UInt frame_rate, Bool bInput )
|
||||
{
|
||||
if( m_bInit )
|
||||
{
|
||||
@@ -228,7 +229,7 @@ Bool PlaYUVerStream::open( std::string filename, UInt width, UInt height, Int in
|
||||
m_uiHeight = height;
|
||||
m_iPixelFormat = input_format;
|
||||
m_uiBitsPerPixel = bitsPel;
|
||||
m_uiEndianness = endianness;
|
||||
m_iEndianness = endianness;
|
||||
m_dFrameRate = frame_rate;
|
||||
|
||||
m_pchFilename = new Char[m_cFilename.size() + 1];
|
||||
@@ -248,7 +249,7 @@ Bool PlaYUVerStream::open( std::string filename, UInt width, UInt height, Int in
|
||||
#ifdef USE_FFMPEG
|
||||
if( m_iStreamHandler == FFMPEG )
|
||||
{
|
||||
if( !m_cLibAvContext->initAvFormat( m_pchFilename, m_uiWidth, m_uiHeight, m_iPixelFormat, m_uiBitsPerPixel, m_uiEndianness, m_dFrameRate, m_uiTotalFrameNum ) )
|
||||
if( !m_cLibAvContext->initAvFormat( m_pchFilename, m_uiWidth, m_uiHeight, m_iPixelFormat, m_uiBitsPerPixel, m_iEndianness, m_dFrameRate, m_uiTotalFrameNum ) )
|
||||
{
|
||||
throw "Cannot open file using FFmpeg libs";
|
||||
}
|
||||
@@ -371,7 +372,7 @@ Bool PlaYUVerStream::reload()
|
||||
if( m_iStreamHandler == FFMPEG )
|
||||
{
|
||||
m_cLibAvContext->closeAvFormat();
|
||||
if( !m_cLibAvContext->initAvFormat( m_pchFilename, m_uiWidth, m_uiHeight, m_iPixelFormat, m_uiBitsPerPixel, m_uiEndianness, m_dFrameRate, m_uiTotalFrameNum ) )
|
||||
if( !m_cLibAvContext->initAvFormat( m_pchFilename, m_uiWidth, m_uiHeight, m_iPixelFormat, m_uiBitsPerPixel, m_iEndianness, m_dFrameRate, m_uiTotalFrameNum ) )
|
||||
{
|
||||
throw "Cannot open file using FFmpeg libs";
|
||||
}
|
||||
@@ -462,7 +463,7 @@ Void PlaYUVerStream::close()
|
||||
m_bInit = false;
|
||||
}
|
||||
|
||||
Void PlaYUVerStream::getFormat( UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rBitsPerPel, UInt& rEndianness, UInt& rFrameRate )
|
||||
Void PlaYUVerStream::getFormat( UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rBitsPerPel, Int& rEndianness, UInt& rFrameRate )
|
||||
{
|
||||
if( m_bInit )
|
||||
{
|
||||
@@ -470,7 +471,7 @@ Void PlaYUVerStream::getFormat( UInt& rWidth, UInt& rHeight, Int& rInputFormat,
|
||||
rHeight = m_uiHeight;
|
||||
rInputFormat = m_iPixelFormat;
|
||||
rBitsPerPel = m_uiBitsPerPixel;
|
||||
rEndianness = m_uiEndianness;
|
||||
rEndianness = m_iEndianness;
|
||||
rFrameRate = m_dFrameRate;
|
||||
}
|
||||
else
|
||||
@@ -581,7 +582,7 @@ Void PlaYUVerStream::readFrame()
|
||||
throw "[PlaYUVerStream] Error reading frame from libav";
|
||||
return;
|
||||
}
|
||||
m_pcNextFrame->frameFromBuffer( m_cLibAvContext->m_pchFrameBuffer, m_cLibAvContext->m_uiFrameBufferSize, m_uiEndianness );
|
||||
m_pcNextFrame->frameFromBuffer( m_cLibAvContext->m_pchFrameBuffer, m_cLibAvContext->m_uiFrameBufferSize, m_iEndianness );
|
||||
}
|
||||
#endif
|
||||
if( m_iStreamHandler == YUV_IO )
|
||||
@@ -593,7 +594,7 @@ Void PlaYUVerStream::readFrame()
|
||||
throw "[PlaYUVerStream] Cannot read file";
|
||||
return;
|
||||
}
|
||||
m_pcNextFrame->frameFromBuffer( m_pStreamBuffer, bytes_read, m_uiEndianness );
|
||||
m_pcNextFrame->frameFromBuffer( m_pStreamBuffer, bytes_read, m_iEndianness );
|
||||
}
|
||||
m_uiCurrFrameFileIdx++;
|
||||
return;
|
||||
|
||||
@@ -95,8 +95,8 @@ public:
|
||||
END_OF_SEQ,
|
||||
};
|
||||
|
||||
Bool open( std::string filename, std::string resolution, std::string input_format, UInt bitsPel, UInt endianness, UInt frame_rate, Bool bInput = true );
|
||||
Bool open( std::string filename, UInt width, UInt height, Int input_format, UInt bitsPel, UInt endianness, UInt frame_rate, Bool bInput = true );
|
||||
Bool open( std::string filename, std::string resolution, std::string input_format, UInt bitsPel, Int endianness, UInt frame_rate, Bool bInput = true );
|
||||
Bool open( std::string filename, UInt width, UInt height, Int input_format, UInt bitsPel, Int endianness, UInt frame_rate, Bool bInput = true );
|
||||
|
||||
Bool reload();
|
||||
|
||||
@@ -105,7 +105,7 @@ public:
|
||||
Bool openFile();
|
||||
Void closeFile();
|
||||
|
||||
Void getFormat( UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rBitsPerPel, UInt& rEndianness, UInt& rFrameRate );
|
||||
Void getFormat( UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rBitsPerPel, Int& rEndianness, UInt& rFrameRate );
|
||||
|
||||
Void loadAll();
|
||||
|
||||
@@ -194,7 +194,7 @@ private:
|
||||
UInt m_uiHeight;
|
||||
Int m_iPixelFormat;
|
||||
UInt m_uiBitsPerPixel;
|
||||
UInt m_uiEndianness;
|
||||
Int m_iEndianness;
|
||||
Double m_dFrameRate;
|
||||
UInt64 m_uiTotalFrameNum;
|
||||
Int64 m_iCurrFrameNum;
|
||||
|
||||
Reference in New Issue
Block a user