File: d3d_device.h

package info (click to toggle)
libvpl-tools 1.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,652 kB
  • sloc: cpp: 107,469; python: 4,303; ansic: 3,202; sh: 159; lisp: 52; makefile: 13
file content (79 lines) | stat: -rw-r--r-- 2,367 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*############################################################################
  # Copyright (C) 2005 Intel Corporation
  #
  # SPDX-License-Identifier: MIT
  ############################################################################*/

#pragma once

#if defined(_WIN32) || defined(_WIN64)

    #include "hw_device.h"

    #pragma warning(disable : 4201)
    #include <d3d9.h>
    #include <dxva.h>
    #include <dxva2api.h>
    #include <windows.h>

    #define VIDEO_MAIN_FORMAT D3DFMT_YUY2

/** Direct3D 9 device implementation.
@note Device always set D3DPRESENT_PARAMETERS::Windowed to TRUE.
*/
class CD3D9Device : public CHWDevice {
public:
    CD3D9Device();
    virtual ~CD3D9Device();

    virtual mfxStatus Init(mfxHDL hWindow,
                           mfxU16 nViews,
                           mfxU32 nAdapterNum,
                           bool isFullScreen = false);
    virtual mfxStatus Reset();
    virtual mfxStatus GetHandle(mfxHandleType type, mfxHDL* pHdl);
    virtual mfxStatus SetHandle(mfxHandleType type, mfxHDL hdl);
    virtual mfxStatus RenderFrame(mfxFrameSurface1* pSurface, mfxFrameAllocator* pmfxAlloc);
    virtual void UpdateTitle(double /*fps*/) {}
    virtual void Close();
    void DefineFormat(bool isA2rgb10) {
        m_bIsA2rgb10 = (isA2rgb10) ? TRUE : FALSE;
    }
    virtual void SetMondelloInput(bool /*isMondelloInputEnabled*/) {}
    virtual void SetDxgiFullScreen() {}

protected:
    mfxStatus CreateVideoProcessors();
    bool CheckOverlaySupport();
    virtual mfxStatus FillD3DPP(mfxHDL hWindow, mfxU16 nViews, D3DPRESENT_PARAMETERS& D3DPP);

private:
    IDirect3D9Ex* m_pD3D9;
    IDirect3DDevice9Ex* m_pD3DD9;
    IDirect3DDeviceManager9* m_pDeviceManager9;
    D3DPRESENT_PARAMETERS m_D3DPP;
    UINT m_resetToken;

    mfxU16 m_nViews;

    D3DSURFACE_DESC m_backBufferDesc;

    // service required to create video processors
    IDirectXVideoProcessorService* m_pDXVAVPS;
    //left channel processor
    IDirectXVideoProcessor* m_pDXVAVP_Left;
    // right channel processor
    IDirectXVideoProcessor* m_pDXVAVP_Right;

    // target rectangle
    RECT m_targetRect;

    // various structures for DXVA2 calls
    DXVA2_VideoDesc m_VideoDesc;
    DXVA2_VideoProcessBltParams m_BltParams;
    DXVA2_VideoSample m_Sample;

    BOOL m_bIsA2rgb10;
};

#endif // #if defined( _WIN32 ) || defined ( _WIN64 )