Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #2537 from popcornmix/mediatime

[rbp] Set mediatime on GPU after a seek.
  • Loading branch information...
commit 030f960290e2888a721eef5dc76386aa9ae47678 2 parents 3caf659 + c106cfd
@huceke huceke authored
View
3  xbmc/cores/omxplayer/OMXPlayer.cpp
@@ -3296,6 +3296,9 @@ void COMXPlayer::FlushBuffers(bool queued, double pts, bool accurate)
CSingleLock lock(m_StateSection);
m_State = m_StateInput;
}
+ // let clock know the new time so progress bar updates immediately
+ if(startpts != DVD_NOPTS_VALUE)
+ m_av_clock.OMXMediaTime(startpts);
}
// since we call ffmpeg functions to decode, this is being called in the same thread as ::Process() is
View
46 xbmc/linux/OMXClock.cpp
@@ -745,6 +745,52 @@ double OMXClock::OMXMediaTime(bool fixPreroll /* true */ , bool lock /* = true *
return pts;
}
+// Set the media time, so calls to get media time use the updated value,
+// useful after a seek so mediatime is updated immediately (rather than waiting for first decoded packet)
+bool OMXClock::OMXMediaTime(double pts, bool fixPreroll /* = true*/, bool lock /* = true*/)
+{
+ if(m_omx_clock.GetComponent() == NULL)
+ return false;
+
+ if(lock)
+ Lock();
+
+ OMX_ERRORTYPE omx_err = OMX_ErrorNone;
+ OMX_INDEXTYPE index;
+ OMX_TIME_CONFIG_TIMESTAMPTYPE timeStamp;
+ OMX_INIT_STRUCTURE(timeStamp);
+ timeStamp.nPortIndex = m_omx_clock.GetInputPort();
+
+ if(g_guiSettings.GetBool("videoplayer.usedisplayasclock") && m_has_video)
+ index = OMX_IndexConfigTimeCurrentVideoReference;
+ else if(m_has_audio)
+ index = OMX_IndexConfigTimeCurrentAudioReference;
+ else
+ index = OMX_IndexConfigTimeCurrentVideoReference;
+
+ if(fixPreroll)
+ pts -= (OMX_PRE_ROLL * 1000);
+ timeStamp.nTimestamp = ToOMXTime(pts);
+
+ omx_err = m_omx_clock.SetConfig(index, &timeStamp);
+ if(omx_err != OMX_ErrorNone)
+ {
+ CLog::Log(LOGERROR, "OMXClock::OMXMediaTime error setting %s", index == OMX_IndexConfigTimeCurrentAudioReference ?
+ "OMX_IndexConfigTimeCurrentAudioReference":"OMX_IndexConfigTimeCurrentVideoReference");
+ if(lock)
+ UnLock();
+ return false;
+ }
+
+ CLog::Log(LOGDEBUG, "OMXClock::OMXMediaTime set config %s = %.2f", index == OMX_IndexConfigTimeCurrentAudioReference ?
+ "OMX_IndexConfigTimeCurrentAudioReference":"OMX_IndexConfigTimeCurrentVideoReference", pts);
+
+ if(lock)
+ UnLock();
+
+ return true;
+}
+
bool OMXClock::OMXPause(bool lock /* = true */)
{
if(m_omx_clock.GetComponent() == NULL)
View
1  xbmc/linux/OMXClock.h
@@ -116,6 +116,7 @@ class OMXClock
bool OMXReset(bool lock = true);
double OMXWallTime(bool lock = true);
double OMXMediaTime(bool fixPreroll = true, bool lock = true);
+ bool OMXMediaTime(double pts, bool fixPreroll = true, bool lock = true);
bool OMXPause(bool lock = true);
bool OMXResume(bool lock = true);
bool OMXUpdateClock(double pts, bool lock = true);
Please sign in to comment.
Something went wrong with that request. Please try again.