Skip to content
Browse files

fixed problem with streams that update time (DVD,BluRay)

tagged packets with stream time at reading
update stream Current time when playing
  • Loading branch information...
1 parent 38aecd1 commit 755138c51cfdaa242631ee35c19e6e0d4f900825 @dragonflight committed Oct 14, 2012
View
1 xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxPacket.h
@@ -33,4 +33,5 @@
double pts; // pts in DVD_TIME_BASE
double dts; // dts in DVD_TIME_BASE
double duration; // duration in DVD_TIME_BASE if available
+ int time; // time as determined by input stream or -1 otherwise
} DemuxPacket;
View
14 xbmc/cores/dvdplayer/DVDPlayer.cpp
@@ -1234,6 +1234,11 @@ void CDVDPlayer::Process()
// it's a valid data packet, reset error counter
m_errorCount = 0;
+ CDVDInputStream::IDisplayTime* pDisplayTime = dynamic_cast<CDVDInputStream::IDisplayTime*>(m_pInputStream);
+ if (pDisplayTime && pDisplayTime->GetTotalTime() > 0)
+ pPacket->time = pDisplayTime->GetTime();
+ else
+ pPacket->time = -1;
// check so that none of our streams has become invalid
if (!IsValidStream(m_CurrentAudio) && m_dvdPlayerAudio.IsStalled()) CloseAudioStream(true);
@@ -3803,10 +3808,16 @@ void CDVDPlayer::UpdatePlayState(double timeout)
SPlayerState state(m_State);
+ if( m_dvdPlayerVideo.GetCurrentPts() != DVD_NOPTS_VALUE)
+ state.dts = m_dvdPlayerVideo.GetCurrentPts();
+ else if( m_dvdPlayerAudio.GetCurrentPts() != DVD_NOPTS_VALUE)
+ state.dts = m_dvdPlayerAudio.GetCurrentPts();
+/*
if (m_CurrentVideo.dts != DVD_NOPTS_VALUE)
state.dts = m_CurrentVideo.dts;
else if(m_CurrentAudio.dts != DVD_NOPTS_VALUE)
state.dts = m_CurrentAudio.dts;
+*/
else
state.dts = m_clock.GetClock();
@@ -3833,7 +3844,8 @@ void CDVDPlayer::UpdatePlayState(double timeout)
CDVDInputStream::IDisplayTime* pDisplayTime = dynamic_cast<CDVDInputStream::IDisplayTime*>(m_pInputStream);
if (pDisplayTime && pDisplayTime->GetTotalTime() > 0)
{
- state.time = pDisplayTime->GetTime();
+ if( m_dvdPlayerVideo.GetCurrentTime() > 0 )
+ state.time = m_dvdPlayerVideo.GetCurrentTime();
state.time_total = pDisplayTime->GetTotalTime();
}
View
4 xbmc/cores/dvdplayer/DVDPlayerVideo.cpp
@@ -147,6 +147,7 @@ CDVDPlayerVideo::CDVDPlayerVideo( CDVDClock* pClock
m_messageQueue.SetMaxTimeSize(8.0);
g_dvdPerformanceCounter.EnableVideoQueue(&m_messageQueue);
+ m_iCurrentTime = -1;
m_iCurrentPts = DVD_NOPTS_VALUE;
m_iDroppedFrames = 0;
m_fFrameRate = 25;
@@ -302,6 +303,7 @@ void CDVDPlayerVideo::OnStartup()
m_crop.x1 = m_crop.x2 = 0.0f;
m_crop.y1 = m_crop.y2 = 0.0f;
+ m_iCurrentTime = -1;
m_iCurrentPts = DVD_NOPTS_VALUE;
m_FlipTimeStamp = m_pClock->GetAbsoluteClock();
@@ -484,6 +486,8 @@ void CDVDPlayerVideo::Process()
DemuxPacket* pPacket = ((CDVDMsgDemuxerPacket*)pMsg)->GetPacket();
bool bPacketDrop = ((CDVDMsgDemuxerPacket*)pMsg)->GetPacketDrop();
+ if( pPacket->time != -1 )
+ m_iCurrentTime = pPacket->time;
if (m_stalled)
{
CLog::Log(LOGINFO, "CDVDPlayerVideo - Stillframe left, switching to normal playback");
View
2 xbmc/cores/dvdplayer/DVDPlayerVideo.h
@@ -88,6 +88,7 @@ class CDVDPlayerVideo : public CThread
bool InitializedOutputDevice();
+ int GetCurrentTime() { return m_iCurrentTime; }
double GetCurrentPts() { return m_iCurrentPts; }
int GetPullupCorrection() { return m_pullupCorrection.GetPatternLength(); }
@@ -124,6 +125,7 @@ class CDVDPlayerVideo : public CThread
CDVDMessageQueue m_messageQueue;
CDVDMessageQueue& m_messageParent;
+ int m_iCurrentTime; // time of last packet displayed
double m_iCurrentPts; // last pts displayed
double m_iVideoDelay;
double m_iSubtitleDelay;

1 comment on commit 755138c

@dragonflight
Owner

I have only changed the Video player as I believe that is sufficient, to be absolutely correct one could update the audio player as well anf display the most recent time. If people think that is the right way I can make the changes.

Please sign in to comment.
Something went wrong with that request. Please try again.