mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 15:45:38 +00:00
Fixed an issue where audio for static videos in the gamelist view would get muted on navigation.
This commit is contained in:
parent
28209ecf08
commit
993efe8504
|
@ -21,11 +21,9 @@ GamelistView::GamelistView(FileData* root)
|
||||||
, mRenderer {Renderer::getInstance()}
|
, mRenderer {Renderer::getInstance()}
|
||||||
, mViewStyle {ViewController::BASIC}
|
, mViewStyle {ViewController::BASIC}
|
||||||
, mLegacyMode {false}
|
, mLegacyMode {false}
|
||||||
|
, mStaticVideoAudio {false}
|
||||||
{
|
{
|
||||||
mViewStyle = ViewController::getInstance()->getState().viewstyle;
|
mViewStyle = ViewController::getInstance()->getState().viewstyle;
|
||||||
|
|
||||||
if (mLegacyMode)
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GamelistView::~GamelistView()
|
GamelistView::~GamelistView()
|
||||||
|
@ -108,6 +106,7 @@ void GamelistView::onThemeChanged(const std::shared_ptr<ThemeData>& theme)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mStaticVideoAudio = false;
|
||||||
const bool isStartupSystem {Settings::getInstance()->getString("StartupSystem") ==
|
const bool isStartupSystem {Settings::getInstance()->getString("StartupSystem") ==
|
||||||
mRoot->getSystem()->getName()};
|
mRoot->getSystem()->getName()};
|
||||||
|
|
||||||
|
@ -199,6 +198,8 @@ void GamelistView::onThemeChanged(const std::shared_ptr<ThemeData>& theme)
|
||||||
if (mStaticVideoComponents.back()->getMetadataElement())
|
if (mStaticVideoComponents.back()->getMetadataElement())
|
||||||
mStaticVideoComponents.back()->setScrollHide(true);
|
mStaticVideoComponents.back()->setScrollHide(true);
|
||||||
mStaticVideoComponents.back()->setGeneralFade(true);
|
mStaticVideoComponents.back()->setGeneralFade(true);
|
||||||
|
if (element.second.has("audio"))
|
||||||
|
mStaticVideoAudio = element.second.get<bool>("audio");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mVideoComponents.push_back(std::make_unique<VideoFFmpegComponent>());
|
mVideoComponents.push_back(std::make_unique<VideoFFmpegComponent>());
|
||||||
|
@ -552,7 +553,7 @@ void GamelistView::updateView(const CursorState& state)
|
||||||
if (file == nullptr) {
|
if (file == nullptr) {
|
||||||
if (mVideoPlaying) {
|
if (mVideoPlaying) {
|
||||||
for (auto& video : mVideoComponents) {
|
for (auto& video : mVideoComponents) {
|
||||||
video->stopVideoPlayer();
|
video->stopVideoPlayer(!mStaticVideoAudio);
|
||||||
video->setVideo("");
|
video->setVideo("");
|
||||||
if (!video->hasStartDelay())
|
if (!video->hasStartDelay())
|
||||||
video->setImage("");
|
video->setImage("");
|
||||||
|
@ -576,7 +577,7 @@ void GamelistView::updateView(const CursorState& state)
|
||||||
for (auto& video : mVideoComponents) {
|
for (auto& video : mVideoComponents) {
|
||||||
setGameImage(mRandomGame, video.get());
|
setGameImage(mRandomGame, video.get());
|
||||||
|
|
||||||
video->stopVideoPlayer();
|
video->stopVideoPlayer(!mStaticVideoAudio);
|
||||||
|
|
||||||
if (video->hasStaticVideo())
|
if (video->hasStaticVideo())
|
||||||
video->setStaticVideo();
|
video->setStaticVideo();
|
||||||
|
@ -593,7 +594,7 @@ void GamelistView::updateView(const CursorState& state)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& video : mVideoComponents) {
|
for (auto& video : mVideoComponents) {
|
||||||
video->stopVideoPlayer();
|
video->stopVideoPlayer(!mStaticVideoAudio);
|
||||||
video->setImage("");
|
video->setImage("");
|
||||||
video->setVideo("");
|
video->setVideo("");
|
||||||
if (video->hasStaticVideo()) {
|
if (video->hasStaticVideo()) {
|
||||||
|
@ -612,7 +613,7 @@ void GamelistView::updateView(const CursorState& state)
|
||||||
|
|
||||||
for (auto& video : mVideoComponents) {
|
for (auto& video : mVideoComponents) {
|
||||||
setGameImage(file, video.get());
|
setGameImage(file, video.get());
|
||||||
video->stopVideoPlayer();
|
video->stopVideoPlayer(!mStaticVideoAudio);
|
||||||
|
|
||||||
if (video->hasStaticVideo())
|
if (video->hasStaticVideo())
|
||||||
video->setStaticVideo();
|
video->setStaticVideo();
|
||||||
|
|
|
@ -127,6 +127,7 @@ private:
|
||||||
HelpStyle mHelpStyle;
|
HelpStyle mHelpStyle;
|
||||||
ViewController::GamelistViewStyle mViewStyle;
|
ViewController::GamelistViewStyle mViewStyle;
|
||||||
bool mLegacyMode;
|
bool mLegacyMode;
|
||||||
|
bool mStaticVideoAudio;
|
||||||
|
|
||||||
std::shared_ptr<ThemeData> mTheme;
|
std::shared_ptr<ThemeData> mTheme;
|
||||||
std::vector<GuiComponent*> mThemeExtras;
|
std::vector<GuiComponent*> mThemeExtras;
|
||||||
|
|
|
@ -90,7 +90,7 @@ public:
|
||||||
|
|
||||||
// Basic video controls.
|
// Basic video controls.
|
||||||
void startVideoPlayer();
|
void startVideoPlayer();
|
||||||
virtual void stopVideoPlayer() {}
|
virtual void stopVideoPlayer(bool muteAudio = true) {}
|
||||||
virtual void pauseVideoPlayer() {}
|
virtual void pauseVideoPlayer() {}
|
||||||
|
|
||||||
// Handle looping of the video. Must be called periodically.
|
// Handle looping of the video. Must be called periodically.
|
||||||
|
|
|
@ -1441,8 +1441,9 @@ void VideoFFmpegComponent::startVideoStream()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoFFmpegComponent::stopVideoPlayer()
|
void VideoFFmpegComponent::stopVideoPlayer(bool muteAudio)
|
||||||
{
|
{
|
||||||
|
if (muteAudio)
|
||||||
muteVideoPlayer();
|
muteVideoPlayer();
|
||||||
|
|
||||||
mIsPlaying = false;
|
mIsPlaying = false;
|
||||||
|
|
|
@ -47,7 +47,7 @@ public:
|
||||||
// Never breaks the aspect ratio. setMaxSize() and setResize() are mutually exclusive.
|
// Never breaks the aspect ratio. setMaxSize() and setResize() are mutually exclusive.
|
||||||
void setMaxSize(float width, float height) override;
|
void setMaxSize(float width, float height) override;
|
||||||
// Basic video controls.
|
// Basic video controls.
|
||||||
void stopVideoPlayer() override;
|
void stopVideoPlayer(bool muteAudio = true) override;
|
||||||
void pauseVideoPlayer() override;
|
void pauseVideoPlayer() override;
|
||||||
// Handle looping of the video. Must be called periodically.
|
// Handle looping of the video. Must be called periodically.
|
||||||
void handleLooping() override;
|
void handleLooping() override;
|
||||||
|
|
Loading…
Reference in a new issue