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

#include <mythvideooutopengl.h>

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

Public Types

enum  TextureFormats { AllFormats = 0, LegacyFormats = 1 }
 

Public Member Functions

 MythVideoOutputOpenGL (QString Profile=QString())
 
 ~MythVideoOutputOpenGL () override
 
bool Init (const QSize &VideoDim, const QSize &VideoDispDim, float Aspect, MythDisplay *Display, const QRect &DisplayVisibleRect, MythCodecID CodecId) override
 
void PrepareFrame (VideoFrame *Frame, FrameScanType Scan, OSD *Osd) override
 
void ProcessFrame (VideoFrame *Frame, OSD *Osd, const PIPMap &PiPPlayers, FrameScanType Scan) override
 
void Show (FrameScanType Scan) override
 
void ClearAfterSeek (void) override
 Tells video output to toss decoded buffers due to a seek. More...
 
bool InputChanged (const QSize &VideoDim, const QSize &VideoDispDim, float Aspect, MythCodecID CodecId, bool &AspectOnly, MythMultiLocker *Locks, int ReferenceFrames, bool ForceChange) override
 Tells video output to discard decoded frames and wait for new ones. More...
 
void UpdatePauseFrame (int64_t &DisplayTimecode, FrameScanType Scan=kScan_Progressive) override
 
void InitPictureAttributes (void) override
 
void ShowPIP (VideoFrame *Frame, MythPlayer *PiPPlayer, PIPLocation Location) override
 
void RemovePIP (MythPlayer *PiPPlayer) override
 
bool IsPIPSupported (void) const override
 
MythPainterGetOSDPainter (void) override
 
bool CanVisualise (AudioPlayer *Audio, MythRender *Render) override
 
bool SetupVisualisation (AudioPlayer *Audio, MythRender *Render, const QString &Name) override
 
QStringList GetVisualiserList (void) override
 
bool StereoscopicModesAllowed (void) const override
 
void DoneDisplayingFrame (VideoFrame *Frame) override
 Release a video frame back into the decoder pool. More...
 
void DiscardFrames (bool KeyFrame, bool Flushed) override
 Discard video frames. More...
 
VideoFrameTypeDirectRenderFormats (void) override
 
void WindowResized (const QSize &Size) override
 
void SetVideoFrameRate (float NewRate) override
 
- Public Member Functions inherited from MythVideoOutput
 MythVideoOutput ()
 
virtual ~MythVideoOutput ()
 
virtual void SetDeinterlacing (bool Enable, bool DoubleRate, MythDeintType Force=DEINT_NONE)
 
void SetReferenceFrames (int ReferenceFrames)
 
VideoDisplayProfileGetProfile ()
 
virtual void VideoAspectRatioChanged (float VideoAspect)
 
virtual void ResizeDisplayWindow (const QRect &Rect, bool SaveVisible)
 Resize Display Window. More...
 
virtual void EmbedInWidget (const QRect &EmbedRect)
 Tells video output to embed video in an existing window. More...
 
bool IsEmbedding (void)
 Returns if videooutput is embedding. More...
 
virtual void StopEmbedding (void)
 
virtual void ResizeForVideo (QSize Size=QSize())
 
virtual void Zoom (ZoomDirection Direction)
 
virtual void ToggleMoveBottomLine (void)
 
virtual void SaveBottomLine (void)
 
virtual void GetOSDBounds (QRect &Total, QRect &Visible, float &VisibleAspect, float &FontScaling, float ThemeAspect) const
 
QRect GetMHEGBounds (void)
 
AspectOverrideMode GetAspectOverride (void) const
 
virtual void ToggleAspectOverride (AspectOverrideMode AspectMode=kAspect_Toggle)
 
AdjustFillMode GetAdjustFill (void) const
 
virtual void ToggleAdjustFill (AdjustFillMode FillMode=kAdjustFill_Toggle)
 
QString GetZoomString (void) const
 
