mirror of
https://github.com/mapmapteam/mapmap.git
synced 2026-06-16 12:33:19 +02:00
Temporary fix black screen at the end of the playback
This commit is contained in:
@@ -302,16 +302,21 @@ void VideoImplQtMultiMedia::watchEndOfMedia(qint64 position)
|
||||
{
|
||||
if (_mediaPlayer->isVideoAvailable() && _rate > 0) { // If rate higher than 0
|
||||
if (_mediaPlayer->state() != QMediaPlayer::PausedState) { // Check playback state
|
||||
qreal frameRate = _videoSurface->surfaceFormat().frameRate(); // Current video frame rate
|
||||
qint64 frameCount = _mediaPlayer->duration() / 1000 * qint64(frameRate); // Total number of frames in the video
|
||||
qint64 currentFrame = position / 1000 * qint64(frameRate); // Current frame position
|
||||
if (currentFrame == frameCount) {
|
||||
_mediaPlayer->setPosition(0);
|
||||
qreal frameRate;
|
||||
#ifdef Q_OS_WIN32
|
||||
frameRate = _mediaPlayer->metaData("VideoFrameRate").toDouble(); // Current video frame rate
|
||||
#else
|
||||
frameRate = _videoSurface->surfaceFormat().frameRate(); // Current video frame rate
|
||||
#endif
|
||||
qint64 frameCount = _mediaPlayer->duration() * qint64(frameRate) / 1000; // Total number of frames in the video
|
||||
qint64 currentFrame = position * qint64(frameRate) / 1000; // Current frame position
|
||||
|
||||
if (currentFrame == frameCount) {
|
||||
_mediaPlayer->setPosition(1);
|
||||
_mediaPlayer->play();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -59,12 +59,12 @@ QList<QVideoFrame::PixelFormat> VideoSurface::supportedPixelFormats(
|
||||
{
|
||||
if (handleType == QAbstractVideoBuffer::NoHandle) {
|
||||
return QList<QVideoFrame::PixelFormat>()
|
||||
<< QVideoFrame::Format_ARGB32
|
||||
<< QVideoFrame::Format_ARGB32_Premultiplied
|
||||
<< QVideoFrame::Format_RGB32
|
||||
<< QVideoFrame::Format_RGB24
|
||||
<< QVideoFrame::Format_RGB565
|
||||
<< QVideoFrame::Format_RGB555
|
||||
<< QVideoFrame::Format_ARGB32
|
||||
<< QVideoFrame::Format_ARGB32_Premultiplied
|
||||
<< QVideoFrame::Format_BGR32
|
||||
<< QVideoFrame::Format_BGR24
|
||||
<< QVideoFrame::Format_BGR565
|
||||
|
||||
Reference in New Issue
Block a user