diff --git a/source/ConfigureFormatDialog.cpp b/source/ConfigureFormatDialog.cpp index 238c0a4..69c0be5 100755 --- a/source/ConfigureFormatDialog.cpp +++ b/source/ConfigureFormatDialog.cpp @@ -147,7 +147,7 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget *parent ) : MainLayout->addLayout( resolutionGrid ); - // Pixel format + pixelFormatVerticalSpacer = new QSpacerItem( 10, 20, QSizePolicy::Minimum ); MainLayout->addItem( pixelFormatVerticalSpacer ); @@ -179,6 +179,31 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget *parent ) : MainLayout->addLayout( pixelFormatLayout ); + // Frame rate format + + framerateFormatVerticalSpacer = new QSpacerItem( 10, 20, QSizePolicy::Minimum ); + MainLayout->addItem( pixelFormatVerticalSpacer ); + + framerateFormatLayout = new QHBoxLayout(); + framerateFormatLayout->setObjectName( QStringLiteral( "pixelFormatLayout" ) ); + + framerateFormatLabel = new QLabel(); + framerateFormatLabel->setObjectName( QStringLiteral( "pixelFormatLabel" ) ); + framerateFormatLabel->setText( QApplication::translate( "pixelFormat", "Pixel FormatBox", 0 ) ); + + framerateFormatHorizontalSpacer = new QSpacerItem( 40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + + framerateSpinBox = new QSpinBox( ); + framerateSpinBox->setObjectName( QStringLiteral( "framerateSpinBox" ) ); + framerateSpinBox->setRange( 0, 200 ); + framerateSpinBox->setValue( 30 ); + + framerateFormatLayout->addWidget( framerateFormatLabel ); + framerateFormatLayout->addItem( framerateFormatHorizontalSpacer ); + framerateFormatLayout->addWidget( framerateSpinBox ); + + MainLayout->addLayout( framerateFormatLayout ); + // Confirmation buttons verticalSpacerConfirmation = new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding ); @@ -191,7 +216,6 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget *parent ) : MainLayout->addWidget( dialogButtonOkCancel ); - Int idx; connect( standardResolutionBox, SIGNAL( currentIndexChanged(int) ), this, SLOT( StandardResolutionSelection() ) ); connect( dialogButtonOkCancel, SIGNAL( accepted() ), this, SLOT( accept() ) ); connect( dialogButtonOkCancel, SIGNAL( rejected() ), this, SLOT( reject() ) ); diff --git a/source/ConfigureFormatDialog.h b/source/ConfigureFormatDialog.h index 9d0dce6..ee15ec7 100755 --- a/source/ConfigureFormatDialog.h +++ b/source/ConfigureFormatDialog.h @@ -66,6 +66,11 @@ public: return pixelFormatBox->currentIndex(); } + UInt getFrameRate() + { + return framerateSpinBox->value(); + } + private Q_SLOTS: void StandardResolutionSelection(); @@ -98,6 +103,12 @@ private: QSpacerItem *pixelFormatHorizontalSpacer; QComboBox *pixelFormatBox; + QSpacerItem *framerateFormatVerticalSpacer; + QHBoxLayout *framerateFormatLayout; + QLabel *framerateFormatLabel; + QSpacerItem *framerateFormatHorizontalSpacer; + QSpinBox *framerateSpinBox; + QSpacerItem *verticalSpacerConfirmation; QDialogButtonBox *dialogButtonOkCancel; diff --git a/source/InputStream.cpp b/source/InputStream.cpp index 1a12523..90a54ef 100755 --- a/source/InputStream.cpp +++ b/source/InputStream.cpp @@ -124,16 +124,17 @@ Bool InputStream::needFormatDialog( QString filename ) } } -Void InputStream::init( QString filename, UInt width, UInt height, Int input_format ) +Void InputStream::init( QString filename, UInt width, UInt height, Int input_format, UInt frame_rate ) { m_uiWidth = width; m_uiHeight = height; + m_uiFrameRate = frame_rate; m_iFileFormat = YUVFormat; m_iPixelFormat = input_format; #ifdef USE_FFMPEG - Bool avStatus = m_cLibAvContext.initAvFormat( filename, m_uiWidth, m_uiHeight, m_iPixelFormat ); + Bool avStatus = m_cLibAvContext.initAvFormat( filename, m_uiWidth, m_uiHeight, m_iPixelFormat, m_uiFrameRate ); #endif if( m_uiWidth <= 0 || m_uiHeight <= 0 ) diff --git a/source/InputStream.h b/source/InputStream.h index da185ac..cd7762c 100755 --- a/source/InputStream.h +++ b/source/InputStream.h @@ -92,7 +92,7 @@ public: Bool needFormatDialog( QString filename ); - Void init( QString filename, UInt width, UInt height, Int input_format ); + Void init( QString filename, UInt width, UInt height, Int input_format, UInt frame_rate ); Void readFrame(); diff --git a/source/LibAvContextHandle.cpp b/source/LibAvContextHandle.cpp index 438cd30..9c7dd19 100755 --- a/source/LibAvContextHandle.cpp +++ b/source/LibAvContextHandle.cpp @@ -82,7 +82,7 @@ Void LibAvContextHandle::closeAvFormat() av_free( video_dst_data[0] ); } -Bool LibAvContextHandle::initAvFormat( QString filename, UInt& width, UInt& height, Int& pixel_format ) +Bool LibAvContextHandle::initAvFormat( QString filename, UInt& width, UInt& height, Int& pixel_format, UInt& frame_rate ) { Bool bRet = true; int ret = 0; diff --git a/source/LibAvContextHandle.h b/source/LibAvContextHandle.h index b2460b4..5a7e065 100755 --- a/source/LibAvContextHandle.h +++ b/source/LibAvContextHandle.h @@ -46,7 +46,7 @@ namespace plaYUVer class LibAvContextHandle { public: - Bool initAvFormat( QString filename, UInt& width, UInt& height, Int& pixel_format ); + Bool initAvFormat( QString filename, UInt& width, UInt& height, Int& pixel_format, UInt& frame_rate ); Void closeAvFormat(); Bool decodeAvFormat(); diff --git a/source/SubWindowHandle.cpp b/source/SubWindowHandle.cpp index 2c5393e..8c6b94f 100644 --- a/source/SubWindowHandle.cpp +++ b/source/SubWindowHandle.cpp @@ -67,11 +67,11 @@ bool SubWindowHandle::loadFile( const QString &fileName ) { return false; } - m_currStream.init( fileName, formatDialog.getResolution().width(), formatDialog.getResolution().height(), formatDialog.getPixelFormat() ); + m_currStream.init( fileName, formatDialog.getResolution().width(), formatDialog.getResolution().height(), formatDialog.getPixelFormat(), formatDialog.getFrameRate() ); } else { - m_currStream.init( fileName, 0, 0, 0 ); + m_currStream.init( fileName, 0, 0, 0, 0 ); } QApplication::setOverrideCursor( Qt::WaitCursor ); QApplication::restoreOverrideCursor();