MythTV  master
Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MythVideoOutputGPU Class Reference

Common code shared between GPU accelerated sub-classes (e.g. OpenGL) More...

#include <mythvideooutgpu.h>

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

Public Slots

void WindowResized (QSize Size)
 
void ResizeForVideo (QSize Size=QSize())
 
- Public Slots inherited from MythVideoBounds
void RefreshVideoBoundsState ()
 Send out latest state to listeners. More...
 
void ScreenChanged (QScreen *screen)
 
void PhysicalDPIChanged (qreal)
 
void SourceChanged (QSize VideoDim, QSize VideoDispDim, float Aspect)
 Update for new source video dimensions and aspect ratio. More...
 
void VideoAspectRatioChanged (float Aspect)
 Calls SetVideoAspectRatio(float aspect), then calls MoveResize() to apply changes. More...
 
virtual void EmbedPlayback (bool Embed, QRect Rect)
 
void ToggleAdjustFill (AdjustFillMode AdjustFillMode=kAdjustFill_Toggle)
 Sets up letterboxing for various standard video frame and monitor dimensions, then calls MoveResize() to apply them. More...
 
void ToggleAspectOverride (AspectOverrideMode AspectMode=kAspect_Toggle)
 Enforce different aspect ratio than detected, then calls VideoAspectRatioChanged(float) to apply them. More...
 
void ResizeDisplayWindow (QRect Rect, bool SaveVisibleRect)
 Resize Display Window. More...
 
void MoveResize (void)
 performs all the calculations for video framing and any resizing. More...
 
void Zoom (ZoomDirection Direction)
 Sets up zooming into to different parts of the video. More...
 
void ToggleMoveBottomLine (void)
 
void SaveBottomLine (void)
 
void SetVideoScalingAllowed (bool Change)
 Disable or enable underscan/overscan. More...
 
void SetDisplayAspect (float DisplayAspect)
 
void SetWindowSize (QSize Size)
 
void SetITVResize (QRect Rect)
 
void SetRotation (int Rotation)
 Set the rotation in degrees. More...
 
void SetStereoOverride (StereoscopicMode Mode)
 

Signals

void ChangePictureAttribute (PictureAttribute Attribute, bool Direction, int Value)
 
void PictureAttributeChanged (PictureAttribute Attribute, int Value)
 
void SupportedAttributesChanged (PictureAttributeSupported Supported)
 
void PictureAttributesUpdated (const std::map< PictureAttribute, int > &Values)
 
void RefreshState ()
 
void DoRefreshState ()
 
- Signals inherited from MythVideoBounds
void UpdateOSDMessage (const QString &Message)
 
void VideoSizeChanged (const QSize &VideoDim, const QSize &VideoDispDim)
 
void VideoRectsChanged (const QRect &DisplayVideoRect, const QRect &VideoRect)
 
void VisibleRectChanged (const QRect &DisplayVisibleRect)
 
void WindowRectChanged (const QRect &WindowRect)
 
void VideoBoundsStateChanged (MythVideoBoundsState VideoState)
 

Public Member Functions

 ~MythVideoOutputGPU () override
 
void InitPictureAttributes () override
 
void SetVideoFrameRate (float NewRate) override
 
void DiscardFrames (bool KeyFrame, bool Flushed) override
 Discard video frames. More...
 
void DoneDisplayingFrame (MythVideoFrame *Frame) override
 Release a video frame back into the decoder pool. More...
 
void UpdatePauseFrame (int64_t &DisplayTimecode, FrameScanType Scan=kScan_Progressive) override
 
bool InputChanged (QSize VideoDim, QSize VideoDispDim, float Aspect, MythCodecID CodecId, bool &AspectOnly, int ReferenceFrames, bool ForceChange) override
 Tells video output to discard decoded frames and wait for new ones. More...
 
void EndFrame () override
 
void ClearAfterSeek () override
 Tells video output to toss decoded buffers due to a seek. More...
 
- Public Member Functions inherited from MythVideoOutput
 ~MythVideoOutput () override=default
 
virtual void SetDeinterlacing (bool Enable, bool DoubleRate, MythDeintType Force=DEINT_NONE)
 
virtual void RenderEnd ()=0
 
virtual void GetOSDBounds (QRect &Total, QRect &Visible, float &VisibleAspect, float &FontScaling, float ThemeAspect) const
 
