1 #ifndef VIDEO_DISPLAY_PROFILE_H_
2 #define VIDEO_DISPLAY_PROFILE_H_
9 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
12 #include <QRecursiveMutex>
30 static constexpr
const char*
COND_WIDTH {
"cond_width" };
32 static constexpr
const char*
COND_RATE {
"cond_framerate" };
34 static constexpr
const char*
PREF_DEC {
"pref_decoder" };
35 static constexpr
const char*
PREF_CPUS {
"pref_max_cpus" };
36 static constexpr
const char*
PREF_LOOP {
"pref_skiploop" };
37 static constexpr
const char*
PREF_RENDER {
"pref_videorenderer" };
63 void SetProfileID(
uint Id);
64 void Set(
const QString &Value,
const QString &Data);
67 uint GetProfileID()
const;
68 QString Get(
const QString &Value)
const;
69 uint GetPriority()
const;
70 QMap<QString,QString> GetAll()
const;
73 bool CheckRange(
const QString& Key,
float Value,
bool *Ok =
nullptr)
const;
74 bool CheckRange(
const QString& Key,
int Value,
bool *Ok =
nullptr)
const;
75 bool CheckRange(
const QString& Key,
float FValue,
int IValue,
bool IsFloat,
bool *Ok =
nullptr)
const;
76 bool IsMatch(QSize Size,
float Framerate,
const QString &CodecName,
77 const QStringList &DisallowedDecoders = QStringList())
const;
84 QMap<QString,QString> m_pref { };
92 void DeinterlacersChanged(
const QString& Single,
const QString& Double);
93 void UpscalerChanged(
const QString& Upscaler);
99 void SetInput(QSize Size,
float Framerate = 0,
const QString &CodecName = QString(),
100 const QStringList &DisallowedDecoders = QStringList());
101 void SetOutput(
float Framerate);
102 float GetOutput()
const;
103 void SetVideoRenderer(
const QString &VideoRenderer);
104 QString GetDecoder()
const;
105 bool IsDecoderCompatible(
const QString &
Decoder)
const;
106 uint GetMaxCPUs()
const ;
107 bool IsSkipLoopEnabled()
const;
108 QString GetVideoRenderer()
const;
110 QString GetSingleRatePreferences()
const;
111 QString GetDoubleRatePreferences()
const;
112 QString GetUpscaler()
const;
115 static void InitStatics(
bool Reinit =
false);
116 static const QList<QPair<QString,QString> >& GetDeinterlacers();
117 static QStringList GetDecoders();
118 static QStringList GetDecoderNames();
119 static std::vector<std::pair<QString,QString>> GetUpscalers();
120 static QString GetDecoderName(
const QString &
Decoder);
121 static QString GetDecoderHelp(
const QString &
Decoder = QString());
122 static QString GetVideoRendererName(
const QString &Renderer);
123 static QString GetDefaultProfileName(
const QString &HostName);
124 static void SetDefaultProfileName(
const QString &ProfileName,
const QString &HostName);
125 static uint GetProfileGroupID(
const QString &ProfileName,
const QString &HostName);
126 static QStringList GetProfiles(
const QString &HostName);
127 static bool DeleteProfileGroup(
const QString &GroupName,
const QString &HostName);
128 static uint CreateProfileGroup(
const QString &ProfileName,
const QString &HostName);
130 const QString& Width,
const QString& Height,
131 const QString& Codecs,
const QString&
Decoder,
132 uint MaxCpus,
bool SkipLoop,
const QString& VideoRenderer,
133 const QString& Deint1,
const QString& Deint2,
135 static void CreateProfiles(
const QString &HostName);
136 static QStringList GetVideoRenderers(
const QString &
Decoder);
137 static QString GetVideoRendererHelp(
const QString &Renderer);
138 static QString GetPreferredVideoRenderer(
const QString &
Decoder);
139 static QStringList GetFilteredRenderers(
const QString &
Decoder,
const QStringList &Renderers);
140 static QString GetBestVideoRenderer(
const QStringList &Renderers);
141 static std::vector<MythVideoProfileItem> LoadDB(
uint GroupId);
142 static bool DeleteDB(
uint GroupId,
const std::vector<MythVideoProfileItem>& Items);
143 static bool SaveDB(
uint GroupId, std::vector<MythVideoProfileItem>& Items);
146 std::vector<MythVideoProfileItem>::const_iterator
147 FindMatch(QSize Size,
float Framerate,
const QString &CodecName,
148 const QStringList& DisallowedDecoders = QStringList());
149 void LoadBestPreferences(QSize Size,
float Framerate,
const QString &CodecName,
150 const QStringList &DisallowedDecoders = QStringList());
151 QString GetPreference(
const QString &Key)
const;
152 void SetPreference(
const QString &Key,
const QString &Value);
155 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
156 mutable QMutex m_lock { QMutex::Recursive };
160 QSize m_lastSize { 0, 0 };
161 float m_lastRate { 0.0F };
162 QString m_lastCodecName { };
163 QMap<QString,QString> m_currentPreferences { };
164 std::vector<MythVideoProfileItem> m_allowedPreferences { };
166 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
167 static inline QMutex kSafeLock = QMutex(QMutex::Recursive);
171 static inline bool kSafeInitialized =
false;
172 static inline QMap<QString,QStringList> kSafeRenderer = {};
173 static inline QMap<QString,QStringList> kSafeRendererGroup = {};
174 static inline QMap<QString,QStringList> kSafeEquivDec = {};
175 static inline QStringList kSafeCustom = {};
176 static inline QMap<QString,uint> kSafeRendererPriority = {};
177 static inline QMap<QString,QString> kDecName = {};
178 static inline QMap<QString,QString> kRendName = {};
179 static inline QStringList kSafeDecoders = {};