File: device-vaapi.h

package info (click to toggle)
libvpl 1%3A2.16.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 21,580 kB
  • sloc: cpp: 92,604; ansic: 6,176; python: 4,312; sh: 323; makefile: 7
file content (51 lines) | stat: -rw-r--r-- 1,364 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
//==============================================================================
// Copyright Intel Corporation
//
// SPDX-License-Identifier: MIT
//==============================================================================

#ifndef DISPATCHER_HELLO_VAAPI_SHARING_IMPORT_SRC_HW_DEVICE_H_
#define DISPATCHER_HELLO_VAAPI_SHARING_IMPORT_SRC_HW_DEVICE_H_
#ifdef __linux__
    #include <fcntl.h>
    #include <unistd.h>
    #include "va/va.h"
    #include "va/va_drm.h"
    #include "va/va_drmcommon.h"

    #include "vpl/mfx.h"
struct DevCtxVAAPI {
public:
    DevCtxVAAPI() : m_vaDRMfd(-1), m_vaDisplay() {}

    ~DevCtxVAAPI() {
        if (m_vaDisplay) {
            vaTerminate(m_vaDisplay);
            m_vaDisplay = nullptr;
        }

        if (m_vaDRMfd >= 0) {
            close(m_vaDRMfd);
            m_vaDRMfd = -1;
        }
    }

    mfxStatus InitDevice(mfxU32 nAdapterNum, mfxHandleType *pHandleType, mfxHDL *pHandle);

    VADisplay GetVADisplay(void) {
        return m_vaDisplay;
    }

    VASurfaceID CreateSurfaceToShare(mfxU16 width,
                                     mfxU16 height,
                                     mfxU8 *data,
                                     bool brender = false);

private:
    int m_vaDRMfd;
    VADisplay m_vaDisplay;
};

#endif //Linux

#endif // DISPATCHER__HELLO_VAAPI_SHARING_IMPORT_SRC_HW_DEVICE_H_