aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRainer Hochecker <fernetmenta@online.de>2014-09-27 13:25:23 +0200
committerRainer Hochecker <fernetmenta@online.de>2014-09-27 13:25:23 +0200
commitb87399635c70299cd3cd037af0a676a67e1b706c (patch)
treebf2db72eb4b6bbc615a0c09cbf188155b7732cb3
parent1ba69b4513f14ea4219ce6ba4dbe58313b37ad1d (diff)
winrenderer: implement flush, fixes loss of video when moving window to other screen
-rw-r--r--xbmc/cores/VideoRenderers/WinRenderer.cpp38
-rw-r--r--xbmc/cores/VideoRenderers/WinRenderer.h6
-rw-r--r--xbmc/rendering/dx/RenderSystemDX.cpp3
3 files changed, 43 insertions, 4 deletions
diff --git a/xbmc/cores/VideoRenderers/WinRenderer.cpp b/xbmc/cores/VideoRenderers/WinRenderer.cpp
index 39fe9d1596..c769377a1f 100644
--- a/xbmc/cores/VideoRenderers/WinRenderer.cpp
+++ b/xbmc/cores/VideoRenderers/WinRenderer.cpp
@@ -310,6 +310,9 @@ int CWinRenderer::GetImage(YV12Image *image, int source, bool readonly)
YUVBuffer *buf = (YUVBuffer*)m_VideoBuffers[source];
+ if (buf->IsReadyToRender())
+ return -1;
+
image->cshift_x = 1;
image->cshift_y = 1;
image->height = m_sourceHeight;
@@ -483,6 +486,18 @@ void CWinRenderer::UnInit()
}
}
+void CWinRenderer::Flush()
+{
+ PreInit();
+ SetViewMode(CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode);
+ ManageDisplay();
+
+ m_bConfigured = true;
+
+ SelectRenderMethod();
+ UpdateRenderMethod();
+}
+
bool CWinRenderer::CreateIntermediateRenderTarget(unsigned int width, unsigned int height)
{
// Initialize a render target for intermediate rendering
@@ -705,6 +720,9 @@ void CWinRenderer::Render(DWORD flags)
return;
}
+ if (!m_VideoBuffers[m_iYV12RenderBuffer]->IsReadyToRender())
+ return;
+
UpdateVideoFilter();
// Optimize later? we could get by with bilinear under some circumstances
@@ -1200,9 +1218,6 @@ bool CWinRenderer::CreateYV12Texture(int index)
buf->StartDecode();
buf->Clear();
- if(index == m_iYV12RenderBuffer)
- buf->StartRender();
-
CLog::Log(LOGDEBUG, "created video buffer %i", index);
return true;
}
@@ -1428,6 +1443,11 @@ void YUVBuffer::Release()
void YUVBuffer::StartRender()
{
+ if (!m_locked)
+ return;
+
+ m_locked = false;
+
for(unsigned i = 0; i < m_activeplanes; i++)
{
if(planes[i].texture.Get() && planes[i].rect.pBits)
@@ -1439,6 +1459,11 @@ void YUVBuffer::StartRender()
void YUVBuffer::StartDecode()
{
+ if (m_locked)
+ return;
+
+ m_locked = true;
+
for(unsigned i = 0; i < m_activeplanes; i++)
{
if(planes[i].texture.Get()
@@ -1498,4 +1523,11 @@ void YUVBuffer::Clear()
}
}
+bool YUVBuffer::IsReadyToRender()
+{
+ if (!m_locked)
+ return true;
+ return false;
+}
+
#endif
diff --git a/xbmc/cores/VideoRenderers/WinRenderer.h b/xbmc/cores/VideoRenderers/WinRenderer.h
index e0f76f4944..5014321d3e 100644
--- a/xbmc/cores/VideoRenderers/WinRenderer.h
+++ b/xbmc/cores/VideoRenderers/WinRenderer.h
@@ -95,6 +95,7 @@ struct SVideoBuffer
virtual void StartDecode() {}; // Prepare the buffer to receive data from dvdplayer
virtual void StartRender() {}; // dvdplayer finished filling the buffer with data
virtual void Clear() {}; // clear the buffer with solid black
+ virtual bool IsReadyToRender() { return true; };
};
// YV12 decoder textures
@@ -106,7 +107,7 @@ struct SVideoPlane
struct YUVBuffer : SVideoBuffer
{
- YUVBuffer() : m_width (0), m_height(0), m_format(RENDER_FMT_NONE), m_activeplanes(0) {}
+ YUVBuffer() : m_width(0), m_height(0), m_format(RENDER_FMT_NONE), m_activeplanes(0), m_locked(false) {}
~YUVBuffer();
bool Create(ERenderFormat format, unsigned int width, unsigned int height);
virtual void Release();
@@ -114,6 +115,7 @@ struct YUVBuffer : SVideoBuffer
virtual void StartRender();
virtual void Clear();
unsigned int GetActivePlanes() { return m_activeplanes; }
+ virtual bool IsReadyToRender();
SVideoPlane planes[MAX_PLANES];
@@ -122,6 +124,7 @@ private:
unsigned int m_height;
ERenderFormat m_format;
unsigned int m_activeplanes;
+ bool m_locked;
};
struct DXVABuffer : SVideoBuffer
@@ -156,6 +159,7 @@ public:
virtual void UnInit();
virtual void Reset(); /* resets renderer after seek for example */
virtual bool IsConfigured() { return m_bConfigured; }
+ virtual void Flush();
virtual std::vector<ERenderFormat> SupportedFormats() { return m_formats; }
diff --git a/xbmc/rendering/dx/RenderSystemDX.cpp b/xbmc/rendering/dx/RenderSystemDX.cpp
index 527ba8b8a6..838a094f1e 100644
--- a/xbmc/rendering/dx/RenderSystemDX.cpp
+++ b/xbmc/rendering/dx/RenderSystemDX.cpp
@@ -36,6 +36,7 @@
#include "Util.h"
#include "win32/WIN32Util.h"
#include "video/VideoReferenceClock.h"
+#include "cores/VideoRenderers/RenderManager.h"
#if (D3DX_SDK_VERSION >= 42) //aug 2009 sdk and up use dxerr
#include <Dxerr.h>
#else
@@ -372,6 +373,8 @@ void CRenderSystemDX::OnDeviceReset()
for (vector<ID3DResource *>::iterator i = m_resources.begin(); i != m_resources.end(); i++)
(*i)->OnResetDevice();
+ g_renderManager.Flush();
+
g_windowManager.SendMessage(GUI_MSG_NOTIFY_ALL, 0, 0, GUI_MSG_RENDERER_RESET);
}
else