[WASAPI] set stream audio category
[xbmc.git] / xbmc / cores / RetroPlayer / buffers / RenderBufferDMA.h
blob5e9f157d63344d86308790e79b122db570fa5969
1 /*
2 * Copyright (C) 2017-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include "cores/RetroPlayer/buffers/BaseRenderBuffer.h"
13 #include <memory>
15 #include "system_gl.h"
17 class CEGLImage;
18 class IBufferObject;
20 namespace KODI
22 namespace RETRO
24 class CRenderContext;
26 /**
27 * @brief Special IRenderBuffer implementation for use with CBufferObject.
28 * This buffer type uses Direct Memory Access (DMA) sharing via file
29 * descriptors (fds). The file descriptor is then used to create an
30 * EGL image.
33 class CRenderBufferDMA : public CBaseRenderBuffer
35 public:
36 CRenderBufferDMA(CRenderContext& context, int fourcc);
37 ~CRenderBufferDMA() override;
39 // implementation of IRenderBuffer via CRenderBufferSysMem
40 bool Allocate(AVPixelFormat format, unsigned int width, unsigned int height) override;
41 size_t GetFrameSize() const override;
42 uint8_t* GetMemory() override;
43 void ReleaseMemory() override;
45 // implementation of IRenderBuffer
46 bool UploadTexture() override;
48 GLuint TextureID() const { return m_textureId; }
50 protected:
51 // Construction parameters
52 CRenderContext& m_context;
53 const int m_fourcc = 0;
55 const GLenum m_textureTarget = GL_TEXTURE_2D;
56 GLuint m_textureId = 0;
58 private:
59 void CreateTexture();
60 void DeleteTexture();
62 std::unique_ptr<CEGLImage> m_egl;
63 std::unique_ptr<IBufferObject> m_bo;
65 } // namespace RETRO
66 } // namespace KODI