mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-19 19:15:26 +00:00
Qt: use unique_ptr in qt_video_source
This commit is contained in:
parent
9295e6f5c8
commit
b96e41285c
2 changed files with 6 additions and 6 deletions
|
@ -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<QMovie>(m_video_path);
|
||||
m_video_path.clear();
|
||||
|
||||
if (!m_movie->isValid())
|
||||
|
@ -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<QBuffer>(&m_video_data);
|
||||
m_video_buffer->open(QIODevice::ReadOnly);
|
||||
}
|
||||
|
||||
m_video_sink.reset(new QVideoSink());
|
||||
m_video_sink = std::make_unique<QVideoSink>();
|
||||
QObject::connect(m_video_sink.get(), &QVideoSink::videoFrameChanged, m_video_sink.get(), [this](const QVideoFrame& frame)
|
||||
{
|
||||
m_image_change_callback(frame);
|
||||
m_has_new = true;
|
||||
});
|
||||
|
||||
m_media_player.reset(new QMediaPlayer());
|
||||
m_media_player = std::make_unique<QMediaPlayer>();
|
||||
m_media_player->setVideoSink(m_video_sink.get());
|
||||
m_media_player->setLoops(QMediaPlayer::Infinite);
|
||||
|
||||
|
|
|
@ -49,8 +49,8 @@ protected:
|
|||
|
||||
std::unique_ptr<QBuffer> m_video_buffer;
|
||||
std::unique_ptr<QMediaPlayer> m_media_player;
|
||||
std::shared_ptr<QVideoSink> m_video_sink;
|
||||
std::shared_ptr<QMovie> m_movie;
|
||||
std::unique_ptr<QVideoSink> m_video_sink;
|
||||
std::unique_ptr<QMovie> m_movie;
|
||||
|
||||
std::function<void(const QVideoFrame&)> m_image_change_callback = nullptr;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue