diff options
author | Rainer Hochecker <fernetmenta@online.de> | 2013-12-10 09:00:29 -0800 |
---|---|---|
committer | Rainer Hochecker <fernetmenta@online.de> | 2013-12-10 09:00:29 -0800 |
commit | 7f6c5e4ee4c86602677add662380eb4813cc6f69 (patch) | |
tree | 6596492e31679fe45931baf75c2dc9b3e5ca75fa | |
parent | f5c2313f03b51a947d48d8a5d02672a4477dc41f (diff) | |
parent | abad0f65bdfb1f3f51e02dc8dedfc41ecc943b17 (diff) |
Merge pull request #3774 from FernetMenta/skiptrack
Inform (pa)player about intent to reopen on skipping tracks
-rw-r--r-- | xbmc/ApplicationPlayer.cpp | 6 | ||||
-rw-r--r-- | xbmc/ApplicationPlayer.h | 2 | ||||
-rw-r--r-- | xbmc/cores/AudioEngine/AEFactory.cpp | 6 | ||||
-rw-r--r-- | xbmc/cores/AudioEngine/AEFactory.h | 1 | ||||
-rw-r--r-- | xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 19 | ||||
-rw-r--r-- | xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h | 3 | ||||
-rw-r--r-- | xbmc/cores/AudioEngine/Interfaces/AE.h | 6 | ||||
-rw-r--r-- | xbmc/cores/ExternalPlayer/ExternalPlayer.cpp | 2 | ||||
-rw-r--r-- | xbmc/cores/ExternalPlayer/ExternalPlayer.h | 2 | ||||
-rw-r--r-- | xbmc/cores/IPlayer.h | 2 | ||||
-rw-r--r-- | xbmc/cores/dvdplayer/DVDPlayer.cpp | 2 | ||||
-rw-r--r-- | xbmc/cores/dvdplayer/DVDPlayer.h | 2 | ||||
-rw-r--r-- | xbmc/cores/omxplayer/OMXPlayer.cpp | 2 | ||||
-rw-r--r-- | xbmc/cores/omxplayer/OMXPlayer.h | 2 | ||||
-rw-r--r-- | xbmc/cores/paplayer/PAPlayer.cpp | 5 | ||||
-rw-r--r-- | xbmc/cores/paplayer/PAPlayer.h | 2 | ||||
-rw-r--r-- | xbmc/network/upnp/UPnPPlayer.cpp | 2 | ||||
-rw-r--r-- | xbmc/network/upnp/UPnPPlayer.h | 2 |
18 files changed, 52 insertions, 16 deletions
diff --git a/xbmc/ApplicationPlayer.cpp b/xbmc/ApplicationPlayer.cpp index 1dd8df6eeb..83aa8757c7 100644 --- a/xbmc/ApplicationPlayer.cpp +++ b/xbmc/ApplicationPlayer.cpp @@ -49,13 +49,13 @@ void CApplicationPlayer::ClosePlayer() } } -void CApplicationPlayer::CloseFile() +void CApplicationPlayer::CloseFile(bool reopen) { boost::shared_ptr<IPlayer> player = GetInternal(); if (player) { ++m_iPlayerOPSeq; - player->CloseFile(); + player->CloseFile(reopen); } } @@ -81,7 +81,7 @@ void CApplicationPlayer::ClosePlayerGapless(PLAYERCOREID newCore) // but if we do not stop it, we can not distingush callbacks from previous // item and current item, it will confused us then we can not make correct delay // callback after the starting state. - CloseFile(); + CloseFile(true); } } diff --git a/xbmc/ApplicationPlayer.h b/xbmc/ApplicationPlayer.h index 212389f06a..21a0b7a44c 100644 --- a/xbmc/ApplicationPlayer.h +++ b/xbmc/ApplicationPlayer.h @@ -60,7 +60,7 @@ public: int m_iPlaySpeed; // player management - void CloseFile(); + void CloseFile(bool reopen = false); void ClosePlayer(); void ClosePlayerGapless(PLAYERCOREID newCore); void CreatePlayer(PLAYERCOREID newCore, IPlayerCallback& callback); diff --git a/xbmc/cores/AudioEngine/AEFactory.cpp b/xbmc/cores/AudioEngine/AEFactory.cpp index c03b439eee..e798e0fae8 100644 --- a/xbmc/cores/AudioEngine/AEFactory.cpp +++ b/xbmc/cores/AudioEngine/AEFactory.cpp @@ -439,3 +439,9 @@ bool CAEFactory::IsSettingVisible(const std::string &condition, const std::strin return AE->IsSettingVisible(value); } + +void CAEFactory::KeepConfiguration(unsigned int millis) +{ + if (AE) + AE->KeepConfiguration(millis); +} diff --git a/xbmc/cores/AudioEngine/AEFactory.h b/xbmc/cores/AudioEngine/AEFactory.h index 745ddc1333..cb5317e4ca 100644 --- a/xbmc/cores/AudioEngine/AEFactory.h +++ b/xbmc/cores/AudioEngine/AEFactory.h @@ -76,6 +76,7 @@ public: static void SettingOptionsAudioQualityLevelsFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int ¤t); static void SettingOptionsAudioStreamsilenceFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int ¤t); static bool IsSettingVisible(const std::string &condition, const std::string &value, const std::string &settingId); + static void KeepConfiguration(unsigned int millis); static void RegisterAudioCallback(IAudioCallback* pCallback); static void UnregisterAudioCallback(); diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp index b1a9857101..abf1509191 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp @@ -231,6 +231,9 @@ void CActiveAE::StateMachine(int signal, Protocol *port, Message *msg) case CActiveAEControlProtocol::MUTE: m_muted = *(bool*)msg->data; return; + case CActiveAEControlProtocol::KEEPCONFIG: + m_extKeepConfig = *(unsigned int*)msg->data; + return; default: break; } @@ -540,7 +543,10 @@ void CActiveAE::StateMachine(int signal, Protocol *port, Message *msg) DiscardStream(stream); if (m_streams.empty()) { - m_extDrainTimer.Set(m_stats.GetDelay() * 1000); + if (m_extKeepConfig) + m_extDrainTimer.Set(m_extKeepConfig); + else + m_extDrainTimer.Set(m_stats.GetDelay() * 1000); m_extDrain = true; } m_extTimeout = 0; @@ -719,6 +725,7 @@ void CActiveAE::Process() m_bStateMachineSelfTrigger = false; m_extDrain = false; m_extDeferData = false; + m_extKeepConfig = 0; // start sink m_sink.Start(); @@ -854,6 +861,8 @@ void CActiveAE::Configure(AEAudioFormat *desiredFmt) m_sinkRequestFormat = inputFormat; ApplySettingsToFormat(m_sinkRequestFormat, m_settings, (int*)&m_mode); + m_extKeepConfig = 0; + std::string device = AE_IS_RAW(m_sinkRequestFormat.m_dataFormat) ? m_settings.passthoughdevice : m_settings.device; std::string driver; CAESinkFactory::ParseDevice(device, driver); @@ -1269,6 +1278,7 @@ void CActiveAE::ChangeResamplers() void CActiveAE::ApplySettingsToFormat(AEAudioFormat &format, AudioSettings &settings, int *mode) { + int oldMode = m_mode; if (mode) *mode = MODE_PCM; @@ -1329,6 +1339,8 @@ void CActiveAE::ApplySettingsToFormat(AEAudioFormat &format, AudioSettings &sett if (m_settings.config == AE_CONFIG_FIXED || (settings.stereoupmix && format.m_channelLayout.Count() <= 2)) format.m_channelLayout = stdLayout; + else if (m_extKeepConfig && (settings.config == AE_CONFIG_AUTO) && (oldMode != MODE_RAW)) + format.m_channelLayout = m_internalFormat.m_channelLayout; else format.m_channelLayout.ResolveChannels(stdLayout); } @@ -2237,6 +2249,11 @@ void CActiveAE::SetSoundMode(const int mode) m_controlPort.SendOutMessage(CActiveAEControlProtocol::SOUNDMODE, &soundmode, sizeof(int)); } +void CActiveAE::KeepConfiguration(unsigned int millis) +{ + unsigned int timeMs = millis; + m_controlPort.SendOutMessage(CActiveAEControlProtocol::KEEPCONFIG, &timeMs, sizeof(unsigned int)); +} void CActiveAE::OnLostDevice() { diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h index 2955bb8a58..0e22a2ed68 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h @@ -86,6 +86,7 @@ public: GETSTATE, DISPLAYLOST, DISPLAYRESET, + KEEPCONFIG, TIMEOUT, }; enum InSignal @@ -219,6 +220,7 @@ public: virtual bool SupportsSilenceTimeout(); virtual bool SupportsQualityLevel(enum AEQuality level); virtual bool IsSettingVisible(const std::string &settingId); + virtual void KeepConfiguration(unsigned int millis); virtual void RegisterAudioCallback(IAudioCallback* pCallback); virtual void UnregisterAudioCallback(); @@ -286,6 +288,7 @@ protected: bool m_extError; bool m_extDrain; XbmcThreads::EndTime m_extDrainTimer; + unsigned int m_extKeepConfig; bool m_extDeferData; enum diff --git a/xbmc/cores/AudioEngine/Interfaces/AE.h b/xbmc/cores/AudioEngine/Interfaces/AE.h index d2f895cddc..f91dc4c369 100644 --- a/xbmc/cores/AudioEngine/Interfaces/AE.h +++ b/xbmc/cores/AudioEngine/Interfaces/AE.h @@ -226,5 +226,11 @@ public: * @return true if AudioEngine wants to display this setting */ virtual bool IsSettingVisible(const std::string &settingId) {return false; } + + /** + * Instruct AE to keep configuration for a specified time + * @param millis time for which old configuration should be kept + */ + virtual void KeepConfiguration(unsigned int millis) {return; } }; diff --git a/xbmc/cores/ExternalPlayer/ExternalPlayer.cpp b/xbmc/cores/ExternalPlayer/ExternalPlayer.cpp index 4301a23214..81b717e9c7 100644 --- a/xbmc/cores/ExternalPlayer/ExternalPlayer.cpp +++ b/xbmc/cores/ExternalPlayer/ExternalPlayer.cpp @@ -120,7 +120,7 @@ bool CExternalPlayer::OpenFile(const CFileItem& file, const CPlayerOptions &opti } } -bool CExternalPlayer::CloseFile() +bool CExternalPlayer::CloseFile(bool reopen) { m_bAbortRequest = true; diff --git a/xbmc/cores/ExternalPlayer/ExternalPlayer.h b/xbmc/cores/ExternalPlayer/ExternalPlayer.h index 11a32a5240..f30352b32f 100644 --- a/xbmc/cores/ExternalPlayer/ExternalPlayer.h +++ b/xbmc/cores/ExternalPlayer/ExternalPlayer.h @@ -36,7 +36,7 @@ public: virtual void RegisterAudioCallback(IAudioCallback* pCallback) {} virtual void UnRegisterAudioCallback() {} virtual bool OpenFile(const CFileItem& file, const CPlayerOptions &options); - virtual bool CloseFile(); + virtual bool CloseFile(bool reopen = false); virtual bool IsPlaying() const; virtual void Pause(); virtual bool IsPaused() const; diff --git a/xbmc/cores/IPlayer.h b/xbmc/cores/IPlayer.h index 21345ae653..62cd1bedc2 100644 --- a/xbmc/cores/IPlayer.h +++ b/xbmc/cores/IPlayer.h @@ -133,7 +133,7 @@ public: virtual bool OpenFile(const CFileItem& file, const CPlayerOptions& options){ return false;} virtual bool QueueNextFile(const CFileItem &file) { return false; } virtual void OnNothingToQueueNotify() {} - virtual bool CloseFile(){ return true;} + virtual bool CloseFile(bool reopen = false) = 0; virtual bool IsPlaying() const { return false;} virtual bool CanPause() { return true; }; virtual void Pause() = 0; diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp index f9375c6fc6..a698b8f459 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp @@ -590,7 +590,7 @@ bool CDVDPlayer::OpenFile(const CFileItem& file, const CPlayerOptions &options) } } -bool CDVDPlayer::CloseFile() +bool CDVDPlayer::CloseFile(bool reopen) { CLog::Log(LOGNOTICE, "CDVDPlayer::CloseFile()"); diff --git a/xbmc/cores/dvdplayer/DVDPlayer.h b/xbmc/cores/dvdplayer/DVDPlayer.h index 5ae5f9fc82..dfe679f6eb 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.h +++ b/xbmc/cores/dvdplayer/DVDPlayer.h @@ -181,7 +181,7 @@ public: CDVDPlayer(IPlayerCallback& callback); virtual ~CDVDPlayer(); virtual bool OpenFile(const CFileItem& file, const CPlayerOptions &options); - virtual bool CloseFile(); + virtual bool CloseFile(bool reopen = false); virtual bool IsPlaying() const; virtual void Pause(); virtual bool IsPaused() const; diff --git a/xbmc/cores/omxplayer/OMXPlayer.cpp b/xbmc/cores/omxplayer/OMXPlayer.cpp index 5e77059e8d..9cccaacff1 100644 --- a/xbmc/cores/omxplayer/OMXPlayer.cpp +++ b/xbmc/cores/omxplayer/OMXPlayer.cpp @@ -636,7 +636,7 @@ bool COMXPlayer::OpenFile(const CFileItem &file, const CPlayerOptions &options) } } -bool COMXPlayer::CloseFile() +bool COMXPlayer::CloseFile(bool reopen) { CLog::Log(LOGDEBUG, "COMXPlayer::CloseFile"); diff --git a/xbmc/cores/omxplayer/OMXPlayer.h b/xbmc/cores/omxplayer/OMXPlayer.h index 96eed11367..f34764de7b 100644 --- a/xbmc/cores/omxplayer/OMXPlayer.h +++ b/xbmc/cores/omxplayer/OMXPlayer.h @@ -177,7 +177,7 @@ public: virtual ~COMXPlayer(); virtual bool OpenFile(const CFileItem &file, const CPlayerOptions &options); - virtual bool CloseFile(); + virtual bool CloseFile(bool reopen = false); virtual bool IsPlaying() const; virtual void Pause(); virtual bool IsPaused() const; diff --git a/xbmc/cores/paplayer/PAPlayer.cpp b/xbmc/cores/paplayer/PAPlayer.cpp index 1785b73ee6..3c53a6d4c2 100644 --- a/xbmc/cores/paplayer/PAPlayer.cpp +++ b/xbmc/cores/paplayer/PAPlayer.cpp @@ -509,8 +509,11 @@ inline bool PAPlayer::PrepareStream(StreamInfo *si) return true; } -bool PAPlayer::CloseFile() +bool PAPlayer::CloseFile(bool reopen) { + if (reopen) + CAEFactory::KeepConfiguration(3000); + if (!m_isPaused) SoftStop(true, true); CloseAllStreams(false); diff --git a/xbmc/cores/paplayer/PAPlayer.h b/xbmc/cores/paplayer/PAPlayer.h index 8321ce2520..6ae110a8b9 100644 --- a/xbmc/cores/paplayer/PAPlayer.h +++ b/xbmc/cores/paplayer/PAPlayer.h @@ -46,7 +46,7 @@ public: virtual bool OpenFile(const CFileItem& file, const CPlayerOptions &options); virtual bool QueueNextFile(const CFileItem &file); virtual void OnNothingToQueueNotify(); - virtual bool CloseFile(); + virtual bool CloseFile(bool reopen = false); virtual bool IsPlaying() const; virtual void Pause(); virtual bool IsPaused() const; diff --git a/xbmc/network/upnp/UPnPPlayer.cpp b/xbmc/network/upnp/UPnPPlayer.cpp index b78f97b77b..a5712c4500 100644 --- a/xbmc/network/upnp/UPnPPlayer.cpp +++ b/xbmc/network/upnp/UPnPPlayer.cpp @@ -357,7 +357,7 @@ failed: return false; } -bool CUPnPPlayer::CloseFile() +bool CUPnPPlayer::CloseFile(bool reopen) { NPT_CHECK_POINTER_LABEL_SEVERE(m_delegate, failed); NPT_CHECK_LABEL(m_control->Stop(m_delegate->m_device diff --git a/xbmc/network/upnp/UPnPPlayer.h b/xbmc/network/upnp/UPnPPlayer.h index 61e31eeb17..b8c721c8de 100644 --- a/xbmc/network/upnp/UPnPPlayer.h +++ b/xbmc/network/upnp/UPnPPlayer.h @@ -37,7 +37,7 @@ public: virtual bool OpenFile(const CFileItem& file, const CPlayerOptions& options); virtual bool QueueNextFile(const CFileItem &file); - virtual bool CloseFile(); + virtual bool CloseFile(bool reopen = false); virtual bool IsPlaying() const; virtual void Pause(); virtual bool IsPaused() const; |