MythTV  master
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Static Private Member Functions | List of all members
MythVideoTextureOpenGL Class Reference

#include <mythvideotextureopengl.h>

Inheritance diagram for MythVideoTextureOpenGL:
Inheritance graph
[legend]
Collaboration diagram for MythVideoTextureOpenGL:
Collaboration graph
[legend]

Public Member Functions

 MythVideoTextureOpenGL (GLuint Texture)
 
 ~MythVideoTextureOpenGL ()=default
 
- Public Member Functions inherited from MythGLTexture
 MythGLTexture (QOpenGLTexture *Texture)
 
 MythGLTexture (GLuint Texture)
 
 ~MythGLTexture ()=default
 

Static Public Member Functions

static std::vector< MythVideoTextureOpenGL * > CreateTextures (MythRenderOpenGL *Context, VideoFrameType Type, VideoFrameType Format, std::vector< QSize > Sizes, GLenum Target=QOpenGLTexture::Target2D)
 Create a set of textures suitable for the given Type and Format. More...
 
static void UpdateTextures (MythRenderOpenGL *Context, const MythVideoFrame *Frame, const std::vector< MythVideoTextureOpenGL * > &Textures)
 Update the contents of the given Textures for data held in Frame. More...
 
static void DeleteTexture (MythRenderOpenGL *Context, MythVideoTextureOpenGL *Texture)
 
static void DeleteTextures (MythRenderOpenGL *Context, std::vector< MythVideoTextureOpenGL * > &Textures)
 
static void SetTextureFilters (MythRenderOpenGL *Context, const std::vector< MythVideoTextureOpenGL * > &Textures, QOpenGLTexture::Filter Filter, QOpenGLTexture::WrapMode Wrap=QOpenGLTexture::ClampToEdge)
 
static MythVideoTextureOpenGLCreateTexture (MythRenderOpenGL *Context, QSize Size, GLenum Target=QOpenGLTexture::Target2D, QOpenGLTexture::PixelType PixelType=QOpenGLTexture::UInt8, QOpenGLTexture::PixelFormat PixelFormat=QOpenGLTexture::RGBA, QOpenGLTexture::TextureFormat Format=QOpenGLTexture::NoFormat, QOpenGLTexture::Filter Filter=QOpenGLTexture::Linear, QOpenGLTexture::WrapMode Wrap=QOpenGLTexture::ClampToEdge)
 Create and initialise a MythVideoTexture that is backed by a QOpenGLTexture. More...
 
static VideoFramebuffer CreateVideoFrameBuffer (MythRenderOpenGL *Context, VideoFrameType OutputType, QSize Size, bool HighPrecision=true)
 

Public Attributes

bool m_valid { false }
 
QOpenGLTexture::Filter m_filter { QOpenGLTexture::Linear }
 
VideoFrameType m_frameType { FMT_NONE }
 
VideoFrameType m_frameFormat { FMT_NONE }
 
uint m_plane { 0 }
 
uint m_planeCount { 0 }
 
bool m_allowGLSLDeint { false }
 
MythAVCopym_copyContext { nullptr }
 
- Public Attributes inherited from MythGLTexture
unsigned char * m_data { nullptr }
 
int m_bufferSize { 0 }
 
GLuint m_textureId { 0 }
 
QOpenGLTexture * m_texture { nullptr }
 
QOpenGLTexture::PixelFormat m_pixelFormat { QOpenGLTexture::RGBA }
 
QOpenGLTexture::PixelType m_pixelType { QOpenGLTexture::UInt8 }
 
QOpenGLBuffer * m_vbo { nullptr }
 
QSize m_size { QSize() }
 
QSize m_totalSize { QSize() }
 
bool m_flip { true }
 
bool m_crop { false }
 
QRect m_source { QRect() }
 
QRect m_destination { QRect() }
 
std::array< GLfloat, 16 > m_vertexData { 0.0F }
 
GLenum m_target { QOpenGLTexture::Target2D }
 
int m_rotation { 0 }
 

Protected Member Functions

 MythVideoTextureOpenGL (QOpenGLTexture *Texture)
 

Static Private Member Functions

static std::vector< MythVideoTextureOpenGL * > CreateHardwareTextures (MythRenderOpenGL *Context, VideoFrameType Type, VideoFrameType Format, std::vector< QSize > Sizes, GLenum Target)
 Create a set of hardware textures suitable for the given format. More...
 
