diff options
-rw-r--r-- | xbmc/cores/AudioRenderers/ALSADirectSound.cpp | 5 | ||||
-rw-r--r-- | xbmc/cores/AudioRenderers/ALSADirectSound.h | 1 | ||||
-rw-r--r-- | xbmc/cores/AudioRenderers/CoreAudioRenderer.cpp | 5 | ||||
-rw-r--r-- | xbmc/cores/AudioRenderers/CoreAudioRenderer.h | 1 | ||||
-rw-r--r-- | xbmc/cores/AudioRenderers/IAudioRenderer.h | 1 | ||||
-rw-r--r-- | xbmc/cores/AudioRenderers/PulseAudioDirectSound.cpp | 5 | ||||
-rw-r--r-- | xbmc/cores/AudioRenderers/PulseAudioDirectSound.h | 1 | ||||
-rw-r--r-- | xbmc/cores/AudioRenderers/Win32DirectSound.cpp | 6 | ||||
-rw-r--r-- | xbmc/cores/AudioRenderers/Win32DirectSound.h | 1 | ||||
-rw-r--r-- | xbmc/cores/dvdplayer/DVDAudio.cpp | 16 | ||||
-rw-r--r-- | xbmc/cores/dvdplayer/DVDAudio.h | 2 |
11 files changed, 44 insertions, 0 deletions
diff --git a/xbmc/cores/AudioRenderers/ALSADirectSound.cpp b/xbmc/cores/AudioRenderers/ALSADirectSound.cpp index b85a4cd0cb..8d5ac37314 100644 --- a/xbmc/cores/AudioRenderers/ALSADirectSound.cpp +++ b/xbmc/cores/AudioRenderers/ALSADirectSound.cpp @@ -512,6 +512,11 @@ float CALSADirectSound::GetCacheTime() return (float)(m_uiBufferSize - GetSpace()) / (float)m_uiBytesPerSecond; } +float CALSADirectSound::GetCacheTotal() +{ + return (float)m_uiBufferSize / (float)m_uiBytesPerSecond; +} + //*********************************************************************************************** unsigned int CALSADirectSound::GetChunkLen() { diff --git a/xbmc/cores/AudioRenderers/ALSADirectSound.h b/xbmc/cores/AudioRenderers/ALSADirectSound.h index 8466dbad61..f314a67bff 100644 --- a/xbmc/cores/AudioRenderers/ALSADirectSound.h +++ b/xbmc/cores/AudioRenderers/ALSADirectSound.h @@ -49,6 +49,7 @@ public: virtual unsigned int GetChunkLen(); virtual float GetDelay(); virtual float GetCacheTime(); + virtual float GetCacheTotal(); CALSADirectSound(); virtual bool Initialize(IAudioCallback* pCallback, const CStdString& device, int iChannels, unsigned int uiSamplesPerSec, unsigned int uiBitsPerSample, bool bResample, const char* strAudioCodec = "", bool bIsMusic=false, bool bPassthrough = false); virtual ~CALSADirectSound(); diff --git a/xbmc/cores/AudioRenderers/CoreAudioRenderer.cpp b/xbmc/cores/AudioRenderers/CoreAudioRenderer.cpp index c13a3cd405..20ee587857 100644 --- a/xbmc/cores/AudioRenderers/CoreAudioRenderer.cpp +++ b/xbmc/cores/AudioRenderers/CoreAudioRenderer.cpp @@ -626,6 +626,11 @@ float CCoreAudioRenderer::GetCacheTime() return GetDelay(); } +float CCoreAudioRenderer::GetCacheTotal() +{ + return (float)m_MaxCacheLen / m_AvgBytesPerSec; +} + unsigned int CCoreAudioRenderer::GetChunkLen() { return m_ChunkLen; diff --git a/xbmc/cores/AudioRenderers/CoreAudioRenderer.h b/xbmc/cores/AudioRenderers/CoreAudioRenderer.h index 81d64816c8..c88cdba8ca 100644 --- a/xbmc/cores/AudioRenderers/CoreAudioRenderer.h +++ b/xbmc/cores/AudioRenderers/CoreAudioRenderer.h @@ -110,6 +110,7 @@ class CCoreAudioRenderer : public IAudioRenderer virtual unsigned int AddPackets(const void* data, unsigned int len); virtual unsigned int GetSpace(); virtual float GetCacheTime(); + virtual float GetCacheTotal(); virtual bool Pause(); virtual bool Stop(); virtual bool Resume(); diff --git a/xbmc/cores/AudioRenderers/IAudioRenderer.h b/xbmc/cores/AudioRenderers/IAudioRenderer.h index 1d8e12ffd6..633d5d4f15 100644 --- a/xbmc/cores/AudioRenderers/IAudioRenderer.h +++ b/xbmc/cores/AudioRenderers/IAudioRenderer.h @@ -47,6 +47,7 @@ public: virtual void RegisterAudioCallback(IAudioCallback* pCallback) = 0; virtual float GetDelay() = 0; virtual float GetCacheTime() = 0; + virtual float GetCacheTotal() { return 1.0f; } virtual unsigned int AddPackets(const void* data, unsigned int len) = 0; virtual bool IsResampling() { return false;}; diff --git a/xbmc/cores/AudioRenderers/PulseAudioDirectSound.cpp b/xbmc/cores/AudioRenderers/PulseAudioDirectSound.cpp index a9d030d647..e806494f18 100644 --- a/xbmc/cores/AudioRenderers/PulseAudioDirectSound.cpp +++ b/xbmc/cores/AudioRenderers/PulseAudioDirectSound.cpp @@ -487,6 +487,11 @@ float CPulseAudioDirectSound::GetCacheTime() return (float)(m_uiBufferSize - GetSpace()) / (float)m_uiBytesPerSecond; } +float CPulseAudioDirectSound::GetCacheTotal() +{ + return (float)m_uiBufferSize / (float)m_uiBytesPerSecond; +} + float CPulseAudioDirectSound::GetDelay() { if (!m_bIsAllocated) diff --git a/xbmc/cores/AudioRenderers/PulseAudioDirectSound.h b/xbmc/cores/AudioRenderers/PulseAudioDirectSound.h index a637af41f5..a91330f73b 100644 --- a/xbmc/cores/AudioRenderers/PulseAudioDirectSound.h +++ b/xbmc/cores/AudioRenderers/PulseAudioDirectSound.h @@ -45,6 +45,7 @@ public: virtual unsigned int GetChunkLen(); virtual float GetDelay(); virtual float GetCacheTime(); + virtual float GetCacheTotal(); CPulseAudioDirectSound(); virtual bool Initialize(IAudioCallback* pCallback, const CStdString& device, int iChannels, unsigned int uiSamplesPerSec, unsigned int uiBitsPerSample, bool bResample, const char* strAudioCodec = "", bool bIsMusic=false, bool bPassthrough = false); virtual ~CPulseAudioDirectSound(); diff --git a/xbmc/cores/AudioRenderers/Win32DirectSound.cpp b/xbmc/cores/AudioRenderers/Win32DirectSound.cpp index 06abb00939..b35c66a820 100644 --- a/xbmc/cores/AudioRenderers/Win32DirectSound.cpp +++ b/xbmc/cores/AudioRenderers/Win32DirectSound.cpp @@ -419,6 +419,12 @@ float CWin32DirectSound::GetCacheTime() return (float)m_CacheLen / (float)m_AvgBytesPerSec; } +float CWin32DirectSound::GetCacheTotal() +{ + CSingleLock lock (m_critSection); + return (float)m_dwBufferLen / (float)m_AvgBytesPerSec; +} + //*********************************************************************************************** unsigned int CWin32DirectSound::GetChunkLen() { diff --git a/xbmc/cores/AudioRenderers/Win32DirectSound.h b/xbmc/cores/AudioRenderers/Win32DirectSound.h index a3de3a0f5d..e424c83a4b 100644 --- a/xbmc/cores/AudioRenderers/Win32DirectSound.h +++ b/xbmc/cores/AudioRenderers/Win32DirectSound.h @@ -43,6 +43,7 @@ public: virtual unsigned int GetChunkLen(); virtual float GetDelay(); virtual float GetCacheTime(); + virtual float GetCacheTotal(); CWin32DirectSound(); virtual bool Initialize(IAudioCallback* pCallback, const CStdString& device, int iChannels, unsigned int uiSamplesPerSec, unsigned int uiBitsPerSample, bool bResample, const char* strAudioCodec = "", bool bIsMusic=false, bool bPassthrough = false); virtual ~CWin32DirectSound(); diff --git a/xbmc/cores/dvdplayer/DVDAudio.cpp b/xbmc/cores/dvdplayer/DVDAudio.cpp index e19f96f8d3..293a60f7f9 100644 --- a/xbmc/cores/dvdplayer/DVDAudio.cpp +++ b/xbmc/cores/dvdplayer/DVDAudio.cpp @@ -330,3 +330,19 @@ bool CDVDAudio::IsValidFormat(const DVDAudioFrame &audioframe) return true; } + +double CDVDAudio::GetCacheTime() +{ + CSingleLock lock (m_critSection); + if(!m_pAudioDecoder) + return 0.0; + return m_pAudioDecoder->GetCacheTime(); +} + +double CDVDAudio::GetCacheTotal() +{ + CSingleLock lock (m_critSection); + if(!m_pAudioDecoder) + return 0.0; + return m_pAudioDecoder->GetCacheTotal(); +}
\ No newline at end of file diff --git a/xbmc/cores/dvdplayer/DVDAudio.h b/xbmc/cores/dvdplayer/DVDAudio.h index d730276fca..669dfc8d48 100644 --- a/xbmc/cores/dvdplayer/DVDAudio.h +++ b/xbmc/cores/dvdplayer/DVDAudio.h @@ -65,6 +65,8 @@ public: void Destroy(); DWORD AddPackets(const DVDAudioFrame &audioframe); double GetDelay(); // returns the time it takes to play a packet if we add one at this time + double GetCacheTime(); // returns total amount of data cached in audio output at this time + double GetCacheTotal(); // returns total amount the audio device can buffer void Flush(); void Finish(); void Drain(); |