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

#include <mythopenglvideo.h>

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

Public Types

enum  VideoShaderType {
  Default = 0, Progressive = 1, InterlacedTop = 2, InterlacedBot = 3,
  BicubicUpsize = 4, ShaderCount = 5
}
 
- Public Types inherited from MythVideoGPU
enum  VideoResize {
  None = 0x000, Deinterlacer = 0x001, Sampling = 0x002, Performance = 0x004,
  Framebuffer = 0x008, ToneMap = 0x010, Bicubic = 0x020
}
 

Public Slots

void UpdateShaderParameters ()
 
- Public Slots inherited from MythVideoGPU
void UpdateColourSpace (bool PrimariesChanged)
 
void SetVideoDimensions (QSize VideoDim, QSize VideoDispDim)
 
void SetVideoRects (QRect DisplayVideoRect, QRect VideoRect)
 
void SetViewportRect (QRect DisplayVisibleRect)
 
void UpscalerChanged (const QString &Upscaler)
 

Public Member Functions

 MythOpenGLVideo (MythRenderOpenGL *Render, MythVideoColourSpace *ColourSpace, MythVideoBounds *Bounds, const MythVideoProfilePtr &VideoProfile, const QString &Profile)
 
 ~MythOpenGLVideo () override
 
void StartFrame () override
 
void PrepareFrame (MythVideoFrame *Frame, FrameScanType Scan=kScan_Progressive) override
 Update the current input texture using the data from the given video frame. More...
 
void RenderFrame (MythVideoFrame *Frame, bool TopFieldFirst, FrameScanType Scan, StereoscopicMode StereoOverride, bool DrawBorder=false) override
 
void EndFrame () override
 
QString GetProfile () const override
 
void ResetFrameFormat () override
 
void ResetTextures () override
 Clear reference frames after a seek as they will contain old images. More...
 
- Public Member Functions inherited from MythVideoGPU
 MythVideoGPU (MythRender *Render, MythVideoColourSpace *ColourSpace, MythVideoBounds *Bounds, const MythVideoProfilePtr &VideoProfile, QString Profile)
 
 ~MythVideoGPU () override
 
bool IsValid () const
 
void SetProfile (const QString &Profile)
 
void SetMasterViewport (QSize Size)
 
QSize GetVideoDim () const
 

Static Public Member Functions

static QString TypeToProfile (VideoFrameType Type)
 
- Static Public Member Functions inherited from MythVideoGPU
static QString VideoResizeToString (VideoResizing Resize)
 

Protected Member Functions

void ColourSpaceUpdate (bool PrimariesChanged) override
 

Private Member Functions

bool SetupFrameFormat (VideoFrameType InputType, VideoFrameType OutputType, QSize Size, GLenum TextureTarget)
 
bool CreateVideoShader (VideoShaderType Type, MythDeintType Deint=DEINT_NONE)
 Create the appropriate shader for the operation Type. More...
 
void BindTextures (bool Deinterlacing, vector< MythVideoTextureOpenGL * > &Current, vector< MythGLTexture * > &Textures)
 
bool AddDeinterlacer (const MythVideoFrame *Frame, FrameScanType Scan, MythDeintType Filter=DEINT_SHADER, bool CreateReferences=true)
 
void CleanupDeinterlacers ()
 
void SetupBicubic (VideoResizing &Resize)
 

Private Attributes

MythRenderOpenGLm_openglRender { nullptr }
 
int m_gles { 0 }
 
MythDeintType m_fallbackDeinterlacer { MythDeintType::DEINT_NONE }
 
std::array< QOpenGLShaderProgram *, ShaderCountm_shaders { nullptr }
 
std::array< int, ShaderCountm_shaderCost { 1 }
 
vector< MythVideoTextureOpenGL * > m_inputTextures
 
vector< MythVideoTextureOpenGL * > m_prevTextures
 
vector< MythVideoTextureOpenGL * > m_nextTextures
 
QOpenGLFramebufferObject * m_frameBuffer { nullptr }
 
MythVideoTextureOpenGLm_frameBufferTexture { nullptr }
 
QOpenGLFunctions::OpenGLFeatures m_features
 
int m_extraFeatures { 0 }
 
GLenum m_textureTarget { QOpenGLTexture::Target2D }
 
bool m_chromaUpsamplingFilter { false }
 
MythOpenGLTonemapm_toneMap { nullptr }
 

Additional Inherited Members

- Signals inherited from MythVideoGPU
void OutputChanged (QSize VideoDim, QSize VideoDispDim, float)
 
- Protected Attributes inherited from MythVideoGPU
MythRenderm_render { nullptr }
 
uint64_t m_discontinuityCounter { 0 }
 
QString m_profile
 
VideoFrameType m_inputType { FMT_NONE }
 
VideoFrameType m_outputType { FMT_NONE }
 
