bool VideoOutputVDPAU::Init(int width, int height, float aspect, WId winid, const QRect &win_rect, MythCodecID codec_id) { // Attempt to free up as much video memory as possible // only works when using the VDPAU painter for the UI MythPainter *painter = GetMythPainter(); if (painter) painter->FreeResources(); m_win = winid; QMutexLocker locker(&m_lock); window.SetNeedRepaint(true); bool ok = VideoOutput::Init(width, height, aspect, winid, win_rect,codec_id); if (db_vdisp_profile) db_vdisp_profile->SetVideoRenderer("vdpau"); InitDisplayMeasurements(width, height, true); ParseOptions(); if (ok) ok = InitRender(); if (ok) ok = InitBuffers(); if (!ok) { TearDown(); return ok; } InitPictureAttributes(); MoveResize(); LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Created VDPAU context (%1 decode)") .arg(codec_is_std(video_codec_id) ? "software" : "GPU")); return ok; }
static void setDebugShowNames(void) { MythPainter *p = GetMythPainter(); p->SetDebugMode(p->ShowBorders(), !p->ShowTypeNames()); if (GetMythMainWindow()->GetMainStack()->GetTopScreen()) GetMythMainWindow()->GetMainStack()->GetTopScreen()->SetRedraw(); }
bool VideoOutputD3D::Init(const QSize &video_dim_buf, const QSize &video_dim_disp, float aspect, WId winid, const QRect &win_rect,MythCodecID codec_id) { MythPainter *painter = GetMythPainter(); if (painter) painter->FreeResources(); QMutexLocker locker(&m_lock); m_hWnd = (HWND)winid; window.SetAllowPreviewEPG(true); VideoOutput::Init(video_dim_buf, video_dim_disp, aspect, winid, win_rect, codec_id); LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Init with codec: %1") .arg(toString(codec_id))); SetProfile(); bool success = true; success &= SetupContext(); InitDisplayMeasurements(video_dim_disp.width(), video_dim_disp.height(), false); if (codec_is_dxva2(video_codec_id)) { if (!CreateDecoder()) return false; } success &= CreateBuffers(); success &= InitBuffers(); success &= CreatePauseFrame(); MoveResize(); if (!success) TearDown(); else { m_osd_painter = new MythD3D9Painter(m_render); if (m_osd_painter) { m_osd_painter->SetSwapControl(false); LOG(VB_PLAYBACK, LOG_INFO, LOC + "Created D3D9 osd painter."); } else LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to create D3D9 osd painter."); } return success; }
bool VideoOutputD3D::Init(int width, int height, float aspect, WId winid, int winx, int winy, int winw, int winh, MythCodecID codec_id, WId embedid) { MythPainter *painter = GetMythPainter(); if (painter) painter->FreeResources(); QMutexLocker locker(&m_lock); m_hWnd = winid; m_hEmbedWnd = embedid; window.SetAllowPreviewEPG(true); VideoOutput::Init(width, height, aspect, winid, winx, winy, winw, winh, codec_id, embedid); if (db_vdisp_profile) db_vdisp_profile->SetVideoRenderer("direct3d"); bool success = true; success &= SetupContext(); InitDisplayMeasurements(width, height, false); vbuffers.Init(kNumBuffers, true, kNeedFreeFrames, kPrebufferFramesNormal, kPrebufferFramesSmall, kKeepPrebuffer); success &= vbuffers.CreateBuffers(FMT_YV12, window.GetVideoDim().width(), window.GetVideoDim().height()); m_pauseFrame.height = vbuffers.GetScratchFrame()->height; m_pauseFrame.width = vbuffers.GetScratchFrame()->width; m_pauseFrame.bpp = vbuffers.GetScratchFrame()->bpp; m_pauseFrame.size = vbuffers.GetScratchFrame()->size; m_pauseFrame.buf = new unsigned char[m_pauseFrame.size + 128]; m_pauseFrame.frameNumber = vbuffers.GetScratchFrame()->frameNumber; MoveResize(); if (!success) TearDown(); else { m_osd_painter = new MythD3D9Painter(m_render); if (m_osd_painter) { m_osd_painter->SetSwapControl(false); VERBOSE(VB_PLAYBACK, LOC + "Created D3D9 osd painter."); } else VERBOSE(VB_IMPORTANT, LOC + "Failed to create D3D9 osd painter."); } return success; }
bool VideoOutputD3D::Init(int width, int height, float aspect, WId winid, int winx, int winy, int winw, int winh, MythCodecID codec_id, WId embedid) { MythPainter *painter = GetMythPainter(); if (painter) painter->FreeResources(); QMutexLocker locker(&m_lock); m_hWnd = winid; m_hEmbedWnd = embedid; window.SetAllowPreviewEPG(true); VideoOutput::Init(width, height, aspect, winid, winx, winy, winw, winh, codec_id, embedid); VERBOSE(VB_PLAYBACK, LOC + QString("Init with codec: %1") .arg(toString(codec_id))); SetProfile(); bool success = true; success &= SetupContext(); InitDisplayMeasurements(width, height, false); if (codec_is_dxva2(video_codec_id)) { if (!CreateDecoder()) return false; } success &= CreateBuffers(); success &= InitBuffers(); success &= CreatePauseFrame(); MoveResize(); if (!success) TearDown(); else { m_osd_painter = new MythD3D9Painter(m_render); if (m_osd_painter) { m_osd_painter->SetSwapControl(false); VERBOSE(VB_PLAYBACK, LOC + "Created D3D9 osd painter."); } else VERBOSE(VB_IMPORTANT, LOC + "Failed to create D3D9 osd painter."); } return success; }