Add seek functions into the playuver
This commit is contained in:
1 parent
585c402335
commit
50fd611291
5 files changed
+30
-4
No files matched your search
@@ -304,6 +304,8 @@ cv::Mat InputStream::getFrameCvMat()
|
||||
|
||||
Void InputStream::seekInput( Int new_frame_num )
|
||||
{
|
||||
if( new_frame_num < 0 || new_frame_num >= m_uiTotalFrameNum )
|
||||
return;
|
||||
#ifdef USE_FFMPEG
|
||||
if( m_cLibAvContext.getStatus() )
|
||||
{
|
||||
|
||||
@@ -208,15 +208,21 @@ bool SubWindowHandle::playEvent()
|
||||
return false;
|
||||
}
|
||||
|
||||
Void SubWindowHandle::seekEvent( UInt new_frame_num )
|
||||
Void SubWindowHandle::seekAbsoluteEvent( UInt new_frame_num )
|
||||
{
|
||||
m_pCurrStream->seekInput( new_frame_num );
|
||||
refreshFrame();
|
||||
}
|
||||
|
||||
Void SubWindowHandle::seekRelativeEvent( Bool bIsFoward )
|
||||
{
|
||||
m_pCurrStream->seekInput( m_pCurrStream->getCurrFrameNum() + ( bIsFoward ? 1 : -1 ) );
|
||||
refreshFrame();
|
||||
}
|
||||
|
||||
Void SubWindowHandle::stopEvent()
|
||||
{
|
||||
seekEvent( 0 );
|
||||
seekAbsoluteEvent( 0 );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,8 @@ public:
|
||||
Bool save();
|
||||
|
||||
Void stopEvent();
|
||||
Void seekEvent( UInt new_frame_num );
|
||||
Void seekAbsoluteEvent( UInt new_frame_num );
|
||||
Void seekRelativeEvent( Bool bIsFoward );
|
||||
|
||||
QImage* FrameToQImage( PlaYUVerFrame* curr_frame );
|
||||
|
||||
|
||||
@@ -220,11 +220,19 @@ void plaYUVerApp::playEvent()
|
||||
}
|
||||
}
|
||||
|
||||
void plaYUVerApp::seekEvent( int direction )
|
||||
{
|
||||
if( activeSubWindow() )
|
||||
{
|
||||
activeSubWindow()->seekRelativeEvent( direction > 0 ? true : false );
|
||||
}
|
||||
}
|
||||
|
||||
void plaYUVerApp::seekSliderEvent( int new_frame_num )
|
||||
{
|
||||
if( activeSubWindow() )
|
||||
{
|
||||
activeSubWindow()->seekEvent( new_frame_num );
|
||||
activeSubWindow()->seekAbsoluteEvent( (UInt)new_frame_num );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -543,10 +551,17 @@ Void plaYUVerApp::createActions()
|
||||
actionVideoStop->setIcon( QIcon( style()->standardIcon( QStyle::SP_MediaStop ) ) );
|
||||
connect( actionVideoStop, SIGNAL( triggered() ), this, SLOT( stop() ) );
|
||||
|
||||
mapperSeekVideo = new QSignalMapper( this );
|
||||
connect( mapperSeekVideo, SIGNAL( mapped(int) ), this, SLOT( seekEvent(int) ) );
|
||||
|
||||
actionVideoBackward = new QAction( "VideoBackward", this );
|
||||
actionVideoBackward->setIcon( QIcon( style()->standardIcon( QStyle::SP_MediaSeekBackward ) ) );
|
||||
connect( actionVideoBackward, SIGNAL( triggered() ), mapperSeekVideo, SLOT( map() ) );
|
||||
mapperSeekVideo->setMapping( actionVideoBackward, 0 );
|
||||
actionVideoForward = new QAction( "VideoForward", this );
|
||||
actionVideoForward->setIcon( QIcon( style()->standardIcon( QStyle::SP_MediaSeekForward ) ) );
|
||||
connect( actionVideoForward, SIGNAL( triggered() ), mapperSeekVideo, SLOT( map() ) );
|
||||
mapperSeekVideo->setMapping( actionVideoForward, 1 );
|
||||
|
||||
actionVideoLoop = new QAction( "Repeat", this );
|
||||
actionVideoLoop->setCheckable( true );
|
||||
|
||||
@@ -65,6 +65,7 @@ private Q_SLOTS:
|
||||
void stop();
|
||||
void playEvent();
|
||||
void seekSliderEvent( int new_frame_num );
|
||||
void seekEvent( int direction );
|
||||
|
||||
void selectModule( QAction * );
|
||||
|
||||
@@ -118,6 +119,7 @@ private:
|
||||
QSlider *m_pcFrameSlider;
|
||||
|
||||
QSignalMapper *mapperZoom;
|
||||
QSignalMapper *mapperSeekVideo;
|
||||
QSignalMapper *mapperWindow;
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user