xbmc
BufferObject.h
1 /*
2  * Copyright (C) 2005-2020 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 "IBufferObject.h"
12 
13 #include <memory>
14 #include <stdint.h>
15 
22 {
23 public:
29  static std::unique_ptr<CBufferObject> GetBufferObject(bool needsCreateBySize);
30 
31  virtual bool CreateBufferObject(uint32_t format, uint32_t width, uint32_t height) override = 0;
32  bool CreateBufferObject(uint64_t size) override { return false; }
33 
34  int GetFd() override;
35  uint32_t GetStride() override;
36  uint64_t GetModifier() override;
37 
38  void SyncStart() override;
39  void SyncEnd() override;
40 
41 protected:
42  int m_fd{-1};
43  uint32_t m_stride{0};
44 };
bool CreateBufferObject(uint64_t size) override
Create a BufferObject based only on the size of the desired buffer.
Definition: BufferObject.h:32
void SyncEnd() override
Must be called after reading/writing data to the BufferObject.
Definition: BufferObject.cpp:51
void SyncStart() override
Must be called before reading/writing data to the BufferObject.
Definition: BufferObject.cpp:39
Interface to describe CBufferObjects.
Definition: IBufferObject.h:39
virtual bool CreateBufferObject(uint32_t format, uint32_t width, uint32_t height) override=0
Create a BufferObject based on the format, width, and height of the desired buffer.
static std::unique_ptr< CBufferObject > GetBufferObject(bool needsCreateBySize)
Get a BufferObject from CBufferObjectFactory.
Definition: BufferObject.cpp:19
base class for using the IBufferObject interface.
Definition: BufferObject.h:21
uint32_t GetStride() override
Get the Stride of the BufferObject.
Definition: BufferObject.cpp:29
int GetFd() override
Get the File Descriptor of the BufferObject.
Definition: BufferObject.cpp:24
uint64_t GetModifier() override
Get the Modifier of the BufferObject.
Definition: BufferObject.cpp:34