Fix chrash when closing
This commit is contained in:
1 parent
9cef35c310
commit
f10b9f06c7
5 files changed
+64
-80
No files matched your search
@@ -176,13 +176,14 @@ Void StreamPropertiesSideBar::setData( PlaYUVerStream* pcStream )
|
||||
// FramePropertiesSideBar
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
FramePropertiesSideBar::FramePropertiesSideBar( QWidget* parent, Bool *pbIsPlaying ) :
|
||||
QWidget( parent )
|
||||
FramePropertiesSideBar::FramePropertiesSideBar( QWidget* parent, Bool* pbMainPlaySwitch ) :
|
||||
QWidget( parent ),
|
||||
pbMainPlaySwitch( pbMainPlaySwitch )
|
||||
{
|
||||
// -------------- Variables definition --------------
|
||||
m_pcFrame = NULL;
|
||||
m_iLastFrameType = -1;
|
||||
m_pbIsPlaying = pbIsPlaying;
|
||||
m_pbIsPlaying = false;
|
||||
|
||||
// Histogram area -----------------------------------------------------
|
||||
|
||||
@@ -401,10 +402,12 @@ QSize FramePropertiesSideBar::sizeHint() const
|
||||
return bestSize( size() );
|
||||
}
|
||||
|
||||
Void FramePropertiesSideBar::setData( PlaYUVerFrame* pcFrame )
|
||||
Void FramePropertiesSideBar::setData( PlaYUVerFrame* pcFrame, Bool isPlaying )
|
||||
{
|
||||
m_pbIsPlaying = isPlaying;
|
||||
if( !pcFrame )
|
||||
{
|
||||
m_pcFrame = NULL;
|
||||
m_iLastFrameType = -1;
|
||||
labelMeanValue->clear();
|
||||
labelPixelsValue->clear();
|
||||
@@ -479,8 +482,11 @@ Void FramePropertiesSideBar::setData( PlaYUVerFrame* pcFrame )
|
||||
}
|
||||
}
|
||||
setEnabled( true );
|
||||
m_pcFrame = pcFrame;
|
||||
updateDataHistogram();
|
||||
if( m_pcFrame != pcFrame || !(*pbMainPlaySwitch) )
|
||||
{
|
||||
m_pcFrame = pcFrame;
|
||||
updateDataHistogram();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -517,7 +523,7 @@ Void FramePropertiesSideBar::updateDataHistogram()
|
||||
{
|
||||
if( m_pcFrame->isValid() && isVisible() )
|
||||
{
|
||||
if( !(*m_pbIsPlaying) )
|
||||
if( !( *pbMainPlaySwitch && m_pbIsPlaying ) )
|
||||
{
|
||||
// If a selection area is done in Image Editor and if the current
|
||||
// image is the same in Image Viewer, then compute too the histogram
|
||||
|
||||
@@ -68,12 +68,12 @@ class FramePropertiesSideBar: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
FramePropertiesSideBar( QWidget* parent, Bool *pbIsPlaying );
|
||||
FramePropertiesSideBar( QWidget* parent, Bool* pbMainPlaySwitch );
|
||||
~FramePropertiesSideBar();
|
||||
|
||||
QSize sizeHint() const;
|
||||
|
||||
Void setData( PlaYUVerFrame* m_pcStream );
|
||||
Void setData( PlaYUVerFrame* m_pcStream, Bool isPlaying );
|
||||
Void setSelection( const QRect &selectionArea );
|
||||
|
||||
Void stopHistogram();
|
||||
@@ -97,9 +97,12 @@ private:
|
||||
};
|
||||
|
||||
PlaYUVerFrame *m_pcFrame;
|
||||
Bool* m_pbIsPlaying;
|
||||
Int m_iLastFrameType;
|
||||
|
||||
Bool* pbMainPlaySwitch;
|
||||
Bool m_pbIsPlaying;
|
||||
|
||||
|
||||
QComboBox *channelCB;
|
||||
QComboBox *colorsCB;
|
||||
QComboBox *renderingCB;
|
||||
|
||||
+29
-49
@@ -436,9 +436,6 @@ Void plaYUVerApp::updateStreamProperties()
|
||||
{
|
||||
if( m_pcCurrentVideoSubWindow )
|
||||
{
|
||||
m_pcStreamProperties->setData( m_pcCurrentVideoSubWindow->getInputStream() );
|
||||
m_pcFrameProperties->setData( m_pcCurrentVideoSubWindow->getCurrFrame() );
|
||||
|
||||
Int frame_num = 0;
|
||||
UInt64 total_frame_num = 1;
|
||||
if( m_pcCurrentVideoSubWindow->getInputStream() )
|
||||
@@ -446,11 +443,16 @@ Void plaYUVerApp::updateStreamProperties()
|
||||
frame_num = m_pcCurrentVideoSubWindow->getInputStream()->getCurrFrameNum();
|
||||
m_pcFrameNumInfo->setCurrFrameNum( frame_num );
|
||||
total_frame_num = getMaxFrameNumber();
|
||||
m_pcStreamProperties->setData( m_pcCurrentVideoSubWindow->getInputStream() );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pcStreamProperties->setData( NULL );
|
||||
m_pcFrameNumInfo->setCurrFrameNum( 0 );
|
||||
}
|
||||
|
||||
m_pcFrameProperties->setData( m_pcCurrentVideoSubWindow->getCurrFrame(), m_pcCurrentVideoSubWindow->isPlaying() );
|
||||
|
||||
m_pcFrameSlider->setValue( frame_num );
|
||||
m_pcFrameSlider->setMaximum( total_frame_num - 1 );
|
||||
m_pcFrameNumInfo->setTotalFrameNum( total_frame_num );
|
||||
@@ -464,7 +466,7 @@ Void plaYUVerApp::updateStreamProperties()
|
||||
return;
|
||||
}
|
||||
m_pcStreamProperties->setData( NULL );
|
||||
m_pcFrameProperties->setData( NULL );
|
||||
m_pcFrameProperties->setData( NULL, false );
|
||||
m_pcFrameNumInfo->setCurrFrameNum( 0 );
|
||||
m_pcFrameNumInfo->setTotalFrameNum( 0 );
|
||||
m_pcZoomFactorSBox->setValue( 0.0 );
|
||||
@@ -481,7 +483,7 @@ Void plaYUVerApp::updatePropertiesSelectedArea( QRect area )
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pcFrameProperties->setData( NULL );
|
||||
m_pcFrameProperties->setData( NULL, false );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -525,46 +527,27 @@ Void plaYUVerApp::play()
|
||||
{
|
||||
UInt frameRate;
|
||||
UInt timeInterval;
|
||||
if( m_acPlayingSubWindows.size() > 0 )
|
||||
{
|
||||
if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) )
|
||||
{
|
||||
for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||
{
|
||||
m_acPlayingSubWindows.at( i )->play();
|
||||
}
|
||||
frameRate = m_acPlayingSubWindows.at( 0 )->getInputStream()->getFrameRate();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pcCurrentVideoSubWindow->play();
|
||||
frameRate = m_pcCurrentVideoSubWindow->getInputStream()->getFrameRate();
|
||||
}
|
||||
timeInterval = ( UInt )( 1000.0 / frameRate + 0.5 );
|
||||
m_pcPlayingTimer->setInterval( timeInterval );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) )
|
||||
if( m_acPlayingSubWindows.size() < 2 )
|
||||
{
|
||||
for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||
{
|
||||
m_acPlayingSubWindows.at( i )->pause();
|
||||
}
|
||||
m_acPlayingSubWindows.clear();
|
||||
m_acPlayingSubWindows.append( m_pcCurrentVideoSubWindow );
|
||||
}
|
||||
else
|
||||
if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) )
|
||||
{
|
||||
m_pcCurrentVideoSubWindow->pause();
|
||||
for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||
{
|
||||
m_acPlayingSubWindows.at( i )->play();
|
||||
}
|
||||
frameRate = m_acPlayingSubWindows.at( 0 )->getInputStream()->getFrameRate();
|
||||
timeInterval = ( UInt )( 1000.0 / frameRate + 0.5 );
|
||||
m_pcPlayingTimer->setInterval( timeInterval );
|
||||
}
|
||||
}
|
||||
setTimerStatus();
|
||||
updateStreamProperties();
|
||||
}
|
||||
|
||||
Void plaYUVerApp::pause()
|
||||
{
|
||||
if( m_pcCurrentVideoSubWindow )
|
||||
else
|
||||
{
|
||||
if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) )
|
||||
{
|
||||
@@ -601,6 +584,7 @@ Void plaYUVerApp::stop()
|
||||
}
|
||||
}
|
||||
updateStreamProperties();
|
||||
m_pcLockLabel->setVisible( false );
|
||||
}
|
||||
|
||||
Void plaYUVerApp::playEvent()
|
||||
@@ -608,19 +592,9 @@ Void plaYUVerApp::playEvent()
|
||||
Bool bEndOfSequence = false;
|
||||
try
|
||||
{
|
||||
if( m_acPlayingSubWindows.size() > 0 )
|
||||
for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||
{
|
||||
for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||
{
|
||||
bEndOfSequence |= m_acPlayingSubWindows.at( i )->playEvent();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_pcCurrentVideoSubWindow )
|
||||
{
|
||||
bEndOfSequence |= m_pcCurrentVideoSubWindow->playEvent();
|
||||
}
|
||||
bEndOfSequence |= m_acPlayingSubWindows.at( i )->playEvent();
|
||||
}
|
||||
if( bEndOfSequence && !m_arrayActions[VIDEO_LOOP_ACT]->isChecked() )
|
||||
{
|
||||
@@ -712,6 +686,7 @@ Void plaYUVerApp::videoSelectionButtonEvent()
|
||||
pcVideoSubWinodw->scaleView( scaleFactor );
|
||||
}
|
||||
}
|
||||
m_pcLockLabel->setVisible( true );
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -786,6 +761,7 @@ Void plaYUVerApp::chageSubWindowSelection()
|
||||
SubWindowHandle *new_window = activeSubWindow();
|
||||
if( activeSubWindow() != m_pcCurrentSubWindow )
|
||||
{
|
||||
m_pcCurrentVideoSubWindow = NULL;
|
||||
if( activeSubWindow() )
|
||||
{
|
||||
m_pcCurrentSubWindow = new_window;
|
||||
@@ -808,10 +784,10 @@ Void plaYUVerApp::chageSubWindowSelection()
|
||||
}
|
||||
m_pcQualityMeasurement->updateCurrentWindow( m_pcCurrentVideoSubWindow );
|
||||
}
|
||||
updateZoomFactorSBox();
|
||||
}
|
||||
}
|
||||
updateStreamProperties();
|
||||
updateZoomFactorSBox();
|
||||
m_pcQualityMeasurement->updateSubWindowList();
|
||||
updateMenus();
|
||||
}
|
||||
@@ -1171,6 +1147,9 @@ Void plaYUVerApp::createActions()
|
||||
m_arrayActions[VIDEO_FORWARD_ACT]->setIcon( QIcon( style()->standardIcon( QStyle::SP_MediaSeekForward ) ) );
|
||||
connect( m_arrayActions[VIDEO_LOCK_SELECTION_ACT], SIGNAL( triggered() ), this, SLOT( videoSelectionButtonEvent() ) );
|
||||
|
||||
m_pcLockLabel = new QLabel( "Playing Lock" );
|
||||
m_pcLockLabel->setVisible( true );
|
||||
|
||||
m_pcFrameSlider = new QSlider;
|
||||
m_pcFrameSlider->setOrientation( Qt::Horizontal );
|
||||
m_pcFrameSlider->setMaximumWidth( 100 );
|
||||
@@ -1356,6 +1335,7 @@ Void plaYUVerApp::createToolBars()
|
||||
m_arrayToolBars[VIDEO_TOOLBAR]->addAction( m_arrayActions[PLAY_ACT] );
|
||||
//m_arrayToolBars[VIDEO_TOOLBAR]->addAction( m_arrayActions[PAUSE_ACT] );
|
||||
m_arrayToolBars[VIDEO_TOOLBAR]->addAction( m_arrayActions[STOP_ACT] );
|
||||
m_arrayToolBars[VIDEO_TOOLBAR]->addWidget( m_pcLockLabel );
|
||||
m_arrayToolBars[VIDEO_TOOLBAR]->addAction( m_arrayActions[VIDEO_BACKWARD_ACT] );
|
||||
m_arrayToolBars[VIDEO_TOOLBAR]->addWidget( m_pcFrameSlider );
|
||||
m_arrayToolBars[VIDEO_TOOLBAR]->addAction( m_arrayActions[VIDEO_FORWARD_ACT] );
|
||||
|
||||
+1
-1
@@ -81,7 +81,6 @@ private Q_SLOTS:
|
||||
* Playing functions slots
|
||||
*/
|
||||
void play();
|
||||
void pause();
|
||||
void stop();
|
||||
void playEvent();
|
||||
void seekSliderEvent( int new_frame_num );
|
||||
@@ -199,6 +198,7 @@ private:
|
||||
|
||||
QVector<VideoSubWindow*> m_acPlayingSubWindows;
|
||||
|
||||
QLabel* m_pcLockLabel;
|
||||
QSlider* m_pcFrameSlider;
|
||||
WidgetFrameNumber* m_pcFrameNumInfo;
|
||||
QDoubleSpinBox *m_pcZoomFactorSBox;
|
||||
|
||||
+15
-20
@@ -80,7 +80,6 @@ PlaYUVerFrame::~PlaYUVerFrame()
|
||||
closePixfc();
|
||||
}
|
||||
|
||||
|
||||
Void PlaYUVerFrame::init( UInt width, UInt height, Int pel_format )
|
||||
{
|
||||
m_pppcInputPel = NULL;
|
||||
@@ -120,9 +119,9 @@ Int PlaYUVerFrame::getColorSpace() const
|
||||
}
|
||||
|
||||
Int PlaYUVerFrame::getNumberChannels() const
|
||||
{
|
||||
return m_pcPelFormat->numberChannels;
|
||||
}
|
||||
{
|
||||
return m_pcPelFormat->numberChannels;
|
||||
}
|
||||
|
||||
UInt64 PlaYUVerFrame::getBytesPerFrame()
|
||||
{
|
||||
@@ -195,7 +194,7 @@ Void PlaYUVerFrame::adjustSelectedAreaDims( UInt& posX, UInt& posY, UInt& areaWi
|
||||
if( ( posX + areaWidth ) % 2 )
|
||||
areaWidth++;
|
||||
if( ( posY + areaHeight ) % 2 )
|
||||
areaHeight++;
|
||||
areaHeight++;
|
||||
}
|
||||
|
||||
Void PlaYUVerFrame::copyFrom( PlaYUVerFrame* input_frame, UInt xPos, UInt yPos )
|
||||
@@ -230,7 +229,7 @@ PlaYUVerFrame::Pixel PlaYUVerFrame::getPixelValue( Int xPos, Int yPos, Int eColo
|
||||
PlaYUVerFrame::Pixel PlaYUVerFrame::ConvertPixel( PlaYUVerFrame::Pixel inputPixel, Int eOutputSpace )
|
||||
{
|
||||
Int outA, outB, outC;
|
||||
PlaYUVerFrame::Pixel outPixel(COLOR_INVALID, 0, 0, 0);
|
||||
PlaYUVerFrame::Pixel outPixel( COLOR_INVALID, 0, 0, 0 );
|
||||
|
||||
if( inputPixel.ColorSpace() == eOutputSpace || eOutputSpace == COLOR_ARGB || eOutputSpace == COLOR_GRAY )
|
||||
return inputPixel;
|
||||
@@ -308,26 +307,25 @@ Void PlaYUVerFrame::FrametoRGB8Pixfc()
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Void PlaYUVerFrame::getCvMat( Void** ppCvFrame )
|
||||
{
|
||||
#ifdef USE_OPENCV
|
||||
Int cvType = CV_8UC3;
|
||||
switch( m_iPixelFormat )
|
||||
{
|
||||
case YUV420p:
|
||||
case YUV444p:
|
||||
case YUV422p:
|
||||
case YUYV422:
|
||||
case YUV420p:
|
||||
case YUV444p:
|
||||
case YUV422p:
|
||||
case YUYV422:
|
||||
cvType = CV_8UC4;
|
||||
break;
|
||||
case GRAY:
|
||||
case GRAY:
|
||||
cvType = CV_8UC1;
|
||||
break;
|
||||
case RGB8:
|
||||
case RGB8:
|
||||
cvType = CV_8UC3;
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
cv::Mat *pcCvFrame = new cv::Mat( m_uiHeight, m_uiWidth, cvType );
|
||||
@@ -352,13 +350,13 @@ Void PlaYUVerFrame::fromCvMat( Void* voidFrame )
|
||||
{
|
||||
switch( opencvFrame->channels() )
|
||||
{
|
||||
case 1:
|
||||
case 1:
|
||||
m_iPixelFormat = GRAY;
|
||||
break;
|
||||
case 4:
|
||||
case 4:
|
||||
m_iPixelFormat = RGB8;
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -393,15 +391,12 @@ Void PlaYUVerFrame::fromCvMat( Void* voidFrame )
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
**************************************************************
|
||||
* Quality Related Function API
|
||||
**************************************************************
|
||||
*/
|
||||
|
||||
|
||||
Double PlaYUVerFrame::getQuality( Int Metric, PlaYUVerFrame* Org, Int component )
|
||||
{
|
||||
switch( Metric )
|
||||
|
||||
Reference in new issue
Block a user