using namespace VDPAU;
#define NUM_RENDER_PICS 7
+#define NUM_CROP_PIX 3
#define ARSIZE(x) (sizeof(x) / sizeof((x)[0]))
{
delete m_context;
m_context = 0;
+ *ctx = NULL;
return false;
}
}
avctx->draw_horiz_band = CDecoder::FFDrawSlice;
avctx->slice_flags=SLICE_FLAG_CODED_ORDER|SLICE_FLAG_ALLOW_FIELD;
avctx->hwaccel_context = &m_hwContext;
- avctx->thread_count = 1;
g_Windowing.Register(this);
return true;
m_inMsgEvent.Reset();
m_vdpauConfigured = true;
+ m_ErrorCount = 0;
return true;
}
(VdpPictureInfo const *)&(vdp->m_hwContext.info),
vdp->m_hwContext.bitstream_buffers_used,
vdp->m_hwContext.bitstream_buffers);
- vdp->CheckStatus(vdp_st, __LINE__);
+ if (vdp->CheckStatus(vdp_st, __LINE__))
+ vdp->m_DecoderError = true;
+ else
+ vdp->m_DecoderError = false;
+
uint64_t diff = CurrentHostCounter() - startTime;
if (diff*1000/CurrentHostFrequency() > 30)
CLog::Log(LOGDEBUG, "CVDPAU::DrawSlice - VdpDecoderRender long decoding: %d ms, dec: %d, proc: %d, rend: %d", (int)((diff*1000)/CurrentHostFrequency()), decoded, processed, rend);
CSingleLock lock(m_DecoderSection);
+ if (m_DecoderError && pFrame)
+ return VC_ERROR;
+
if (!m_vdpauConfigured)
return VC_ERROR;
{
CLog::Log(LOGERROR, " (VDPAU) Error: %s(%d) at %s:%d\n", m_vdpauConfig.context->GetProcs().vdp_get_error_string(vdp_st), vdp_st, __FILE__, line);
+ m_ErrorCount++;
+
if(m_DisplayState == VDPAU_OPEN)
{
if (vdp_st == VDP_STATUS_DISPLAY_PREEMPTED)
m_DisplayEvent.Reset();
m_DisplayState = VDPAU_LOST;
}
- else
+ else if (m_ErrorCount > 2)
m_DisplayState = VDPAU_ERROR;
}
return true;
}
+ m_ErrorCount = 0;
return false;
}
}
m_mixerstep = 0;
+ m_processPicture.crop = false;
if (m_mixerInput[1].DVDPic.format == RENDER_FMT_VDPAU)
{
m_processPicture.outputSurface = m_outputSurfaces.front();
if (m_SeenInterlaceFlag)
{
double ratio = (double)m_mixerInput[1].DVDPic.iDisplayHeight / m_mixerInput[1].DVDPic.iHeight;
- m_mixerInput[1].DVDPic.iHeight -= 6;
- m_mixerInput[1].DVDPic.iDisplayHeight = lrint(ratio*m_mixerInput[1].DVDPic.iHeight);
+ m_mixerInput[1].DVDPic.iDisplayHeight = lrint(ratio*(m_mixerInput[1].DVDPic.iHeight-NUM_CROP_PIX*2));
+ m_processPicture.crop = true;
}
}
else
bool COutput::Uninit()
{
m_mixer.Dispose();
+ glFlush();
+ while(ProcessSyncPicture())
+ {
+ Sleep(10);
+ }
GLUnmapSurfaces();
ReleaseBufferPool();
DestroyGlxContext();
retPic->texWidth = m_config.outWidth;
retPic->texHeight = m_config.outHeight;
retPic->crop.x1 = 0;
- retPic->crop.y1 = (m_config.outHeight - retPic->DVDPic.iHeight) / 2;
+ retPic->crop.y1 = procPic.crop ? NUM_CROP_PIX : 0;
retPic->crop.x2 = m_config.outWidth;
retPic->crop.y2 = m_config.outHeight - retPic->crop.y1;
}