mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-03-24 19:38:32 -06:00
Qt: start hover audio/video after a timeout
This commit is contained in:
parent
40229adb14
commit
51514f9dc8
@ -27,6 +27,7 @@ static std::array<qt_audio_instance, 2> s_audio_instance = {};
|
||||
qt_video_source::qt_video_source(bool is_emulation)
|
||||
: video_source()
|
||||
, m_audio_instance_index(is_emulation ? qt_audio_instance::emu_index : qt_audio_instance::gui_index)
|
||||
, m_video_timer_timeout_ms(is_emulation ? 0 : 1000)
|
||||
{
|
||||
}
|
||||
|
||||
@ -56,7 +57,7 @@ void qt_video_source::set_active(bool active)
|
||||
|
||||
if (active)
|
||||
{
|
||||
start_movie();
|
||||
start_movie_timer();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -187,6 +188,27 @@ void qt_video_source::init_movie()
|
||||
}
|
||||
}
|
||||
|
||||
void qt_video_source::start_movie_timer()
|
||||
{
|
||||
if (m_video_timer_timeout_ms == 0)
|
||||
{
|
||||
start_movie();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_video_timer)
|
||||
{
|
||||
m_video_timer = std::make_unique<QTimer>();
|
||||
QObject::connect(m_video_timer.get(), &QTimer::timeout, m_video_timer.get(), [this]()
|
||||
{
|
||||
if (!m_active) return;
|
||||
start_movie();
|
||||
});
|
||||
}
|
||||
|
||||
m_video_timer->start(m_video_timer_timeout_ms);
|
||||
}
|
||||
|
||||
void qt_video_source::start_movie()
|
||||
{
|
||||
init_movie();
|
||||
@ -210,6 +232,7 @@ void qt_video_source::start_movie()
|
||||
void qt_video_source::stop_movie()
|
||||
{
|
||||
m_active = false;
|
||||
m_video_timer.reset();
|
||||
|
||||
if (m_movie)
|
||||
{
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
#include <QVideoSink>
|
||||
#include <QVideoFrame>
|
||||
#include <QPixmap>
|
||||
#include <QTimer>
|
||||
|
||||
class qt_video_source : public video_source
|
||||
{
|
||||
@ -29,6 +30,7 @@ public:
|
||||
void set_active(bool active) override;
|
||||
bool get_active() const override { return m_active; }
|
||||
|
||||
void start_movie_timer();
|
||||
void start_movie();
|
||||
void stop_movie();
|
||||
|
||||
@ -51,11 +53,13 @@ protected:
|
||||
QString m_video_path;
|
||||
QString m_audio_path;
|
||||
u32 m_audio_instance_index = 0;
|
||||
u32 m_video_timer_timeout_ms = 0;
|
||||
std::string m_iso_path; // path of the source archive
|
||||
QByteArray m_video_data{};
|
||||
QImage m_image{};
|
||||
std::vector<u8> m_image_path;
|
||||
|
||||
std::unique_ptr<QTimer> m_video_timer;
|
||||
std::unique_ptr<QBuffer> m_video_buffer;
|
||||
std::unique_ptr<QMediaPlayer> m_media_player;
|
||||
std::unique_ptr<QVideoSink> m_video_sink;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user