diff options
author | ronie <ronie@users.noreply.github.com> | 2020-02-08 23:09:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-08 23:09:26 +0100 |
commit | 5200daeb6ace6b32752ecb6d53bd205f4f81d92d (patch) | |
tree | 1b6c33c9c02d968bd74a3ea06a0de61f29859e30 | |
parent | e50950aa01e8090109869dc03e1af6d361136230 (diff) | |
parent | 14d5ff50710bdf4070c682c6883b674697149565 (diff) |
Merge pull request #17225 from ronie/fullscreenplayback
add setting to switch to visualisation on playback
-rw-r--r-- | addons/resource.language.en_gb/resources/strings.po | 15 | ||||
-rwxr-xr-x | system/settings/settings.xml | 5 | ||||
-rw-r--r-- | xbmc/Application.cpp | 31 | ||||
-rw-r--r-- | xbmc/cores/paplayer/PAPlayer.cpp | 9 | ||||
-rw-r--r-- | xbmc/cores/paplayer/PAPlayer.h | 1 | ||||
-rw-r--r-- | xbmc/settings/Settings.cpp | 1 | ||||
-rw-r--r-- | xbmc/settings/Settings.h | 1 |
7 files changed, 59 insertions, 4 deletions
diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po index e1be15aff6..3f8736e6ba 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po @@ -5839,7 +5839,12 @@ msgctxt "#12379" msgid "Use pan and zoom effects" msgstr "" -#empty strings from id 12380 to 12381 +#empty string with id 12380 + +#: system/settings/settings.xml +msgctxt "#12381" +msgid "Switch to visualisation on playback" +msgstr "" #. time format with meridiem (xx) e.g. "HH:mm:ss xx" #: xbmc/LangInfo.cpp @@ -21420,7 +21425,13 @@ msgctxt "#38111" msgid "This category contains other settings for the GUI interface" msgstr "" -#empty strings from id 38112 to 38189 +#. Description of setting with label #12381 "Switch to visualisation on playback" +#: system/settings/settings.xml +msgctxt "#38112" +msgid "Automatically go to the visualisation window when audio playback starts" +msgstr "" + +#empty strings from id 38113 to 38189 msgctxt "#38190" msgid "Extract thumbnails from video files" diff --git a/system/settings/settings.xml b/system/settings/settings.xml index f4719d2c9d..93824a9d5b 100755 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -1003,6 +1003,11 @@ </category> <category id="music" label="14216" help="38108"> <group id="1" label="593"> + <setting id="musicfiles.selectaction" type="boolean" label="12381" help="38112"> + <level>0</level> + <default>false</default> + <control type="toggle" /> + </setting> <setting id="musicfiles.trackformat" type="string" label="13307" help="36275"> <level>3</level> <default>[%N. ]%A - %T</default> diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index 950a829e36..ed3c44f3e9 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -2102,7 +2102,8 @@ void CApplication::OnApplicationMessage(ThreadMessage* pMsg) case TMSG_SWITCHTOFULLSCREEN: if (CServiceBroker::GetGUI()->GetWindowManager().GetActiveWindow() != WINDOW_FULLSCREEN_VIDEO && - CServiceBroker::GetGUI()->GetWindowManager().GetActiveWindow() != WINDOW_FULLSCREEN_GAME) + CServiceBroker::GetGUI()->GetWindowManager().GetActiveWindow() != WINDOW_FULLSCREEN_GAME && + CServiceBroker::GetGUI()->GetWindowManager().GetActiveWindow() != WINDOW_VISUALISATION) SwitchToFullScreen(true); break; @@ -2916,7 +2917,15 @@ bool CApplication::PlayFile(CFileItem item, const std::string& player, bool bRes // this really aught to be inside !bRestart, but since PlayStack // uses that to init playback, we have to keep it outside int playlist = CServiceBroker::GetPlaylistPlayer().GetCurrentPlaylist(); - if (item.IsVideo() && playlist == PLAYLIST_VIDEO && CServiceBroker::GetPlaylistPlayer().GetPlaylist(playlist).size() > 1) + if (item.IsAudio() && playlist == PLAYLIST_MUSIC) + { // playing from a playlist by the looks + // don't switch to fullscreen if we are not playing the first item... + options.fullscreen = !CServiceBroker::GetPlaylistPlayer().HasPlayedFirstFile() && + CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool( + CSettings::SETTING_MUSICFILES_SELECTACTION); + } + else if (item.IsVideo() && playlist == PLAYLIST_VIDEO && + CServiceBroker::GetPlaylistPlayer().GetPlaylist(playlist).size() > 1) { // playing from a playlist by the looks // don't switch to fullscreen if we are not playing the first item... options.fullscreen = !CServiceBroker::GetPlaylistPlayer().HasPlayedFirstFile() && CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_fullScreenOnMovieStart && !CMediaSettings::GetInstance().DoesVideoStartWindowed(); @@ -4563,6 +4572,24 @@ bool CApplication::SwitchToFullScreen(bool force /* = false */) if (pDialog) pDialog->Close(true); } + // if playing from the album info window, close it first! + if (CServiceBroker::GetGUI()->GetWindowManager().IsModalDialogTopmost(WINDOW_DIALOG_MUSIC_INFO)) + { + CGUIDialogVideoInfo* pDialog = CServiceBroker::GetGUI()-> + GetWindowManager().GetWindow<CGUIDialogVideoInfo>(WINDOW_DIALOG_MUSIC_INFO); + if (pDialog) + pDialog->Close(true); + } + + // if playing from the song info window, close it first! + if (CServiceBroker::GetGUI()->GetWindowManager().IsModalDialogTopmost(WINDOW_DIALOG_SONG_INFO)) + { + CGUIDialogVideoInfo* pDialog = CServiceBroker::GetGUI()-> + GetWindowManager().GetWindow<CGUIDialogVideoInfo>(WINDOW_DIALOG_SONG_INFO); + if (pDialog) + pDialog->Close(true); + } + int windowID = WINDOW_INVALID; // See if we're playing a game, and are in GUI mode diff --git a/xbmc/cores/paplayer/PAPlayer.cpp b/xbmc/cores/paplayer/PAPlayer.cpp index 97d50e5252..881f8a606b 100644 --- a/xbmc/cores/paplayer/PAPlayer.cpp +++ b/xbmc/cores/paplayer/PAPlayer.cpp @@ -17,6 +17,7 @@ #include "cores/AudioEngine/Utils/AEUtil.h" #include "cores/DataCacheCore.h" #include "cores/VideoPlayer/Process/ProcessInfo.h" +#include "messaging/ApplicationMessenger.h" #include "music/tags/MusicInfoTag.h" #include "settings/AdvancedSettings.h" #include "settings/Settings.h" @@ -25,6 +26,8 @@ #include "utils/log.h" #include "video/Bookmark.h" +using namespace KODI::MESSAGING; + #define TIME_TO_CACHE_NEXT_FILE 5000 /* 5 seconds before end of song, start caching the next song */ #define FAST_XFADE_TIME 80 /* 80 milliseconds */ #define MAX_SKIP_XFADE_TIME 2000 /* max 2 seconds crossfade on track skip */ @@ -218,6 +221,7 @@ void PAPlayer::CloseAllStreams(bool fade/* = true */) bool PAPlayer::OpenFile(const CFileItem& file, const CPlayerOptions &options) { m_defaultCrossfadeMS = CServiceBroker::GetSettingsComponent()->GetSettings()->GetInt(CSettings::SETTING_MUSICPLAYER_CROSSFADE) * 1000; + m_fullScreen = options.fullscreen; if (m_streams.size() > 1 || !m_defaultCrossfadeMS || m_isPaused) { @@ -719,6 +723,11 @@ inline bool PAPlayer::ProcessStream(StreamInfo *si, double &freeBufferTime) if (m_signalStarted) m_callback.OnPlayBackStarted(si->m_fileItem); m_signalStarted = true; + if (m_fullScreen) + { + CApplicationMessenger::GetInstance().PostMsg(TMSG_SWITCHTOFULLSCREEN); + m_fullScreen = false; + } m_callback.OnAVStarted(si->m_fileItem); } diff --git a/xbmc/cores/paplayer/PAPlayer.h b/xbmc/cores/paplayer/PAPlayer.h index 33674645a6..3e1c2c5f81 100644 --- a/xbmc/cores/paplayer/PAPlayer.h +++ b/xbmc/cores/paplayer/PAPlayer.h @@ -116,6 +116,7 @@ private: bool m_isPlaying; bool m_isPaused; bool m_isFinished; /* if there are no more songs in the queue */ + bool m_fullScreen; unsigned int m_defaultCrossfadeMS; /* how long the default crossfade is in ms */ unsigned int m_upcomingCrossfadeMS; /* how long the upcoming crossfade is in ms */ CEvent m_startEvent; /* event for playback start */ diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp index 29682616eb..729dc40f92 100644 --- a/xbmc/settings/Settings.cpp +++ b/xbmc/settings/Settings.cpp @@ -263,6 +263,7 @@ const std::string CSettings::SETTING_MUSICPLAYER_REPLAYGAINAVOIDCLIPPING = "musi const std::string CSettings::SETTING_MUSICPLAYER_CROSSFADE = "musicplayer.crossfade"; const std::string CSettings::SETTING_MUSICPLAYER_CROSSFADEALBUMTRACKS = "musicplayer.crossfadealbumtracks"; const std::string CSettings::SETTING_MUSICPLAYER_VISUALISATION = "musicplayer.visualisation"; +const std::string CSettings::SETTING_MUSICFILES_SELECTACTION = "musicfiles.selectaction"; const std::string CSettings::SETTING_MUSICFILES_USETAGS = "musicfiles.usetags"; const std::string CSettings::SETTING_MUSICFILES_TRACKFORMAT = "musicfiles.trackformat"; const std::string CSettings::SETTING_MUSICFILES_NOWPLAYINGTRACKFORMAT = "musicfiles.nowplayingtrackformat"; diff --git a/xbmc/settings/Settings.h b/xbmc/settings/Settings.h index 9cde72c529..c6287e6a1f 100644 --- a/xbmc/settings/Settings.h +++ b/xbmc/settings/Settings.h @@ -228,6 +228,7 @@ public: static const std::string SETTING_MUSICPLAYER_CROSSFADE; static const std::string SETTING_MUSICPLAYER_CROSSFADEALBUMTRACKS; static const std::string SETTING_MUSICPLAYER_VISUALISATION; + static const std::string SETTING_MUSICFILES_SELECTACTION; static const std::string SETTING_MUSICFILES_USETAGS; static const std::string SETTING_MUSICFILES_TRACKFORMAT; static const std::string SETTING_MUSICFILES_NOWPLAYINGTRACKFORMAT; |