diff --git a/es-core/src/components/VideoPlayerComponent.cpp b/es-core/src/components/VideoPlayerComponent.cpp index 556123648..abeae844c 100644 --- a/es-core/src/components/VideoPlayerComponent.cpp +++ b/es-core/src/components/VideoPlayerComponent.cpp @@ -11,6 +11,14 @@ #include #include #include +#include + +class VolumeControl +{ +public: + static std::shared_ptr & getInstance(); + int getVolume() const; +}; VideoPlayerComponent::VideoPlayerComponent(Window* window, std::string path) : VideoComponent(window), @@ -101,10 +109,16 @@ void VideoPlayerComponent::startVideo() const char* argv[] = { "", "--layer", "10010", "--loop", "--no-osd", "--aspect-mode", "letterbox", "--vol", "0", "-o", "both","--win", buf, "--no-ghost-box", "", "", "", "", NULL }; // check if we want to mute the audio - if (!Settings::getInstance()->getBool("VideoAudio")) + if (!Settings::getInstance()->getBool("VideoAudio") || (float)VolumeControl::getInstance()->getVolume() == 0) { argv[8] = "-1000000"; } + else + { + float percentVolume = (float)VolumeControl::getInstance()->getVolume(); + int OMXVolume = (int)(log(percentVolume/100)*2000); + argv[8] = std::to_string(OMXVolume).c_str(); + } // test if there's a path for possible subtitles, meaning we're a screensaver video if (!subtitlePath.empty())