PictureAttributeSupported GetSupportedPictureAttributes (void)
 
int ChangePictureAttribute (PictureAttribute AttributeType, bool Direction)
 
virtual int SetPictureAttribute (PictureAttribute Attribute, int NewValue)
 
int GetPictureAttribute (PictureAttribute AttributeType)
 
virtual bool IsPBPSupported (void) const
 
bool HasSoftwareFrames (void) const
 
virtual void SetFramesPlayed (long long FramesPlayed)
 
virtual long long GetFramesPlayed (void)
 
bool IsErrored () const
 
VideoErrorState GetError (void) const
 
void SetPrebuffering (bool Normal)
 Sets whether to use a normal number of buffers or fewer buffers. More...
 
virtual int ValidVideoFrames (void) const
 Returns number of frames that are fully decoded. More...
 
int FreeVideoFrames (void)
 Returns number of frames available for decoding onto. More...
 
bool EnoughFreeFrames (void)
 Returns true iff enough frames are available to decode onto. More...
 
bool EnoughDecodedFrames (void)
 Returns true iff there are plenty of decoded frames ready for display. More...
 
virtual VideoFrameGetNextFreeFrame (void)
 Blocks until it is possible to return a frame for decoding onto. More...
 
virtual void ReleaseFrame (VideoFrame *Frame)
 Releases a frame from the ready for decoding queue onto the queue of frames ready for display. More...
 
virtual void DeLimboFrame (VideoFrame *Frame)
 Releases a frame for reuse if it is in limbo. More...
 
virtual void StartDisplayingFrame (void)
 Tell GetLastShownFrame() to return the next frame from the head of the queue of frames to display. More...
 
virtual void DiscardFrame (VideoFrame *frame)
 Releases frame from any queue onto the queue of frames ready for decoding onto. More...
 
virtual void CheckFrameStates (void)
 
virtual VideoFrameGetLastDecodedFrame (void)
 
virtual VideoFrameGetLastShownFrame (void)
 Returns frame from the head of the ready to be displayed queue, if StartDisplayingFrame has been called. More...
 
QString GetFrameStatus (void) const
 Returns string with status of each frame for debugging. More...
 
void SetVideoResize (const QRect &VideoRect)
 Tells the player to resize the video frame (used for ITV) More...
 
void SetVideoScalingAllowed (bool Allow)
 Disable or enable underscan/overscan. More...
 
virtual QRect GetPIPRect (PIPLocation Location, MythPlayer *PiPPlayer=nullptr, bool DoPixelAdj=true) const
 returns QRect of PIP based on PIPLocation More...
 
virtual void SetPIPState (PIPState Setting)
 
QRect GetImageRect (const QRect &Rect, QRect *DisplayRect=nullptr)
 translates caption/dvd button rectangle into 'screen' space More...
 
QRect GetSafeRect (void)
 Returns a QRect describing an area of the screen on which it is 'safe' to render the On Screen Display. More...
 
bool EnableVisualisation (AudioPlayer *Audio, bool Enable, const QString &Name=QString(""))
 
VideoVisualGetVisualisation (void)
 
QString GetVisualiserName (void)
 
void DestroyVisualisation (void)
 
void SetStereoscopicMode (StereoscopicMode mode)
 
StereoscopicMode GetStereoscopicMode (void) const
 

Static Public Member Functions

static void GetRenderOptions (RenderOptions &Options)
 Generate the list of available OpenGL profiles. More...
 
static QStringList GetAllowedRenderers (MythCodecID CodecId, const QSize &VideoDim)
 Generate a list of supported OpenGL profiles. More...
 
- Static Public Member Functions inherited from MythVideoOutput
static void GetRenderOptions (RenderOptions &Options)
 
static MythVideoOutputCreate (const QString &Decoder, MythCodecID CodecID, PIPState PiPState, const QSize &VideoDim, const QSize &VideoDispDim, float VideoAspect, QWidget *ParentWidget, const QRect &EmbedRect, float FrameRate, uint PlayerFlags, QString &Codec, int ReferenceFrames)
 Depending on compile-time configure settings and run-time renderer settings, create a relevant VideoOutput subclass. More...
 