virtual void SetFramesPlayed (long long FramesPlayed)
 
virtual long long GetFramesPlayed ()
 
bool IsErrored () const
 
VideoErrorState GetError () const
 
void SetPrebuffering (bool Normal)
 Sets whether to use a normal number of buffers or fewer buffers. More...
 
virtual int ValidVideoFrames () const
 Returns number of frames that are fully decoded. More...
 
int FreeVideoFrames ()
 Returns number of frames available for decoding onto. More...
 
bool EnoughFreeFrames ()
 Returns true iff enough frames are available to decode onto. More...
 
bool EnoughDecodedFrames ()
 Returns true iff there are plenty of decoded frames ready for display. More...
 
virtual MythVideoFrameGetNextFreeFrame ()
 Blocks until it is possible to return a frame for decoding onto. More...
 
virtual void ReleaseFrame (MythVideoFrame *Frame)
 Releases a frame from the ready for decoding queue onto the queue of frames ready for display. More...
 
virtual void DeLimboFrame (MythVideoFrame *Frame)
 Releases a frame for reuse if it is in limbo. More...
 
virtual void StartDisplayingFrame ()
 Tell GetLastShownFrame() to return the next frame from the head of the queue of frames to display. More...
 
virtual void DiscardFrame (MythVideoFrame *frame)
 Releases frame from any queue onto the queue of frames ready for decoding onto. More...
 
virtual void CheckFrameStates ()
 
virtual MythVideoFrameGetLastDecodedFrame ()
 
virtual MythVideoFrameGetLastShownFrame ()
 Returns frame from the head of the ready to be displayed queue, if StartDisplayingFrame has been called. More...
 
QString GetFrameStatus () const
 Returns string with status of each frame for debugging. More...
 
QRect GetImageRect (QRect Rect, QRect *DisplayRect=nullptr)
 translates caption/dvd button rectangle into 'screen' space More...
 
QRect GetSafeRect ()
 Returns a QRect describing an area of the screen on which it is 'safe' to render the On Screen Display. More...
 
PictureAttributeSupported GetSupportedPictureAttributes ()
 
bool HasSoftwareFrames () const
 
- Public Member Functions inherited from MythVideoBounds
 MythVideoBounds ()
 
 ~MythVideoBounds () override=default
 
bool InitBounds (QSize VideoDim, QSize VideoDispDim, float Aspect, QRect WindowRect)
 
void SetDisplay (MythDisplay *mDisplay)
 
bool IsEmbedding (void) const
 
bool IsEmbeddingAndHidden () const
 
QSize GetVideoDim (void) const
 
QSize GetVideoDispDim (void) const
 
float GetOverridenVideoAspect (void) const
 
QRect GetDisplayVisibleRect (void) const
 
QRect GetWindowRect (void) const
 
QRect GetRawWindowRect (void) const
 
QRect GetVideoRect (void) const
 
QRect GetDisplayVideoRect (void) const
 
QRect GetEmbeddingRect (void) const
 
bool UsingGuiSize (void) const
 
AdjustFillMode GetAdjustFill (void) const
 
float GetVideoAspect (void) const
 
float GetDisplayAspect (void) const
 
StereoscopicMode GetStereoOverride () const
 
bool VideoIsFullScreen (void) const
 Check whether the video display rect covers the entire window/framebuffer. More...
 
QRegion GetBoundingRegion (void) const
 Return the region of DisplayVisibleRect that lies outside of DisplayVideoRect. More...
 

Static Public Member Functions

static void GetRenderOptions (RenderOptions &Options, MythRender *Render)
 
static MythVideoOutputGPUCreate (MythMainWindow *MainWindow, MythRender *Render, MythPainter *Painter, MythDisplay *Display, const QString &Decoder, MythCodecID CodecID, QSize VideoDim, QSize VideoDispDim, float VideoAspect, float FrameRate, uint PlayerFlags, const QString &Codec, int ReferenceFrames, const VideoFrameTypes *&RenderFormats)
 
static VideoFrameType FrameTypeForCodec (MythCodecID CodecId)
 
- Static Public Member Functions inherited from MythVideoOutput
static void GetRenderOptions (RenderOptions &Options, MythRender *Render)
 

