-
Notifications
You must be signed in to change notification settings - Fork 343
/
vaapicontext.h
85 lines (73 loc) · 2.28 KB
/
vaapicontext.h
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
80
81
82
83
84
85
#ifndef VAAPICONTEXT_H
#define VAAPICONTEXT_H
extern "C" {
#include "libavcodec/vaapi.h"
}
#include "va/va_version.h"
#if VA_CHECK_VERSION(0,34,0)
#include "va/va_compat.h"
#endif
#include "va/va_x11.h"
#include "videocolourspace.h"
struct vaapi_surface
{
VASurfaceID m_id;
};
class VAAPIDisplay;
class OpenGLVideo;
class MythXDisplay;
class MythRenderOpenGL;
class VAAPIRenderedPicture;
enum VAAPIDisplayType
{
kVADisplayX11,
kVADisplayGLX,
};
class VAAPIContext
{
public:
static bool IsFormatAccelerated(QSize size, MythCodecID codec,
PixelFormat &pix_fmt);
VAAPIContext(VAAPIDisplayType display_type, MythCodecID codec);
~VAAPIContext();
bool CreateDisplay(QSize size, bool noreuse = false,
MythRenderOpenGL *render = NULL);
bool CreateBuffers(void);
void* GetVideoSurface(int i);
uint8_t* GetSurfaceIDPointer(void* buf);
int GetNumBuffers(void) const { return m_numSurfaces; }
PixelFormat GetPixelFormat(void) const { return m_pix_fmt; }
// X11 display
bool CopySurfaceToFrame(VideoFrame *frame, const void *buf);
bool InitImage(const void *buf);
// GLX display
bool CopySurfaceToTexture(const void* buf, uint texture,
uint texture_type, FrameScanType scan);
VAAPIRenderedPicture* GetPixmap(uint texture, uint texture_type);
void ClearPixmaps(void);
bool InitDisplay(void);
bool InitProfiles(void);
bool InitBuffers(void);
bool InitContext(void);
void InitPictureAttributes(VideoColourSpace &colourspace);
int SetPictureAttribute(PictureAttribute attribute, int newValue);
VAAPIDisplayType m_dispType;
vaapi_context m_ctx;
MythCodecID m_codec;
QSize m_size;
VAAPIDisplay *m_display;
VAProfile m_vaProfile;
VAEntrypoint m_vaEntrypoint;
PixelFormat m_pix_fmt;
int m_numSurfaces;
VASurfaceID *m_surfaces;
vaapi_surface *m_surfaceData;
QHash<uint, VAAPIRenderedPicture*> m_glxSurfaces;
VADisplayAttribute* m_pictureAttributes;
int m_pictureAttributeCount;
int m_hueBase;
VAImage m_image;
bool m_deriveSupport;
MythUSWCCopy *m_copy;
};
#endif // VAAPICONTEXT_H