QSize m_videoDispDim
 
QSize m_videoDim
 
QSize m_masterViewportSize
 
QRect m_displayVideoRect
 
QRect m_videoRect
 
MythVideoColourSpacem_videoColourSpace { nullptr }
 
QSize m_inputTextureSize
 
VideoResizing m_resizing { None }
 
int m_lastRotation { 0 }
 
MythDeintType m_deinterlacer { MythDeintType::DEINT_NONE }
 
bool m_deinterlacer2x { false }
 
bool m_valid { false }
 
bool m_viewportControl { true }
 
uint m_lastStereo { 0 }
 
StereoscopicMode m_stereoMode { kStereoscopicModeSideBySideDiscard }
 
bool m_bicubicUpsize { false }
 

Detailed Description

MythOpenGLVideo is responsible for displaying video frames on screen using OpenGL. Frames may be sourced from main or graphics memory and MythOpenGLVideo must handle colourspace conversion, deinterlacing and scaling as required.

Note
MythOpenGLVideo has no knowledge of buffering, timing and other presentation state. Its role is to render video frames on screen.

Definition at line 24 of file mythopenglvideo.h.

Member Enumeration Documentation

◆ VideoShaderType

Enumerator
Default 
Progressive 
InterlacedTop 
InterlacedBot 
BicubicUpsize 
ShaderCount 

Definition at line 29 of file mythopenglvideo.h.

Constructor & Destructor Documentation

◆ MythOpenGLVideo()

MythOpenGLVideo::MythOpenGLVideo ( MythRenderOpenGL Render,
MythVideoColourSpace ColourSpace,
MythVideoBounds Bounds,
const MythVideoProfilePtr VideoProfile,
const QString &  Profile 
)

Definition at line 34 of file mythopenglvideo.cpp.

◆ ~MythOpenGLVideo()

MythOpenGLVideo::~MythOpenGLVideo ( )
override

Definition at line 59 of file mythopenglvideo.cpp.

Member Function Documentation

◆ TypeToProfile()

QString MythOpenGLVideo::TypeToProfile ( VideoFrameType  Type)
static

Definition at line 1047 of file mythopenglvideo.cpp.

Referenced by GetProfile().

◆ StartFrame()

void MythOpenGLVideo::StartFrame ( )
inlineoverridevirtual

Implements MythVideoGPU.

Definition at line 45 of file mythopenglvideo.h.

◆ PrepareFrame()

void MythOpenGLVideo::PrepareFrame ( MythVideoFrame Frame,
FrameScanType  Scan = kScan_Progressive 
)
overridevirtual

Update the current input texture using the data from the given video frame.

Implements MythVideoGPU.

Definition at line 548 of file mythopenglvideo.cpp.

◆ RenderFrame()

void MythOpenGLVideo::RenderFrame ( MythVideoFrame Frame,
bool  TopFieldFirst,
FrameScanType  Scan,
StereoscopicMode  StereoOverride,
bool  DrawBorder = false 
)
overridevirtual

Implements MythVideoGPU.

Definition at line 647 of file mythopenglvideo.cpp.

◆ EndFrame()

void MythOpenGLVideo::EndFrame ( )
inlineoverridevirtual

Implements MythVideoGPU.

Definition at line 49 of file mythopenglvideo.h.

◆ GetProfile()

QString MythOpenGLVideo::GetProfile ( ) const
overridevirtual

Reimplemented from MythVideoGPU.

Definition at line 128 of file mythopenglvideo.cpp.

Referenced by SetupFrameFormat().

◆ ResetFrameFormat()

void MythOpenGLVideo::ResetFrameFormat ( )
overridevirtual

Reimplemented from MythVideoGPU.

Definition at line 527 of file mythopenglvideo.cpp.

Referenced by PrepareFrame(), SetupFrameFormat(), and ~MythOpenGLVideo().

◆ ResetTextures()

void MythOpenGLVideo::ResetTextures ( )
overridevirtual

Clear reference frames after a seek as they will contain old images.

Implements MythVideoGPU.

Definition at line 1010 of file mythopenglvideo.cpp.

Referenced by PrepareFrame().

◆ UpdateShaderParameters

void MythOpenGLVideo::UpdateShaderParameters ( )
slot

Definition at line 96 of file mythopenglvideo.cpp.

Referenced by AddDeinterlacer(), SetupBicubic(), and SetupFrameFormat().

◆ ColourSpaceUpdate()

void MythOpenGLVideo::ColourSpaceUpdate ( bool  PrimariesChanged)
overrideprotectedvirtual

Implements MythVideoGPU.

Definition at line 70 of file mythopenglvideo.cpp.

◆ SetupFrameFormat()

bool MythOpenGLVideo::SetupFrameFormat ( VideoFrameType  InputType,
VideoFrameType  OutputType,
QSize  Size,
GLenum  TextureTarget 
)
private