Protected Member Functions

 MythVideoOutputGPU (MythMainWindow *MainWindow, MythRender *Render, MythPainterGPU *Painter, MythDisplay *Display, MythVideoProfilePtr VideoProfile, QString &Profile)
 
virtual QRect GetDisplayVisibleRectAdj ()
 
bool Init (QSize VideoDim, QSize VideoDispDim, float Aspect, QRect DisplayVisibleRect, MythCodecID CodecId) override
 
void PrepareFrame (MythVideoFrame *Frame, FrameScanType Scan) override
 
void RenderFrame (MythVideoFrame *Frame, FrameScanType Scan) override
 
void RenderOverlays (OSD &Osd) override
 
bool CreateBuffers (MythCodecID CodecID, QSize Size)
 
void DestroyBuffers ()
 
bool ProcessInputChange ()
 
void InitDisplayMeasurements ()
 Initialise display measurement. More...
 
void SetReferenceFrames (int ReferenceFrames)
 
- Protected Member Functions inherited from MythVideoOutput
 MythVideoOutput ()
 
QRect GetVisibleOSDBounds (float &VisibleAspect, float &FontScaling, float ThemeAspect) const
 Returns visible portions of total OSD bounds. More...
 

Protected Attributes

MythMainWindowm_mainWindow { nullptr }
 
MythRenderm_render { nullptr }
 
MythVideoGPUm_video { nullptr }
 
MythPainterGPUm_painter { nullptr }
 
MythCodecID m_newCodecId { kCodec_NONE }
 
QSize m_newVideoDim { 0, 0 }
 
QSize m_newVideoDispDim { 0, 0 }
 
float m_newAspect { 0.0F }
 
bool m_newFrameRate { false }
 
bool m_buffersCreated { false }
 
QString m_profile
 
bool m_needFullClear { false }
 
- Protected Attributes inherited from MythVideoOutput
MythVideoColourSpace m_videoColourSpace
 
LetterBoxColour m_dbLetterboxColour { kLetterBoxColour_Black }
 
uint8_t m_clearColor { 0 }
 
uint8_t m_clearAlpha { 255 }
 
MythCodecID m_videoCodecID { kCodec_NONE }
 
int m_maxReferenceFrames { 16 }
 
MythVideoProfilePtr m_videoProfile { nullptr }
 
VideoBuffers m_videoBuffers
 
VideoErrorState m_errorState { kError_None }
 
long long m_framesPlayed { 0 }
 
MythAVCopy m_copyFrame
 
MythDeinterlacer m_deinterlacer
 
const VideoFrameTypesm_renderFormats { &MythVideoFrame::kDefaultRenderFormats }
 
bool m_deinterlacing { false }
 
bool m_deinterlacing2X { false }
 
MythDeintType m_forcedDeinterlacer { DEINT_NONE }
 
- Protected Attributes inherited from MythVideoBounds
MythDisplaym_display {nullptr}
 

Detailed Description

Common code shared between GPU accelerated sub-classes (e.g. OpenGL)

MythVideoOutputGPU is a pure virtual class that contains code shared between the differing hardware accelerated MythVideoOutput subclasses.

Note
This should be considered a work-in-progress and it is likely to change.
See also
MythVideoOutput
MythVideoOutputOpenGL
MythVideoOutputVulkan

Definition at line 11 of file mythvideooutgpu.h.

Constructor & Destructor Documentation

◆ ~MythVideoOutputGPU()

MythVideoOutputGPU::~MythVideoOutputGPU ( )
override

Definition at line 239 of file mythvideooutgpu.cpp.

◆ MythVideoOutputGPU()

MythVideoOutputGPU::MythVideoOutputGPU ( MythMainWindow MainWindow,
MythRender Render,
MythPainterGPU Painter,
MythDisplay Display,
MythVideoProfilePtr  VideoProfile,
QString &  Profile 
)
protected

Definition at line 197 of file mythvideooutgpu.cpp.

Member Function Documentation

◆ GetRenderOptions()

void MythVideoOutputGPU::GetRenderOptions ( RenderOptions Options,
MythRender Render 
)
static

Definition at line 20 of file mythvideooutgpu.cpp.

Referenced by MythVideoOutput::GetRenderOptions().

◆ Create()

