kodi: update to kodi-14-2cd9438

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2014-11-16 12:15:14 +01:00
parent 03f6db3269
commit 8003914943
3 changed files with 22 additions and 881 deletions

View File

@ -17,7 +17,7 @@
################################################################################
PKG_NAME="kodi-theme-Confluence"
PKG_VERSION="14-19893f8"
PKG_VERSION="14-2cd9438"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="GPL"

View File

@ -17,7 +17,7 @@
################################################################################
PKG_NAME="kodi"
PKG_VERSION="14-19893f8"
PKG_VERSION="14-2cd9438"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="GPL"

View File

@ -1,359 +1,7 @@
From 3a5bdd36382f3cd5891128f5ad8cc9a8a1866e24 Mon Sep 17 00:00:00 2001
From: xbmc <fernetmenta@online.de>
Date: Mon, 28 May 2012 10:49:05 +0200
Subject: [PATCH 01/19] dvdplayer: allow rewinding at end of stream, do a seek
after rewind
---
xbmc/cores/dvdplayer/DVDPlayer.cpp | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp
index f586933..844b278 100644
--- a/xbmc/cores/dvdplayer/DVDPlayer.cpp
+++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp
@@ -1704,7 +1704,7 @@ void CDVDPlayer::HandlePlaySpeed()
}
else if (m_CurrentVideo.id >= 0
- && m_CurrentVideo.inited == true
+ && (m_CurrentVideo.inited == true || GetPlaySpeed() < 0) // allow rewind at end of file
&& m_SpeedState.lastpts != m_dvdPlayerVideo->GetCurrentPts()
&& m_SpeedState.lasttime != GetTime())
{
@@ -2351,6 +2351,12 @@ void CDVDPlayer::HandleMessages()
pvrinputstream->Pause( speed == 0 );
}
+ // do a seek after rewind, clock is not in sync with current pts
+ if (m_playSpeed < 0 && speed >= 0)
+ {
+ m_messenger.Put(new CDVDMsgPlayerSeek(GetTime(), true, true, true));
+ }
+
// if playspeed is different then DVD_PLAYSPEED_NORMAL or DVD_PLAYSPEED_PAUSE
// audioplayer, stops outputing audio to audiorendere, but still tries to
// sleep an correct amount for each packet
From b839effd5c32cdab55913e43980c10bb1a34ae42 Mon Sep 17 00:00:00 2001
From: xbmc <fernetmenta@online.de>
Date: Mon, 20 Aug 2012 16:06:39 +0200
Subject: [PATCH 02/19] dvdplayer: observe pts counter overflow
---
.../cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp | 197 ++++++++++++++++++++-
xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.h | 3 +
2 files changed, 199 insertions(+), 1 deletion(-)
diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
index a9a8f0a..e9edd0c 100644
--- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
+++ b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
@@ -18,7 +18,6 @@
*
*/
-#include "system.h"
#ifndef __STDC_CONSTANT_MACROS
#define __STDC_CONSTANT_MACROS
#endif
@@ -26,6 +25,7 @@
#define __STDC_LIMIT_MACROS
#endif
#ifdef TARGET_POSIX
+#include "system.h"
#include "stdint.h"
#endif
#include "DVDDemuxFFmpeg.h"
@@ -477,6 +477,9 @@ bool CDVDDemuxFFmpeg::Open(CDVDInputStream* pInput, bool streaminfo, bool filein
if (skipCreateStreams && GetNrOfStreams() == 0)
m_program = 0;
+ m_bPtsWrapChecked = false;
+ m_bPtsWrap = false;
+
return true;
}
@@ -617,6 +620,12 @@ double CDVDDemuxFFmpeg::ConvertTimestamp(int64_t pts, int den, int num)
if (pts == (int64_t)AV_NOPTS_VALUE)
return DVD_NOPTS_VALUE;
+ if (m_bPtsWrap)
+ {
+ if (pts < m_iStartTime && pts < m_iEndTime)
+ pts += m_iMaxTime;
+ }
+
// do calculations in floats as they can easily overflow otherwise
// we don't care for having a completly exact timestamp anyway
double timestamp = (double)pts * num / den;
@@ -763,6 +772,24 @@ DemuxPacket* CDVDDemuxFFmpeg::Read()
m_pkt.pkt.pts = AV_NOPTS_VALUE;
}
+ if (!m_bPtsWrapChecked && m_pFormatContext->iformat->flags & AVFMT_TS_DISCONT)
+ {
+ int defaultStream = av_find_default_stream_index(m_pFormatContext);
+ int64_t duration = m_pFormatContext->streams[defaultStream]->duration * 1.5;
+ m_iMaxTime = 1LL<<m_pFormatContext->streams[defaultStream]->pts_wrap_bits;
+ m_iStartTime = m_pFormatContext->streams[defaultStream]->start_time;
+ if (m_iStartTime != DVD_NOPTS_VALUE)
+ {
+ m_iEndTime = (m_iStartTime + duration) & ~m_iMaxTime;
+ if (m_iEndTime < m_iStartTime)
+ {
+ CLog::Log(LOGNOTICE,"CDVDDemuxFFmpeg::Read - file contains pts overflow");
+ m_bPtsWrap = true;
+ }
+ }
+ m_bPtsWrapChecked = true;
+ }
+
// copy contents into our own packet
pPacket->iSize = m_pkt.pkt.size;
@@ -896,7 +923,16 @@ bool CDVDDemuxFFmpeg::SeekTime(int time, bool backwords, double *startpts)
ret = av_seek_frame(m_pFormatContext, -1, seek_pts, backwords ? AVSEEK_FLAG_BACKWARD : 0);
if(ret >= 0)
+ {
UpdateCurrentPTS();
+
+ // seek may fail silently on streams which allow discontinuity
+ // if current timestamp is way off asume a pts overflow and try bisect seek
+ if (m_bPtsWrap && fabs(time - m_currentPts/1000) > 10000)
+ {
+ ret = SeekTimeDiscont(seek_pts, backwords) ? 1 : -1;
+ }
+ }
}
if(m_currentPts == DVD_NOPTS_VALUE)
@@ -915,6 +951,165 @@ bool CDVDDemuxFFmpeg::SeekTime(int time, bool backwords, double *startpts)
return (ret >= 0);
}
+bool CDVDDemuxFFmpeg::SeekTimeDiscont(int64_t pts, bool backwards)
+{
+ // this code is taken from ffmpeg function ff_gen_search
+ // it is modified to assume a pts overflow if timestamp < start_time
+ if (!m_pFormatContext->iformat->read_timestamp)
+ return false;
+
+ int defaultStream = av_find_default_stream_index(m_pFormatContext);
+
+ if (defaultStream < 0)
+ {
+ return false;
+ }
+
+ // timestamp for default must be expressed in AV_TIME_BASE units
+ pts = av_rescale_rnd(pts, m_pFormatContext->streams[defaultStream]->time_base.den,
+ AV_TIME_BASE * (int64_t)m_pFormatContext->streams[defaultStream]->time_base.num,
+ AV_ROUND_NEAR_INF);
+
+ int64_t pos, pos_min, pos_max, pos_limit, ts, ts_min, ts_max;
+ int64_t start_pos, filesize;
+ int no_change;
+
+ pos_min = m_pFormatContext->data_offset;
+ ts_min = m_pFormatContext->iformat->read_timestamp(m_pFormatContext, defaultStream,
+ &pos_min, INT64_MAX);
+ if (ts_min == AV_NOPTS_VALUE)
+ return false;
+
+ if(ts_min >= pts)
+ {
+ pos = pos_min;
+ return true;
+ }
+
+ int step= 1024;
+ filesize = m_pInput->GetLength();
+ pos_max = filesize - 1;
+ do
+ {
+ pos_max -= step;
+ ts_max = m_pFormatContext->iformat->read_timestamp(m_pFormatContext, defaultStream,
+ &pos_max, pos_max + step);
+ step += step;
+ }while (ts_max == AV_NOPTS_VALUE && pos_max >= step);
+
+ if (ts_max == AV_NOPTS_VALUE)
+ return false;
+
+ if (ts_max < m_iStartTime && ts_max < m_iEndTime)
+ ts_max += m_iMaxTime;
+
+ for(;;)
+ {
+ int64_t tmp_pos = pos_max + 1;
+ int64_t tmp_ts = m_pFormatContext->iformat->read_timestamp(m_pFormatContext, defaultStream,
+ &tmp_pos, INT64_MAX);
+ if(tmp_ts == AV_NOPTS_VALUE)
+ break;
+
+ if (tmp_ts < m_iStartTime && tmp_ts < m_iEndTime)
+ tmp_ts += m_iMaxTime;
+
+ ts_max = tmp_ts;
+ pos_max = tmp_pos;
+ if (tmp_pos >= filesize)
+ break;
+ }
+ pos_limit = pos_max;
+
+ if(ts_max <= pts)
+ {
+ bool ret = SeekByte(pos_max);
+ if (ret)
+ {
+ m_currentPts = ConvertTimestamp(ts_max, m_pFormatContext->streams[defaultStream]->time_base.den,
+ m_pFormatContext->streams[defaultStream]->time_base.num);
+ }
+ return ret;
+ }
+
+ if(ts_min > ts_max)
+ {
+ return false;
+ }
+ else if (ts_min == ts_max)
+ {
+ pos_limit = pos_min;
+ }
+
+ no_change=0;
+ while (pos_min < pos_limit)
+ {
+ if (no_change == 0)
+ {
+ int64_t approximate_keyframe_distance= pos_max - pos_limit;
+ // interpolate position (better than dichotomy)
+ pos = av_rescale_rnd(pts - ts_min, pos_max - pos_min,
+ ts_max - ts_min, AV_ROUND_NEAR_INF)
+ + pos_min - approximate_keyframe_distance;
+ }
+ else if (no_change == 1)
+ {
+ // bisection, if interpolation failed to change min or max pos last time
+ pos = (pos_min + pos_limit) >> 1;
+ }
+ else
+ {
+ /* linear search if bisection failed, can only happen if there
+ are very few or no keyframes between min/max */
+ pos = pos_min;
+ }
+ if (pos <= pos_min)
+ pos= pos_min + 1;
+ else if (pos > pos_limit)
+ pos= pos_limit;
+ start_pos = pos;
+
+ ts = m_pFormatContext->iformat->read_timestamp(m_pFormatContext, defaultStream,
+ &pos, INT64_MAX);
+ if (pos == pos_max)
+ no_change++;
+ else
+ no_change=0;
+
+ if (ts == AV_NOPTS_VALUE)
+ {
+ return false;
+ }
+
+ if (ts < m_iStartTime && ts < m_iEndTime)
+ ts += m_iMaxTime;
+
+ if (pts <= ts)
+ {
+ pos_limit = start_pos - 1;
+ pos_max = pos;
+ ts_max = ts;
+ }
+ if (pts >= ts)
+ {
+ pos_min = pos;
+ ts_min = ts;
+ }
+ }
+
+ pos = (backwards) ? pos_min : pos_max;
+ ts = (backwards) ? ts_min : ts_max;
+
+ bool ret = SeekByte(pos);
+ if (ret)
+ {
+ m_currentPts = ConvertTimestamp(ts, m_pFormatContext->streams[defaultStream]->time_base.den,
+ m_pFormatContext->streams[defaultStream]->time_base.num);
+ }
+
+ return ret;
+}
+
bool CDVDDemuxFFmpeg::SeekByte(int64_t pos)
{
CSingleLock lock(m_critSection);
diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.h b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.h
index c2f607d..b7daa34 100644
--- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.h
+++ b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.h
@@ -102,6 +102,7 @@ class CDVDDemuxFFmpeg : public CDVDDemux
DemuxPacket* Read();
bool SeekTime(int time, bool backwords = false, double* startpts = NULL);
+ bool SeekTimeDiscont(int64_t pts, bool backwards);
bool SeekByte(int64_t pos);
int GetStreamLength();
CDemuxStream* GetStream(int iStreamId);
@@ -165,5 +166,7 @@ class CDVDDemuxFFmpeg : public CDVDDemux
bool m_streaminfo;
bool m_checkvideo;
+ bool m_bPtsWrap, m_bPtsWrapChecked;
+ int64_t m_iStartTime, m_iMaxTime, m_iEndTime;
};
From 13e1f0a869af5aa79d99a447ed10860a587134bb Mon Sep 17 00:00:00 2001
From: xbmc <fernetmenta@online.de>
Date: Tue, 2 Oct 2012 13:02:10 +0200
Subject: [PATCH 03/19] dvdplayer: avoid short screen flicker caused by
unnecessary reconfigure of renderer
---
xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp
index 9eacad2..5461608 100644
--- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp
+++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp
@@ -1052,13 +1052,16 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts)
#ifdef HAS_VIDEO_PLAYBACK
double config_framerate = m_bFpsInvalid ? 0.0 : m_fFrameRate;
+ double render_framerate = g_graphicsContext.GetFPS();
+ if (CSettings::Get().GetInt("videoplayer.adjustrefreshrate") == ADJUST_REFRESHRATE_OFF)
+ render_framerate = config_framerate;
/* check so that our format or aspect has changed. if it has, reconfigure renderer */
if (!g_renderManager.IsConfigured()
|| ( m_output.width != pPicture->iWidth )
|| ( m_output.height != pPicture->iHeight )
|| ( m_output.dwidth != pPicture->iDisplayWidth )
|| ( m_output.dheight != pPicture->iDisplayHeight )
- || ( m_output.framerate != config_framerate )
+ || (!m_bFpsInvalid && fmod(m_output.framerate, config_framerate) != 0.0 && render_framerate != config_framerate)
|| ( m_output.color_format != (unsigned int)pPicture->format )
|| ( m_output.extended_format != pPicture->extended_format )
|| ( m_output.color_matrix != pPicture->color_matrix && pPicture->color_matrix != 0 ) // don't reconfigure on unspecified
From a1c9620d33de0a17f199511f2f739db57c549c66 Mon Sep 17 00:00:00 2001
From 8a29d2fa2571cadbdccc003d08efa23fcc046f45 Mon Sep 17 00:00:00 2001
From: xbmc <fernetmenta@online.de>
Date: Thu, 11 Oct 2012 12:05:50 +0200
Subject: [PATCH 04/19] vdpau: advanced settings for auto deinterlacing
Subject: [PATCH 1/9] vdpau: advanced settings for auto deinterlacing
---
xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp | 8 ++++----
@ -362,10 +10,10 @@ Subject: [PATCH 04/19] vdpau: advanced settings for auto deinterlacing
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp
index e5e7970..8c353af 100644
index 5760fc5..300b901 100644
--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp
@@ -1958,10 +1958,10 @@ EINTERLACEMETHOD CMixer::GetDeinterlacingMethod(bool log /* = false */)
@@ -1957,10 +1957,10 @@ EINTERLACEMETHOD CMixer::GetDeinterlacingMethod(bool log /* = false */)
if (method == VS_INTERLACEMETHOD_AUTO)
{
int deint = -1;
@ -381,7 +29,7 @@ index e5e7970..8c353af 100644
if (deint != -1)
{
diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp
index a50ac84..23462d3 100644
index f4c309b..04ef53a 100644
--- a/xbmc/settings/AdvancedSettings.cpp
+++ b/xbmc/settings/AdvancedSettings.cpp
@@ -157,6 +157,8 @@ void CAdvancedSettings::Initialize()
@ -416,299 +64,17 @@ index 7df586e..eccd25c 100644
bool m_videoVDPAUdeintSkipChromaHD;
bool m_musicUseTimeSeeking;
From 36977f10cf162718eba5a636daecd1d66dbbdaf9 Mon Sep 17 00:00:00 2001
From: xbmc <fernetmenta@online.de>
Date: Fri, 2 Nov 2012 13:20:03 +0100
Subject: [PATCH 05/19] player: fix rewind
---
xbmc/cores/dvdplayer/DVDMessage.h | 5 +++-
xbmc/cores/dvdplayer/DVDPlayer.cpp | 41 ++++++++++++++++++++++-----------
xbmc/cores/dvdplayer/DVDPlayer.h | 8 ++++---
xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 18 ++++++++++++++-
xbmc/cores/dvdplayer/DVDPlayerVideo.h | 1 +
5 files changed, 55 insertions(+), 18 deletions(-)
diff --git a/xbmc/cores/dvdplayer/DVDMessage.h b/xbmc/cores/dvdplayer/DVDMessage.h
index a365821..07366df 100644
--- a/xbmc/cores/dvdplayer/DVDMessage.h
+++ b/xbmc/cores/dvdplayer/DVDMessage.h
@@ -212,7 +212,7 @@ class CDVDMsgPlayerSetState : public CDVDMsg
class CDVDMsgPlayerSeek : public CDVDMsg
{
public:
- CDVDMsgPlayerSeek(int time, bool backward, bool flush = true, bool accurate = true, bool restore = true, bool trickplay = false)
+ CDVDMsgPlayerSeek(int time, bool backward, bool flush = true, bool accurate = true, bool restore = true, bool trickplay = false, bool sync = true)
: CDVDMsg(PLAYER_SEEK)
, m_time(time)
, m_backward(backward)
@@ -220,6 +220,7 @@ class CDVDMsgPlayerSeek : public CDVDMsg
, m_accurate(accurate)
, m_restore(restore)
, m_trickplay(trickplay)
+ , m_sync(sync)
{}
int GetTime() { return m_time; }
bool GetBackward() { return m_backward; }
@@ -227,6 +228,7 @@ class CDVDMsgPlayerSeek : public CDVDMsg
bool GetAccurate() { return m_accurate; }
bool GetRestore() { return m_restore; }
bool GetTrickPlay() { return m_trickplay; }
+ bool GetSync() { return m_sync; }
private:
int m_time;
bool m_backward;
@@ -234,6 +236,7 @@ class CDVDMsgPlayerSeek : public CDVDMsg
bool m_accurate;
bool m_restore; // whether to restore any EDL cut time
bool m_trickplay;
+ bool m_sync;
};
class CDVDMsgPlayerSeekChapter : public CDVDMsg
diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp
index 844b278..1a7f021 100644
--- a/xbmc/cores/dvdplayer/DVDPlayer.cpp
+++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp
@@ -601,6 +601,7 @@ bool CDVDPlayer::OpenFile(const CFileItem& file, const CPlayerOptions &options)
SetPlaySpeed(DVD_PLAYSPEED_NORMAL);
m_State.Clear();
+ memset(&m_SpeedState, 0, sizeof(m_SpeedState));
m_UpdateApplication = 0;
m_offset_pts = 0;
m_CurrentAudio.originaldts = DVD_NOPTS_VALUE;
@@ -1705,11 +1706,13 @@ void CDVDPlayer::HandlePlaySpeed()
}
else if (m_CurrentVideo.id >= 0
&& (m_CurrentVideo.inited == true || GetPlaySpeed() < 0) // allow rewind at end of file
- && m_SpeedState.lastpts != m_dvdPlayerVideo->GetCurrentPts()
+ && (m_SpeedState.lastpts != m_dvdPlayerVideo->GetCurrentPts() || fabs(m_SpeedState.lastabstime - CDVDClock::GetAbsoluteClock()) > DVD_MSEC_TO_TIME(200))
+ && (m_dvdPlayerVideo->GetCurrentPts() != DVD_NOPTS_VALUE)
&& m_SpeedState.lasttime != GetTime())
{
m_SpeedState.lastpts = m_dvdPlayerVideo->GetCurrentPts();
m_SpeedState.lasttime = (double) GetTime();
+ m_SpeedState.lastabstime = CDVDClock::GetAbsoluteClock();
// check how much off clock video is when ff/rw:ing
// a problem here is that seeking isn't very accurate
// and since the clock will be resynced after seek
@@ -1726,9 +1729,15 @@ void CDVDPlayer::HandlePlaySpeed()
if(error > DVD_MSEC_TO_TIME(1000))
{
- CLog::Log(LOGDEBUG, "CDVDPlayer::Process - Seeking to catch up");
- int64_t iTime = (int64_t)DVD_TIME_TO_MSEC(m_clock.GetClock() + m_State.time_offset + 500000.0 * m_playSpeed / DVD_PLAYSPEED_NORMAL);
- m_messenger.Put(new CDVDMsgPlayerSeek((int) iTime, (GetPlaySpeed() < 0), true, false, false, true));
+ error = (int)DVD_TIME_TO_MSEC(m_clock.GetClock()) - m_SpeedState.lastseekpts;
+
+ if(abs(error) > 1000)
+ {
+ CLog::Log(LOGDEBUG, "CDVDPlayer::Process - Seeking to catch up");
+ m_SpeedState.lastseekpts = (int)DVD_TIME_TO_MSEC(m_clock.GetClock());
+ int iTime = DVD_TIME_TO_MSEC(m_clock.GetClock() + m_State.time_offset + 500000.0 * m_playSpeed / DVD_PLAYSPEED_NORMAL);
+ m_messenger.Put(new CDVDMsgPlayerSeek(iTime, (GetPlaySpeed() < 0), true, false, false, true, false));
+ }
}
}
}
@@ -2200,7 +2209,7 @@ void CDVDPlayer::HandleMessages()
else
m_StateInput.dts = start;
- FlushBuffers(!msg.GetFlush(), start, msg.GetAccurate());
+ FlushBuffers(!msg.GetFlush(), start, msg.GetAccurate(), msg.GetSync());
}
else
CLog::Log(LOGWARNING, "error while seeking");
@@ -2336,9 +2345,10 @@ void CDVDPlayer::HandleMessages()
double offset;
offset = CDVDClock::GetAbsoluteClock() - m_State.timestamp;
offset *= m_playSpeed / DVD_PLAYSPEED_NORMAL;
+ offset = DVD_TIME_TO_MSEC(offset);
if(offset > 1000) offset = 1000;
if(offset < -1000) offset = -1000;
- m_State.time += DVD_TIME_TO_MSEC(offset);
+ m_State.time += offset;
m_State.timestamp = CDVDClock::GetAbsoluteClock();
}
@@ -2354,7 +2364,8 @@ void CDVDPlayer::HandleMessages()
// do a seek after rewind, clock is not in sync with current pts
if (m_playSpeed < 0 && speed >= 0)
{
- m_messenger.Put(new CDVDMsgPlayerSeek(GetTime(), true, true, true));
+ int64_t iTime = (int64_t)DVD_TIME_TO_MSEC(m_clock.GetClock() + m_State.time_offset);
+ m_messenger.Put(new CDVDMsgPlayerSeek(iTime, true, true, false, false, true));
}
// if playspeed is different then DVD_PLAYSPEED_NORMAL or DVD_PLAYSPEED_PAUSE
@@ -3328,7 +3339,7 @@ void CDVDPlayer::UpdateClockMaster()
}
}
-void CDVDPlayer::FlushBuffers(bool queued, double pts, bool accurate)
+void CDVDPlayer::FlushBuffers(bool queued, double pts, bool accurate, bool sync)
{
double startpts;
if(accurate && !m_omxplayer_mode)
@@ -3340,19 +3351,23 @@ void CDVDPlayer::FlushBuffers(bool queued, double pts, bool accurate)
if(startpts != DVD_NOPTS_VALUE)
startpts -= m_offset_pts;
- m_CurrentAudio.inited = false;
+ if (sync)
+ {
+ m_CurrentAudio.inited = false;
+ m_CurrentVideo.inited = false;
+ m_CurrentSubtitle.inited = false;
+ m_CurrentTeletext.inited = false;
+ }
+
m_CurrentAudio.dts = DVD_NOPTS_VALUE;
m_CurrentAudio.startpts = startpts;
- m_CurrentVideo.inited = false;
m_CurrentVideo.dts = DVD_NOPTS_VALUE;
m_CurrentVideo.startpts = startpts;
- m_CurrentSubtitle.inited = false;
m_CurrentSubtitle.dts = DVD_NOPTS_VALUE;
m_CurrentSubtitle.startpts = startpts;
- m_CurrentTeletext.inited = false;
m_CurrentTeletext.dts = DVD_NOPTS_VALUE;
m_CurrentTeletext.startpts = startpts;
@@ -3396,7 +3411,7 @@ void CDVDPlayer::FlushBuffers(bool queued, double pts, bool accurate)
m_CurrentTeletext.started = false;
}
- if(pts != DVD_NOPTS_VALUE)
+ if(pts != DVD_NOPTS_VALUE && sync)
m_clock.Discontinuity(pts);
UpdatePlayState(0);
diff --git a/xbmc/cores/dvdplayer/DVDPlayer.h b/xbmc/cores/dvdplayer/DVDPlayer.h
index 9f75ccf..c8b81d7 100644
--- a/xbmc/cores/dvdplayer/DVDPlayer.h
+++ b/xbmc/cores/dvdplayer/DVDPlayer.h
@@ -351,7 +351,7 @@ class CDVDPlayer : public IPlayer, public CThread, public IDVDPlayer
bool GetCachingTimes(double& play_left, double& cache_left, double& file_offset);
- void FlushBuffers(bool queued, double pts = DVD_NOPTS_VALUE, bool accurate = true);
+ void FlushBuffers(bool queued, double pts = DVD_NOPTS_VALUE, bool accurate = true, bool sync = true);
void HandleMessages();
void HandlePlaySpeed();
@@ -405,8 +405,10 @@ class CDVDPlayer : public IPlayer, public CThread, public IDVDPlayer
int m_playSpeed;
struct SSpeedState
{
- double lastpts; // holds last display pts during ff/rw operations
- double lasttime;
+ double lastpts; // holds last display pts during ff/rw operations
+ int64_t lasttime;
+ int lastseekpts;
+ double lastabstime;
} m_SpeedState;
int m_errorCount;
diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp
index 5461608..d98baeb 100644
--- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp
+++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp
@@ -1160,6 +1160,20 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts)
pts += m_iVideoDelay - DVD_SEC_TO_TIME(g_renderManager.GetDisplayLatency());
}
+ if (m_speed < 0)
+ {
+ double inputPts = m_droppingStats.m_lastPts;
+ double renderPts = m_droppingStats.m_lastRenderPts;
+ if (pts > renderPts)
+ {
+ if (inputPts >= renderPts)
+ {
+ Sleep(50);
+ }
+ return result | EOS_DROPPED;
+ }
+ }
+
// calculate the time we need to delay this picture before displaying
double iSleepTime, iClockSleep, iFrameSleep, iPlayingClock, iCurrentClock;
@@ -1466,7 +1480,7 @@ double CDVDPlayerVideo::GetCurrentPts()
if( m_stalled )
iRenderPts = DVD_NOPTS_VALUE;
- else
+ else if ( m_speed == DVD_PLAYSPEED_NORMAL)
iRenderPts = iRenderPts - max(0.0, iSleepTime);
return iRenderPts;
@@ -1567,6 +1581,8 @@ int CDVDPlayerVideo::CalcDropRequirement(double pts)
int iDroppedPics = -1;
int iBufferLevel;
+ m_droppingStats.m_lastPts = pts;
+
// get decoder stats
if (!m_pVideoCodec->GetCodecStats(iDecoderPts, iDroppedPics))
iDecoderPts = pts;
diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.h b/xbmc/cores/dvdplayer/DVDPlayerVideo.h
index a38a9c3..4e1b3d6 100644
--- a/xbmc/cores/dvdplayer/DVDPlayerVideo.h
+++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.h
@@ -51,6 +51,7 @@ class CDroppingStats
double m_totalGain;
double m_lastDecoderPts;
double m_lastRenderPts;
+ double m_lastPts;
unsigned int m_lateFrames;
unsigned int m_dropRequests;
};
From 5f8454a1a679262316424324590550259398a38f Mon Sep 17 00:00:00 2001
From: xbmc <fernetmenta@online.de>
Date: Thu, 28 Mar 2013 20:50:59 +0100
Subject: [PATCH 06/19] fix incorrect display of fps when dr kicks in
---
xbmc/Application.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp
index 48fa09b..415e4c2 100644
--- a/xbmc/Application.cpp
+++ b/xbmc/Application.cpp
@@ -2326,10 +2326,11 @@ void CApplication::Render()
if (frameTime < singleFrameTime)
Sleep(singleFrameTime - frameTime);
}
- m_lastFrameTime = XbmcThreads::SystemClockMillis();
if (flip)
g_graphicsContext.Flip(dirtyRegions);
+
+ m_lastFrameTime = XbmcThreads::SystemClockMillis();
CTimeUtils::UpdateFrameTime(flip);
g_renderManager.UpdateResolution();
From 2fc87d8796b4c102fb35ebe29c966c40962e5e43 Mon Sep 17 00:00:00 2001
From 7f086396571f870f80c15b67700e9ab81c1d3933 Mon Sep 17 00:00:00 2001
From: Rainer Hochecker <fernetmenta@online.de>
Date: Thu, 25 Jul 2013 17:18:13 +0200
Subject: [PATCH 07/19] ActiveAE: slightly reduce buffer size
Subject: [PATCH 2/9] ActiveAE: slightly reduce buffer size
---
xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
index 0e4d8da..99538dc 100644
index 6e9900f..17b6c01 100644
--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
@@ -33,8 +33,8 @@ using namespace ActiveAE;
@ -723,211 +89,10 @@ index 0e4d8da..99538dc 100644
void CEngineStats::Reset(unsigned int sampleRate)
From dcc907a7cac7a980ba5057b84aec40248434a9cb Mon Sep 17 00:00:00 2001
From: Rainer Hochecker <fernetmenta@online.de>
Date: Sun, 4 Aug 2013 10:11:16 +0200
Subject: [PATCH 08/19] Revert "vdpau: comment some features that will be added
later"
This reverts commit e00b4f65864d623ab4d2e9e5c06db138e661f1cf.
---
xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp
index 8c353af..33ec1f4 100644
--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp
@@ -1085,8 +1085,7 @@ int CDecoder::Decode(AVCodecContext *avctx, AVFrame *pFrame)
m_bufferStats.IncDecoded();
m_vdpauOutput.m_dataPort.SendOutMessage(COutputDataProtocol::NEWFRAME, &pic, sizeof(pic));
- //TODO
- // m_codecControl = pic.DVDPic.iFlags & (DVP_FLAG_DRAIN | DVP_FLAG_NO_POSTPROC);
+ m_codecControl = pic.DVDPic.iFlags & (DVP_FLAG_DRAIN | DVP_FLAG_NO_POSTPROC);
}
int retval = 0;
@@ -2282,8 +2281,7 @@ void CMixer::InitCycle()
int flags;
uint64_t latency;
m_config.stats->GetParams(latency, flags);
- // TODO
- if (0) //flags & DVP_FLAG_NO_POSTPROC)
+ if (flags & DVP_FLAG_NO_POSTPROC)
SetPostProcFeatures(false);
else
SetPostProcFeatures(true);
@@ -2295,8 +2293,7 @@ void CMixer::InitCycle()
bool interlaced = m_mixerInput[1].DVDPic.iFlags & DVP_FLAG_INTERLACED;
m_SeenInterlaceFlag |= interlaced;
- // TODO
- if (//!(flags & DVP_FLAG_NO_POSTPROC) &&
+ if (!(flags & DVP_FLAG_NO_POSTPROC) &&
(mode == VS_DEINTERLACEMODE_FORCE ||
(mode == VS_DEINTERLACEMODE_AUTO && interlaced)))
{
@@ -2318,8 +2315,7 @@ void CMixer::InitCycle()
m_config.stats->SetCanSkipDeint(true);
}
- // TODO
- if (0) //m_mixerInput[1].DVDPic.iFlags & DVP_FLAG_DROPDEINT)
+ if (m_mixerInput[1].DVDPic.iFlags & DVP_FLAG_DROPDEINT)
{
m_mixersteps = 1;
}
From b6ecdba8f294a2d83581b7188fbf3677283cbcde Mon Sep 17 00:00:00 2001
From: Rainer Hochecker <fernetmenta@online.de>
Date: Tue, 11 Feb 2014 18:15:06 +0100
Subject: [PATCH 09/19] ActiveAE: add some debug logging
---
xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp
index 96bce12..7bd9c9b 100644
--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp
+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp
@@ -265,7 +265,13 @@ unsigned int CActiveAEStream::AddData(uint8_t* const *data, unsigned int offset,
}
}
if (!m_inMsgEvent.WaitMSec(200))
+ {
+ double cachetime = GetCacheTime();
+ CSingleLock lock(m_streamLock);
+ CLog::Log(LOGWARNING, "CActiveAEStream::AddData - timeout waiting for buffer, paused: %d, cache time: %f, free buffers: %d",
+ m_paused, cachetime, m_streamFreeBuffers);
break;
+ }
}
return copied;
}
From 8fb8a4320d136d92d2a07f71d9673674652634df Mon Sep 17 00:00:00 2001
From: Rainer Hochecker <fernetmenta@online.de>
Date: Sat, 23 Aug 2014 11:42:31 +0200
Subject: [PATCH 10/19] dvdplayer: rename codec ctrl flags
---
xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp
index 33ec1f4..300b901 100644
--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp
@@ -1085,7 +1085,7 @@ int CDecoder::Decode(AVCodecContext *avctx, AVFrame *pFrame)
m_bufferStats.IncDecoded();
m_vdpauOutput.m_dataPort.SendOutMessage(COutputDataProtocol::NEWFRAME, &pic, sizeof(pic));
- m_codecControl = pic.DVDPic.iFlags & (DVP_FLAG_DRAIN | DVP_FLAG_NO_POSTPROC);
+ m_codecControl = pic.DVDPic.iFlags & (DVD_CODEC_CTRL_DRAIN | DVD_CODEC_CTRL_NO_POSTPROC);
}
int retval = 0;
@@ -2281,7 +2281,7 @@ void CMixer::InitCycle()
int flags;
uint64_t latency;
m_config.stats->GetParams(latency, flags);
- if (flags & DVP_FLAG_NO_POSTPROC)
+ if (flags & DVD_CODEC_CTRL_NO_POSTPROC)
SetPostProcFeatures(false);
else
SetPostProcFeatures(true);
@@ -2293,7 +2293,7 @@ void CMixer::InitCycle()
bool interlaced = m_mixerInput[1].DVDPic.iFlags & DVP_FLAG_INTERLACED;
m_SeenInterlaceFlag |= interlaced;
- if (!(flags & DVP_FLAG_NO_POSTPROC) &&
+ if (!(flags & DVD_CODEC_CTRL_NO_POSTPROC) &&
(mode == VS_DEINTERLACEMODE_FORCE ||
(mode == VS_DEINTERLACEMODE_AUTO && interlaced)))
{
@@ -2315,7 +2315,7 @@ void CMixer::InitCycle()
m_config.stats->SetCanSkipDeint(true);
}
- if (m_mixerInput[1].DVDPic.iFlags & DVP_FLAG_DROPDEINT)
+ if (m_mixerInput[1].DVDPic.iFlags & DVD_CODEC_CTRL_SKIPDEINT)
{
m_mixersteps = 1;
}
From b0dfd947b0286ea60fcbdf1f04fc1071d94f9c92 Mon Sep 17 00:00:00 2001
From: Rainer Hochecker <fernetmenta@online.de>
Date: Fri, 13 Jun 2014 14:37:16 +0200
Subject: [PATCH 11/19] VAAPI: implement codec control flags
---
xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp
index 0d6477a..a5e560a 100644
--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp
@@ -739,6 +739,8 @@ int CDecoder::Decode(AVCodecContext* avctx, AVFrame* pFrame)
pic.DVDPic.color_matrix = avctx->colorspace;
m_bufferStats.IncDecoded();
m_vaapiOutput.m_dataPort.SendOutMessage(COutputDataProtocol::NEWFRAME, &pic, sizeof(pic));
+
+ m_codecControl = pic.DVDPic.iFlags & (DVD_CODEC_CTRL_DRAIN | DVD_CODEC_CTRL_NO_POSTPROC);
}
int retval = 0;
@@ -1800,8 +1802,8 @@ bool COutput::PreferPP()
void COutput::InitCycle()
{
uint64_t latency;
- int speed;
- m_config.stats->GetParams(latency, speed);
+ int flags;
+ m_config.stats->GetParams(latency, flags);
m_config.stats->SetCanSkipDeint(false);
@@ -1809,7 +1811,8 @@ void COutput::InitCycle()
EINTERLACEMETHOD method = CMediaSettings::Get().GetCurrentVideoSettings().m_InterlaceMethod;
bool interlaced = m_currentPicture.DVDPic.iFlags & DVP_FLAG_INTERLACED;
- if ((mode == VS_DEINTERLACEMODE_FORCE ||
+ if (!(flags & DVD_CODEC_CTRL_NO_POSTPROC) &&
+ (mode == VS_DEINTERLACEMODE_FORCE ||
(mode == VS_DEINTERLACEMODE_AUTO && interlaced)))
{
if((method == VS_INTERLACEMETHOD_AUTO && interlaced)
@@ -2627,6 +2630,7 @@ bool CVppPostproc::AddPicture(CVaapiDecodedPicture &pic)
m_decodedPics.push_front(pic);
m_frameCount++;
m_step = 0;
+ m_config.stats->SetCanSkipDeint(true);
return true;
}
@@ -2671,6 +2675,13 @@ bool CVppPostproc::Filter(CVaapiProcessedPicture &outPic)
}
outPic.DVDPic = it->DVDPic;
+ // skip deinterlacing cycle if requested
+ if (m_step == 1 && (outPic.DVDPic.iFlags & DVD_CODEC_CTRL_SKIPDEINT))
+ {
+ Advance();
+ return false;
+ }
+
// vpp deinterlacing
VAProcFilterParameterBufferDeinterlacing *filterParams;
VABufferID pipelineBuf;
From 830d6fea068973b4585d90377f3d33e81d824819 Mon Sep 17 00:00:00 2001
From 839d6295e3158562a56b21d438e9b48f3a7ee2a0 Mon Sep 17 00:00:00 2001
From: Rainer Hochecker <fernetmenta@online.de>
Date: Sat, 4 Oct 2014 21:25:31 +0200
Subject: [PATCH 13/19] vaapi: lock gfx context on pre-cleanup
Subject: [PATCH 4/9] vaapi: lock gfx context on pre-cleanup
---
xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp | 1 +
@ -946,10 +111,10 @@ index a5e560a..823f613 100644
if (m_vaapiOutput.m_controlPort.SendOutMessageSync(COutputControlProtocol::PRECLEANUP,
&reply,
From 88d7d32432de9a12595ed79484f74c656dc09144 Mon Sep 17 00:00:00 2001
From e1d83be487296f0e05e256c8efdbf7d7c8233a1e Mon Sep 17 00:00:00 2001
From: Anssi Hannula <anssi@xbmc.org>
Date: Sun, 19 Oct 2014 21:34:47 +0300
Subject: [PATCH 14/19] [linux] Add FDEventMonitor for monitoring file
Subject: [PATCH 5/9] [linux] Add FDEventMonitor for monitoring file
descriptors
Add FDEventMonitor helper thread for monitoring file descriptors for
@ -1329,10 +494,10 @@ index c147d8f..744fd06 100644
SRCS += LinuxTimezone.cpp
SRCS += PosixMountProvider.cpp
From 69f614bd35389e5d61fc312872e169cfc72695df Mon Sep 17 00:00:00 2001
From 1cee1d708009ba18c3588c2d6e16d9e5f00a0e60 Mon Sep 17 00:00:00 2001
From: Anssi Hannula <anssi@xbmc.org>
Date: Sun, 19 Oct 2014 21:36:44 +0300
Subject: [PATCH 15/19] [AE] ALSA: Add ALSADeviceMonitor for monitoring card
Subject: [PATCH 6/9] [AE] ALSA: Add ALSADeviceMonitor for monitoring card
removals/additions
---
@ -1609,10 +774,10 @@ index 0000000..f9e2f26
+#endif
+
From 02117cd1588e15f1c3bc76c402a5614d5ea67c85 Mon Sep 17 00:00:00 2001
From 30a90fe4c23b37c7025a75f374444141d8f13fec Mon Sep 17 00:00:00 2001
From: Anssi Hannula <anssi@xbmc.org>
Date: Sun, 19 Oct 2014 21:37:49 +0300
Subject: [PATCH 16/19] [AE] ALSA: Add ALSADeviceMonitor for monitoring ELD
Subject: [PATCH 7/9] [AE] ALSA: Add ALSADeviceMonitor for monitoring ELD
changes
ELD changes can happen e.g. when the connected HDMI sink is changed.
@ -1953,10 +1118,10 @@ index 0000000..56dfd50
+#endif
+
From 530c78a7a2daf79e7e2069fff515086e5d78570a Mon Sep 17 00:00:00 2001
From b973fa859970c7066f774fed2b1836773ef5c85d Mon Sep 17 00:00:00 2001
From: Anssi Hannula <anssi@xbmc.org>
Date: Sun, 2 Nov 2014 21:10:51 +0200
Subject: [PATCH 17/19] [AE] ALSA: Add more logging to device change triggers
Subject: [PATCH 8/9] [AE] ALSA: Add more logging to device change triggers
---
xbmc/cores/AudioEngine/Sinks/alsa/ALSADeviceMonitor.cpp | 13 +++++++++++--
@ -2005,10 +1170,10 @@ index 9b595ee..f9ca9ae 100644
}
From 879ce04fbccdfbb3b77d52897a50283cfd807970 Mon Sep 17 00:00:00 2001
From c7d8a5a7f2f0bec8c17996310087d7f333146cca Mon Sep 17 00:00:00 2001
From: Anssi Hannula <anssi@xbmc.org>
Date: Tue, 4 Nov 2014 19:22:03 +0200
Subject: [PATCH 18/19] [AE] ALSA: Fix DeviceChange event triggered by
Subject: [PATCH 9/9] [AE] ALSA: Fix DeviceChange event triggered by
enumeration
All hctl elements get an SND_CTL_EVENT_MASK_REMOVE event when the ctl
@ -2055,27 +1220,3 @@ index f9ca9ae..89a7585 100644
CAEFactory::DeviceChange();
}
From f473448ddddbca43f2a62e872af50696cb1114dd Mon Sep 17 00:00:00 2001
From: Rainer Hochecker <fernetmenta@online.de>
Date: Sat, 1 Nov 2014 07:47:16 +0100
Subject: [PATCH 19/19] videorefclock: use videosync DRM on AMD systems
---
xbmc/video/VideoReferenceClock.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/xbmc/video/VideoReferenceClock.cpp b/xbmc/video/VideoReferenceClock.cpp
index 2ba8cec..06d9ff4 100644
--- a/xbmc/video/VideoReferenceClock.cpp
+++ b/xbmc/video/VideoReferenceClock.cpp
@@ -98,7 +98,8 @@ void CVideoReferenceClock::Process()
#if defined(HAVE_X11)
std::string gpuvendor = g_Windowing.GetRenderVendor();
std::transform(gpuvendor.begin(), gpuvendor.end(), gpuvendor.begin(), ::tolower);
- if (gpuvendor.compare(0, 5, "intel") == 0)
+ if ((gpuvendor.compare(0, 5, "intel") == 0 ||
+ gpuvendor.compare(0, 5, "x.org") == 0)) // AMD
m_pVideoSync = new CVideoSyncDRM();
#if defined(HAS_GLX)
else