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 #include "cores/VideoPlayer/Buffers/VideoBufferDRMPRIME.h"
12 #include "utils/EGLImage.h"
13 #include "utils/Geometry.h"
14 
15 #include "system_gl.h"
16 
17 class CDRMPRIMETexture
18 {
19 public:
20   CDRMPRIMETexture() = default;
21   ~CDRMPRIMETexture();
22 
23   bool Map(CVideoBufferDRMPRIME* buffer);
24   void Unmap();
25   void Init(EGLDisplay eglDisplay);
26 
GetTexture()27   GLuint GetTexture() { return m_texture; }
GetTextureSize()28   CSizeInt GetTextureSize() { return {m_texWidth, m_texHeight}; }
29 
30 protected:
31   CVideoBufferDRMPRIME* m_primebuffer{nullptr};
32   std::unique_ptr<CEGLImage> m_eglImage;
33 
34   const GLenum m_textureTarget{GL_TEXTURE_EXTERNAL_OES};
35   GLuint m_texture{0};
36   int m_texWidth{0};
37   int m_texHeight{0};
38 };
39