MythTV master
mythdisplay.h
Go to the documentation of this file.
1#ifndef MYTHDISPLAY_H
2#define MYTHDISPLAY_H
3
4// Qt
5#include <QSize>
6#include <QScreen>
7#include <QMutex>
8
9// MythTV
12#include "libmythui/mythedid.h"
13#include "libmythui/mythhdr.h"
14#include "libmythui/mythuiexp.h"
15#include "libmythui/mythvrr.h"
16
17// Std
18#include <cmath>
19
20class MythMainWindow;
21
22class MUI_PUBLIC MythDisplay : public QObject
23{
24 Q_OBJECT
25
26 friend class MythMainWindow;
27
28 public:
29 virtual bool VideoModesAvailable () { return false; }
30 virtual bool UsingVideoModes () { return false; }
31 virtual bool IsPlanar () { return false; }
32 virtual const MythDisplayModes& GetVideoModes();
33
34 static void ConfigureQtGUI (int SwapInterval, const MythCommandLineParser& CmdLine);
35 static bool SpanAllScreens ();
36 static QString GetExtraScreenInfo (QScreen *qScreen);
37 QStringList GetDescription ();
38 QRect GetScreenBounds ();
39 QScreen* GetCurrentScreen ();
40 static int GetScreenCount ();
41 double GetPixelAspectRatio ();
42 QSize GetGUIResolution ();
43 bool NextModeIsLarger (QSize Size);
44 void SwitchToDesktop ();
45 bool SwitchToGUI (bool Wait = false);
46 bool SwitchToVideo (QSize Size, double Rate = 0.0);
47 QSize GetResolution ();
48 QSize GetPhysicalSize ();
49 double GetRefreshRate () const;
50 std::chrono::microseconds GetRefreshInterval (std::chrono::microseconds Fallback) const;
51 double GetAspectRatio (QString &Source, bool IgnoreModeOverride = false);
52 double EstimateVirtualAspectRatio();
53 MythEDID& GetEDID ();
54 MythDisplayRates GetRefreshRates (QSize Size);
55 MythHDRPtr GetHDRState ();
56
57 public slots:
58 virtual void ScreenChanged (QScreen *qScreen);
59 static void PrimaryScreenChanged (QScreen *qScreen);
60 void ScreenAdded (QScreen *qScreen);
61 void ScreenRemoved (QScreen *qScreen);
62 void PhysicalDPIChanged (qreal DPI);
63 static void GeometryChanged (QRect Geometry);
64
65 signals:
66 void CurrentScreenChanged (QScreen *qScreen);
67 void ScreenCountChanged (int Screens);
68 void CurrentDPIChanged (qreal DPI);
69
70 protected:
71 static MythDisplay* Create(MythMainWindow* MainWindow);
73 ~MythDisplay() override;
74
75 virtual void UpdateCurrentMode ();
76 virtual bool SwitchToVideoMode (QSize Size, double Framerate);
77
78 void DebugModes () const;
79 void SetWidget (QWidget *MainWindow);
80 static QScreen* GetDesiredScreen ();
81 static void DebugScreen (QScreen *qScreen, const QString &Message);
82 void Initialise ();
83 void InitScreenBounds ();
84 void WaitForScreenChange();
85 void WaitForNewScreen ();
86 void InitHDR ();
87
88 bool m_waitForModeChanges { true };
89 bool m_modeComplete { false };
90 double m_refreshRate { 0.0 };
91 double m_aspectRatioOverride { 0.0 };
92 QSize m_resolution { 0, 0 };
93 QSize m_physicalSize { 0, 0 };
95 QWidget* m_widget { nullptr };
96 QWindow* m_window { nullptr };
97 QScreen* m_screen { nullptr };
99 MythHDRPtr m_hdrState { nullptr };
100 MythVRRPtr m_vrrState { nullptr };
101
102 private:
103 Q_DISABLE_COPY(MythDisplay)
104 static void PauseForModeSwitch();
105
106 bool m_initialised { false };
107 bool m_firstScreenChange{ true };
113};
114
115#endif
Parent class for defining application command line parsers.
MythDisplayMode m_guiMode
Definition: mythdisplay.h:110
virtual bool VideoModesAvailable()
Definition: mythdisplay.h:29
MythDisplayModes m_videoModes
Definition: mythdisplay.h:98
MythDisplayMode m_desktopMode
Definition: mythdisplay.h:109
virtual bool UsingVideoModes()
Definition: mythdisplay.h:30
void ScreenCountChanged(int Screens)
DisplayModeMap m_overrideVideoModes
Definition: mythdisplay.h:112
void CurrentScreenChanged(QScreen *qScreen)
MythEDID m_edid
Definition: mythdisplay.h:94
QRect m_screenBounds
Definition: mythdisplay.h:108
MythDisplayMode m_videoMode
Definition: mythdisplay.h:111
virtual bool IsPlanar()
Definition: mythdisplay.h:31
void CurrentDPIChanged(qreal DPI)
std::map< uint64_t, MythDisplayMode > DisplayModeMap
std::vector< MythDisplayMode > MythDisplayModes
std::vector< double > MythDisplayRates
std::shared_ptr< class MythHDR > MythHDRPtr
Definition: mythhdr.h:30
#define MUI_PUBLIC
Definition: mythuiexp.h:9
std::shared_ptr< class MythVRR > MythVRRPtr
Definition: mythvrr.h:12