aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRainer Hochecker <fernetmenta@online.de>2017-09-19 07:50:57 +0200
committerGitHub <noreply@github.com>2017-09-19 07:50:57 +0200
commit5dd414ee8813e4b802c3ba52b5b6c32d428e8b34 (patch)
tree3da1d9e091c9c1ed9a305fddb5ba03f9cf3c8197
parentf5bdcb35aa635e4a1438a0695e4025af3f61cf6e (diff)
parentddcd9d2dc1e580b2005931b42576dbf16da81c8a (diff)
Merge pull request #12808 from FernetMenta/advance
VideoPlayer: frame advance
-rw-r--r--xbmc/ApplicationPlayer.cpp7
-rw-r--r--xbmc/ApplicationPlayer.h1
-rw-r--r--xbmc/cores/IPlayer.h1
-rw-r--r--xbmc/cores/VideoPlayer/DVDClock.cpp10
-rw-r--r--xbmc/cores/VideoPlayer/DVDClock.h1
-rw-r--r--xbmc/cores/VideoPlayer/DVDMessage.h1
-rw-r--r--xbmc/cores/VideoPlayer/VideoPlayer.cpp15
-rw-r--r--xbmc/cores/VideoPlayer/VideoPlayer.h1
-rw-r--r--xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp2
-rw-r--r--xbmc/interfaces/builtins/PlayerBuiltins.cpp14
10 files changed, 52 insertions, 1 deletions
diff --git a/xbmc/ApplicationPlayer.cpp b/xbmc/ApplicationPlayer.cpp
index 17dd190ca1..38dcd64506 100644
--- a/xbmc/ApplicationPlayer.cpp
+++ b/xbmc/ApplicationPlayer.cpp
@@ -523,6 +523,13 @@ void CApplicationPlayer::SetTempo(float tempo)
player->SetTempo(tempo);
}
+void CApplicationPlayer::FrameAdvance(int frames)
+{
+ std::shared_ptr<IPlayer> player = GetInternal();
+ if (player)
+ player->FrameAdvance(frames);
+}
+
void CApplicationPlayer::DoAudioWork()
{
std::shared_ptr<IPlayer> player = GetInternal();
diff --git a/xbmc/ApplicationPlayer.h b/xbmc/ApplicationPlayer.h
index 740adfae9e..92115a0068 100644
--- a/xbmc/ApplicationPlayer.h
+++ b/xbmc/ApplicationPlayer.h
@@ -75,6 +75,7 @@ public:
PlayBackRet OpenFile(const CFileItem& item, const CPlayerOptions& options);
void SetPlaySpeed(float speed);
void SetTempo(float tempo);
+ void FrameAdvance(int frames);
void FrameMove();
void Render(bool clear, uint32_t alpha = 255, bool gui = true);
diff --git a/xbmc/cores/IPlayer.h b/xbmc/cores/IPlayer.h
index 8455ea4d64..7940b1b893 100644
--- a/xbmc/cores/IPlayer.h
+++ b/xbmc/cores/IPlayer.h
@@ -317,6 +317,7 @@ public:
virtual void SetSpeed(float speed) = 0;
virtual void SetTempo(float tempo) { };
virtual bool SupportsTempo() { return false; }
+ virtual void FrameAdvance(int frames) { };
//Returns true if not playback (paused or stopped being filled)
virtual bool IsCaching() const {return false;};
diff --git a/xbmc/cores/VideoPlayer/DVDClock.cpp b/xbmc/cores/VideoPlayer/DVDClock.cpp
index d4b06878f6..9086df5f03 100644
--- a/xbmc/cores/VideoPlayer/DVDClock.cpp
+++ b/xbmc/cores/VideoPlayer/DVDClock.cpp
@@ -122,6 +122,16 @@ void CDVDClock::Pause(bool pause)
}
}
+void CDVDClock::Advance(double time)
+{
+ CSingleLock lock(m_critSection);
+
+ if (m_pauseClock)
+ {
+ m_pauseClock += time / DVD_TIME_BASE * m_systemFrequency;
+ }
+}
+
void CDVDClock::SetSpeed(int iSpeed)
{
// this will sometimes be a little bit of due to rounding errors, ie clock might jump a bit when changing speed
diff --git a/xbmc/cores/VideoPlayer/DVDClock.h b/xbmc/cores/VideoPlayer/DVDClock.h
index 76bd255d6d..e528e9b48f 100644
--- a/xbmc/cores/VideoPlayer/DVDClock.h
+++ b/xbmc/cores/VideoPlayer/DVDClock.h
@@ -65,6 +65,7 @@ public:
double GetVsyncAdjust();
void Pause(bool pause);
+ void Advance(double time);
protected:
double SystemToAbsolute(int64_t system);
diff --git a/xbmc/cores/VideoPlayer/DVDMessage.h b/xbmc/cores/VideoPlayer/DVDMessage.h
index ae32aea3ae..82baacfc49 100644
--- a/xbmc/cores/VideoPlayer/DVDMessage.h
+++ b/xbmc/cores/VideoPlayer/DVDMessage.h
@@ -63,6 +63,7 @@ public:
PLAYER_AVCHANGE, // signal a change in audio or video parameters
PLAYER_ABORT,
PLAYER_REPORT_STATE,
+ PLAYER_FRAME_ADVANCE,
// demuxer related messages
DEMUXER_PACKET, // data packet
diff --git a/xbmc/cores/VideoPlayer/VideoPlayer.cpp b/xbmc/cores/VideoPlayer/VideoPlayer.cpp
index 8e9253b266..6822f81d77 100644
--- a/xbmc/cores/VideoPlayer/VideoPlayer.cpp
+++ b/xbmc/cores/VideoPlayer/VideoPlayer.cpp
@@ -2845,6 +2845,12 @@ void CVideoPlayer::HandleMessages()
if (m_pDemuxer)
m_pDemuxer->SetSpeed(speed);
}
+ else if (pMsg->IsType(CDVDMsg::PLAYER_FRAME_ADVANCE))
+ {
+ int frames = static_cast<CDVDMsgInt*>(pMsg)->m_value;
+ double time = DVD_TIME_BASE / m_processInfo->GetVideoFps() * frames;
+ m_clock.Advance(time);
+ }
else if (pMsg->IsType(CDVDMsg::GENERAL_GUI_ACTION))
OnAction(static_cast<CDVDMsgType<CAction>*>(pMsg)->m_value);
else if (pMsg->IsType(CDVDMsg::PLAYER_STARTED))
@@ -3427,6 +3433,15 @@ void CVideoPlayer::SetTempo(float tempo)
}
}
+void CVideoPlayer::FrameAdvance(int frames)
+{
+ float currentSpeed = m_processInfo->GetNewSpeed();
+ if (currentSpeed != DVD_PLAYSPEED_PAUSE)
+ return;
+
+ m_messenger.Put(new CDVDMsgInt(CDVDMsg::PLAYER_FRAME_ADVANCE, frames));
+}
+
bool CVideoPlayer::SupportsTempo()
{
return m_canTempo;
diff --git a/xbmc/cores/VideoPlayer/VideoPlayer.h b/xbmc/cores/VideoPlayer/VideoPlayer.h
index 7aba70e6a5..50bd221c3e 100644
--- a/xbmc/cores/VideoPlayer/VideoPlayer.h
+++ b/xbmc/cores/VideoPlayer/VideoPlayer.h
@@ -359,6 +359,7 @@ public:
void SetSpeed(float speed) override;
void SetTempo(float tempo) override;
bool SupportsTempo() override;
+ void FrameAdvance(int frames) override;
bool OnAction(const CAction &action) override;
int GetSourceBitrate() override;
diff --git a/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp b/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp
index 47b5201164..beb12aef58 100644
--- a/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp
+++ b/xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp
@@ -333,7 +333,7 @@ void CVideoPlayerVideo::Process()
while (!m_bStop)
{
int iQueueTimeOut = (int)(m_stalled ? frametime : frametime * 10) / 1000;
- int iPriority = (m_speed == DVD_PLAYSPEED_PAUSE && m_syncState == IDVDStreamPlayer::SYNC_INSYNC) ? 1 : 0;
+ int iPriority = 0;
if (m_syncState == IDVDStreamPlayer::SYNC_WAITSYNC)
iPriority = 1;
diff --git a/xbmc/interfaces/builtins/PlayerBuiltins.cpp b/xbmc/interfaces/builtins/PlayerBuiltins.cpp
index 08d5d1c5b6..faa533e1cf 100644
--- a/xbmc/interfaces/builtins/PlayerBuiltins.cpp
+++ b/xbmc/interfaces/builtins/PlayerBuiltins.cpp
@@ -137,6 +137,20 @@ static int PlayerControl(const std::vector<std::string>& params)
{
g_application.StopPlaying();
}
+ else if (StringUtils::StartsWithNoCase(params[0], "frameadvance"))
+ {
+ std::string strFrames;
+ if (params[0].size() == 12)
+ CLog::Log(LOGERROR, "PlayerControl(frameadvance(n)) called with no argument");
+ else if (params[0].size() < 15) // arg must be at least "(N)"
+ CLog::Log(LOGERROR, "PlayerControl(frameadvance(n)) called with invalid argument: \"%s\"", params[0].substr(13).c_str());
+ else
+
+ strFrames = params[0].substr(13);
+ StringUtils::TrimRight(strFrames, ")");
+ float frames = (float) atof(strFrames.c_str());
+ g_application.m_pPlayer->FrameAdvance(frames);
+ }
else if (paramlow =="rewind" || paramlow == "forward")
{
if (g_application.m_pPlayer->IsPlaying() && !g_application.m_pPlayer->IsPaused())