MythTV master
mythvideoout.h
Go to the documentation of this file.
1#ifndef MYTH_VIDEOOUT_H_
2#define MYTH_VIDEOOUT_H_
3
4// Std
5#include <memory>
6
7// Qt
8#include <QSize>
9#include <QRect>
10#include <QString>
11#include <QPoint>
12#include <QMap>
13#include <qwindowdefs.h>
14
15// MythTV
19#include "libmythtv/mythframe.h"
26
27class MythPlayer;
28class OSD;
29class AudioPlayer;
30class MythRender;
31class MythPainter;
32
33using MythVideoProfilePtr = std::shared_ptr<MythVideoProfile>;
34
36{
37 Q_OBJECT
38
39 public:
40 static void GetRenderOptions(RenderOptions& Options, MythRender* Render);
41
42 ~MythVideoOutput() override = default;
43
44 virtual bool Init(QSize VideoDim, QSize VideoDispDim,
45 float VideoAspect, QRect WindowRect, MythCodecID CodecID);
46 virtual void SetVideoFrameRate(float VideoFrameRate);
47 virtual void SetDeinterlacing(bool Enable, bool DoubleRate, MythDeintType Force = DEINT_NONE);
50 virtual void RenderEnd () = 0;
51 virtual void EndFrame () = 0;
52 virtual bool InputChanged(QSize VideoDim, QSize VideoDispDim,
53 float VideoAspect, MythCodecID CodecID,
54 bool& AspectChanged, int ReferenceFrames, bool ForceChange);
55 virtual void GetOSDBounds(QRect& Total, QRect& Visible,
56 float& VisibleAspect, float& FontScaling,
57 float ThemeAspect) const;
58 virtual void SetFramesPlayed(long long FramesPlayed);
59 virtual long long GetFramesPlayed();
60 bool IsErrored() const;
62
63 void SetPrebuffering(bool Normal);
64 virtual void ClearAfterSeek();
65 virtual int ValidVideoFrames() const;
66 int FreeVideoFrames();
67 bool EnoughFreeFrames();
70 virtual void ReleaseFrame(MythVideoFrame* Frame);
71 virtual void DeLimboFrame(MythVideoFrame* Frame);
72 virtual void StartDisplayingFrame();
74 virtual void DiscardFrame(MythVideoFrame* Frame);
75 virtual void DiscardFrames(bool KeyFrame, bool Flushed);
76 virtual void CheckFrameStates() { }
79 QString GetFrameStatus() const;
80 QRect GetImageRect(QRect Rect, QRect* DisplayRect = nullptr);
81 QRect GetSafeRect();
82
83 // These methods are only required by MythPlayerUI
85 virtual void InitPictureAttributes () { }
87 virtual void UpdatePauseFrame (std::chrono::milliseconds& /*DisplayTimecode*/,
88 FrameScanType /*Scan*/ = kScan_Progressive) {}
89
90 protected:
92 QRect GetVisibleOSDBounds(float& VisibleAspect, float& FontScaling, float ThemeAspect) const;
93
96 uint8_t m_clearColor { 0 };
97 uint8_t m_clearAlpha { 255 };
103 long long m_framesPlayed { 0 };
107 bool m_deinterlacing { false };
108 bool m_deinterlacing2X { false };
110
111 private:
112 Q_DISABLE_COPY(MythVideoOutput)
113};
114
115#endif
Handles software based deinterlacing of video frames.
MythVideoColourSpace contains a QMatrix4x4 that can convert YCbCr data to RGB.
static const VideoFrameTypes kDefaultRenderFormats
Definition: mythframe.h:90
virtual void UpdatePauseFrame(std::chrono::milliseconds &, FrameScanType=kScan_Progressive)
Definition: mythvideoout.h:87
MythCodecID m_videoCodecID
Definition: mythvideoout.h:98
bool EnoughFreeFrames()
Returns true iff enough frames are available to decode onto.
VideoErrorState m_errorState
Definition: mythvideoout.h:102
uint8_t m_clearColor
Definition: mythvideoout.h:96
long long m_framesPlayed
Definition: mythvideoout.h:103
LetterBoxColour m_dbLetterboxColour
Definition: mythvideoout.h:95
bool EnoughDecodedFrames()
Returns true iff there are plenty of decoded frames ready for display.
virtual void ReleaseFrame(MythVideoFrame *Frame)
Releases a frame from the ready for decoding queue onto the queue of frames ready for display.
virtual void StartDisplayingFrame()
Tell GetLastShownFrame() to return the next frame from the head of the queue of frames to display.
virtual void GetOSDBounds(QRect &Total, QRect &Visible, float &VisibleAspect, float &FontScaling, float ThemeAspect) const
virtual int ValidVideoFrames() const
Returns number of frames that are fully decoded.
bool IsErrored() const
virtual void ClearAfterSeek()
Tells video output to toss decoded buffers due to a seek.
virtual MythVideoFrame * GetLastDecodedFrame()
bool HasSoftwareFrames() const
Definition: mythvideoout.h:86
void SetPrebuffering(bool Normal)
Sets whether to use a normal number of buffers or fewer buffers.
virtual void EndFrame()=0
virtual void InitPictureAttributes()
Definition: mythvideoout.h:85
virtual void SetDeinterlacing(bool Enable, bool DoubleRate, MythDeintType Force=DEINT_NONE)
MythAVCopy m_copyFrame
Definition: mythvideoout.h:104
MythVideoColourSpace m_videoColourSpace
Definition: mythvideoout.h:94
virtual bool Init(QSize VideoDim, QSize VideoDispDim, float VideoAspect, QRect WindowRect, MythCodecID CodecID)
~MythVideoOutput() override=default
QRect GetImageRect(QRect Rect, QRect *DisplayRect=nullptr)
translates caption/dvd button rectangle into 'screen' space
MythVideoProfilePtr m_videoProfile
Definition: mythvideoout.h:100
virtual void CheckFrameStates()
Definition: mythvideoout.h:76
virtual void SetVideoFrameRate(float VideoFrameRate)
virtual void PrepareFrame(MythVideoFrame *Frame, FrameScanType Scan=kScan_Ignore)=0
PictureAttributeSupported GetSupportedPictureAttributes()
virtual long long GetFramesPlayed()
virtual void RenderEnd()=0
QRect GetSafeRect()
Returns a QRect describing an area of the screen on which it is 'safe' to render the On Screen Displa...
QString GetFrameStatus() const
Returns string with status of each frame for debugging.
MythDeintType m_forcedDeinterlacer
Definition: mythvideoout.h:109
VideoErrorState GetError() const
uint8_t m_clearAlpha
Definition: mythvideoout.h:97
virtual void DeLimboFrame(MythVideoFrame *Frame)
Releases a frame for reuse if it is in limbo.
VideoBuffers m_videoBuffers
Definition: mythvideoout.h:101
virtual MythVideoFrame * GetLastShownFrame()
Returns frame from the head of the ready to be displayed queue, if StartDisplayingFrame has been call...
virtual MythVideoFrame * GetNextFreeFrame()
Blocks until it is possible to return a frame for decoding onto.
MythDeinterlacer m_deinterlacer
Definition: mythvideoout.h:105
int FreeVideoFrames()
Returns number of frames available for decoding onto.
virtual void DiscardFrame(MythVideoFrame *Frame)
Releases frame from any queue onto the queue of frames ready for decoding onto.
virtual void SetFramesPlayed(long long FramesPlayed)
const VideoFrameTypes * m_renderFormats
Definition: mythvideoout.h:106
virtual void DiscardFrames(bool KeyFrame, bool Flushed)
Releases all frames not being actively displayed from any queue onto the queue of frames ready for de...
static void GetRenderOptions(RenderOptions &Options, MythRender *Render)
virtual void DoneDisplayingFrame(MythVideoFrame *Frame)
Releases frame returned from GetLastShownFrame() onto the queue of frames ready for decoding onto.
virtual bool InputChanged(QSize VideoDim, QSize VideoDispDim, float VideoAspect, MythCodecID CodecID, bool &AspectChanged, int ReferenceFrames, bool ForceChange)
Tells video output to discard decoded frames and wait for new ones.
QRect GetVisibleOSDBounds(float &VisibleAspect, float &FontScaling, float ThemeAspect) const
Returns visible portions of total OSD bounds.
virtual void RenderFrame(MythVideoFrame *Frame, FrameScanType)=0
int m_maxReferenceFrames
Definition: mythvideoout.h:99
Definition: osd.h:94
This class creates tracks the state of the buffers used by various VideoOutput derived classes.
Definition: videobuffers.h:39
MythCodecID
Definition: mythcodecid.h:14
@ kCodec_NONE
Definition: mythcodecid.h:17
static bool codec_sw_copy(MythCodecID id)
Definition: mythcodecid.h:374
MythDeintType
Definition: mythframe.h:67
@ DEINT_NONE
Definition: mythframe.h:68
std::vector< VideoFrameType > VideoFrameTypes
Definition: mythframe.h:82
std::shared_ptr< MythVideoProfile > MythVideoProfilePtr
Definition: mythvideogpu.h:18
VideoErrorState
@ kError_None
PictureAttributeSupported
FrameScanType
Definition: videoouttypes.h:95
@ kScan_Ignore
Definition: videoouttypes.h:96
@ kScan_Progressive
LetterBoxColour
Definition: videoouttypes.h:87
@ kLetterBoxColour_Black
Definition: videoouttypes.h:89