diff --git a/source/ConfigureFormatDialog.cpp b/source/ConfigureFormatDialog.cpp index 9781458..238c0a4 100755 --- a/source/ConfigureFormatDialog.cpp +++ b/source/ConfigureFormatDialog.cpp @@ -49,7 +49,7 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget *parent ) : headLayout = new QHBoxLayout(); headLayout->setObjectName( QStringLiteral( "headLayout" ) ); - dialogTitleLabel = new QLabel( this ); + dialogTitleLabel = new QLabel(); dialogTitleLabel->setObjectName( QStringLiteral( "dialogTitleLabel" ) ); QFont font; font.setPointSize( 11 ); @@ -60,7 +60,7 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget *parent ) : headerSpacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - dialogIconLabel = new QLabel( this ); + dialogIconLabel = new QLabel( ); dialogIconLabel->setObjectName( QStringLiteral( "dialogIconLabel" ) ); dialogIconLabel->setPixmap( QPixmap( ":/images/dialogheader-grid.png" ) ); @@ -75,15 +75,15 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget *parent ) : verticalSpacer = new QSpacerItem( 10, 20, QSizePolicy::Minimum ); MainLayout->addItem( verticalSpacer ); - standardResolutionLayout = new QHBoxLayout( ); + standardResolutionLayout = new QHBoxLayout(); standardResolutionLayout->setObjectName( QStringLiteral( "standardResolutionLayout" ) ); - standardResolutionLabel = new QLabel( this ); + standardResolutionLabel = new QLabel( ); standardResolutionLabel->setObjectName( QStringLiteral( "standardResolutionLabel" ) ); standardResolutionLabel->setText( QApplication::translate( "ConfigureFormat", "Standard Resolution", 0 ) ); horizontalSpacer = new QSpacerItem( 40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - standardResolutionBox = new QComboBox( this ); + standardResolutionBox = new QComboBox( ); standardResolutionBox->setObjectName( QStringLiteral( "standardResolutionBox" ) ); QSizePolicy sizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed ); sizePolicy.setHorizontalStretch( 0 ); @@ -107,10 +107,10 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget *parent ) : resolutionGridVerticalSpacer = new QSpacerItem( 10, 20, QSizePolicy::Minimum ); MainLayout->addItem( resolutionGridVerticalSpacer ); - resolutionGrid = new QGridLayout( this ); + resolutionGrid = new QGridLayout( ); resolutionGrid->setObjectName( QStringLiteral( "resolutionGrid" ) ); - resolutionLabel = new QLabel( this ); + resolutionLabel = new QLabel( ); resolutionLabel->setObjectName( QStringLiteral( "resolutionLabel" ) ); QFont font1; font1.setBold( true ); @@ -118,23 +118,23 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget *parent ) : resolutionLabel->setFont( font1 ); resolutionLabel->setText( QApplication::translate( "ConfigureFormat", "Resolution chosen", 0 ) ); - widthLabel = new QLabel( this ); + widthLabel = new QLabel( ); widthLabel->setObjectName( QStringLiteral( "widthLabel" ) ); widthLabel->setText( QApplication::translate( "ConfigureFormat", "Width", 0 ) ); - widthSpinBox = new QSpinBox( this ); + widthSpinBox = new QSpinBox( ); widthSpinBox->setObjectName( QStringLiteral( "widthSpinBox" ) ); widthSpinBox->setRange( 0, 5000 ); widthSpinBox->setValue( 0 ); - heightLabel = new QLabel( this ); + heightLabel = new QLabel( ); heightLabel->setObjectName( QStringLiteral( "heightLabel" ) ); heightLabel->setText( QApplication::translate( "ConfigureFormat", "Height", 0 ) ); - heightSpinBox = new QSpinBox( this ); + heightSpinBox = new QSpinBox( ); heightSpinBox->setObjectName( QStringLiteral( "heightSpinBox" ) ); heightSpinBox->setRange( 0, 5000 ); heightSpinBox->setValue( 0 ); - pixelsLabel = new QLabel( this ); + pixelsLabel = new QLabel( ); pixelsLabel->setObjectName( QStringLiteral( "pixelsLabel" ) ); pixelsLabel->setText( QApplication::translate( "ConfigureFormat", "Pixels", 0 ) ); @@ -155,13 +155,13 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget *parent ) : pixelFormatLayout = new QHBoxLayout( ); pixelFormatLayout->setObjectName( QStringLiteral( "pixelFormatLayout" ) ); - pixelFormatLabel = new QLabel( this ); + pixelFormatLabel = new QLabel( ); pixelFormatLabel->setObjectName( QStringLiteral( "pixelFormatLabel" ) ); pixelFormatLabel->setText( QApplication::translate( "pixelFormat", "Pixel FormatBox", 0 ) ); pixelFormatHorizontalSpacer = new QSpacerItem( 40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - pixelFormatBox = new QComboBox( this ); + pixelFormatBox = new QComboBox( ); pixelFormatBox->setObjectName( QStringLiteral( "pixelFormatBox" ) ); QSizePolicy sizePolicyPixelFormat( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed ); sizePolicyPixelFormat.setHorizontalStretch( 0 ); @@ -184,7 +184,7 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget *parent ) : verticalSpacerConfirmation = new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding ); MainLayout->addItem( verticalSpacerConfirmation ); - dialogButtonOkCancel = new QDialogButtonBox( this ); + dialogButtonOkCancel = new QDialogButtonBox( ); dialogButtonOkCancel->setObjectName( QString::fromUtf8( "dialogButtonBox" ) ); dialogButtonOkCancel->setStandardButtons( QDialogButtonBox::Cancel | QDialogButtonBox::Ok ); dialogButtonOkCancel->setCenterButtons( false ); diff --git a/source/InputStream.cpp b/source/InputStream.cpp index 07f36d4..083dcb5 100755 --- a/source/InputStream.cpp +++ b/source/InputStream.cpp @@ -109,7 +109,6 @@ QStringList InputStream::supportedPixelFormatList() Bool InputStream::needFormatDialog( QString filename ) { - return true; QString fileExtension = QFileInfo( filename ).completeSuffix(); if( !fileExtension.compare( QString( "yuv" ) ) ) { @@ -130,7 +129,7 @@ Void InputStream::init( QString filename, UInt width, UInt height, Int input_for m_iPixelFormat = input_format; #ifdef USE_FFMPEG - Bool avStatus = m_cLibAvContext.initAvFormat( filename, width, height, input_format ); + Bool avStatus = m_cLibAvContext.initAvFormat( filename, m_uiWidth, m_uiHeight, m_iPixelFormat ); #endif if( m_uiWidth <= 0 || m_uiHeight <= 0 ) diff --git a/source/LibAvContextHandle.cpp b/source/LibAvContextHandle.cpp index 73e08ed..e926a69 100755 --- a/source/LibAvContextHandle.cpp +++ b/source/LibAvContextHandle.cpp @@ -24,7 +24,7 @@ #include "LibAvContextHandle.h" #ifdef USE_FFMPEG - + #include #include @@ -135,6 +135,19 @@ Bool LibAvContextHandle::initAvFormat( QString filename, UInt& width, UInt& heig video_dst_bufsize = ret; } + AVCodecContext *in_codec = fmt_ctx->streams[0]->codec; + width = in_codec->width; + height = in_codec->height; + switch( in_codec->pix_fmt ) + { + case AV_PIX_FMT_YUV420P: + pixel_format = PlaYUVerFrame::YUV420; + break; + case AV_PIX_FMT_GRAY8: + pixel_format = PlaYUVerFrame::YUV400; + break; + } + /* dump input information to stderr */ av_dump_format( fmt_ctx, 0, src_filename, 0 ); if( !video_stream )