Commit cce937e6 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen
Browse files

Added failback when FPS can't be determined by the media player

parent 63f5523e
...@@ -39,7 +39,6 @@ ClipRenderer::ClipRenderer() : ...@@ -39,7 +39,6 @@ ClipRenderer::ClipRenderer() :
connect( m_mediaPlayer, SIGNAL( stopped() ), this, SLOT( __videoStopped() ) ); connect( m_mediaPlayer, SIGNAL( stopped() ), this, SLOT( __videoStopped() ) );
connect( m_mediaPlayer, SIGNAL( paused() ), this, SLOT( __videoPaused() ) ); connect( m_mediaPlayer, SIGNAL( paused() ), this, SLOT( __videoPaused() ) );
connect( m_mediaPlayer, SIGNAL( playing() ), this, SLOT( __videoPlaying() ) ); connect( m_mediaPlayer, SIGNAL( playing() ), this, SLOT( __videoPlaying() ) );
connect( m_mediaPlayer, SIGNAL( positionChanged() ), this, SLOT( __positionChanged() ) );
connect( m_mediaPlayer, SIGNAL( timeChanged() ), this, SLOT( __timeChanged() ) ); connect( m_mediaPlayer, SIGNAL( timeChanged() ), this, SLOT( __timeChanged() ) );
connect( m_mediaPlayer, SIGNAL( endReached() ), this, SLOT( __endReached() ) ); connect( m_mediaPlayer, SIGNAL( endReached() ), this, SLOT( __endReached() ) );
} }
...@@ -248,21 +247,27 @@ void ClipRenderer::__videoPlaying() ...@@ -248,21 +247,27 @@ void ClipRenderer::__videoPlaying()
emit playing(); emit playing();
} }
void ClipRenderer::__positionChanged() //void ClipRenderer::__positionChanged()
{ //{
if ( m_clipLoaded == false) // if ( m_clipLoaded == false)
return ; // return ;
//
float begin = m_begin / ( m_end - m_begin ); // qDebug() << "begin:" << m_begin << "end:" << m_end;
float end = m_end / ( m_end - m_begin ); // qDebug() << "position:" << m_mediaPlayer->getPosition();
float pos = ( m_mediaPlayer->getPosition() - begin ) / // float begin = m_begin / ( m_end - m_begin );
( end - begin ); // float end = m_end / ( m_end - m_begin );
emit frameChanged( pos, MainWorkflow::Renderer ); // float pos = ( m_mediaPlayer->getPosition() - begin ) /
} // ( end - begin );
// qDebug() << pos;
// emit frameChanged( pos, MainWorkflow::Renderer );
//}
void ClipRenderer::__timeChanged() void ClipRenderer::__timeChanged()
{ {
qint64 f = qRound64( (qreal)m_mediaPlayer->getTime() / 1000.0 * (qreal)m_mediaPlayer->getFps() ); float fps = (qreal)m_mediaPlayer->getFps();
if ( fps < 0.1f )
fps = m_selectedMedia->getFps();
qint64 f = qRound64( (qreal)m_mediaPlayer->getTime() / 1000.0 * fps );
emit frameChanged( f, MainWorkflow::Renderer ); emit frameChanged( f, MainWorkflow::Renderer );
} }
......
...@@ -70,7 +70,7 @@ public slots: ...@@ -70,7 +70,7 @@ public slots:
virtual void mediaUnloaded( const QUuid& ); virtual void mediaUnloaded( const QUuid& );
virtual void previewWidgetCursorChanged( qint64 newFrame ); virtual void previewWidgetCursorChanged( qint64 newFrame );
void __positionChanged(); // void __positionChanged();
void __timeChanged(); void __timeChanged();
void __videoPaused(); void __videoPaused();
void __videoPlaying(); void __videoPlaying();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment