diff --git a/rpcs3/rpcs3qt/game_list_grid.cpp b/rpcs3/rpcs3qt/game_list_grid.cpp index 5d4b90203f..4a762f288c 100644 --- a/rpcs3/rpcs3qt/game_list_grid.cpp +++ b/rpcs3/rpcs3qt/game_list_grid.cpp @@ -91,19 +91,19 @@ void game_list_grid::populate( if (const QPixmap pixmap = item->get_movie_image(frame); item->get_active() && !pixmap.isNull()) { item->set_icon(gui::utils::get_centered_pixmap(pixmap, m_icon_size, 0, 0, 1.0, Qt::FastTransformation)); + return; } - else - { - std::lock_guard lock(item->pixmap_mutex); + std::lock_guard lock(item->pixmap_mutex); + + if (!game->pxmap.isNull()) + { item->set_icon(game->pxmap); if (!game->has_hover_gif && !game->has_hover_pam) { game->pxmap = {}; } - - item->stop_movie(); } }); diff --git a/rpcs3/rpcs3qt/game_list_table.cpp b/rpcs3/rpcs3qt/game_list_table.cpp index 96f94787b5..31950ab177 100644 --- a/rpcs3/rpcs3qt/game_list_table.cpp +++ b/rpcs3/rpcs3qt/game_list_table.cpp @@ -252,19 +252,19 @@ void game_list_table::populate( if (const QPixmap pixmap = icon_item->get_movie_image(frame); icon_item->get_active() && !pixmap.isNull()) { icon_item->setData(Qt::DecorationRole, pixmap.scaled(m_icon_size, Qt::KeepAspectRatio)); + return; } - else - { - std::lock_guard lock(icon_item->pixmap_mutex); + std::lock_guard lock(icon_item->pixmap_mutex); + + if (!game->pxmap.isNull()) + { icon_item->setData(Qt::DecorationRole, game->pxmap); if (!game->has_hover_gif && !game->has_hover_pam) { game->pxmap = {}; } - - icon_item->stop_movie(); } }); diff --git a/rpcs3/rpcs3qt/qt_video_source.cpp b/rpcs3/rpcs3qt/qt_video_source.cpp index ad5332d1bf..107e5ef850 100644 --- a/rpcs3/rpcs3qt/qt_video_source.cpp +++ b/rpcs3/rpcs3qt/qt_video_source.cpp @@ -34,11 +34,11 @@ void qt_video_source::set_active(bool active) } } -void qt_video_source::image_change_callback() const +void qt_video_source::image_change_callback(const QVideoFrame& frame) const { if (m_image_change_callback) { - m_image_change_callback({}); + m_image_change_callback(frame); } } @@ -65,7 +65,7 @@ void qt_video_source::init_movie() if (lower.endsWith(".gif")) { - m_movie.reset(new QMovie(m_video_path)); + m_movie = std::make_unique(m_video_path); m_video_path.clear(); if (!m_movie->isValid()) @@ -76,7 +76,7 @@ void qt_video_source::init_movie() QObject::connect(m_movie.get(), &QMovie::frameChanged, m_movie.get(), [this](int) { - m_image_change_callback({}); + image_change_callback(); m_has_new = true; }); return; @@ -98,18 +98,18 @@ void qt_video_source::init_movie() return; } - m_video_buffer.reset(new QBuffer(&m_video_data)); + m_video_buffer = std::make_unique(&m_video_data); m_video_buffer->open(QIODevice::ReadOnly); } - m_video_sink.reset(new QVideoSink()); + m_video_sink = std::make_unique(); QObject::connect(m_video_sink.get(), &QVideoSink::videoFrameChanged, m_video_sink.get(), [this](const QVideoFrame& frame) { - m_image_change_callback(frame); + image_change_callback(frame); m_has_new = true; }); - m_media_player.reset(new QMediaPlayer()); + m_media_player = std::make_unique(); m_media_player->setVideoSink(m_video_sink.get()); m_media_player->setLoops(QMediaPlayer::Infinite); diff --git a/rpcs3/rpcs3qt/qt_video_source.h b/rpcs3/rpcs3qt/qt_video_source.h index 27f716f0d4..a2710eea33 100644 --- a/rpcs3/rpcs3qt/qt_video_source.h +++ b/rpcs3/rpcs3qt/qt_video_source.h @@ -31,7 +31,7 @@ public: QPixmap get_movie_image(const QVideoFrame& frame) const; - void image_change_callback() const; + void image_change_callback(const QVideoFrame& frame = {}) const; void set_image_change_callback(const std::function& func); protected: @@ -49,8 +49,8 @@ protected: std::unique_ptr m_video_buffer; std::unique_ptr m_media_player; - std::shared_ptr m_video_sink; - std::shared_ptr m_movie; + std::unique_ptr m_video_sink; + std::unique_ptr m_movie; std::function m_image_change_callback = nullptr;