◆ CreateVideoShader()

bool MythOpenGLVideo::CreateVideoShader ( VideoShaderType  Type,
MythDeintType  Deint = DEINT_NONE 
)
private

Create the appropriate shader for the operation Type.

Note
Shader cost is calculated as 1 per texture read and 2 per dependent read. If there are alternative shader conditions, the worst case is used. (A dependent read is defined as any texture read that does not use the exact texture coordinates passed into the fragment shader)

Definition at line 298 of file mythopenglvideo.cpp.

Referenced by AddDeinterlacer(), SetupBicubic(), and SetupFrameFormat().

◆ BindTextures()

void MythOpenGLVideo::BindTextures ( bool  Deinterlacing,
vector< MythVideoTextureOpenGL * > &  Current,
vector< MythGLTexture * > &  Textures 
)
private

Definition at line 1020 of file mythopenglvideo.cpp.

Referenced by RenderFrame().

◆ AddDeinterlacer()

bool MythOpenGLVideo::AddDeinterlacer ( const MythVideoFrame Frame,
FrameScanType  Scan,
MythDeintType  Filter = DEINT_SHADER,
bool  CreateReferences = true 
)
private

Definition at line 157 of file mythopenglvideo.cpp.

Referenced by PrepareFrame(), and RenderFrame().

◆ CleanupDeinterlacers()

void MythOpenGLVideo::CleanupDeinterlacers ( )
private

Definition at line 135 of file mythopenglvideo.cpp.

Referenced by AddDeinterlacer().

◆ SetupBicubic()

void MythOpenGLVideo::SetupBicubic ( VideoResizing &  Resize)
private

Definition at line 1062 of file mythopenglvideo.cpp.

Referenced by RenderFrame().

Member Data Documentation

◆ m_openglRender

MythRenderOpenGL* MythOpenGLVideo::m_openglRender { nullptr }
private

◆ m_gles

int MythOpenGLVideo::m_gles { 0 }
private

Definition at line 72 of file mythopenglvideo.h.

Referenced by CreateVideoShader(), MythOpenGLVideo(), and RenderFrame().

◆ m_fallbackDeinterlacer

MythDeintType MythOpenGLVideo::m_fallbackDeinterlacer { MythDeintType::DEINT_NONE }
private

Definition at line 73 of file mythopenglvideo.h.

Referenced by AddDeinterlacer(), CleanupDeinterlacers(), and ResetFrameFormat().

◆ m_shaders

std::array<QOpenGLShaderProgram*,ShaderCount> MythOpenGLVideo::m_shaders { nullptr }
private

◆ m_shaderCost

std::array<int,ShaderCount> MythOpenGLVideo::m_shaderCost { 1 }
private

Definition at line 75 of file mythopenglvideo.h.

Referenced by CreateVideoShader(), RenderFrame(), and ResetFrameFormat().

◆ m_inputTextures

vector<MythVideoTextureOpenGL*> MythOpenGLVideo::m_inputTextures
private

◆ m_prevTextures

vector<MythVideoTextureOpenGL*> MythOpenGLVideo::m_prevTextures
private

◆ m_nextTextures

vector<MythVideoTextureOpenGL*> MythOpenGLVideo::m_nextTextures
private

◆ m_frameBuffer

QOpenGLFramebufferObject* MythOpenGLVideo::m_frameBuffer { nullptr }
private

Definition at line 79 of file mythopenglvideo.h.

Referenced by RenderFrame(), and ResetFrameFormat().

◆ m_frameBufferTexture

MythVideoTextureOpenGL* MythOpenGLVideo::m_frameBufferTexture { nullptr }
private

Definition at line 80 of file mythopenglvideo.h.

Referenced by RenderFrame(), and ResetFrameFormat().

◆ m_features

QOpenGLFunctions::OpenGLFeatures MythOpenGLVideo::m_features
private

Definition at line 81 of file mythopenglvideo.h.

Referenced by CreateVideoShader(), and MythOpenGLVideo().

◆ m_extraFeatures

int MythOpenGLVideo::m_extraFeatures { 0 }
private

Definition at line 82 of file mythopenglvideo.h.

Referenced by MythOpenGLVideo(), and RenderFrame().

◆ m_textureTarget

GLenum MythOpenGLVideo::m_textureTarget { QOpenGLTexture::Target2D }
private

◆ m_chromaUpsamplingFilter

bool MythOpenGLVideo::m_chromaUpsamplingFilter { false }
private

Definition at line 84 of file mythopenglvideo.h.

Referenced by CreateVideoShader(), and MythOpenGLVideo().

◆ m_toneMap

MythOpenGLTonemap* MythOpenGLVideo::m_toneMap { nullptr }
private

Definition at line 85 of file mythopenglvideo.h.

Referenced by RenderFrame(), and ~MythOpenGLVideo().


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