MythVideoOutputGPU * MythVideoOutputGPU::Create ( MythMainWindow MainWindow,
MythRender Render,
MythPainter Painter,
MythDisplay Display,
const QString &  Decoder,
MythCodecID  CodecID,
QSize  VideoDim,
QSize  VideoDispDim,
float  VideoAspect,
float  FrameRate,
uint  PlayerFlags,
const QString &  Codec,
int  ReferenceFrames,
const VideoFrameTypes *&  RenderFormats 
)
static

Definition at line 33 of file mythvideooutgpu.cpp.

Referenced by MythPlayerVideoUI::InitVideo().

◆ FrameTypeForCodec()

VideoFrameType MythVideoOutputGPU::FrameTypeForCodec ( MythCodecID  CodecId)
static

Definition at line 173 of file mythvideooutgpu.cpp.

Referenced by MythVideoOutputOpenGL::GetAllowedRenderers().

◆ ChangePictureAttribute

void MythVideoOutputGPU::ChangePictureAttribute ( PictureAttribute  Attribute,
bool  Direction,
int  Value 
)
signal

◆ PictureAttributeChanged

void MythVideoOutputGPU::PictureAttributeChanged ( PictureAttribute  Attribute,
int  Value 
)
signal

◆ SupportedAttributesChanged

void MythVideoOutputGPU::SupportedAttributesChanged ( PictureAttributeSupported  Supported)
signal

◆ PictureAttributesUpdated

void MythVideoOutputGPU::PictureAttributesUpdated ( const std::map< PictureAttribute, int > &  Values)
signal

◆ RefreshState

void MythVideoOutputGPU::RefreshState ( )
signal

◆ DoRefreshState

void MythVideoOutputGPU::DoRefreshState ( )
signal

Referenced by MythVideoOutputGPU().

◆ WindowResized

void MythVideoOutputGPU::WindowResized ( QSize  Size)
slot

Definition at line 259 of file mythvideooutgpu.cpp.

Referenced by MythPlayerVideoUI::InitVideo().

◆ ResizeForVideo

void MythVideoOutputGPU::ResizeForVideo ( QSize  Size = QSize())
slot

Definition at line 701 of file mythvideooutgpu.cpp.

Referenced by Init(), MythPlayerVideoUI::InitVideo(), and ProcessInputChange().

◆ InitPictureAttributes()

void MythVideoOutputGPU::InitPictureAttributes ( )
overridevirtual

Reimplemented from MythVideoOutput.

Definition at line 254 of file mythvideooutgpu.cpp.

Referenced by Init().

◆ SetVideoFrameRate()

void MythVideoOutputGPU::SetVideoFrameRate ( float  NewRate)
overridevirtual

Reimplemented from MythVideoOutput.

Definition at line 265 of file mythvideooutgpu.cpp.

◆ DiscardFrames()

void MythVideoOutputGPU::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 332 of file mythvideooutgpu.cpp.

Referenced by DestroyBuffers().

◆ DoneDisplayingFrame()

void MythVideoOutputGPU::DoneDisplayingFrame ( MythVideoFrame Frame)
overridevirtual

Release a video frame back into the decoder pool.

Software frames do not need a pause frame as the MythVideo subclass 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 353 of file mythvideooutgpu.cpp.

Referenced by UpdatePauseFrame().

◆ UpdatePauseFrame()

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

Reimplemented from MythVideoOutput.

Definition at line 646 of file mythvideooutgpu.cpp.

◆ InputChanged()