static int CalcHueBase (const QString &AdaptorName)
 
static MythDeintType ParseDeinterlacer (const QString &Deinterlacer)
 

Protected Member Functions

void DestroyBuffers (void)
 
bool CreateBuffers (MythCodecID CodecID, QSize Size)
 
QRect GetDisplayVisibleRect (void)
 
- Protected Member Functions inherited from MythVideoOutput
virtual void MoveResize (void)
 
void InitDisplayMeasurements (void)
 Initialise display measurement. More...
 
virtual void ShowPIPs (VideoFrame *Frame, const PIPMap &PiPPlayers)
 
QRect GetVisibleOSDBounds (float &VisibleAspect, float &FontScaling, float ThemeAspect) const
 Returns visible portions of total OSD bounds. More...
 
QRect GetTotalOSDBounds (void) const
 

Protected Attributes

MythRenderOpenGLm_render { nullptr }
 
TextureFormats m_textureFormats { AllFormats }
 
MythOpenGLVideom_openGLVideo { nullptr }
 
QMap< MythPlayer *, MythOpenGLVideo * > m_openGLVideoPiPs
 
QMap< MythPlayer *, boolm_openGLVideoPiPsReady
 
MythOpenGLVideom_openGLVideoPiPActive { nullptr }
 
MythOpenGLPainterm_openGLPainter { nullptr }
 
QString m_videoProfile
 
MythCodecID m_newCodecId { kCodec_NONE }
 
QSize m_newVideoDim
 
QSize m_newVideoDispDim
 
float m_newAspect { 0.0F }
 
bool m_newFrameRate { false }
 
bool m_buffersCreated { false }
 
MythOpenGLPerfm_openGLPerf { nullptr }
 
- Protected Attributes inherited from MythVideoOutput
MythDisplaym_display {nullptr}
 
VideoOutWindow m_window
 
VideoColourSpace m_videoColourSpace
 
AspectOverrideMode m_dbAspectOverride {kAspect_Off}
 
AdjustFillMode m_dbAdjustFill {kAdjustFill_Off}
 
LetterBoxColour m_dbLetterboxColour {kLetterBoxColour_Black}
 
MythCodecID m_videoCodecID {kCodec_NONE}
 
int m_maxReferenceFrames {16}
 
VideoDisplayProfilem_dbDisplayProfile {nullptr}
 
VideoBuffers m_videoBuffers
 
VideoErrorState m_errorState {kError_None}
 
long long m_framesPlayed {0}
 
VideoVisualm_visual {nullptr}
 
StereoscopicMode m_stereo {kStereoscopicModeNone}
 
MythAVCopy m_copyFrame
 
MythDeinterlacer m_deinterlacer
 

Additional Inherited Members

- Static Protected Member Functions inherited from MythVideoOutput
static void CopyFrame (VideoFrame *To, const VideoFrame *From)
 

Detailed Description

Definition at line 12 of file mythvideooutopengl.h.

Member Enumeration Documentation

◆ TextureFormats

Enumerator
AllFormats 
LegacyFormats 

Definition at line 15 of file mythvideooutopengl.h.

Constructor & Destructor Documentation

◆ MythVideoOutputOpenGL()

MythVideoOutputOpenGL::MythVideoOutputOpenGL ( QString  Profile = QString())
explicit

Definition at line 99 of file mythvideooutopengl.cpp.

◆ ~MythVideoOutputOpenGL()

MythVideoOutputOpenGL::~MythVideoOutputOpenGL ( )
override

Definition at line 157 of file mythvideooutopengl.cpp.

Member Function Documentation

◆ GetRenderOptions()

void MythVideoOutputOpenGL::GetRenderOptions ( RenderOptions Options)
static

Generate the list of available OpenGL profiles.

