Skip to content

Commit

Permalink
player: ensure seekFinished is emitted if play from startPosition
Browse files Browse the repository at this point in the history
Then wang-bin#637 can be simplified as
player.setStartPosition(5000); ;
connect(&player, &AVPlayer::seekFinished, this,
&PlayerWindow::pauseOnSeek);
  • Loading branch information
wang-bin committed Jun 25, 2016
1 parent 2d9e527 commit b842b64
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/AVPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1232,12 +1232,7 @@ void AVPlayer::playInternal()
qDebug("Starting video thread...");
d->vthread->start();
}
if (d->start_position_norm > 0) {
if (relativeTimeMode())
d->demuxer.seek(qint64((d->start_position_norm + absoluteMediaStartPosition())));
else
d->demuxer.seek((qint64)(d->start_position_norm));
}

d->read_thread->setMediaEndAction(mediaEndAction());
d->read_thread->start();

Expand All @@ -1253,6 +1248,12 @@ void AVPlayer::playInternal()
}
d->state = PlayingState;
} //end lock scoped here to avoid dead lock if connect started() to a slot that call unload()/play()
if (d->start_position_norm > 0) {
if (relativeTimeMode())
setPosition(qint64((d->start_position_norm + absoluteMediaStartPosition())));
else
setPosition((qint64)(d->start_position_norm));
}
Q_EMIT stateChanged(PlayingState);
Q_EMIT started(); //we called stop(), so must emit started()
}
Expand Down

0 comments on commit b842b64

Please sign in to comment.