{
m_network = NULL;
TiXmlBase::SetCondenseWhiteSpace(false);
- m_iPlaySpeed = 1;
m_bInhibitIdleShutdown = false;
m_bScreenSave = false;
m_dpms = NULL;
if (action.GetID() == ACTION_PREV_ITEM && m_pPlayer->CanSeek())
{
SeekTime(0);
- SetPlaySpeed(1);
+ m_pPlayer->SetPlaySpeed(1, g_application.m_muted);
return true;
}
}
// pause : pauses current audio song
- if (action.GetID() == ACTION_PAUSE && m_iPlaySpeed == 1)
+ if (action.GetID() == ACTION_PAUSE && m_pPlayer->GetPlaySpeed() == 1)
{
m_pPlayer->Pause();
#ifdef HAS_KARAOKE
#endif
if (!m_pPlayer->IsPaused())
{ // unpaused - set the playspeed back to normal
- SetPlaySpeed(1);
+ m_pPlayer->SetPlaySpeed(1, g_application.m_muted);
}
g_audioManager.Enable(m_pPlayer->IsPaused());
return true;
// if we are playing at normal speed, then allow play to pause
if (action.GetID() == ACTION_PLAYER_PLAY || action.GetID() == ACTION_PAUSE)
{
- if (m_iPlaySpeed != 1)
+ if (m_pPlayer->GetPlaySpeed() != 1)
{
- SetPlaySpeed(1);
+ m_pPlayer->SetPlaySpeed(1, g_application.m_muted);
}
else
{
}
if (action.GetID() == ACTION_PLAYER_FORWARD || action.GetID() == ACTION_PLAYER_REWIND)
{
- int iPlaySpeed = m_iPlaySpeed;
+ int iPlaySpeed = m_pPlayer->GetPlaySpeed();
if (action.GetID() == ACTION_PLAYER_REWIND && iPlaySpeed == 1) // Enables Rewinding
iPlaySpeed *= -2;
else if (action.GetID() == ACTION_PLAYER_REWIND && iPlaySpeed > 1) //goes down a notch if you're FFing
if (iPlaySpeed > 32 || iPlaySpeed < -32)
iPlaySpeed = 1;
- SetPlaySpeed(iPlaySpeed);
+ m_pPlayer->SetPlaySpeed(iPlaySpeed, g_application.m_muted);
return true;
}
- else if ((action.GetAmount() || GetPlaySpeed() != 1) && (action.GetID() == ACTION_ANALOG_REWIND || action.GetID() == ACTION_ANALOG_FORWARD))
+ else if ((action.GetAmount() || m_pPlayer->GetPlaySpeed() != 1) && (action.GetID() == ACTION_ANALOG_REWIND || action.GetID() == ACTION_ANALOG_FORWARD))
{
// calculate the speed based on the amount the button is held down
int iPower = (int)(action.GetAmount() * MAX_FFWD_SPEED + 0.5f);
int iSpeed = 1 << iPower;
if (iSpeed != 1 && action.GetID() == ACTION_ANALOG_REWIND)
iSpeed = -iSpeed;
- g_application.SetPlaySpeed(iSpeed);
+ g_application.m_pPlayer->SetPlaySpeed(iSpeed, g_application.m_muted);
if (iSpeed == 1)
CLog::Log(LOGDEBUG,"Resetting playspeed");
return true;
m_pPlayer->Pause();
g_audioManager.Enable(m_pPlayer->IsPaused());
- g_application.SetPlaySpeed(1);
+ g_application.m_pPlayer->SetPlaySpeed(1, g_application.m_muted);
return true;
}
}
CMediaSettings::Get().GetCurrentVideoSettings() = CMediaSettings::Get().GetDefaultVideoSettings();
// see if we have saved options in the database
- SetPlaySpeed(1);
- m_iPlaySpeed = 1; // Reset both CApp's & Player's speed else we'll get confused
+ m_pPlayer->SetPlaySpeed(1, g_application.m_muted);
+ m_pPlayer->m_iPlaySpeed = 1; // Reset both CApp's & Player's speed else we'll get confused
*m_itemCurrentFile = item;
m_nextPlaylistItem = -1;
if(iResult == PLAYBACK_OK)
{
- if (m_iPlaySpeed != 1)
+ if (m_pPlayer->GetPlaySpeed() != 1)
{
- int iSpeed = m_iPlaySpeed;
- m_iPlaySpeed = 1;
- SetPlaySpeed(iSpeed);
+ int iSpeed = m_pPlayer->GetPlaySpeed();
+ m_pPlayer->m_iPlaySpeed = 1;
+ m_pPlayer->SetPlaySpeed(iSpeed, g_application.m_muted);
}
// if player has volume control, set it.
CJSONUtils::MillisecondsToTimeObject(iTime, param["player"]["time"]);
CJSONUtils::MillisecondsToTimeObject(seekOffset, param["player"]["seekoffset"]);;
param["player"]["playerid"] = g_playlistPlayer.GetCurrentPlaylist();
- param["player"]["speed"] = GetPlaySpeed();
+ param["player"]["speed"] = m_pPlayer->GetPlaySpeed();
CAnnouncementManager::Announce(Player, "xbmc", "OnSeek", m_itemCurrentFile, param);
g_infoManager.SetDisplayAfterSeek(2500, seekOffset/1000);
}
m_pPlayer->ClosePlayer();
// Reset playspeed
- m_iPlaySpeed = 1;
+ m_pPlayer->m_iPlaySpeed = 1;
}
if (!m_pPlayer->IsPlaying())
return int(((float)(CMediaSettings::Get().GetCurrentVideoSettings().m_AudioDelay + g_advancedSettings.m_videoAudioDelayRange)) / (2 * g_advancedSettings.m_videoAudioDelayRange)*100.0f + 0.5f);
}
-void CApplication::SetPlaySpeed(int iSpeed)
-{
- if (!m_pPlayer->IsPlayingAudio() && !m_pPlayer->IsPlayingVideo())
- return ;
- if (m_iPlaySpeed == iSpeed)
- return ;
- if (!m_pPlayer->CanSeek())
- return;
- if (m_pPlayer->IsPaused())
- {
- if (
- ((m_iPlaySpeed > 1) && (iSpeed > m_iPlaySpeed)) ||
- ((m_iPlaySpeed < -1) && (iSpeed < m_iPlaySpeed))
- )
- {
- iSpeed = m_iPlaySpeed; // from pause to ff/rw, do previous ff/rw speed
- }
- m_pPlayer->Pause();
- }
- m_iPlaySpeed = iSpeed;
-
- m_pPlayer->ToFFRW(m_iPlaySpeed);
-
- // if player has volume control, set it.
- if (m_pPlayer->ControlsVolume())
- {
- if (m_iPlaySpeed == 1)
- { // restore volume
- m_pPlayer->SetVolume(VOLUME_MAXIMUM);
- }
- else
- { // mute volume
- m_pPlayer->SetVolume(VOLUME_MINIMUM);
- }
- m_pPlayer->SetMute(m_muted);
- }
-}
-
-int CApplication::GetPlaySpeed() const
-{
- return m_iPlaySpeed;
-}
-
// Returns the total time in seconds of the current media. Fractional
// portions of a second are possible - but not necessarily supported by the
// player class. This returns a double to be consistent with GetTime() and
// check if we haven't rewound past the start of the file
if (m_pPlayer->IsPlaying())
{
- int iSpeed = g_application.GetPlaySpeed();
+ int iSpeed = g_application.m_pPlayer->GetPlaySpeed();
if (iSpeed < 1)
{
iSpeed *= -1;
}
if (g_infoManager.GetPlayTime() / 1000 < iPower)
{
- g_application.SetPlaySpeed(1);
+ g_application.m_pPlayer->SetPlaySpeed(1, g_application.m_muted);
g_application.SeekTime(0);
}
}
float GetVolume(bool percentage = true) const;
void SetVolume(float iValue, bool isPercentage = true);
bool IsMuted() const;
+ bool IsMutedInternal() const { return m_muted; }
void ToggleMute(void);
void SetMute(bool mute);
void ShowVolumeBar(const CAction *action = NULL);
- int GetPlaySpeed() const;
int GetSubtitleDelay() const;
int GetAudioDelay() const;
- void SetPlaySpeed(int iSpeed);
void ResetSystemIdleTimer();
void ResetScreenSaverTimer();
void StopScreenSaverTimer();
CFileItemPtr m_progressTrackingItem;
bool m_progressTrackingPlayCountUpdate;
- int m_iPlaySpeed;
int m_currentStackPosition;
int m_nextPlaylistItem;
#include "ApplicationPlayer.h"
#include "cores/IPlayer.h"
+#define VOLUME_MINIMUM 0.0f // -60dB
+#define VOLUME_MAXIMUM 1.0f // 0dB
+
CApplicationPlayer::CApplicationPlayer()
{
m_iPlayerOPSeq = 0;
player->GetScalingMethods(scalingMethods);
}
-void CApplicationPlayer::SetPlaySpeed(int iSpeed)
+void CApplicationPlayer::SetPlaySpeed(int iSpeed, bool bApplicationMuted)
{
if (!IsPlayingAudio() && !IsPlayingVideo())
return ;
{ // mute volume
m_pPlayer->SetVolume(VOLUME_MINIMUM);
}
- m_pPlayer->SetMute(g_application.m_muted);
+ m_pPlayer->SetMute(bApplicationMuted);
}
}
{
return m_iPlaySpeed;
}
-
public:
CApplicationPlayer();
+ int m_iPlaySpeed;
+
// player management
void CloseFile();
void ClosePlayer();
void ClosePlayerGapless(PLAYERCOREID newCore);
void CreatePlayer(PLAYERCOREID newCore, IPlayerCallback& callback);
- bool HasPlayer() const;
PLAYERCOREID GetCurrentPlayer() const { return m_eCurrentPlayer; }
boost::shared_ptr<IPlayer> GetInternal() const;
+ int GetPlaySpeed() const;
+ bool HasPlayer() const;
PlayBackRet OpenFile(const CFileItem& item, const CPlayerOptions& options);
void ResetPlayer() { m_eCurrentPlayer = EPC_NONE; }
+ void SetPlaySpeed(int iSpeed, bool bApplicationMuted);
// proxy calls
int AddSubtitle(const CStdString& strSubPath);
bReturn = g_application.m_pPlayer->IsPlayingVideo();
break;
case PLAYER_PLAYING:
- bReturn = !g_application.m_pPlayer->IsPausedPlayback() && (g_application.GetPlaySpeed() == 1);
+ bReturn = !g_application.m_pPlayer->IsPausedPlayback() && (g_application.m_pPlayer->GetPlaySpeed() == 1);
break;
case PLAYER_PAUSED:
bReturn = g_application.m_pPlayer->IsPausedPlayback();
break;
case PLAYER_REWINDING:
- bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.GetPlaySpeed() < 1;
+ bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.m_pPlayer->GetPlaySpeed() < 1;
break;
case PLAYER_FORWARDING:
- bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.GetPlaySpeed() > 1;
+ bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.m_pPlayer->GetPlaySpeed() > 1;
break;
case PLAYER_REWINDING_2x:
- bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.GetPlaySpeed() == -2;
+ bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.m_pPlayer->GetPlaySpeed() == -2;
break;
case PLAYER_REWINDING_4x:
- bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.GetPlaySpeed() == -4;
+ bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.m_pPlayer->GetPlaySpeed() == -4;
break;
case PLAYER_REWINDING_8x:
- bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.GetPlaySpeed() == -8;
+ bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.m_pPlayer->GetPlaySpeed() == -8;
break;
case PLAYER_REWINDING_16x:
- bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.GetPlaySpeed() == -16;
+ bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.m_pPlayer->GetPlaySpeed() == -16;
break;
case PLAYER_REWINDING_32x:
- bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.GetPlaySpeed() == -32;
+ bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.m_pPlayer->GetPlaySpeed() == -32;
break;
case PLAYER_FORWARDING_2x:
- bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.GetPlaySpeed() == 2;
+ bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.m_pPlayer->GetPlaySpeed() == 2;
break;
case PLAYER_FORWARDING_4x:
- bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.GetPlaySpeed() == 4;
+ bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.m_pPlayer->GetPlaySpeed() == 4;
break;
case PLAYER_FORWARDING_8x:
- bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.GetPlaySpeed() == 8;
+ bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.m_pPlayer->GetPlaySpeed() == 8;
break;
case PLAYER_FORWARDING_16x:
- bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.GetPlaySpeed() == 16;
+ bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.m_pPlayer->GetPlaySpeed() == 16;
break;
case PLAYER_FORWARDING_32x:
- bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.GetPlaySpeed() == 32;
+ bReturn = !g_application.m_pPlayer->IsPausedPlayback() && g_application.m_pPlayer->GetPlaySpeed() == 32;
break;
case PLAYER_CAN_RECORD:
bReturn = g_application.m_pPlayer->CanRecord();
else if (info.m_info == PLAYER_TIME_SPEED)
{
CStdString strTime;
- if (g_application.GetPlaySpeed() != 1)
- strTime.Format("%s (%ix)", GetCurrentPlayTime((TIME_FORMAT)info.GetData1()).c_str(), g_application.GetPlaySpeed());
+ if (g_application.m_pPlayer->GetPlaySpeed() != 1)
+ strTime.Format("%s (%ix)", GetCurrentPlayTime((TIME_FORMAT)info.GetData1()).c_str(), g_application.m_pPlayer->GetPlaySpeed());
else
strTime = GetCurrentPlayTime();
return strTime;
// either resume playing, or pause
if (g_application.m_pPlayer->IsPlaying())
{
- if (g_application.GetPlaySpeed() != 1)
- g_application.SetPlaySpeed(1);
+ if (g_application.m_pPlayer->GetPlaySpeed() != 1)
+ g_application.m_pPlayer->SetPlaySpeed(1, g_application.IsMutedInternal());
else
g_application.m_pPlayer->Pause();
}
{
if (g_application.m_pPlayer->IsPlaying() && !g_application.m_pPlayer->IsPaused())
{
- int iPlaySpeed = g_application.GetPlaySpeed();
+ int iPlaySpeed = g_application.m_pPlayer->GetPlaySpeed();
if (parameter.Equals("rewind") && iPlaySpeed == 1) // Enables Rewinding
iPlaySpeed *= -2;
else if (parameter.Equals("rewind") && iPlaySpeed > 1) //goes down a notch if you're FFing
if (iPlaySpeed > 32 || iPlaySpeed < -32)
iPlaySpeed = 1;
- g_application.SetPlaySpeed(iPlaySpeed);
+ g_application.m_pPlayer->SetPlaySpeed(iPlaySpeed, g_application.IsMutedInternal());
}
}
else if (parameter.Equals("next"))
{
if (g_application.m_pPlayer->IsPausedPlayback())
CApplicationMessenger::Get().MediaPause();
- else if (g_application.GetPlaySpeed() != 1)
- g_application.SetPlaySpeed(1);
+ else if (g_application.m_pPlayer->GetPlaySpeed() != 1)
+ g_application.m_pPlayer->SetPlaySpeed(1, g_application.IsMutedInternal());
}
else if (!g_application.m_pPlayer->IsPausedPlayback())
CApplicationMessenger::Get().MediaPause();
}
- result["speed"] = g_application.m_pPlayer->IsPausedPlayback() ? 0 : g_application.GetPlaySpeed();
+ result["speed"] = g_application.m_pPlayer->IsPausedPlayback() ? 0 : g_application.m_pPlayer->GetPlaySpeed();
return OK;
case Picture:
// If the player is paused we first need to unpause
if (g_application.m_pPlayer->IsPausedPlayback())
g_application.m_pPlayer->Pause();
- g_application.SetPlaySpeed(speed);
+ g_application.m_pPlayer->SetPlaySpeed(speed, g_application.IsMutedInternal());
}
else
g_application.m_pPlayer->Pause();
else
return InvalidParams;
- result["speed"] = g_application.m_pPlayer->IsPausedPlayback() ? 0 : g_application.GetPlaySpeed();
+ result["speed"] = g_application.m_pPlayer->IsPausedPlayback() ? 0 : g_application.m_pPlayer->GetPlaySpeed();
return OK;
case Picture:
{
case Video:
case Audio:
- result = g_application.m_pPlayer->IsPausedPlayback() ? 0 : g_application.GetPlaySpeed();
+ result = g_application.m_pPlayer->IsPausedPlayback() ? 0 : g_application.m_pPlayer->GetPlaySpeed();
break;
case Picture:
{
if (g_application.m_pPlayer->IsPausedPlayback())
return false;
- if (g_application.GetPlaySpeed() != 1)
+ if (g_application.m_pPlayer->GetPlaySpeed() != 1)
return false;
}
void CGUIWindowFullScreen::FrameMove()
{
- if (g_application.GetPlaySpeed() != 1)
+ if (g_application.m_pPlayer->GetPlaySpeed() != 1)
g_infoManager.SetDisplayAfterSeek();
if (m_bShowCurrentTime)
g_infoManager.SetDisplayAfterSeek();