Note
This could be improved by eliminating unsupported profiles at run time - but it is currently called statically and hence options would be fixed and unable to reflect changes in UI render device.

Definition at line 26 of file mythvideooutopengl.cpp.

Referenced by MythVideoOutput::GetRenderOptions().

◆ GetAllowedRenderers()

QStringList MythVideoOutputOpenGL::GetAllowedRenderers ( MythCodecID  CodecId,
const QSize &  VideoDim 
)
static

Generate a list of supported OpenGL profiles.

Note
This list could be filtered based upon current feature support. This would however assume an OpenGL render device (not currently a given) but more importantly, filtering out a selected profile encourages the display profile code to use a higher priority, non-OpenGL renderer (such as VDPAU). By not filtering, we allow the OpenGL video code to fallback to a supported, reasonable alternative.

Definition at line 789 of file mythvideooutopengl.cpp.

Referenced by MythVideoOutput::Create().

◆ Init()

bool MythVideoOutputOpenGL::Init ( const QSize &  VideoDim,
const QSize &  VideoDispDim,
float  Aspect,
MythDisplay Display,
const QRect &  DisplayVisibleRect,
MythCodecID  CodecId 
)
overridevirtual

Reimplemented from MythVideoOutput.

Definition at line 187 of file mythvideooutopengl.cpp.

Referenced by ProcessFrame().

◆ PrepareFrame()

void MythVideoOutputOpenGL::PrepareFrame ( VideoFrame Frame,
FrameScanType  Scan,
OSD Osd 
)
overridevirtual

Implements MythVideoOutput.

Definition at line 478 of file mythvideooutopengl.cpp.

◆ ProcessFrame()

void MythVideoOutputOpenGL::ProcessFrame ( VideoFrame Frame,
OSD Osd,
const PIPMap PiPPlayers,
FrameScanType  Scan 
)
overridevirtual

Implements MythVideoOutput.

Definition at line 385 of file mythvideooutopengl.cpp.

◆ Show()

void MythVideoOutputOpenGL::Show ( FrameScanType  Scan)
overridevirtual

Implements MythVideoOutput.

Definition at line 751 of file mythvideooutopengl.cpp.

◆ ClearAfterSeek()

void MythVideoOutputOpenGL::ClearAfterSeek ( void  )
overridevirtual

Tells video output to toss decoded buffers due to a seek.

Reimplemented from MythVideoOutput.

Definition at line 773 of file mythvideooutopengl.cpp.

◆ InputChanged()

bool MythVideoOutputOpenGL::InputChanged ( const QSize &  VideoDim,
const QSize &  VideoDispDim,
float  VideoAspect,
MythCodecID  CodecID,
bool AspectChanged,
MythMultiLocker Locks,
int  ReferenceFrames,
bool  ForceChange 
)
overridevirtual

Tells video output to discard decoded frames and wait for new ones.

Bug:
We set the new width height and aspect ratio here, but we should do this based on the new video frames in Show().

Reimplemented from MythVideoOutput.

Definition at line 268 of file mythvideooutopengl.cpp.

◆ UpdatePauseFrame()

void MythVideoOutputOpenGL::UpdatePauseFrame ( int64_t &  DisplayTimecode,
FrameScanType  Scan = kScan_Progressive 
)
overridevirtual

Implements MythVideoOutput.

Definition at line 824 of file mythvideooutopengl.cpp.

◆ InitPictureAttributes()

void MythVideoOutputOpenGL::InitPictureAttributes ( void  )
overridevirtual

Reimplemented from MythVideoOutput.

Definition at line 853 of file mythvideooutopengl.cpp.

Referenced by Init().

◆ ShowPIP()

void MythVideoOutputOpenGL::ShowPIP ( VideoFrame Frame,
MythPlayer PiPPlayer,
PIPLocation  Location 
)
overridevirtual

Reimplemented from MythVideoOutput.

Definition at line 858 of file mythvideooutopengl.cpp.