bool MythVideoOutputGPU::InputChanged ( QSize  VideoDim,
QSize  VideoDispDim,
float  VideoAspect,
MythCodecID  CodecID,
bool AspectChanged,
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 426 of file mythvideooutgpu.cpp.

◆ EndFrame()

void MythVideoOutputGPU::EndFrame ( )
overridevirtual

Implements MythVideoOutput.

Reimplemented in MythVideoOutputOpenGL, and MythVideoOutputVulkan.

Definition at line 676 of file mythvideooutgpu.cpp.

◆ ClearAfterSeek()

void MythVideoOutputGPU::ClearAfterSeek ( )
overridevirtual

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

Reimplemented from MythVideoOutput.

Definition at line 681 of file mythvideooutgpu.cpp.

◆ GetDisplayVisibleRectAdj()

QRect MythVideoOutputGPU::GetDisplayVisibleRectAdj ( )
protectedvirtual

Reimplemented in MythVideoOutputOpenGL.

Definition at line 249 of file mythvideooutgpu.cpp.

Referenced by Init().

◆ Init()

bool MythVideoOutputGPU::Init ( QSize  VideoDim,
QSize  VideoDispDim,
float  Aspect,
QRect  DisplayVisibleRect,
MythCodecID  CodecId 
)
overrideprotectedvirtual

◆ PrepareFrame()

void MythVideoOutputGPU::PrepareFrame ( MythVideoFrame Frame,
FrameScanType  Scan 
)
overrideprotectedvirtual

◆ RenderFrame()

void MythVideoOutputGPU::RenderFrame ( MythVideoFrame Frame,
FrameScanType  Scan 
)
overrideprotectedvirtual

◆ RenderOverlays()

void MythVideoOutputGPU::RenderOverlays ( OSD Osd)
overrideprotectedvirtual

Reimplemented from MythVideoOutput.

Definition at line 640 of file mythvideooutgpu.cpp.

◆ CreateBuffers()

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

Definition at line 385 of file mythvideooutgpu.cpp.

Referenced by Init().

◆ DestroyBuffers()

void MythVideoOutputGPU::DestroyBuffers ( )
protected

Definition at line 414 of file mythvideooutgpu.cpp.

Referenced by ~MythVideoOutputGPU().

◆ ProcessInputChange()

bool MythVideoOutputGPU::ProcessInputChange ( )
protected

Definition at line 483 of file mythvideooutgpu.cpp.

Referenced by PrepareFrame().

◆ InitDisplayMeasurements()

void MythVideoOutputGPU::InitDisplayMeasurements ( )
protected

Initialise display measurement.

The sole intent here is to ensure that MythVideoBounds has the correct aspect ratio when it calculates the video display rectangle.

Definition at line 543 of file mythvideooutgpu.cpp.

Referenced by Init(), and WindowResized().

◆ SetReferenceFrames()

void MythVideoOutputGPU::SetReferenceFrames ( int  ReferenceFrames)
protected

Definition at line 421 of file mythvideooutgpu.cpp.

Member Data Documentation

◆ m_mainWindow

MythMainWindow* MythVideoOutputGPU::m_mainWindow { nullptr }
protected

◆ m_render

MythRender* MythVideoOutputGPU::m_render { nullptr }
protected

Definition at line 69 of file mythvideooutgpu.h.

Referenced by Init(), MythVideoOutputGPU(), RenderFrame(), and ~MythVideoOutputGPU().

◆ m_video

MythVideoGPU* MythVideoOutputGPU::m_video { nullptr }
protected

◆ m_painter

MythPainterGPU* MythVideoOutputGPU::m_painter { nullptr }
protected

◆ m_newCodecId

MythCodecID MythVideoOutputGPU::m_newCodecId { kCodec_NONE }
protected

◆ m_newVideoDim

QSize MythVideoOutputGPU::m_newVideoDim { 0, 0 }
protected

Definition at line 73 of file mythvideooutgpu.h.

Referenced by InputChanged(), and ProcessInputChange().

◆ m_newVideoDispDim

QSize MythVideoOutputGPU::m_newVideoDispDim { 0, 0 }
protected

Definition at line 74 of file mythvideooutgpu.h.

Referenced by InputChanged(), and ProcessInputChange().

◆ m_newAspect

float MythVideoOutputGPU::m_newAspect { 0.0F }
protected

Definition at line 75 of file mythvideooutgpu.h.

Referenced by InputChanged(), and ProcessInputChange().

◆ m_newFrameRate

bool MythVideoOutputGPU::m_newFrameRate { false }
protected

Definition at line 76 of file mythvideooutgpu.h.

Referenced by ProcessInputChange(), and SetVideoFrameRate().

◆ m_buffersCreated

bool MythVideoOutputGPU::m_buffersCreated { false }
protected

Definition at line 77 of file mythvideooutgpu.h.

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

◆ m_profile

QString MythVideoOutputGPU::m_profile
protected

Definition at line 78 of file mythvideooutgpu.h.

Referenced by MythVideoOutputOpenGL::MythVideoOutputOpenGL().

◆ m_needFullClear

bool MythVideoOutputGPU::m_needFullClear { false }
protected

Definition at line 79 of file mythvideooutgpu.h.

Referenced by MythVideoOutputGPU(), and MythVideoOutputOpenGL::RenderFrame().


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