kodi
VdpauGL.h
1 /*
2  * Copyright (C) 2007-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 // always define GL_GLEXT_PROTOTYPES before include gl headers
12 #if !defined(GL_GLEXT_PROTOTYPES)
13 #define GL_GLEXT_PROTOTYPES
14 #endif
15 
16 #include <GL/gl.h>
17 #include <GL/glext.h>
18 
19 namespace VDPAU
20 {
21 class CVdpauRenderPicture;
22 
23 
25 {
26  PFNGLVDPAUINITNVPROC glVDPAUInitNV;
27  PFNGLVDPAUFININVPROC glVDPAUFiniNV;
28  PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC glVDPAURegisterOutputSurfaceNV;
29  PFNGLVDPAUREGISTERVIDEOSURFACENVPROC glVDPAURegisterVideoSurfaceNV;
30  PFNGLVDPAUISSURFACENVPROC glVDPAUIsSurfaceNV;
31  PFNGLVDPAUUNREGISTERSURFACENVPROC glVDPAUUnregisterSurfaceNV;
32  PFNGLVDPAUSURFACEACCESSNVPROC glVDPAUSurfaceAccessNV;
33  PFNGLVDPAUMAPSURFACESNVPROC glVDPAUMapSurfacesNV;
34  PFNGLVDPAUUNMAPSURFACESNVPROC glVDPAUUnmapSurfacesNV;
35  PFNGLVDPAUGETSURFACEIVNVPROC glVDPAUGetSurfaceivNV;
36  GLenum textureTarget;
37 };
38 
40 {
41 public:
42  bool Init(void *device, void *procFunc, int64_t ident);
43  void Finish();
44  InteropInfo &GetInterop();
45  bool NeedInit(void *device, void *procFunc, int64_t ident);
46 
47 protected:
48  void *m_device = nullptr;
49  void *m_procFunc = nullptr;
50  int64_t m_ident = 0;
51  InteropInfo m_interop;
52 };
53 
55 {
56 public:
57  bool Map(VDPAU::CVdpauRenderPicture *pic);
58  void Unmap();
59  void Init(InteropInfo &interop);
60 
61  GLuint m_texture = 0;
62  GLuint m_textureTopY = 0;
63  GLuint m_textureTopUV = 0;
64  GLuint m_textureBotY = 0;
65  GLuint m_textureBotUV = 0;
66  int m_texWidth = 0;
67  int m_texHeight = 0;
68 
69 protected:
70  bool MapNV12();
71  void UnmapNV12();
72  bool MapRGB();
73  void UnmapRGB();
74  InteropInfo m_interop;
75  CVdpauRenderPicture *m_vdpauPic = nullptr;
76  struct GLSurface
77  {
78  GLvdpauSurfaceNV glVdpauSurface;
79  } m_glSurface;
80 };
81 }
Definition: VdpauGL.h:39
Definition: VdpauGL.h:76
Definition: VDPAU.h:57
Definition: VdpauGL.h:24
Definition: VDPAU.h:293
Definition: VdpauGL.h:54