diff --git a/es-app/src/views/GamelistView.cpp b/es-app/src/views/GamelistView.cpp index 2e39acc6a..c22226195 100644 --- a/es-app/src/views/GamelistView.cpp +++ b/es-app/src/views/GamelistView.cpp @@ -561,14 +561,14 @@ void GamelistView::updateView(const CursorState& state) } } - bool fadingOut = false; + bool fadingOut {false}; if (file == nullptr) { if (mVideoPlaying) { for (auto& video : mVideoComponents) { video->stopVideoPlayer(!mStaticVideoAudio); video->setVideo(""); if (!video->hasStartDelay()) - video->setImage(""); + video->setImageNoDefault(""); } } mVideoPlaying = false; @@ -588,7 +588,6 @@ void GamelistView::updateView(const CursorState& state) for (auto& video : mVideoComponents) { setGameImage(mRandomGame, video.get()); - video->stopVideoPlayer(!mStaticVideoAudio); if (video->hasStaticVideo()) @@ -609,12 +608,15 @@ void GamelistView::updateView(const CursorState& state) video->stopVideoPlayer(!mStaticVideoAudio); video->setImage(""); video->setVideo(""); + if (video->hasStaticVideo()) { video->setStaticVideo(); } else { video->setDefaultVideo(); } + + video->startVideoPlayer(); } } } @@ -991,6 +993,6 @@ void GamelistView::setGameImage(FileData* file, GuiComponent* comp) } } // This is needed so the default image is set if no game media was found. - if (path == "" && comp->getThemeImageTypes().size() > 0) + if (path == "" && (comp->getThemeImageTypes().size() > 0 || comp->getDefaultImage() != "")) comp->setImage(""); } diff --git a/es-app/src/views/SystemView.cpp b/es-app/src/views/SystemView.cpp index a0cbfb79f..8f8c143e2 100644 --- a/es-app/src/views/SystemView.cpp +++ b/es-app/src/views/SystemView.cpp @@ -1046,7 +1046,8 @@ void SystemView::updateGameSelectors() } for (auto& video : mSystemElements[cursor].videoComponents) { - if (video->hasStaticVideo() || video->getThemeImageTypes().size() == 0) + if (video->hasStaticVideo() || + (video->getThemeImageTypes().size() == 0 && video->getDefaultImage() == "")) continue; GameSelectorComponent* gameSelector {nullptr}; if (multipleSelectors) { @@ -1155,7 +1156,8 @@ void SystemView::updateGameSelectors() } } // This is needed so the default image is set if no game media was found. - if (path == "" && video->getThemeImageTypes().size() > 0) + if (path == "" && + (video->getThemeImageTypes().size() > 0 || video->getDefaultImage() != "")) video->setImage(""); } else { diff --git a/es-core/src/GuiComponent.h b/es-core/src/GuiComponent.h index 62be22a5d..6be172edf 100644 --- a/es-core/src/GuiComponent.h +++ b/es-core/src/GuiComponent.h @@ -261,6 +261,7 @@ public: const std::vector& getThemeImageTypes() { return mThemeImageTypes; } const std::string& getThemeGameSelector() const { return mThemeGameSelector; } const unsigned int getThemeGameSelectorEntry() const { return mThemeGameSelectorEntry; } + virtual const std::string getDefaultImage() const { return ""; } virtual std::shared_ptr getFont() const { return nullptr; } diff --git a/es-core/src/components/VideoComponent.cpp b/es-core/src/components/VideoComponent.cpp index b996481d8..bede04067 100644 --- a/es-core/src/components/VideoComponent.cpp +++ b/es-core/src/components/VideoComponent.cpp @@ -100,6 +100,16 @@ void VideoComponent::setImage(const std::string& path, bool tile) mStaticImagePath = imagePath; } +void VideoComponent::setImageNoDefault(const std::string& path) +{ + // Check if the image has changed. + if (path == mStaticImagePath) + return; + + mStaticImage.setImage(path, false); + mStaticImagePath = path; +} + void VideoComponent::applyTheme(const std::shared_ptr& theme, const std::string& view, const std::string& element, @@ -257,6 +267,9 @@ void VideoComponent::applyTheme(const std::shared_ptr& theme, } } + if (mThemeImageTypes.empty()) + mConfig.startDelay = 0; + if (elem->has("color")) { mColorShift = elem->get("color"); mColorShiftEnd = mColorShift; diff --git a/es-core/src/components/VideoComponent.h b/es-core/src/components/VideoComponent.h index ef590cee9..4ce469b8c 100644 --- a/es-core/src/components/VideoComponent.h +++ b/es-core/src/components/VideoComponent.h @@ -41,6 +41,8 @@ public: void setStaticVideo() { setVideo(mConfig.staticVideoPath); } // Loads a static image that is displayed if the video cannot be played. void setImage(const std::string& path, bool tile = false) override; + // Same as setImage() but does not set the default image if the path argument is empty. + void setImageNoDefault(const std::string& path); // Sets whether we're in media viewer mode. void setMediaViewerMode(bool isMediaViewer) { mMediaViewerMode = isMediaViewer; } // Sets whether we're in screensaver mode. diff --git a/es-core/src/components/VideoFFmpegComponent.h b/es-core/src/components/VideoFFmpegComponent.h index e4f69147d..0be5782ee 100644 --- a/es-core/src/components/VideoFFmpegComponent.h +++ b/es-core/src/components/VideoFFmpegComponent.h @@ -53,6 +53,8 @@ public: void handleLooping() override; // Used to immediately mute audio even if there are samples to play in the buffer. void muteVideoPlayer() override; + // Needed to be able to display the default image even if no image types have been defined. + const std::string getDefaultImage() const override { return mDefaultImagePath; } private: void startVideoStream() override;