Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

xvba: ugly fix for switching channels, will re-design when cleaning up

  • Loading branch information...
commit dbba4fc589981781f52b4205d313c83cbe5f01ea 1 parent 0d94bf7
@FernetMenta authored
View
21 xbmc/cores/VideoRenderers/LinuxRendererGL.cpp
@@ -126,6 +126,7 @@ CLinuxRendererGL::YUVBUFFER::YUVBUFFER()
#endif
#ifdef HAVE_LIBXVBA
xvba = NULL;
+ xvba_tmp = NULL;
#endif
}
@@ -2469,6 +2470,7 @@ void CLinuxRendererGL::DeleteXVBATexture(int index)
m_buffers[index].xvba->FinishGL();
SAFE_RELEASE(m_buffers[index].xvba);
+ SAFE_RELEASE(m_buffers[index].xvba_tmp);
if(plane.id && glIsTexture(plane.id))
glDeleteTextures(1, &plane.id);
@@ -2515,6 +2517,13 @@ void CLinuxRendererGL::UploadXVBATexture(int index)
#ifdef HAVE_LIBXVBA
XVBA::CDecoder *xvba = m_buffers[index].xvba;
+ if (m_buffers[index].xvba_tmp)
+ {
+ SAFE_RELEASE(m_buffers[index].xvba);
+ xvba = m_buffers[index].xvba = m_buffers[index].xvba_tmp;
+ m_buffers[index].xvba_tmp = NULL;
+ }
+
YUVFIELDS &fields = m_buffers[index].fields;
YUVPLANE &planeFallback = fields[0][1];
YUVPLANE &plane = fields[m_currentField][0];
@@ -2579,6 +2588,7 @@ void CLinuxRendererGL::DeleteXVBAyv12Texture(int index)
m_buffers[index].xvba->FinishGL();
SAFE_RELEASE(m_buffers[index].xvba);
+ SAFE_RELEASE(m_buffers[index].xvba_tmp);
if( fields[FIELD_FULL][0].id == 0 ) return;
@@ -2781,6 +2791,13 @@ void CLinuxRendererGL::UploadXVBAyv12Texture(int source)
YUVFIELDS& fields = buf.fields;
XVBA::CDecoder *xvba = m_buffers[source].xvba;
+ if (m_buffers[source].xvba_tmp)
+ {
+ SAFE_RELEASE(m_buffers[source].xvba);
+ xvba = m_buffers[source].xvba = m_buffers[source].xvba_tmp;
+ m_buffers[source].xvba_tmp = NULL;
+ }
+
if (!(im->flags&IMAGE_FLAG_READY) || !xvba)
{
m_eventTexturesDone[source]->Set();
@@ -3685,8 +3702,8 @@ void CLinuxRendererGL::AddProcessor(VAAPI::CHolder& holder)
void CLinuxRendererGL::AddProcessor(XVBA::CDecoder* xvba)
{
YUVBUFFER &buf = m_buffers[NextYV12Texture()];
- SAFE_RELEASE(buf.xvba);
- buf.xvba = (XVBA::CDecoder*)xvba->Acquire();
+ SAFE_RELEASE(buf.xvba_tmp);
+ buf.xvba_tmp = (XVBA::CDecoder*)xvba->Acquire();
}
#endif
View
1  xbmc/cores/VideoRenderers/LinuxRendererGL.h
@@ -287,6 +287,7 @@ class CLinuxRendererGL : public CBaseRenderer
#endif
#ifdef HAVE_LIBXVBA
XVBA::CDecoder* xvba;
+ XVBA::CDecoder* xvba_tmp;
#endif
};
View
10 xbmc/cores/dvdplayer/DVDCodecs/Video/XVBA.cpp
@@ -259,6 +259,8 @@ void *CXVBAContext::GetContext()
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
+static unsigned int decoderId = 0;
+
CDecoder::CDecoder()
{
m_context = 0;
@@ -312,7 +314,9 @@ bool CDecoder::Open(AVCodecContext* avctx, const enum PixelFormat fmt, unsigned
return false;
}
- CLog::Log(LOGNOTICE,"(XVBA::Open) opening dxva decoder");
+ m_decoderId = decoderId++;
+
+ CLog::Log(LOGNOTICE,"(XVBA::Open) opening xvba decoder, id: %d", m_decoderId);
if(avctx->coded_width == 0
|| avctx->coded_height == 0)
@@ -481,11 +485,13 @@ bool CDecoder::Open(AVCodecContext* avctx, const enum PixelFormat fmt, unsigned
void CDecoder::Close()
{
- CLog::Log(LOGNOTICE, "XVBA::Close - closing decoder");
+ CLog::Log(LOGNOTICE, "XVBA::Close - closing decoder, id: %d", m_decoderId);
if (!m_context)
return;
+ FinishGL();
+
DestroySession();
if (m_context)
m_context->Release();
View
1  xbmc/cores/dvdplayer/DVDCodecs/Video/XVBA.h
@@ -123,6 +123,7 @@ class CDecoder : public CDVDVideoCodecFFmpeg::IHardwareDecoder,
XVBADecodeCap m_decoderCap;
void *m_xvbaSession;
+ unsigned int m_decoderId;
struct XVBABufferPool
{
XVBABufferDescriptor *picture_descriptor_buffer;
Please sign in to comment.
Something went wrong with that request. Please try again.