◆ RemovePIP()

void MythVideoOutputOpenGL::RemovePIP ( MythPlayer PiPPlayer)
overridevirtual

Reimplemented from MythVideoOutput.

Definition at line 929 of file mythvideooutopengl.cpp.

◆ IsPIPSupported()

bool MythVideoOutputOpenGL::IsPIPSupported ( void  ) const
inlineoverridevirtual

Reimplemented from MythVideoOutput.

Definition at line 44 of file mythvideooutopengl.h.

◆ GetOSDPainter()

MythPainter * MythVideoOutputOpenGL::GetOSDPainter ( void  )
overridevirtual

Reimplemented from MythVideoOutput.

Definition at line 948 of file mythvideooutopengl.cpp.

◆ CanVisualise()

bool MythVideoOutputOpenGL::CanVisualise ( AudioPlayer Audio,
MythRender Render 
)
overridevirtual

Reimplemented from MythVideoOutput.

Definition at line 953 of file mythvideooutopengl.cpp.

◆ SetupVisualisation()

bool MythVideoOutputOpenGL::SetupVisualisation ( AudioPlayer Audio,
MythRender Render,
const QString &  Name 
)
overridevirtual

Reimplemented from MythVideoOutput.

Definition at line 958 of file mythvideooutopengl.cpp.

◆ GetVisualiserList()

QStringList MythVideoOutputOpenGL::GetVisualiserList ( void  )
overridevirtual

Reimplemented from MythVideoOutput.

Definition at line 941 of file mythvideooutopengl.cpp.

◆ StereoscopicModesAllowed()

bool MythVideoOutputOpenGL::StereoscopicModesAllowed ( void  ) const
inlineoverridevirtual

Reimplemented from MythVideoOutput.

Definition at line 49 of file mythvideooutopengl.h.

◆ DoneDisplayingFrame()

void MythVideoOutputOpenGL::DoneDisplayingFrame ( VideoFrame Frame)
overridevirtual

Release a video frame back into the decoder pool.

Software frames do not need a pause frame as OpenGLVideo holds a copy of the last frame in its input textures. So just release the frame.

Hardware frames hold the underlying interop class and hence access to the video texture. We cannot access them without a frame so retain the most recent frame by removing it from the 'used' queue and adding it to the 'pause' queue.

Reimplemented from MythVideoOutput.

Definition at line 678 of file mythvideooutopengl.cpp.

Referenced by UpdatePauseFrame().

◆ DiscardFrames()

void MythVideoOutputOpenGL::DiscardFrames ( bool  KeyFrame,
bool  Flushed 
)
overridevirtual

Discard video frames.

If Flushed is true, the decoder will probably reset the hardware decoder in use and we need to release any hardware pause frames so the decoder is released before a new one is created.

Reimplemented from MythVideoOutput.

Definition at line 716 of file mythvideooutopengl.cpp.

Referenced by DestroyBuffers().

◆ DirectRenderFormats()

VideoFrameType * MythVideoOutputOpenGL::DirectRenderFormats ( void  )
overridevirtual

Reimplemented from MythVideoOutput.

Definition at line 726 of file mythvideooutopengl.cpp.

◆ WindowResized()

void MythVideoOutputOpenGL::WindowResized ( const QSize &  Size)
overridevirtual

Reimplemented from MythVideoOutput.

Definition at line 745 of file mythvideooutopengl.cpp.

◆ SetVideoFrameRate()

void MythVideoOutputOpenGL::SetVideoFrameRate ( float  NewRate)
overridevirtual

Reimplemented from MythVideoOutput.

Definition at line 254 of file mythvideooutopengl.cpp.

◆ DestroyBuffers()

void MythVideoOutputOpenGL::DestroyBuffers ( void  )
protected

Definition at line 179 of file mythvideooutopengl.cpp.

Referenced by ~MythVideoOutputOpenGL().

◆ CreateBuffers()

