Skip to content

Commit

Permalink
Merge pull request #644 from pjft/disable-ss-audio
Browse files Browse the repository at this point in the history
Added option to disable video screensaver audio on VLC and OMXPlayer
  • Loading branch information
joolswills committed Apr 11, 2020
2 parents 635e50d + b2e7101 commit 3b2227b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
5 changes: 5 additions & 0 deletions es-app/src/guis/GuiVideoScreensaverOptions.cpp
Expand Up @@ -63,6 +63,11 @@ GuiVideoScreensaverOptions::GuiVideoScreensaverOptions(Window* window, const cha
Settings::getInstance()->setInt("SubtitleSize", subSize);
});

auto ss_video_mute = std::make_shared<SwitchComponent>(mWindow);
ss_video_mute->setState(Settings::getInstance()->getBool("ScreenSaverVideoMute"));
addWithLabel("MUTE SCREENSAVER AUDIO", ss_video_mute);
addSaveFunc([ss_video_mute] { Settings::getInstance()->setBool("ScreenSaverVideoMute", ss_video_mute->getState()); });

// Define subtitle font
auto ss_omx_font_file = std::make_shared<TextComponent>(mWindow, "", Font::get(FONT_SIZE_SMALL), 0x777777FF);
addEditableTextComponent(row, "PATH TO FONT FILE", ss_omx_font_file, Settings::getInstance()->getString("SubtitleFont"));
Expand Down
1 change: 1 addition & 0 deletions es-core/src/Settings.cpp
Expand Up @@ -128,6 +128,7 @@ void Settings::setDefaults()
mIntMap["ScreenSaverSwapVideoTimeout"] = 30000;

mBoolMap["VideoAudio"] = true;
mBoolMap["ScreenSaverVideoMute"] = false;
mBoolMap["CaptionsCompatibility"] = true;
// Audio out device for Video playback using OMX player.
mStringMap["OMXAudioDev"] = "both";
Expand Down
3 changes: 2 additions & 1 deletion es-core/src/components/VideoPlayerComponent.cpp
Expand Up @@ -162,7 +162,8 @@ void VideoPlayerComponent::startVideo()
const char* argv[] = { "", "--layer", "10010", "--loop", "--no-osd", "--aspect-mode", "letterbox", "--vol", "0", "-o", "both","--win", buf1, "--orientation", buf2, "", "", "", "", "", "", "", "", "", "", "", NULL };

// check if we want to mute the audio
if (!Settings::getInstance()->getBool("VideoAudio") || (float)VolumeControl::getInstance()->getVolume() == 0)
if ((!Settings::getInstance()->getBool("VideoAudio") || (float)VolumeControl::getInstance()->getVolume() == 0) ||
(Settings::getInstance()->getBool("ScreenSaverVideoMute") && mScreensaverMode))
{
argv[8] = "-1000000";
}
Expand Down
6 changes: 4 additions & 2 deletions es-core/src/components/VideoVlcComponent.cpp
Expand Up @@ -220,7 +220,8 @@ void VideoVlcComponent::handleLooping()
libvlc_state_t state = libvlc_media_player_get_state(mMediaPlayer);
if (state == libvlc_Ended)
{
if (!Settings::getInstance()->getBool("VideoAudio"))
if (!Settings::getInstance()->getBool("VideoAudio") ||
(Settings::getInstance()->getBool("ScreenSaverVideoMute") && mScreensaverMode))
{
libvlc_audio_set_mute(mMediaPlayer, 1);
}
Expand Down Expand Up @@ -295,7 +296,8 @@ void VideoVlcComponent::startVideo()
// Setup the media player
mMediaPlayer = libvlc_media_player_new_from_media(mMedia);

if (!Settings::getInstance()->getBool("VideoAudio"))
if (!Settings::getInstance()->getBool("VideoAudio") ||
(Settings::getInstance()->getBool("ScreenSaverVideoMute") && mScreensaverMode))
{
libvlc_audio_set_mute(mMediaPlayer, 1);
}
Expand Down

0 comments on commit 3b2227b

Please sign in to comment.