Ticket #6618: 6618-vout_d3d_reinit.patch

File 6618-vout_d3d_reinit.patch, 2.0 KB (added by Jeff Lu <jll544@…>, 17 years ago)
  • libs/libmythtv/videoout_d3d.cpp

     
    188188    QMutexLocker locker(&m_lock);
    189189    D3DCAPS9 d3dCaps;
    190190
     191    UnInitD3D();
     192
    191193    typedef LPDIRECT3D9 (WINAPI *LPFND3DC)(UINT SDKVersion);
    192194    static LPFND3DC OurDirect3DCreate9 = NULL;
    193195    static HINSTANCE hD3DLib = NULL;
     
    258260    d3dpp.hDeviceWindow          = m_hWnd;
    259261    d3dpp.Windowed               = TRUE;
    260262    d3dpp.BackBufferWidth        = m_InputCX;
    261     d3dpp.BackBufferHeight       = m_InputCX;
     263    d3dpp.BackBufferHeight       = m_InputCY;
    262264    d3dpp.BackBufferCount        = 1;
    263265    d3dpp.MultiSampleType        = D3DMULTISAMPLE_NONE;
    264266    d3dpp.SwapEffect             = D3DSWAPEFFECT_DISCARD;
     
    522524        return;
    523525    }
    524526
     527    if (!m_pSurface)
     528    {
     529        VERBOSE(VB_IMPORTANT, LOC_ERR + "Picture surface not initialized");
     530        return;
     531    }
     532
    525533    if (!buffer)
    526534        buffer = vbuffers.GetScratchFrame();
    527535
     
    581589            switch (hr)
    582590            {
    583591                case D3DERR_DEVICENOTRESET:
    584                     VERBOSE(VB_IMPORTANT, LOC_ERR +
    585                             "The device has been lost but can be reset "
    586                             "at this time. TODO: implement device reset");
    587                     // TODO: instead of goto renderError, reset the device
    588                     //m_pd3dDevice->Reset(...
     592                    VERBOSE(VB_IMPORTANT, LOC +
     593                            "The device was lost and will be reset now.");
     594                    InitD3D();
    589595                    goto RenderError;
    590596                case D3DERR_DEVICELOST:
    591                     VERBOSE(VB_IMPORTANT, LOC_ERR +
     597                    VERBOSE(VB_PLAYBACK, LOC +
    592598                            "The device has been lost and cannot be reset "
    593599                            "at this time.");
    594600                    goto RenderError;