bool MythVideoOutputOpenGL::CreateBuffers ( MythCodecID  CodecID,
QSize  Size 
)
protected

Definition at line 356 of file mythvideooutopengl.cpp.

Referenced by Init().

◆ GetDisplayVisibleRect()

QRect MythVideoOutputOpenGL::GetDisplayVisibleRect ( void  )
protected

Definition at line 326 of file mythvideooutopengl.cpp.

Referenced by Init(), and MythVideoOutputOpenGL().

Member Data Documentation

◆ m_render

MythRenderOpenGL* MythVideoOutputOpenGL::m_render { nullptr }
protected

◆ m_textureFormats

TextureFormats MythVideoOutputOpenGL::m_textureFormats { AllFormats }
protected

Definition at line 62 of file mythvideooutopengl.h.

Referenced by DirectRenderFormats(), and MythVideoOutputOpenGL().

◆ m_openGLVideo

MythOpenGLVideo* MythVideoOutputOpenGL::m_openGLVideo { nullptr }
protected

◆ m_openGLVideoPiPs

QMap<MythPlayer*,MythOpenGLVideo*> MythVideoOutputOpenGL::m_openGLVideoPiPs
protected

Definition at line 64 of file mythvideooutopengl.h.

Referenced by PrepareFrame(), RemovePIP(), ShowPIP(), and ~MythVideoOutputOpenGL().

◆ m_openGLVideoPiPsReady

QMap<MythPlayer*,bool> MythVideoOutputOpenGL::m_openGLVideoPiPsReady
protected

Definition at line 65 of file mythvideooutopengl.h.

Referenced by PrepareFrame(), RemovePIP(), ShowPIP(), and ~MythVideoOutputOpenGL().

◆ m_openGLVideoPiPActive

MythOpenGLVideo* MythVideoOutputOpenGL::m_openGLVideoPiPActive { nullptr }
protected

Definition at line 66 of file mythvideooutopengl.h.

Referenced by PrepareFrame(), ProcessFrame(), and ShowPIP().

◆ m_openGLPainter

MythOpenGLPainter* MythVideoOutputOpenGL::m_openGLPainter { nullptr }
protected

◆ m_videoProfile

QString MythVideoOutputOpenGL::m_videoProfile
protected

Definition at line 68 of file mythvideooutopengl.h.

Referenced by MythVideoOutputOpenGL(), and ShowPIP().

◆ m_newCodecId

MythCodecID MythVideoOutputOpenGL::m_newCodecId { kCodec_NONE }
protected

Definition at line 69 of file mythvideooutopengl.h.

Referenced by Init(), InputChanged(), PrepareFrame(), and ProcessFrame().

◆ m_newVideoDim

QSize MythVideoOutputOpenGL::m_newVideoDim
protected

Definition at line 70 of file mythvideooutopengl.h.

Referenced by InputChanged(), and ProcessFrame().

◆ m_newVideoDispDim

QSize MythVideoOutputOpenGL::m_newVideoDispDim
protected

Definition at line 71 of file mythvideooutopengl.h.

Referenced by InputChanged(), and ProcessFrame().

◆ m_newAspect

float MythVideoOutputOpenGL::m_newAspect { 0.0F }
protected

Definition at line 72 of file mythvideooutopengl.h.

Referenced by InputChanged(), and ProcessFrame().

◆ m_newFrameRate

bool MythVideoOutputOpenGL::m_newFrameRate { false }
protected

Definition at line 73 of file mythvideooutopengl.h.

Referenced by ProcessFrame(), and SetVideoFrameRate().

◆ m_buffersCreated

bool MythVideoOutputOpenGL::m_buffersCreated { false }
protected

Definition at line 74 of file mythvideooutopengl.h.

Referenced by CreateBuffers(), DestroyBuffers(), and InputChanged().

◆ m_openGLPerf

MythOpenGLPerf* MythVideoOutputOpenGL::m_openGLPerf { nullptr }
protected

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