MythTV  master
mythvideoout.h
Go to the documentation of this file.
1 #ifndef MYTH_VIDEOOUT_H_
2 #define MYTH_VIDEOOUT_H_
3 
4 // Qt
5 #include <QSize>
6 #include <QRect>
7 #include <QString>
8 #include <QPoint>
9 #include <QMap>
10 #include <qwindowdefs.h>
11 
12 // MythTV
13 #include "mythframe.h"
14 #include "videobuffers.h"
15 #include "mythcodecid.h"
16 #include "videoouttypes.h"
17 #include "mythvideobounds.h"
18 #include "mythdisplay.h"
19 #include "videodisplayprofile.h"
20 #include "mythvideocolourspace.h"
21 #include "mythavutil.h"
22 #include "mythdeinterlacer.h"
23 
24 class MythPlayer;
25 class OSD;
26 class AudioPlayer;
27 class MythRender;
28 class MythPainter;
29 
31 {
32  Q_OBJECT
33 
34  public:
35  static void GetRenderOptions(RenderOptions& Options);
37 
38  ~MythVideoOutput() override;
39 
40  virtual bool Init(QSize VideoDim, QSize VideoDispDim,
41  float VideoAspect, QRect WindowRect, MythCodecID CodecID);
42  virtual void SetVideoFrameRate(float playback_fps);
43  virtual void SetDeinterlacing(bool Enable, bool DoubleRate, MythDeintType Force = DEINT_NONE);
46  virtual void RenderEnd () = 0;
47  virtual void EndFrame () = 0;
48  virtual bool InputChanged(QSize VideoDim, QSize VideoDispDim,
49  float VideoAspect, MythCodecID CodecID,
50  bool& AspectChanged, int ReferenceFrames, bool ForceChange);
51  virtual void GetOSDBounds(QRect& Total, QRect& Visible,
52  float& VisibleAspect, float& FontScaling,
53  float ThemeAspect) const;
54  virtual void SetFramesPlayed(long long FramesPlayed);
55  virtual long long GetFramesPlayed();
56  bool IsErrored() const;
57  VideoErrorState GetError() const;
58 
59  void SetPrebuffering(bool Normal);
60  virtual void ClearAfterSeek();
61  virtual int ValidVideoFrames() const;
62  int FreeVideoFrames();
63  bool EnoughFreeFrames();
64  bool EnoughDecodedFrames();
65  const VideoFrameTypes* DirectRenderFormats() const;
67  virtual void ReleaseFrame(MythVideoFrame* Frame);
68  virtual void DeLimboFrame(MythVideoFrame* Frame);
69  virtual void StartDisplayingFrame();
71  virtual void DiscardFrame(MythVideoFrame* frame);
72  virtual void DiscardFrames(bool KeyFrame, bool Flushed);
73  virtual void CheckFrameStates() { }
76  QString GetFrameStatus() const;
77  QRect GetImageRect(QRect Rect, QRect* DisplayRect = nullptr);
78  QRect GetSafeRect();
79 
80  // These methods are only required by MythPlayerUI
81  virtual void ResizeForVideo(QSize /*Size*/ = QSize()) { }
83  int GetPictureAttribute (PictureAttribute AttributeType);
84  virtual void InitPictureAttributes () { }
85  bool HasSoftwareFrames () const { return codec_sw_copy(m_videoCodecID); }
86  virtual void RenderOverlays (OSD& /*Osd*/) {}
87  virtual void UpdatePauseFrame (int64_t& /*DisplayTimecode*/,
88  FrameScanType /*Scan*/ = kScan_Progressive) {}
89 
90  protected:
92  QRect GetVisibleOSDBounds(float& VisibleAspect, float& FontScaling, float ThemeAspect) const;
93 
101  long long m_framesPlayed { 0 };
105  bool m_deinterlacing { false };
106  bool m_deinterlacing2X { false };
108 
109  private:
110  Q_DISABLE_COPY(MythVideoOutput)
111 };
112 
113 #endif
MythVideoOutput::GetOSDBounds
virtual void GetOSDBounds(QRect &Total, QRect &Visible, float &VisibleAspect, float &FontScaling, float ThemeAspect) const
Definition: mythvideoout.cpp:237
MythVideoOutput::m_dbLetterboxColour
LetterBoxColour m_dbLetterboxColour
Definition: mythvideoout.h:95
MythVideoOutput::InputChanged
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.
Definition: mythvideoout.cpp:217
PictureAttributeSupported
PictureAttributeSupported
Definition: videoouttypes.h:117
MythVideoOutput::DirectRenderFormats
const VideoFrameTypes * DirectRenderFormats() const
Definition: mythvideoout.cpp:422
MythVideoOutput
Definition: mythvideoout.h:31
AudioPlayer
Definition: audioplayer.h:25
kCodec_NONE
@ kCodec_NONE
Definition: mythcodecid.h:14
MythVideoOutput::FreeVideoFrames
int FreeVideoFrames()
Returns number of frames available for decoding onto.
Definition: mythvideoout.cpp:319
MythVideoOutput::GetError
VideoErrorState GetError() const
Definition: mythvideoout.cpp:295
MythVideoOutput::m_framesPlayed
long long m_framesPlayed
Definition: mythvideoout.h:101
MythVideoOutput::ResizeForVideo
virtual void ResizeForVideo(QSize=QSize())
Definition: mythvideoout.h:81
kError_None
@ kError_None
Definition: videoouttypes.h:184
VideoBuffers
This class creates tracks the state of the buffers used by various VideoOutput derived classes.
Definition: videobuffers.h:39
MythVideoOutput::m_errorState
VideoErrorState m_errorState
Definition: mythvideoout.h:100
Frame
Definition: zmdefines.h:94
MythVideoOutput::s_defaultFrameTypes
static VideoFrameTypes s_defaultFrameTypes
Definition: mythvideoout.h:36
kLetterBoxColour_Black
@ kLetterBoxColour_Black
Definition: videoouttypes.h:89
VideoErrorState
VideoErrorState
Definition: videoouttypes.h:183
MythVideoOutput::PrepareFrame
virtual void PrepareFrame(MythVideoFrame *Frame, FrameScanType Scan=kScan_Ignore)=0
DEINT_NONE
@ DEINT_NONE
Definition: mythframe.h:64
MythVideoOutput::UpdatePauseFrame
virtual void UpdatePauseFrame(int64_t &, FrameScanType=kScan_Progressive)
Definition: mythvideoout.h:87
FrameScanType
FrameScanType
Definition: videoouttypes.h:95
MythVideoOutput::m_forcedDeinterlacer
MythDeintType m_forcedDeinterlacer
Definition: mythvideoout.h:107
MythVideoOutput::m_renderFrameTypes
VideoFrameTypes * m_renderFrameTypes
Definition: mythvideoout.h:104
MythVideoOutput::SetFramesPlayed
virtual void SetFramesPlayed(long long FramesPlayed)
Definition: mythvideoout.cpp:280
mythframe.h
MythPlayer
Definition: mythplayer.h:83
Visible
Definition: channelsettings.cpp:392
mythdeinterlacer.h
MythVideoOutput::RenderOverlays
virtual void RenderOverlays(OSD &)
Definition: mythvideoout.h:86
MythVideoOutput::SetPrebuffering
void SetPrebuffering(bool Normal)
Sets whether to use a normal number of buffers or fewer buffers.
Definition: mythvideoout.cpp:301
MythVideoOutput::GetPictureAttribute
int GetPictureAttribute(PictureAttribute AttributeType)
Definition: mythvideoout.cpp:275
videobuffers.h
MythVideoOutput::m_copyFrame
MythAVCopy m_copyFrame
Definition: mythvideoout.h:102
MythCodecID
MythCodecID
Definition: mythcodecid.h:11
videodisplayprofile.h
MythVideoOutput::EndFrame
virtual void EndFrame()=0
mythvideocolourspace.h
mythdisplay.h
MythVideoOutput::Init
virtual bool Init(QSize VideoDim, QSize VideoDispDim, float VideoAspect, QRect WindowRect, MythCodecID CodecID)
Definition: mythvideoout.cpp:142
RenderOptions
Definition: videodisplayprofile.h:27
MythVideoOutput::ValidVideoFrames
virtual int ValidVideoFrames() const
Returns number of frames that are fully decoded.
Definition: mythvideoout.cpp:313
videoouttypes.h
kScan_Progressive
@ kScan_Progressive
Definition: videoouttypes.h:100
MythVideoOutput::m_dbDisplayProfile
VideoDisplayProfile * m_dbDisplayProfile
Definition: mythvideoout.h:98
MythVideoOutput::CheckFrameStates
virtual void CheckFrameStates()
Definition: mythvideoout.h:73
MythVideoOutput::ClearAfterSeek
virtual void ClearAfterSeek()
Tells video output to toss decoded buffers due to a seek.
Definition: mythvideoout.cpp:307
MythVideoOutput::DeLimboFrame
virtual void DeLimboFrame(MythVideoFrame *Frame)
Releases a frame for reuse if it is in limbo.
Definition: mythvideoout.cpp:443
VideoFrameTypes
std::vector< VideoFrameType > VideoFrameTypes
Definition: mythframe.h:78
MythVideoOutput::GetFrameStatus
QString GetFrameStatus() const
Returns string with status of each frame for debugging.
Definition: mythvideoout.cpp:344
MythVideoOutput::GetNextFreeFrame
virtual MythVideoFrame * GetNextFreeFrame()
Blocks until it is possible to return a frame for decoding onto.
Definition: mythvideoout.cpp:430
MythVideoOutput::GetImageRect
QRect GetImageRect(QRect Rect, QRect *DisplayRect=nullptr)
translates caption/dvd button rectangle into 'screen' space
Definition: mythvideoout.cpp:357
MythDeinterlacer
Handles software based deinterlacing of video frames.
Definition: mythdeinterlacer.h:15
mythcodecid.h
MythVideoOutput::GetFramesPlayed
virtual long long GetFramesPlayed()
Definition: mythvideoout.cpp:285
MythVideoOutput::DiscardFrames
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...
Definition: mythvideoout.cpp:471
MythVideoOutput::GetLastDecodedFrame
virtual MythVideoFrame * GetLastDecodedFrame()
Definition: mythvideoout.cpp:338
MythVideoOutput::m_videoCodecID
MythCodecID m_videoCodecID
Definition: mythvideoout.h:96
MythVideoOutput::~MythVideoOutput
~MythVideoOutput() override
Definition: mythvideoout.cpp:132
MythVideoOutput::m_deinterlacer
MythDeinterlacer m_deinterlacer
Definition: mythvideoout.h:103
MythVideoBounds
Definition: mythvideobounds.h:24
codec_sw_copy
#define codec_sw_copy(id)
Definition: mythcodecid.h:349
MythVideoOutput::EnoughFreeFrames
bool EnoughFreeFrames()
Returns true iff enough frames are available to decode onto.
Definition: mythvideoout.cpp:325
PictureAttribute
PictureAttribute
Definition: videoouttypes.h:104
MythVideoOutput::ReleaseFrame
virtual void ReleaseFrame(MythVideoFrame *Frame)
Releases a frame from the ready for decoding queue onto the queue of frames ready for display.
Definition: mythvideoout.cpp:437
MythVideoOutput::StartDisplayingFrame
virtual void StartDisplayingFrame()
Tell GetLastShownFrame() to return the next frame from the head of the queue of frames to display.
Definition: mythvideoout.cpp:450
MythVideoOutput::IsErrored
bool IsErrored() const
Definition: mythvideoout.cpp:290
VideoDisplayProfile
Definition: videodisplayprofile.h:69
MythVideoOutput::SetVideoFrameRate
virtual void SetVideoFrameRate(float playback_fps)
Definition: mythvideoout.cpp:167
MythDeintType
MythDeintType
Definition: mythframe.h:63
MythVideoOutput::RenderFrame
virtual void RenderFrame(MythVideoFrame *Frame, FrameScanType)=0
MythVideoOutput::GetSupportedPictureAttributes
PictureAttributeSupported GetSupportedPictureAttributes()
Definition: mythvideoout.cpp:270
MythRender
Definition: mythrender_base.h:24
MythPainter
Definition: mythpainter.h:33
LetterBoxColour
LetterBoxColour
Definition: videoouttypes.h:87
mythavutil.h
MythVideoOutput::MythVideoOutput
MythVideoOutput()
Definition: mythvideoout.cpp:123
MythVideoOutput::GetSafeRect
QRect GetSafeRect()
Returns a QRect describing an area of the screen on which it is 'safe' to render the On Screen Displa...
Definition: mythvideoout.cpp:411
MythAVCopy
Definition: mythavutil.h:41
MythVideoOutput::HasSoftwareFrames
bool HasSoftwareFrames() const
Definition: mythvideoout.h:85
MythVideoOutput::GetRenderOptions
static void GetRenderOptions(RenderOptions &Options)
Definition: mythvideoout.cpp:37
MythVideoOutput::SetDeinterlacing
virtual void SetDeinterlacing(bool Enable, bool DoubleRate, MythDeintType Force=DEINT_NONE)
Definition: mythvideoout.cpp:173
MythVideoFrame
Definition: mythframe.h:83
MythVideoOutput::EnoughDecodedFrames
bool EnoughDecodedFrames()
Returns true iff there are plenty of decoded frames ready for display.
Definition: mythvideoout.cpp:332
MythVideoOutput::InitPictureAttributes
virtual void InitPictureAttributes()
Definition: mythvideoout.h:84
MythVideoOutput::GetLastShownFrame
virtual MythVideoFrame * GetLastShownFrame()
Returns frame from the head of the ready to be displayed queue, if StartDisplayingFrame has been call...
Definition: mythvideoout.cpp:351
MythVideoOutput::RenderEnd
virtual void RenderEnd()=0
MythVideoOutput::m_maxReferenceFrames
int m_maxReferenceFrames
Definition: mythvideoout.h:97
mythvideobounds.h
MythVideoOutput::GetVisibleOSDBounds
QRect GetVisibleOSDBounds(float &VisibleAspect, float &FontScaling, float ThemeAspect) const
Returns visible portions of total OSD bounds.
Definition: mythvideoout.cpp:252
MythVideoColourSpace
MythVideoColourSpace contains a QMatrix4x4 that can convert YCbCr data to RGB.
Definition: mythvideocolourspace.h:21
OSD
Definition: osd.h:95
MythVideoOutput::m_deinterlacing2X
bool m_deinterlacing2X
Definition: mythvideoout.h:106
MythVideoOutput::m_videoBuffers
VideoBuffers m_videoBuffers
Definition: mythvideoout.h:99
kScan_Ignore
@ kScan_Ignore
Definition: videoouttypes.h:96
MythVideoOutput::m_videoColourSpace
MythVideoColourSpace m_videoColourSpace
Definition: mythvideoout.h:94
MythVideoOutput::DiscardFrame
virtual void DiscardFrame(MythVideoFrame *frame)
Releases frame from any queue onto the queue of frames ready for decoding onto.
Definition: mythvideoout.cpp:464
MythVideoOutput::m_deinterlacing
bool m_deinterlacing
Definition: mythvideoout.h:105
MythVideoOutput::DoneDisplayingFrame
virtual void DoneDisplayingFrame(MythVideoFrame *Frame)
Releases frame returned from GetLastShownFrame() onto the queue of frames ready for decoding onto.
Definition: mythvideoout.cpp:457