void CVDPAU::Close() { CLog::Log(LOGNOTICE, " (VDPAU) %s", __FUNCTION__); FiniVDPAUOutput(); FiniVDPAUProcs(); if (m_glPixmap) { CLog::Log(LOGINFO, "GLX: Destroying glPixmap"); glXReleaseTexImageEXT(m_Display, m_glPixmap, GLX_FRONT_LEFT_EXT); glXDestroyPixmap(m_Display, m_glPixmap); m_glPixmap = NULL; } if (m_Pixmap) { CLog::Log(LOGINFO, "GLX: Destroying XPixmap"); XFreePixmap(m_Display, m_Pixmap); m_Pixmap = NULL; } if (m_glContext) { CLog::Log(LOGINFO, "GLX: Destroying glContext"); glXDestroyContext(m_Display, m_glContext); m_glContext = NULL; } }
void CVDPAU::Close() { CLog::Log(LOGNOTICE, " (VDPAU) %s", __FUNCTION__); FiniVDPAUOutput(); FiniVDPAUProcs(); g_Windowing.Unregister(this); m_dllAvUtil.Unload(); }
void CVDPAU::OnLostDevice() { CLog::Log(LOGNOTICE,"CVDPAU::OnLostDevice event"); CExclusiveLock lock(m_DecoderSection); FiniVDPAUOutput(); FiniVDPAUProcs(); m_DisplayState = VDPAU_LOST; m_DisplayEvent.Reset(); }
bool CVDPAU::CheckRecover(bool force) { if (recover || force) { CLog::Log(LOGNOTICE,"Attempting recovery"); FiniVDPAUOutput(); FiniVDPAUProcs(); recover = false; InitVDPAUProcs(); return true; } return false; }
bool CVDPAU::ConfigVDPAU(AVCodecContext* avctx, int ref_frames) { FiniVDPAUOutput(); VdpStatus vdp_st; VdpDecoderProfile vdp_decoder_profile; vid_width = avctx->width; vid_height = avctx->height; surface_width = avctx->coded_width; surface_height = avctx->coded_height; past[1] = past[0] = current = future = NULL; CLog::Log(LOGNOTICE, " (VDPAU) screenWidth:%i vidWidth:%i surfaceWidth:%i",OutWidth,vid_width,surface_width); CLog::Log(LOGNOTICE, " (VDPAU) screenHeight:%i vidHeight:%i surfaceHeight:%i",OutHeight,vid_height,surface_height); ReadFormatOf(avctx->pix_fmt, vdp_decoder_profile, vdp_chroma_type); if(avctx->pix_fmt == PIX_FMT_VDPAU_H264) { max_references = ref_frames; if (max_references > 16) max_references = 16; if (max_references < 5) max_references = 5; } else max_references = 2; vdp_st = vdp_decoder_create(vdp_device, vdp_decoder_profile, surface_width, surface_height, max_references, &decoder); if (CheckStatus(vdp_st, __LINE__)) return false; m_vdpauOutputMethod = OUTPUT_NONE; vdpauConfigured = true; return true; }
int CVDPAU::Check(AVCodecContext* avctx) { EDisplayState state; { CSharedLock lock(m_DisplaySection); state = m_DisplayState; } if (state == VDPAU_LOST) { CLog::Log(LOGNOTICE,"CVDPAU::Check waiting for display reset event"); if (!m_DisplayEvent.WaitMSec(2000)) { CLog::Log(LOGERROR, "CVDPAU::Check - device didn't reset in reasonable time"); return VC_ERROR; } { CSharedLock lock(m_DisplaySection); state = m_DisplayState; } } if (state == VDPAU_RESET || state == VDPAU_ERROR) { CLog::Log(LOGNOTICE,"Attempting recovery"); CSingleLock gLock(g_graphicsContext); CExclusiveLock lock(m_DecoderSection); FiniVDPAUOutput(); FiniVDPAUProcs(); InitVDPAUProcs(); if (state == VDPAU_RESET) return VC_FLUSHED; else return VC_ERROR; } return 0; }
bool CVDPAU::ConfigVDPAU(AVCodecContext* avctx, int ref_frames) { FiniVDPAUOutput(); VdpStatus vdp_st; VdpDecoderProfile vdp_decoder_profile; vid_width = avctx->width; vid_height = avctx->height; past[1] = past[0] = current = future = NULL; CLog::Log(LOGNOTICE, " (VDPAU) screenWidth:%i vidWidth:%i",OutWidth,vid_width); CLog::Log(LOGNOTICE, " (VDPAU) screenHeight:%i vidHeight:%i",OutHeight,vid_height); ReadFormatOf(avctx->pix_fmt, vdp_decoder_profile, vdp_chroma_type); if(avctx->pix_fmt == PIX_FMT_VDPAU_H264) { max_references = ref_frames; if (max_references > 16) max_references = 16; if (max_references < 5) max_references = 5; } else max_references = 2; vdp_st = vdp_decoder_create(vdp_device, vdp_decoder_profile, vid_width, vid_height, max_references, &decoder); CHECK_VDPAU_RETURN(vdp_st, false); vdp_st = vdp_presentation_queue_target_create_x11(vdp_device, m_Pixmap, //x_window, &vdp_flip_target); CHECK_VDPAU_RETURN(vdp_st, false); vdp_st = vdp_presentation_queue_create(vdp_device, vdp_flip_target, &vdp_flip_queue); CHECK_VDPAU_RETURN(vdp_st, false); totalAvailableOutputSurfaces = 0; int tmpMaxOutputSurfaces = NUM_OUTPUT_SURFACES; if (vid_width == FULLHD_WIDTH) tmpMaxOutputSurfaces = NUM_OUTPUT_SURFACES_FOR_FULLHD; // Creation of outputSurfaces for (int i = 0; i < NUM_OUTPUT_SURFACES && i < tmpMaxOutputSurfaces; i++) { vdp_st = vdp_output_surface_create(vdp_device, VDP_RGBA_FORMAT_B8G8R8A8, OutWidth, OutHeight, &outputSurfaces[i]); CHECK_VDPAU_RETURN(vdp_st, false); totalAvailableOutputSurfaces++; } CLog::Log(LOGNOTICE, " (VDPAU) Total Output Surfaces Available: %i of a max (tmp: %i const: %i)", totalAvailableOutputSurfaces, tmpMaxOutputSurfaces, NUM_OUTPUT_SURFACES); surfaceNum = presentSurfaceNum = 0; outputSurface = outputSurfaces[surfaceNum]; vdpauConfigured = true; return true; }