Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
CBufferObject Class Referenceabstract

base class for using the IBufferObject interface. Derived classes should be based on this class. More...

#include <BufferObject.h>

Inheritance diagram for CBufferObject:
IBufferObject CDMAHeapBufferObject CDumbBufferObject CGBMBufferObject CUDMABufferObject

Public Member Functions

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.
 
bool CreateBufferObject (uint64_t size) override
 Create a BufferObject based only on the size of the desired buffer. Not all CBufferObject implementations may support this. This method is required for use with the CAddonVideoCodec as it only knows the decoded buffer size.
 
int GetFd () override
 Get the File Descriptor of the BufferObject. The fd is guaranteed to be available after calling CreateBufferObject().
 
uint32_t GetStride () override
 Get the Stride of the BufferObject. The stride is guaranteed to be available after calling GetMemory().
 
uint64_t GetModifier () override
 Get the Modifier of the BufferObject. Format Modifiers further describe the buffer's format such as for tiling or compression. see https://github.com/torvalds/linux/blob/master/include/uapi/drm/drm_fourcc.h.
 
void SyncStart () override
 Must be called before reading/writing data to the BufferObject.
 
void SyncEnd () override
 Must be called after reading/writing data to the BufferObject.
 
- Public Member Functions inherited from IBufferObject
virtual ~IBufferObject ()=default
 
virtual void DestroyBufferObject ()=0
 Destroy a BufferObject.
 
virtual uint8_tGetMemory ()=0
 Get the Memory location of the BufferObject. This method needs to be called to be able to copy data into the BufferObject.
 
virtual void ReleaseMemory ()=0
 Release the mapped memory of the BufferObject. After calling this the memory location pointed to by GetMemory() will be invalid.
 
virtual std::string GetName () const =0
 Get the Name of the BufferObject type in use.
 

Static Public Member Functions

static std::unique_ptr< CBufferObjectGetBufferObject (bool needsCreateBySize)
 Get a BufferObject from CBufferObjectFactory.
 

Protected Attributes

int m_fd {-1}
 
uint32_t m_stride {0}
 

Detailed Description

base class for using the IBufferObject interface. Derived classes should be based on this class.

Member Function Documentation

◆ CreateBufferObject() [1/2]

virtual bool CBufferObject::CreateBufferObject ( uint32_t format,
uint32_t width,
uint32_t height )
overridepure virtual

Create a BufferObject based on the format, width, and height of the desired buffer.

Parameters
formatframebuffer pixel formats are described using the fourcc codes defined in https://github.com/torvalds/linux/blob/master/include/uapi/drm/drm_fourcc.h
widthwidth of the requested buffer.
heightheight of the requested buffer.
Returns
true BufferObject creation was successful.
false BufferObject creation was unsuccessful.

Implements IBufferObject.

Implemented in CDMAHeapBufferObject, CDumbBufferObject, CGBMBufferObject, and CUDMABufferObject.

◆ CreateBufferObject() [2/2]

bool CBufferObject::CreateBufferObject ( uint64_t size)
inlineoverridevirtual

Create a BufferObject based only on the size of the desired buffer. Not all CBufferObject implementations may support this. This method is required for use with the CAddonVideoCodec as it only knows the decoded buffer size.

Parameters
sizeof the requested buffer.
Returns
true BufferObject creation was successful.
false BufferObject creation was unsuccessful.

Implements IBufferObject.

Reimplemented in CDMAHeapBufferObject, and CUDMABufferObject.

◆ GetBufferObject()

std::unique_ptr< CBufferObject > CBufferObject::GetBufferObject ( bool needsCreateBySize)
static

Get a BufferObject from CBufferObjectFactory.

Returns
std::unique_ptr<CBufferObject>

◆ GetFd()

int CBufferObject::GetFd ( )
overridevirtual

Get the File Descriptor of the BufferObject. The fd is guaranteed to be available after calling CreateBufferObject().

Returns
int fd for the BufferObject. Invalid if -1.

Implements IBufferObject.

◆ GetModifier()

uint64_t CBufferObject::GetModifier ( )
overridevirtual

Get the Modifier of the BufferObject. Format Modifiers further describe the buffer's format such as for tiling or compression. see https://github.com/torvalds/linux/blob/master/include/uapi/drm/drm_fourcc.h.

Returns
uint64_t modifier of the BufferObject. 0 means the layout is linear (default).

Implements IBufferObject.

Reimplemented in CGBMBufferObject.

◆ GetStride()

uint32_t CBufferObject::GetStride ( )
overridevirtual

Get the Stride of the BufferObject. The stride is guaranteed to be available after calling GetMemory().

Returns
uint32_t stride of the BufferObject.

Implements IBufferObject.

◆ SyncEnd()

void CBufferObject::SyncEnd ( )
overridevirtual

Must be called after reading/writing data to the BufferObject.

Implements IBufferObject.

◆ SyncStart()

void CBufferObject::SyncStart ( )
overridevirtual

Must be called before reading/writing data to the BufferObject.

Implements IBufferObject.

Member Data Documentation

◆ m_fd

int CBufferObject::m_fd {-1}
protected

◆ m_stride

uint32_t CBufferObject::m_stride {0}
protected

The documentation for this class was generated from the following files: