aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelupus <elupus@xbmc.org>2012-04-10 22:16:02 +0200
committerelupus <elupus@xbmc.org>2012-04-10 22:41:39 +0200
commitdca5b21ab57d663325dcb643785061acfb19cbdf (patch)
tree348bff550657274dfca0ff1a892ff5c1e5e8876b
parent775c2cb12555e5c5e1e7df814369086b447d255a (diff)
Refactor calculation of min/max dts to allow additional streams
-rw-r--r--xbmc/cores/dvdplayer/DVDPlayer.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp
index b4ad345827..bf206303b4 100644
--- a/xbmc/cores/dvdplayer/DVDPlayer.cpp
+++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp
@@ -1610,6 +1610,15 @@ void CDVDPlayer::UpdateTimestamps(CCurrentStream& current, DemuxPacket* pPacket)
current.dts = dts;
}
+
+static void UpdateLimits(double& minimum, double& maximum, double dts)
+{
+ if(dts == DVD_NOPTS_VALUE)
+ return;
+ if(minimum == DVD_NOPTS_VALUE || minimum > dts) minimum = dts;
+ if(maximum == DVD_NOPTS_VALUE || maximum < dts) maximum = dts;
+}
+
void CDVDPlayer::CheckContinuity(CCurrentStream& current, DemuxPacket* pPacket)
{
if (m_playSpeed < DVD_PLAYSPEED_PAUSE)
@@ -1655,16 +1664,9 @@ void CDVDPlayer::CheckContinuity(CCurrentStream& current, DemuxPacket* pPacket)
}
#endif
- double mindts, maxdts;
- if(m_CurrentAudio.dts == DVD_NOPTS_VALUE)
- maxdts = mindts = m_CurrentVideo.dts;
- else if(m_CurrentVideo.dts == DVD_NOPTS_VALUE)
- maxdts = mindts = m_CurrentAudio.dts;
- else
- {
- maxdts = max(m_CurrentAudio.dts, m_CurrentVideo.dts);
- mindts = min(m_CurrentAudio.dts, m_CurrentVideo.dts);
- }
+ double mindts = DVD_NOPTS_VALUE, maxdts = DVD_NOPTS_VALUE;
+ UpdateLimits(mindts, maxdts, m_CurrentAudio.dts);
+ UpdateLimits(mindts, maxdts, m_CurrentVideo.dts);
/* if we don't have max and min, we can't do anything more */
if( mindts == DVD_NOPTS_VALUE || maxdts == DVD_NOPTS_VALUE )