diff --git a/packages/mediacenter/xbmc/patches/xbmc-995.01-fernetmenta.patch b/packages/mediacenter/xbmc/patches/xbmc-995.01-fernetmenta.patch index 3f239156fd..1a297f3f60 100644 --- a/packages/mediacenter/xbmc/patches/xbmc-995.01-fernetmenta.patch +++ b/packages/mediacenter/xbmc/patches/xbmc-995.01-fernetmenta.patch @@ -1,7 +1,7 @@ -From 013a4ac075824491e8387b62a00e10c30af26421 Mon Sep 17 00:00:00 2001 +From 092b9619c6f3aedac2024ca29942858001d94986 Mon Sep 17 00:00:00 2001 From: xbmc Date: Mon, 28 May 2012 10:34:39 +0200 -Subject: [PATCH 01/27] videoplayer: adapt lateness detection and dropping to +Subject: [PATCH 01/25] videoplayer: adapt lateness detection and dropping to buffering --- @@ -643,10 +643,10 @@ index dcd0ffd..1f0e661 100644 }; -From ad54054429044403a44416be8b74c106b64d758f Mon Sep 17 00:00:00 2001 +From e0f4ed15d18123032440a02a8a143cca031f1eb1 Mon Sep 17 00:00:00 2001 From: xbmc Date: Sun, 2 Sep 2012 16:05:21 +0200 -Subject: [PATCH 02/27] video player: present correct pts to user for a/v sync +Subject: [PATCH 02/25] video player: present correct pts to user for a/v sync (after buffering in renderer) --- @@ -695,10 +695,10 @@ index 1f0e661..a38a9c3 100644 double GetOutputDelay(); /* returns the expected delay, from that a packet is put in queue */ int GetDecoderFreeSpace() { return 0; } -From 9f5a0351e50f63e03fca12592e94cd6c635ef036 Mon Sep 17 00:00:00 2001 +From 8f1e52d07ddc356ee756f970bc8a045e068c2187 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Sat, 1 Jun 2013 11:21:19 +0200 -Subject: [PATCH 03/27] renderer: bump buffers to 5 +Subject: [PATCH 03/25] renderer: bump buffers to 5 --- xbmc/cores/VideoRenderers/BaseRenderer.h | 2 +- @@ -718,10 +718,10 @@ index fb41ccf..f5e5677 100644 class CSetting; -From 49b8b7b8d5e017bc0d04f9f7f892601709825f1c Mon Sep 17 00:00:00 2001 +From 94fc6f131a36e63d60bbd6f51132fac63aa83701 Mon Sep 17 00:00:00 2001 From: xbmc Date: Mon, 28 May 2012 10:41:31 +0200 -Subject: [PATCH 04/27] videoplayer: update frametime, it might change due to +Subject: [PATCH 04/25] videoplayer: update frametime, it might change due to fps detection --- @@ -742,10 +742,10 @@ index 3bfa7f1..a41ed47 100644 { m_codecname = m_pVideoCodec->GetName(); -From dfbc63e5a0844d477700caf931bc9a22776372d3 Mon Sep 17 00:00:00 2001 +From 553eae9fb95cc67a83e15863cf03196af9fd6a85 Mon Sep 17 00:00:00 2001 From: xbmc Date: Mon, 28 May 2012 10:43:06 +0200 -Subject: [PATCH 05/27] videoplayer: give streams with invalid fps a chance for +Subject: [PATCH 05/25] videoplayer: give streams with invalid fps a chance for fps detection --- @@ -766,10 +766,10 @@ index a41ed47..05f5d44 100644 //reset the stored framerates if no good framerate was detected m_fStableFrameRate = 0.0; -From 2af8349533d62b616252c0aa28800f07e0b48d43 Mon Sep 17 00:00:00 2001 +From 58c553159ac43ab916f4f34f812f51b4a6780c80 Mon Sep 17 00:00:00 2001 From: xbmc Date: Mon, 28 May 2012 10:49:05 +0200 -Subject: [PATCH 06/27] dvdplayer: allow rewinding at end of stream, do a seek +Subject: [PATCH 06/25] dvdplayer: allow rewinding at end of stream, do a seek after rewind --- @@ -803,10 +803,10 @@ index 8f41c76..b99c8a2 100644 // audioplayer, stops outputing audio to audiorendere, but still tries to // sleep an correct amount for each packet -From 8a1d664dffffab4b41cf9025565185127ef7e590 Mon Sep 17 00:00:00 2001 +From 9d66fa3dcd22ec78a050626fb49f14928b31ef11 Mon Sep 17 00:00:00 2001 From: xbmc Date: Mon, 20 Aug 2012 16:06:39 +0200 -Subject: [PATCH 07/27] dvdplayer: observe pts counter overflow +Subject: [PATCH 07/25] dvdplayer: observe pts counter overflow --- .../cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp | 197 ++++++++++++++++++++- @@ -1086,10 +1086,10 @@ index 08eb3df..dd89584 100644 }; -From 1f6d472559959ac3193ad33042bb3f01fbadf248 Mon Sep 17 00:00:00 2001 +From 30f899c40ae2eb85efe59682e89520d7bbc7a6de Mon Sep 17 00:00:00 2001 From: xbmc Date: Tue, 2 Oct 2012 13:02:10 +0200 -Subject: [PATCH 08/27] dvdplayer: avoid short screen flicker caused by +Subject: [PATCH 08/25] dvdplayer: avoid short screen flicker caused by unnecessary reconfigure of renderer --- @@ -1119,10 +1119,10 @@ index 05f5d44..5d84cd0 100644 || ( m_output.extended_format != pPicture->extended_format ) || ( m_output.color_matrix != pPicture->color_matrix && pPicture->color_matrix != 0 ) // don't reconfigure on unspecified -From dbde9c6c1a6e2b946cc14783d7e5f9b536c52424 Mon Sep 17 00:00:00 2001 +From 8908d00510b2a85ea24486437e8b134caf398040 Mon Sep 17 00:00:00 2001 From: xbmc Date: Thu, 11 Oct 2012 12:05:50 +0200 -Subject: [PATCH 09/27] vdpau: advanced settings for auto deinterlacing +Subject: [PATCH 09/25] vdpau: advanced settings for auto deinterlacing --- xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp | 8 ++++---- @@ -1185,10 +1185,10 @@ index 7e50a63..980138e 100644 bool m_videoVDPAUdeintSkipChromaHD; bool m_musicUseTimeSeeking; -From e1a347c8a8f4e310d0cbc3b3a234dca6f1f52cb1 Mon Sep 17 00:00:00 2001 +From 88754cb9ed0d7a5c015b9a1a38079104db882d50 Mon Sep 17 00:00:00 2001 From: xbmc Date: Fri, 2 Nov 2012 13:20:03 +0100 -Subject: [PATCH 10/27] player: fix rewind +Subject: [PATCH 10/25] player: fix rewind --- xbmc/cores/dvdplayer/DVDMessage.h | 5 ++++- @@ -1400,10 +1400,10 @@ index a38a9c3..4e1b3d6 100644 unsigned int m_dropRequests; }; -From a4753ee613f87f97e29a990989060c71095c3f61 Mon Sep 17 00:00:00 2001 +From eb3a088fb09e6c47335fec6fe82cd3ca86a5b590 Mon Sep 17 00:00:00 2001 From: xbmc Date: Thu, 28 Mar 2013 20:50:59 +0100 -Subject: [PATCH 11/27] fix incorrect display of fps when dr kicks in +Subject: [PATCH 11/25] fix incorrect display of fps when dr kicks in --- xbmc/Application.cpp | 3 ++- @@ -1427,10 +1427,10 @@ index 94ee013..851a380 100644 g_renderManager.UpdateResolution(); -From 145757456b51b69f7eacb6e90d6e3604ef431b84 Mon Sep 17 00:00:00 2001 +From d553ef305bd1d3f917484be397c74cb122be1073 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Thu, 25 Jul 2013 17:18:13 +0200 -Subject: [PATCH 12/27] ActiveAE: slightly reduce buffer size +Subject: [PATCH 12/25] ActiveAE: slightly reduce buffer size --- xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 4 ++-- @@ -1452,10 +1452,10 @@ index fe5e893..c98c73b 100644 void CEngineStats::Reset(unsigned int sampleRate) -From 24618104a4d34f9fa69a6898434dfe68fc08a3dc Mon Sep 17 00:00:00 2001 +From a26c638dece28a56be02ed154d9c2b7a5c3dc58e Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Sun, 4 Aug 2013 10:11:16 +0200 -Subject: [PATCH 13/27] Revert "vdpau: comment some features that will be added +Subject: [PATCH 13/25] Revert "vdpau: comment some features that will be added later" This reverts commit e00b4f65864d623ab4d2e9e5c06db138e661f1cf. @@ -1508,10 +1508,10 @@ index 1845198..2bfea1a 100644 m_mixersteps = 1; } -From a446749b9d633d2a270328f679a1c634a1ab7f73 Mon Sep 17 00:00:00 2001 +From f5dc3c5adcb54947ea273a7142adaf47f559b6bb Mon Sep 17 00:00:00 2001 From: Marcel Groothuis Date: Thu, 5 Dec 2013 22:02:50 +0100 -Subject: [PATCH 14/27] ffmpeg demuxer: faster channel change for PVR addons +Subject: [PATCH 14/25] ffmpeg demuxer: faster channel change for PVR addons without internal demuxing (such as MediaPortal, ArgusTV, MythTV, NextPVR) Credits: FernetMenta, Davilla, Popcornmix, Whaupt @@ -1868,10 +1868,10 @@ index ca689d0..f383563 100644 else return NULL; -From 266bf6dc835b64fbc1fccba6662c8b80990643ff Mon Sep 17 00:00:00 2001 +From 3a27b9e30fb0dfd8cf8076335f9bc417544b632a Mon Sep 17 00:00:00 2001 From: Wolfgang Haupt Date: Thu, 5 Dec 2013 22:11:57 +0100 -Subject: [PATCH 15/27] DVDFactoryDemuxer: skip streaminfo for udp tcp and +Subject: [PATCH 15/25] DVDFactoryDemuxer: skip streaminfo for udp tcp and pvr-channels --- @@ -1992,10 +1992,10 @@ index 667f6d3..0094709 100644 static void AddSlashAtEnd(std::string& strFolder); static bool HasSlashAtEnd(const std::string& strFile, bool checkURL = false); -From e3e82f4d2c6aa0c8a3e21ba6c537c675bfec1a1b Mon Sep 17 00:00:00 2001 +From a9c2f9a35bd3bd16a54cc6ecb1f322bf62e3d5bd Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Fri, 18 Jul 2014 10:39:07 +0200 -Subject: [PATCH 16/27] fast channel switch, make sure extradata is decoded +Subject: [PATCH 16/25] fast channel switch, make sure extradata is decoded --- xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp | 3 ++- @@ -2016,10 +2016,10 @@ index c01bc11..d38bfab 100644 // We are looking for an IDR frame -From 394e940568426f749efcf1ae314f56fa6ba4cd6d Mon Sep 17 00:00:00 2001 +From 4cee56c346f12526021cd48140901c97b76fc2e7 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Wed, 23 Jul 2014 15:07:37 +0200 -Subject: [PATCH 17/27] ffmpeg demuxer: allow a stream change if pat/pmt was +Subject: [PATCH 17/25] ffmpeg demuxer: allow a stream change if pat/pmt was not seen on open --- @@ -2079,10 +2079,10 @@ index d38bfab..2332b1b 100644 { for (unsigned int i = 0; i < m_pFormatContext->programs[m_program]->nb_stream_indexes; i++) -From 68fea83410e44637f549b31dd3e74fb0b623d504 Mon Sep 17 00:00:00 2001 +From ce2fdeb7e1f734e58c74805efc180ecb950090ba Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Tue, 28 Jan 2014 10:05:26 +0100 -Subject: [PATCH 18/27] xbmc pr 3080 +Subject: [PATCH 18/25] xbmc pr 3080 --- xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp | 8 ++++++++ @@ -2108,10 +2108,10 @@ index 2481b66..40816e3 100644 * Setting it correctly would allow CorePNG decoding. */ avpkt.flags = AV_PKT_FLAG_KEY; -From cccc5d41dcd33307651570d866aac825268eb965 Mon Sep 17 00:00:00 2001 +From cdff6da02f005a718e57dfc235bdd61bb9f2c0d5 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Tue, 11 Feb 2014 18:15:06 +0100 -Subject: [PATCH 19/27] ActiveAE: add some debug logging +Subject: [PATCH 19/25] ActiveAE: add some debug logging --- xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEStream.cpp | 6 ++++++ @@ -2136,10 +2136,10 @@ index ec10397..3b67fc0 100644 return copied; } -From 146df22fa3a5a2876abe50fc34f563d56232e25d Mon Sep 17 00:00:00 2001 +From 5672f89f47a3a8ff31c2aa00bc609e0d090c7cd3 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Sat, 26 Jul 2014 09:54:06 +0200 -Subject: [PATCH 20/27] ffmpeg: adapt depreciated attribute +Subject: [PATCH 20/25] ffmpeg: adapt depreciated attribute max_analyze_duration --- @@ -2160,10 +2160,10 @@ index 2332b1b..edaa006 100644 isMpegts = true; } -From b65042d8b51ca245ea6f5182d1d892dfc1bec4a8 Mon Sep 17 00:00:00 2001 +From 834df1c3785d6163f3bd3380fac87f415ec54976 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Sat, 23 Aug 2014 11:42:31 +0200 -Subject: [PATCH 21/27] dvdplayer: rename codec ctrl flags +Subject: [PATCH 21/25] dvdplayer: rename codec ctrl flags --- xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h | 14 ++++++++------ @@ -2275,10 +2275,10 @@ index bab0972..20aef4e 100644 if (iDropDirective & EOS_DROPPED) { -From 30691569978e210b609bfc616bc639c343de74f8 Mon Sep 17 00:00:00 2001 +From ac0401ca7f609b4345ab1c50eea8d94c35cb82a3 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Fri, 13 Jun 2014 14:37:16 +0200 -Subject: [PATCH 22/27] VAAPI: implement codec control flags +Subject: [PATCH 22/25] VAAPI: implement codec control flags --- .../DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp | 21 ++++++++++++++++++--- @@ -2326,10 +2326,10 @@ index 8715d21..467a802 100644 pDvdVideoPicture->pts = DVD_NOPTS_VALUE; diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp -index 40fbcd8..70eda1a 100644 +index bfcf468..624d6a4 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp -@@ -708,6 +708,8 @@ int CDecoder::Decode(AVCodecContext* avctx, AVFrame* pFrame) +@@ -715,6 +715,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)); @@ -2338,7 +2338,7 @@ index 40fbcd8..70eda1a 100644 } int retval = 0; -@@ -1652,8 +1654,8 @@ bool COutput::HasWork() +@@ -1677,8 +1679,8 @@ bool COutput::PreferPP() void COutput::InitCycle() { uint64_t latency; @@ -2349,7 +2349,7 @@ index 40fbcd8..70eda1a 100644 m_config.stats->SetCanSkipDeint(false); -@@ -1661,7 +1663,8 @@ void COutput::InitCycle() +@@ -1686,7 +1688,8 @@ void COutput::InitCycle() EINTERLACEMETHOD method = CMediaSettings::Get().GetCurrentVideoSettings().m_InterlaceMethod; bool interlaced = m_currentPicture.DVDPic.iFlags & DVP_FLAG_INTERLACED; @@ -2359,7 +2359,7 @@ index 40fbcd8..70eda1a 100644 (mode == VS_DEINTERLACEMODE_AUTO && interlaced))) { if((method == VS_INTERLACEMETHOD_AUTO && interlaced) -@@ -2482,6 +2485,7 @@ bool CVppPostproc::AddPicture(CVaapiDecodedPicture &pic) +@@ -2516,6 +2519,7 @@ bool CVppPostproc::AddPicture(CVaapiDecodedPicture &pic) m_decodedPics.push_front(pic); m_frameCount++; m_step = 0; @@ -2367,7 +2367,7 @@ index 40fbcd8..70eda1a 100644 } bool CVppPostproc::Filter(CVaapiProcessedPicture &outPic) -@@ -2525,6 +2529,13 @@ bool CVppPostproc::Filter(CVaapiProcessedPicture &outPic) +@@ -2559,6 +2563,13 @@ bool CVppPostproc::Filter(CVaapiProcessedPicture &outPic) } outPic.DVDPic = it->DVDPic; @@ -2382,10 +2382,10 @@ index 40fbcd8..70eda1a 100644 VAProcFilterParameterBufferDeinterlacing *filterParams; VABufferID pipelineBuf; -From b38c6dfec5f0a2a7a5c0f8164998468260ad0ff7 Mon Sep 17 00:00:00 2001 +From ff19b3c0f2c3cc2b65ed0f5357fa046c13f54466 Mon Sep 17 00:00:00 2001 From: Rainer Hochecker Date: Thu, 4 Sep 2014 09:25:48 +0200 -Subject: [PATCH 23/27] consider rounding errors in dropping control +Subject: [PATCH 23/25] consider rounding errors in dropping control --- xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 2 +- @@ -2405,381 +2405,88 @@ index 20aef4e..2a10cfd 100644 CDroppingStats::CGain gain; gain.gain = iGain; -From da4403a911093bb2fa20614523e4c9a7a6c41615 Mon Sep 17 00:00:00 2001 +From 0db9b46db86554cd363b49f3d6b85e7c6a9a5a9d Mon Sep 17 00:00:00 2001 From: Rainer Hochecker -Date: Fri, 5 Sep 2014 15:40:24 +0200 -Subject: [PATCH 24/27] vaapi: optimize render pipeline +Date: Mon, 8 Sep 2014 12:12:16 +0200 +Subject: [PATCH 24/25] vaapi: fix potential segfault when pp method is changed --- - xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp | 58 ++++++++++++++++++++++---- - xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.h | 11 ++++- - 2 files changed, 58 insertions(+), 11 deletions(-) + xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp | 22 +++++++++++++++------- + 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp -index 70eda1a..3fba209 100644 +index 624d6a4..f8950c9 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp -@@ -641,7 +641,8 @@ int CDecoder::FFGetBuffer(AVCodecContext *avctx, AVFrame *pic, int flags) - if (surf == VA_INVALID_SURFACE) - { - uint16_t decoded, processed, render; -- va->m_bufferStats.Get(decoded, processed, render); -+ bool vpp; -+ va->m_bufferStats.Get(decoded, processed, render, vpp); - CLog::Log(LOGERROR, "VAAPI::FFGetBuffer - no surface available - dec: %d, render: %d", - decoded, render); - return -1; -@@ -714,6 +715,8 @@ int CDecoder::Decode(AVCodecContext* avctx, AVFrame* pFrame) - - int retval = 0; - uint16_t decoded, processed, render; -+ int vapipe; -+ bool vpp; - Message *msg; - while (m_vaapiOutput.m_controlPort.ReceiveInMessage(&msg)) - { -@@ -725,13 +728,14 @@ int CDecoder::Decode(AVCodecContext* avctx, AVFrame* pFrame) - msg->Release(); - } - -- m_bufferStats.Get(decoded, processed, render); -+ m_bufferStats.Get(decoded, processed, render, vpp); - - bool hasfree = m_videoSurfaces.HasFree(); - while (!retval) - { - // first fill the buffers to keep vaapi busy -- if (decoded < 3 && processed < 3 && m_videoSurfaces.HasFree()) -+ vapipe = vpp ? decoded + processed : decoded; -+ if (vapipe < 4 && m_videoSurfaces.HasFree()) - { - retval |= VC_BUFFER; - } -@@ -748,7 +752,7 @@ int CDecoder::Decode(AVCodecContext* avctx, AVFrame* pFrame) - m_presentPicture = *(CVaapiRenderPicture**)msg->data; - m_presentPicture->vaapi = this; - m_bufferStats.DecRender(); -- m_bufferStats.Get(decoded, processed, render); -+ m_bufferStats.Get(decoded, processed, render, vpp); - retval |= VC_PICTURE; - msg->Release(); - break; -@@ -759,7 +763,7 @@ int CDecoder::Decode(AVCodecContext* avctx, AVFrame* pFrame) - { - if (msg->signal == COutputControlProtocol::STATS) - { -- m_bufferStats.Get(decoded, processed, render); -+ m_bufferStats.Get(decoded, processed, render, vpp); - } - else - { -@@ -769,7 +773,8 @@ int CDecoder::Decode(AVCodecContext* avctx, AVFrame* pFrame) - msg->Release(); - } - -- if (decoded < 3 && processed < 3 && m_videoSurfaces.HasFree()) -+ vapipe = vpp ? decoded + processed : decoded; -+ if (vapipe < 4 && m_videoSurfaces.HasFree()) - { - retval |= VC_BUFFER; - } -@@ -1365,8 +1370,7 @@ void COutput::StateMachine(int signal, Protocol *port, Message *msg) +@@ -1409,7 +1409,11 @@ void COutput::StateMachine(int signal, Protocol *port, Message *msg) switch (signal) { case COutputControlProtocol::TIMEOUT: -- if (!m_bufferPool.decodedPics.empty() && -- m_bufferPool.processedPics.size() < 4) -+ if (PreferPP()) +- m_pp->AddPicture(m_currentPicture); ++ if (!m_pp->AddPicture(m_currentPicture)) ++ { ++ m_state = O_TOP_ERROR; ++ return; ++ } + CVaapiProcessedPicture outPic; + if (m_pp->Filter(outPic)) { - m_currentPicture = m_bufferPool.decodedPics.front(); - m_bufferPool.decodedPics.pop_front(); -@@ -1645,7 +1649,21 @@ void COutput::Flush() - bool COutput::HasWork() +@@ -1664,14 +1668,17 @@ bool COutput::HasWork() + + bool COutput::PreferPP() { - if ((!m_bufferPool.freeRenderPics.empty() && !m_bufferPool.processedPics.empty()) || -- !m_bufferPool.decodedPics.empty()) -+ (!m_bufferPool.decodedPics.empty() && m_bufferPool.processedPics.size() < 4)) -+ return true; -+ -+ return false; -+} -+ -+bool COutput::PreferPP() -+{ -+ if (!m_pp) -+ return true; -+ -+ if (!m_bufferPool.decodedPics.empty() && !m_pp->DoesSync() && m_bufferPool.processedPics.size() < 4) -+ return true; -+ -+ if (m_bufferPool.freeRenderPics.empty() || m_bufferPool.processedPics.empty()) - return true; +- if (!m_pp) +- return true; ++ if (!m_bufferPool.decodedPics.empty()) ++ { ++ if (!m_pp) ++ return true; + +- if (!m_bufferPool.decodedPics.empty() && !m_pp->DoesSync() && m_bufferPool.processedPics.size() < 4) +- return true; ++ if (!m_pp->DoesSync() && m_bufferPool.processedPics.size() < 4) ++ return true; + +- if (m_bufferPool.freeRenderPics.empty() || m_bufferPool.processedPics.empty()) +- return true; ++ if (m_bufferPool.freeRenderPics.empty() || m_bufferPool.processedPics.empty()) ++ return true; ++ } - return false; -@@ -1693,9 +1711,15 @@ void COutput::InitCycle() - { - if (method == VS_INTERLACEMETHOD_DEINTERLACE || - method == VS_INTERLACEMETHOD_RENDER_BOB) -+ { - m_pp = new CFFmpegPostproc(); -+ m_config.stats->SetVpp(false); -+ } - else -+ { - m_pp = new CVppPostproc(); -+ m_config.stats->SetVpp(true); -+ } - if (m_pp->PreInit(m_config)) - { - m_pp->Init(method); -@@ -1720,6 +1744,7 @@ void COutput::InitCycle() - } - if (!m_pp) - { -+ m_config.stats->SetVpp(false); - if (!CSettings::Get().GetBool("videoplayer.prefervaapirender")) - m_pp = new CFFmpegPostproc(); - else -@@ -2282,6 +2307,11 @@ bool CSkipPostproc::Compatible(EINTERLACEMETHOD method) return false; } - -+bool CSkipPostproc::DoesSync() -+{ -+ return false; -+} -+ - //----------------------------------------------------------------------------- - // VPP Postprocessing - //----------------------------------------------------------------------------- -@@ -2723,6 +2753,11 @@ bool CVppPostproc::Compatible(EINTERLACEMETHOD method) - return false; - } - -+bool CVppPostproc::DoesSync() -+{ -+ return false; -+} -+ - bool CVppPostproc::CheckSuccess(VAStatus status) - { - if (status != VA_STATUS_SUCCESS) -@@ -3069,6 +3104,11 @@ bool CFFmpegPostproc::Compatible(EINTERLACEMETHOD method) - return false; - } - -+bool CFFmpegPostproc::DoesSync() -+{ +@@ -2520,6 +2527,7 @@ bool CVppPostproc::AddPicture(CVaapiDecodedPicture &pic) + m_frameCount++; + m_step = 0; + m_config.stats->SetCanSkipDeint(true); + return true; -+} -+ - bool CFFmpegPostproc::CheckSuccess(VAStatus status) - { - if (status != VA_STATUS_SUCCESS) -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.h -index 53608e0..3cc05c2 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.h -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.h -@@ -71,6 +71,7 @@ class CVaapiBufferStats - int codecFlags; - bool canSkipDeint; - int processCmd; -+ bool isVpp; - - void IncDecoded() { CSingleLock l(m_sec); decodedPics++;} - void DecDecoded() { CSingleLock l(m_sec); decodedPics--;} -@@ -78,14 +79,15 @@ class CVaapiBufferStats - void DecProcessed() { CSingleLock l(m_sec); processedPics--;} - void IncRender() { CSingleLock l(m_sec); renderPics++;} - void DecRender() { CSingleLock l(m_sec); renderPics--;} -- void Reset() { CSingleLock l(m_sec); decodedPics=0; processedPics=0;renderPics=0;latency=0;} -- void Get(uint16_t &decoded, uint16_t &processed, uint16_t &render) {CSingleLock l(m_sec); decoded = decodedPics, processed=processedPics, render=renderPics;} -+ void Reset() { CSingleLock l(m_sec); decodedPics=0; processedPics=0;renderPics=0;latency=0;isVpp=false;} -+ void Get(uint16_t &decoded, uint16_t &processed, uint16_t &render, bool &vpp) {CSingleLock l(m_sec); decoded = decodedPics, processed=processedPics, render=renderPics; vpp=isVpp;} - void SetParams(uint64_t time, int flags) { CSingleLock l(m_sec); latency = time; codecFlags = flags; } - void GetParams(uint64_t &lat, int &flags) { CSingleLock l(m_sec); lat = latency; flags = codecFlags; } - void SetCmd(int cmd) { CSingleLock l(m_sec); processCmd = cmd; } - void GetCmd(int &cmd) { CSingleLock l(m_sec); cmd = processCmd; processCmd = 0; } - void SetCanSkipDeint(bool canSkip) { CSingleLock l(m_sec); canSkipDeint = canSkip; } - bool CanSkipDeint() { CSingleLock l(m_sec); if (canSkipDeint) return true; else return false;} -+ void SetVpp(bool vpp) {CSingleLock l(m_sec); isVpp = vpp;} - private: - CCriticalSection m_sec; - }; -@@ -268,6 +270,7 @@ class COutput : private CThread - void Process(); - void StateMachine(int signal, Protocol *port, Message *msg); - bool HasWork(); -+ bool PreferPP(); - void InitCycle(); - CVaapiRenderPicture* ProcessPicture(CVaapiProcessedPicture &pic); - void QueueReturnPicture(CVaapiRenderPicture *pic); -@@ -450,6 +453,7 @@ class CPostproc - virtual void ClearRef(VASurfaceID surf) = 0; - virtual void Flush() = 0; - virtual bool Compatible(EINTERLACEMETHOD method) = 0; -+ virtual bool DoesSync() = 0; - protected: - CVaapiConfig m_config; - int m_step; -@@ -468,6 +472,7 @@ class CSkipPostproc : public CPostproc - void ClearRef(VASurfaceID surf); - void Flush(); - bool Compatible(EINTERLACEMETHOD method); -+ bool DoesSync(); - protected: - CVaapiDecodedPicture m_pic; - }; -@@ -487,6 +492,7 @@ class CVppPostproc : public CPostproc - void ClearRef(VASurfaceID surf); - void Flush(); - bool Compatible(EINTERLACEMETHOD method); -+ bool DoesSync(); - protected: - bool CheckSuccess(VAStatus status); - void Dispose(); -@@ -517,6 +523,7 @@ class CFFmpegPostproc : public CPostproc - void ClearRef(VASurfaceID surf); - void Flush(); - bool Compatible(EINTERLACEMETHOD method); -+ bool DoesSync(); - protected: - bool CheckSuccess(VAStatus status); - void Close(); - -From d8e25988a5a86af34a99e38c45347b7eda7569b3 Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Sat, 6 Sep 2014 10:23:28 +0200 -Subject: [PATCH 25/27] vaapi: cleanup left overs - ---- - xbmc/cores/VideoRenderers/LinuxRendererGL.cpp | 19 +------------------ - 1 file changed, 1 insertion(+), 18 deletions(-) - -diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -index 767e15a..417577d 100644 ---- a/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -+++ b/xbmc/cores/VideoRenderers/LinuxRendererGL.cpp -@@ -2530,25 +2530,8 @@ bool CLinuxRendererGL::CreateVAAPITexture(int index) - plane.pixpertex_x = 1; - plane.pixpertex_y = 1; - -- if(m_renderMethod & RENDER_POT) -- { -- plane.texwidth = NP2(plane.texwidth); -- plane.texheight = NP2(plane.texheight); -- } -- -- glEnable(m_textureTarget); -- glGenTextures(1, &plane.id); -- VerifyGLState(); -+ plane.id = 1; - -- glBindTexture(m_textureTarget, plane.id); -- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); -- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); -- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); -- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); -- glPixelStorei(GL_UNPACK_ALIGNMENT, 4); -- glTexImage2D(m_textureTarget, 0, GL_RGBA, plane.texwidth, plane.texheight, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL); -- glBindTexture(m_textureTarget, 0); -- glDisable(m_textureTarget); - #endif - return true; - } - -From 8cdb49af35d2c08a4528955ce34b378bd205892f Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Sat, 6 Sep 2014 10:24:58 +0200 -Subject: [PATCH 26/27] vaapi: set error if no video surfaces are available - ---- - xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp -index 3fba209..9611bf2 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp -@@ -645,6 +645,7 @@ int CDecoder::FFGetBuffer(AVCodecContext *avctx, AVFrame *pic, int flags) - va->m_bufferStats.Get(decoded, processed, render, vpp); - CLog::Log(LOGERROR, "VAAPI::FFGetBuffer - no surface available - dec: %d, render: %d", - decoded, render); -+ va->m_DisplayState = VAAPI_ERROR; - return -1; - } - - -From 4a33e3c86e2c38a57ff7b8f7671983c251dfdc44 Mon Sep 17 00:00:00 2001 -From: Rainer Hochecker -Date: Sat, 6 Sep 2014 10:25:52 +0200 -Subject: [PATCH 27/27] vaapi: use display connection of vaapi for xsync - ---- - xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp | 11 +++++++---- - xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.h | 2 ++ - 2 files changed, 9 insertions(+), 4 deletions(-) - -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp -index 9611bf2..624d6a4 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp -@@ -241,6 +241,11 @@ VADisplay CVAAPIContext::GetDisplay() - return m_display; } -+Display *CVAAPIContext::GetX11Display() -+{ -+ return m_X11dpy; -+} -+ - bool CVAAPIContext::IsValidDecoder(CDecoder *decoder) - { - std::vector::iterator it; -@@ -932,6 +937,7 @@ bool CDecoder::ConfigVAAPI() - memset(&m_hwContext, 0, sizeof(vaapi_context)); + bool CVppPostproc::Filter(CVaapiProcessedPicture &outPic) + +From 6f09c92b1952bf7cd1128ff6d56ba4e14bbc4351 Mon Sep 17 00:00:00 2001 +From: Rainer Hochecker +Date: Tue, 9 Sep 2014 12:19:25 +0200 +Subject: [PATCH 25/25] pvr: avoid closing stream players on channel switch + +--- + xbmc/cores/dvdplayer/DVDPlayer.cpp | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp +index eb7bae6..5dfce8e 100644 +--- a/xbmc/cores/dvdplayer/DVDPlayer.cpp ++++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp +@@ -1323,7 +1323,11 @@ void CDVDPlayer::Process() + break; + } - m_vaapiConfig.dpy = m_vaapiConfig.context->GetDisplay(); -+ m_vaapiConfig.x11dsp = m_vaapiConfig.context->GetX11Display(); - m_vaapiConfig.attrib = m_vaapiConfig.context->GetAttrib(m_vaapiConfig.profile); - if ((m_vaapiConfig.attrib.value & VA_RT_FORMAT_YUV420) == 0) - { -@@ -1815,7 +1821,7 @@ CVaapiRenderPicture* COutput::ProcessPicture(CVaapiProcessedPicture &pic) - { - return NULL; - } -- XSync(m_Display, false); -+ XSync(m_config.x11dsp, false); - glEnable(m_textureTarget); - glBindTexture(m_textureTarget, retPic->texture); - glXBindTexImageEXT(m_Display, retPic->glPixmap, GLX_FRONT_LEFT_EXT, NULL); -@@ -2058,9 +2064,6 @@ bool COutput::EnsureBufferPool() - } +- OpenDefaultStreams(); ++ // on channel switch we don't want to close stream players at this ++ // time. we'll get the stream change event later ++ if (!m_pInputStream->IsStreamType(DVDSTREAM_TYPE_PVRMANAGER) || ++ m_SelectionStreams.m_Streams.size() != 0) ++ OpenDefaultStreams(); - glGenTextures(1, &pic->texture); -- glBindTexture(m_textureTarget, pic->texture); -- glXBindTexImageEXT(m_Display, pic->glPixmap, GLX_FRONT_LEFT_EXT, NULL); -- glBindTexture(m_textureTarget, 0); - - pic->avFrame = av_frame_alloc(); - pic->valid = false; -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.h -index 3cc05c2..d937eea 100644 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.h -+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.h -@@ -123,6 +123,7 @@ struct CVaapiConfig - VADisplay dpy; - VAProfile profile; - VAConfigAttrib attrib; -+ Display *x11dsp; - }; - - /** -@@ -346,6 +347,7 @@ class CVAAPIContext - static bool EnsureContext(CVAAPIContext **ctx, CDecoder *decoder); - void Release(CDecoder *decoder); - VADisplay GetDisplay(); -+ Display* GetX11Display(); - bool SupportsProfile(VAProfile profile); - VAConfigAttrib GetAttrib(VAProfile profile); - VAConfigID CreateConfig(VAProfile profile, VAConfigAttrib attrib); + // never allow first frames after open to be skipped + if( m_dvdPlayerVideo->IsInited() )