From ff66c4fc2b088b508badb6e9bf83f90f7ba333ec Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Mon, 2 Feb 2015 14:35:14 +0000 Subject: [PATCH 1/4] Add support for more ffmpeg formats --- lib/LibAvContextHandle.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/LibAvContextHandle.cpp b/lib/LibAvContextHandle.cpp index fe2156f..fa9a6e9 100644 --- a/lib/LibAvContextHandle.cpp +++ b/lib/LibAvContextHandle.cpp @@ -179,13 +179,27 @@ Bool LibAvContextHandle::initAvFormat( char* filename, UInt& width, UInt& height num_frames = 0; } + Int pix_fmt = video_dec_ctx->pix_fmt; + switch( pix_fmt ) + { + case AV_PIX_FMT_YUVJ420P: + pix_fmt = AV_PIX_FMT_YUV420P; + break; + case AV_PIX_FMT_YUVJ422P: + pix_fmt = AV_PIX_FMT_YUV422P; + break; + case AV_PIX_FMT_YUVJ444P: + pix_fmt = AV_PIX_FMT_YUV444P; + break; + } + width = video_dec_ctx->width; height = video_dec_ctx->height; pixel_format = PlaYUVerFrame::NO_FMT; for( Int i = 0; i < PLAYUVER_NUMBER_FORMATS; i++ ) { - if( g_PlaYUVerFramePelFormatsList[i].ffmpegPelFormat == video_dec_ctx->pix_fmt ) + if( g_PlaYUVerFramePelFormatsList[i].ffmpegPelFormat == pix_fmt ) { pixel_format = i; break; From 5773770fe099a3a937dc6acf8d83762e01fa71a7 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Mon, 2 Feb 2015 15:50:55 +0000 Subject: [PATCH 2/4] Increase limits --- app/ConfigureFormatDialog.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/ConfigureFormatDialog.cpp b/app/ConfigureFormatDialog.cpp index ca73973..5af7007 100644 --- a/app/ConfigureFormatDialog.cpp +++ b/app/ConfigureFormatDialog.cpp @@ -118,12 +118,12 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget *parent ) : resolutionLabel->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed ) ); QLabel* widthLabel = new QLabel( "Width" ); m_spinBoxWidth = new QSpinBox(); - m_spinBoxWidth->setRange( 0, 8192 ); + m_spinBoxWidth->setRange( 0, 9999 ); m_spinBoxWidth->setValue( 0 ); QLabel* heightLabel = new QLabel( "Height" ); m_spinBoxheight = new QSpinBox(); - m_spinBoxheight->setRange( 0, 4608 ); + m_spinBoxheight->setRange( 0, 9999 ); m_spinBoxheight->setValue( 0 ); QLabel* pixelsLabel = new QLabel(); From 4f5d8f4cd6ac55b24272df88204249b982cfd247 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Mon, 2 Feb 2015 15:58:12 +0000 Subject: [PATCH 3/4] Fix pixel value in gray images --- app/ViewArea.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/ViewArea.cpp b/app/ViewArea.cpp index 711821e..90ab4c3 100644 --- a/app/ViewArea.cpp +++ b/app/ViewArea.cpp @@ -381,7 +381,7 @@ void ViewArea::paintEvent( QPaintEvent *event ) } if( frFormat == PlaYUVerFrame::COLOR_GRAY ) { - sPixelValue = m_pcCurrFrame->getPixelValue( pixelTopLeft.x(), pixelTopLeft.y(), PlaYUVerFrame::COLOR_YUV ); + sPixelValue = m_pcCurrFrame->getPixelValue( pixelTopLeft.x(), pixelTopLeft.y(), PlaYUVerFrame::COLOR_GRAY ); if( sPixelValue.Y() < 128 ) painter.setPen( QColor( Qt::white ) ); From 4bc48fb2e27e0f3215f5b5250b8763f5e2cdb902 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Mon, 2 Feb 2015 16:04:25 +0000 Subject: [PATCH 4/4] Fix displaying pel values --- app/VideoSubWindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/VideoSubWindow.cpp b/app/VideoSubWindow.cpp index 7641cb5..c59d566 100644 --- a/app/VideoSubWindow.cpp +++ b/app/VideoSubWindow.cpp @@ -486,7 +486,7 @@ Void VideoSubWindow::updatePixelValueStatusBar( const QPoint& pos ) Int ColorSpace = m_pcCurrFrame->getColorSpace(); if( ColorSpace == PlaYUVerFrame::COLOR_GRAY ) { - sPixelValue = m_pcCurrFrame->getPixelValue( pos.x(), pos.y(), PlaYUVerFrame::COLOR_YUV ); + sPixelValue = m_pcCurrFrame->getPixelValue( pos.x(), pos.y(), PlaYUVerFrame::COLOR_GRAY ); strStatus.append( QString( "Y: %1" ).arg( sPixelValue.Y() ) ); } if( ColorSpace == PlaYUVerFrame::COLOR_YUV )