Commit 50ad682e authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Solving a repositionning bug when begin is != 0

parent a2cfb26c
......@@ -30,7 +30,7 @@ Instance::Instance()
{
char const *argv[] =
{
"-vvvvv",
// "-vvvvv",
"--no-skip-frames",
// "--intf", "dummy",
"--text-renderer", "dummy",
......
......@@ -153,6 +153,7 @@ qint64 MediaPlayer::getTime()
void MediaPlayer::setTime( qint64 time )
{
qDebug() << "Setting time:" << time;
libvlc_media_player_set_time( m_internalPtr, time, m_ex );
CheckVlcppException( m_ex );
}
......
......@@ -162,29 +162,27 @@ void ClipWorkflow::initialize()
m_mediaPlayer->setMedia( m_vlcMedia );
qDebug() << "Associating media to media player";
connect( m_mediaPlayer, SIGNAL( playing() ), this, SLOT( setPositionAfterPlayback() ), Qt::DirectConnection );
connect( m_mediaPlayer, SIGNAL( playing() ), this, SLOT( pauseAfterPlaybackStarted() ), Qt::DirectConnection );
connect( m_mediaPlayer, SIGNAL( endReached() ), this, SLOT( clipEndReached() ), Qt::DirectConnection );
qDebug() << "Starting playback";
m_mediaPlayer->play();
}
//FIXME: this step is probably useless, due to modification in the TrackWorkflow
void ClipWorkflow::setPositionAfterPlayback()
{
disconnect( m_mediaPlayer, SIGNAL( playing() ), this, SLOT( setPositionAfterPlayback() ) );
connect( m_mediaPlayer, SIGNAL( timeChanged() ), this, SLOT( pauseAfterPlaybackStarted() ), Qt::DirectConnection );
m_mediaPlayer->setTime( m_clip->getBegin() );
}
//void ClipWorkflow::setPositionAfterPlayback()
//{
// disconnect( m_mediaPlayer, SIGNAL( playing() ), this, SLOT( setPositionAfterPlayback() ) );
// connect( m_mediaPlayer, SIGNAL( timeChanged() ), this, SLOT( pauseAfterPlaybackStarted() ), Qt::DirectConnection );
//
// m_mediaPlayer->setTime( m_clip->getBegin() );
//}
void ClipWorkflow::pauseAfterPlaybackStarted()
{
disconnect( m_mediaPlayer, SIGNAL( timeChanged() ), this, SLOT( pauseAfterPlaybackStarted() ) );
//FIXME: it seems that this signal is never connected :o
// disconnect( m_mediaPlayer, SIGNAL( timeChanged() ), this, SLOT( pauseAfterPlaybackStarted() ) );
disconnect( m_mediaPlayer, SIGNAL( playing() ), this, SLOT( pauseAfterPlaybackStarted() ) );
connect( m_mediaPlayer, SIGNAL( paused() ), this, SLOT( initializedMediaPlayer() ), Qt::DirectConnection );
qDebug() << "Media player position changed";
m_mediaPlayer->pause();
}
......
......@@ -210,7 +210,7 @@ class ClipWorkflow : public QObject
private slots:
void pauseAfterPlaybackStarted();
void initializedMediaPlayer();
void setPositionAfterPlayback();
// void setPositionAfterPlayback();
void pausedMediaPlayer();
void unpausedMediaPlayer();
......
......@@ -564,7 +564,8 @@ void TrackWorkflow::clear()
void TrackWorkflow::adjustClipTime( qint64 currentFrame, qint64 start, ClipWorkflow* cw )
{
qint64 nbMs = ( currentFrame - start ) / cw->getClip()->getParent()->getFps() * 1000;
qint64 startFrame = cw->getClip()->getBegin() + nbMs;
qint64 beginInMs = cw->getClip()->getBegin() / cw->getClip()->getParent()->getFps() * 1000;
qint64 startFrame = beginInMs + nbMs;
cw->setTime( startFrame );
}
......
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