static std::vector< MythVideoTextureOpenGL * > CreateSoftwareTextures (MythRenderOpenGL *Context, VideoFrameType Type, VideoFrameType Format, std::vector< QSize > Sizes, GLenum Target)
 Create a set of OpenGL textures to represent the given Format. More...
 
static void YV12ToYV12 (MythRenderOpenGL *Context, const MythVideoFrame *Frame, MythVideoTextureOpenGL *Texture, uint Plane)
 Copy YV12 frame data to 'YV12' textures. More...
 
static void YV12ToYUYV (const MythVideoFrame *Frame, MythVideoTextureOpenGL *Texture)
 Copy YV12 frame data to a YUYV texture. More...
 
static void NV12ToNV12 (MythRenderOpenGL *Context, const MythVideoFrame *Frame, MythVideoTextureOpenGL *Texture, uint Plane)
 Copy NV12 video frame data to 'NV12' textures. More...
 
static bool CreateBuffer (MythVideoTextureOpenGL *Texture, int Size)
 Create a data buffer for holding CPU side texture data. More...
 

Detailed Description

Definition at line 21 of file mythvideotextureopengl.h.

Constructor & Destructor Documentation

◆ MythVideoTextureOpenGL() [1/2]

MythVideoTextureOpenGL::MythVideoTextureOpenGL ( GLuint  Texture)
explicit

◆ ~MythVideoTextureOpenGL()

MythVideoTextureOpenGL::~MythVideoTextureOpenGL ( )
default

◆ MythVideoTextureOpenGL() [2/2]

MythVideoTextureOpenGL::MythVideoTextureOpenGL ( QOpenGLTexture *  Texture)
explicitprotected

Definition at line 7 of file mythvideotextureopengl.cpp.

Member Function Documentation

◆ CreateTextures()

std::vector< MythVideoTextureOpenGL * > MythVideoTextureOpenGL::CreateTextures ( MythRenderOpenGL Context,
VideoFrameType  Type,
VideoFrameType  Format,
std::vector< QSize >  Sizes,
GLenum  Target = QOpenGLTexture::Target2D 
)
static

◆ UpdateTextures()

void MythVideoTextureOpenGL::UpdateTextures ( MythRenderOpenGL Context,
const MythVideoFrame Frame,
const std::vector< MythVideoTextureOpenGL * > &  Textures 
)
static

Update the contents of the given Textures for data held in Frame.

Definition at line 281 of file mythvideotextureopengl.cpp.

Referenced by MythOpenGLVideo::PrepareFrame().

◆ DeleteTexture()

void MythVideoTextureOpenGL::DeleteTexture ( MythRenderOpenGL Context,
MythVideoTextureOpenGL Texture 
)
static

◆ DeleteTextures()

void MythVideoTextureOpenGL::DeleteTextures ( MythRenderOpenGL Context,
std::vector< MythVideoTextureOpenGL * > &  Textures 
)
static

◆ SetTextureFilters()

void MythVideoTextureOpenGL::SetTextureFilters ( MythRenderOpenGL Context,
const std::vector< MythVideoTextureOpenGL * > &  Textures,
QOpenGLTexture::Filter  Filter,
QOpenGLTexture::WrapMode  Wrap = QOpenGLTexture::ClampToEdge 
)
static

◆ CreateTexture()

MythVideoTextureOpenGL * MythVideoTextureOpenGL::CreateTexture ( MythRenderOpenGL Context,
QSize  Size,
GLenum  Target = QOpenGLTexture::Target2D,
QOpenGLTexture::PixelType  PixelType = QOpenGLTexture::UInt8,
QOpenGLTexture::PixelFormat  PixelFormat = QOpenGLTexture::RGBA,
QOpenGLTexture::TextureFormat  Format = QOpenGLTexture::NoFormat,
QOpenGLTexture::Filter  Filter = QOpenGLTexture::Linear,
QOpenGLTexture::WrapMode  Wrap = QOpenGLTexture::ClampToEdge 
)
static

Create and initialise a MythVideoTexture that is backed by a QOpenGLTexture.

QOpenGLTexture abstracts much of the detail of handling textures but is not compatible with a number of hardware decoder requirements.

Definition at line 432 of file mythvideotextureopengl.cpp.

Referenced by MythVTBInterop::Acquire(), MythVAAPIInteropGLXCopy::Acquire(), and CreateSoftwareTextures().

◆ CreateVideoFrameBuffer()

