Permalink
Browse files

dvdplayer: move navigator state into IMenus

This allow bluray navigator to make use of it eventually
  • Loading branch information...
1 parent 39e860c commit 850836458ddbbd8a313c0938f10c23d17b7e510a @elupus committed Mar 17, 2013
@@ -120,6 +120,9 @@ class CDVDInputStream
virtual bool IsInMenu() = 0;
virtual void SkipStill() = 0;
virtual double GetTimeStampCorrection() = 0;
+ virtual bool GetState(std::string &xmlstate) = 0;
+ virtual bool SetState(const std::string &xmlstate) = 0;
+
};
class ISeekable
@@ -82,6 +82,9 @@ class CDVDInputStreamBluray
virtual bool OnMouseClick(const CPoint &point) { return false; }
virtual double GetTimeStampCorrection() { return 0.0; }
virtual void SkipStill();
+ virtual bool GetState(std::string &xmlstate) { return false; }
+ virtual bool SetState(const std::string &xmlstate) { return false; }
+
void UserInput(bd_vk_key_e vk);
@@ -1144,7 +1144,7 @@ bool CDVDInputStreamNavigator::IsSubtitleStreamEnabled()
return false;
}
-bool CDVDInputStreamNavigator::GetNavigatorState(std::string &xmlstate)
+bool CDVDInputStreamNavigator::GetState(std::string &xmlstate)
{
if( !m_dvdnav )
return false;
@@ -1165,7 +1165,7 @@ bool CDVDInputStreamNavigator::GetNavigatorState(std::string &xmlstate)
return true;
}
-bool CDVDInputStreamNavigator::SetNavigatorState(std::string &xmlstate)
+bool CDVDInputStreamNavigator::SetState(const std::string &xmlstate)
{
if( !m_dvdnav )
return false;
@@ -108,8 +108,8 @@ class CDVDInputStreamNavigator
int GetAudioStreamCount();
bool SetActiveAudioStream(int iId);
- bool GetNavigatorState(std::string &xmlstate);
- bool SetNavigatorState(std::string &xmlstate);
+ bool GetState(std::string &xmlstate);
+ bool SetState(const std::string &xmlstate);
int GetChapter() { return m_iPart; } // the current part in the current title
int GetChapterCount() { return m_iPartCount; } // the number of parts in the current title
@@ -917,16 +917,15 @@ void CDVDPlayer::Process()
return;
}
- if(m_pInputStream->IsStreamType(DVDSTREAM_TYPE_DVD))
+ if (CDVDInputStream::IMenus* ptr = dynamic_cast<CDVDInputStream::IMenus*>(m_pInputStream))
{
- CLog::Log(LOGNOTICE, "DVDPlayer: playing a dvd with menu's");
+ CLog::Log(LOGNOTICE, "DVDPlayer: playing a file with menu's");
m_PlayerOptions.starttime = 0;
-
if(m_PlayerOptions.state.size() > 0)
- ((CDVDInputStreamNavigator*)m_pInputStream)->SetNavigatorState(m_PlayerOptions.state);
- else
- ((CDVDInputStreamNavigator*)m_pInputStream)->EnableSubtitleStream(g_settings.m_currentVideoSettings.m_SubtitleOn);
+ ptr->SetState(m_PlayerOptions.state);
+ else if(CDVDInputStreamNavigator* nav = dynamic_cast<CDVDInputStreamNavigator*>(m_pInputStream))
+ nav->EnableSubtitleStream(g_settings.m_currentVideoSettings.m_SubtitleOn);
g_settings.m_currentVideoSettings.m_SubtitleCached = true;
}
@@ -2159,13 +2158,14 @@ void CDVDPlayer::HandleMessages()
CDVDMsgPlayerSetState* pMsgPlayerSetState = (CDVDMsgPlayerSetState*)pMsg;
- if (m_pInputStream && m_pInputStream->IsStreamType(DVDSTREAM_TYPE_DVD))
+ if (CDVDInputStream::IMenus* ptr = dynamic_cast<CDVDInputStream::IMenus*>(m_pInputStream))
{
- std::string s = pMsgPlayerSetState->GetState();
- ((CDVDInputStreamNavigator*)m_pInputStream)->SetNavigatorState(s);
- m_dvd.state = DVDSTATE_NORMAL;
- m_dvd.iDVDStillStartTime = 0;
- m_dvd.iDVDStillTime = 0;
+ if(ptr->SetState(pMsgPlayerSetState->GetState()))
+ {
+ m_dvd.state = DVDSTATE_NORMAL;
+ m_dvd.iDVDStillStartTime = 0;
+ m_dvd.iDVDStillTime = 0;
+ }
}
g_infoManager.SetDisplayAfterSeek();
@@ -3937,8 +3937,11 @@ void CDVDPlayer::UpdatePlayState(double timeout)
state.time_src = ETIMESOURCE_INPUT;
}
- if (dynamic_cast<CDVDInputStream::IMenus*>(m_pInputStream))
+ if (CDVDInputStream::IMenus* ptr = dynamic_cast<CDVDInputStream::IMenus*>(m_pInputStream))
{
+ if(!ptr->GetState(state.player_state))
+ state.player_state = "";
+
if(m_dvd.state == DVDSTATE_STILL)
{
state.time = XbmcThreads::SystemClockMillis() - m_dvd.iDVDStillStartTime;
@@ -3963,13 +3966,6 @@ void CDVDPlayer::UpdatePlayState(double timeout)
if(state.time_total <= 0)
state.canseek = false;
- state.player_state = "";
- if(CDVDInputStreamNavigator* ptr = dynamic_cast<CDVDInputStreamNavigator*>(m_pInputStream))
- {
- if(!ptr->GetNavigatorState(state.player_state))
- state.player_state = "";
- }
-
if (state.time_src == ETIMESOURCE_CLOCK)
state.time_offset = m_offset_pts;
else if (state.dts != DVD_NOPTS_VALUE)

0 comments on commit 8508364

Please sign in to comment.