VideoFramebuffer MythVideoTextureOpenGL::CreateVideoFrameBuffer ( MythRenderOpenGL Context,
VideoFrameType  OutputType,
QSize  Size,
bool  HighPrecision = true 
)
static

Definition at line 580 of file mythvideotextureopengl.cpp.

Referenced by MythOpenGLVideo::RenderFrame().

◆ CreateHardwareTextures()

std::vector< MythVideoTextureOpenGL * > MythVideoTextureOpenGL::CreateHardwareTextures ( MythRenderOpenGL Context,
VideoFrameType  Type,
VideoFrameType  Format,
std::vector< QSize >  Sizes,
GLenum  Target 
)
staticprivate

Create a set of hardware textures suitable for the given format.

Note
This is a simple wrapper that deliberately does nothing more than create a texture and sets suitable defaults. In most instances, hardware textures require specific handling.
Linear filtering is always set (except MediaCodec/MMAL which use OES)

Definition at line 85 of file mythvideotextureopengl.cpp.

Referenced by CreateTextures().

◆ CreateSoftwareTextures()

std::vector< MythVideoTextureOpenGL * > MythVideoTextureOpenGL::CreateSoftwareTextures ( MythRenderOpenGL Context,
VideoFrameType  Type,
VideoFrameType  Format,
std::vector< QSize >  Sizes,
GLenum  Target 
)
staticprivate

Create a set of OpenGL textures to represent the given Format.

Note
All textures are created with CreateTexture which defaults to Linear filtering.

Definition at line 133 of file mythvideotextureopengl.cpp.

Referenced by CreateTextures().

◆ YV12ToYV12()

void MythVideoTextureOpenGL::YV12ToYV12 ( MythRenderOpenGL Context,
const MythVideoFrame Frame,
MythVideoTextureOpenGL Texture,
uint  Plane 
)
inlinestaticprivate

Copy YV12 frame data to 'YV12' textures.

Definition at line 485 of file mythvideotextureopengl.cpp.

Referenced by UpdateTextures().

◆ YV12ToYUYV()

void MythVideoTextureOpenGL::YV12ToYUYV ( const MythVideoFrame Frame,
MythVideoTextureOpenGL Texture 
)
inlinestaticprivate

Copy YV12 frame data to a YUYV texture.

Definition at line 512 of file mythvideotextureopengl.cpp.

Referenced by UpdateTextures().

◆ NV12ToNV12()

void MythVideoTextureOpenGL::NV12ToNV12 ( MythRenderOpenGL Context,
const MythVideoFrame Frame,
MythVideoTextureOpenGL Texture,
uint  Plane 
)
inlinestaticprivate

Copy NV12 video frame data to 'NV12' textures.

Definition at line 538 of file mythvideotextureopengl.cpp.

Referenced by UpdateTextures().

◆ CreateBuffer()

bool MythVideoTextureOpenGL::CreateBuffer ( MythVideoTextureOpenGL Texture,
int  Size 
)
inlinestaticprivate

Create a data buffer for holding CPU side texture data.

Definition at line 563 of file mythvideotextureopengl.cpp.

Referenced by NV12ToNV12(), YV12ToYUYV(), and YV12ToYV12().

Member Data Documentation

◆ m_valid

bool MythVideoTextureOpenGL::m_valid { false }

Definition at line 49 of file mythvideotextureopengl.h.

Referenced by NV12ToNV12(), YV12ToYUYV(), and YV12ToYV12().

◆ m_filter

QOpenGLTexture::Filter MythVideoTextureOpenGL::m_filter { QOpenGLTexture::Linear }

Definition at line 50 of file mythvideotextureopengl.h.

◆ m_frameType

VideoFrameType MythVideoTextureOpenGL::m_frameType { FMT_NONE }

◆ m_frameFormat

VideoFrameType MythVideoTextureOpenGL::m_frameFormat { FMT_NONE }

◆ m_plane

uint MythVideoTextureOpenGL::m_plane { 0 }

◆ m_planeCount

uint MythVideoTextureOpenGL::m_planeCount { 0 }

◆ m_allowGLSLDeint

bool MythVideoTextureOpenGL::m_allowGLSLDeint { false }

◆ m_copyContext

MythAVCopy* MythVideoTextureOpenGL::m_copyContext { nullptr }

Definition at line 59 of file mythvideotextureopengl.h.

Referenced by DeleteTexture(), and YV12ToYUYV().


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