MythTV master
videoouttypes.h
Go to the documentation of this file.
1#ifndef VIDEOOUT_TYPES_H_
2#define VIDEOOUT_TYPES_H_
3
4// Qt
5#include <QPoint>
6#include <QString>
7#include <QObject>
8
9// Caption Display modes
10enum : std::uint16_t
11{
12 kDisplayNone = 0x000,
23 kDisplayAllTextCaptions = ~kDisplayDVDButton & kDisplayAllCaptions
24};
25
30inline bool OptionalCaptionEnabled(uint Captions)
31{
32 return (kDisplayNUVTeletextCaptions == Captions) ||
33 (kDisplayTeletextCaptions == Captions) ||
34 (kDisplayAVSubtitle == Captions) ||
35 (kDisplayCC608 == Captions) ||
36 (kDisplayCC708 == Captions) ||
37 (kDisplayTextSubtitle == Captions) ||
38 (kDisplayRawTextSubtitle == Captions) ||
39 (kDisplayTeletextMenu == Captions);
40}
41
42enum ZoomDirection : std::uint8_t
43{
58};
59
60enum AspectOverrideMode : std::int8_t
61{
66 kAspect_14_9 = 3, // added after 16:9 so as not to upset existing setups.
68 kAspect_END = 5
69};
70
71enum AdjustFillMode : std::int8_t
72{
84};
85
86enum LetterBoxColour : std::int8_t
87{
92};
93
94enum FrameScanType : std::int8_t
95{
101};
102
103enum PictureAttribute : std::uint8_t
104{
115
116enum PictureAttributeSupported : std::uint8_t
117{
125};
126
127#define ALL_PICTURE_ATTRIBUTES static_cast<PictureAttributeSupported> \
128 (kPictureAttributeSupported_Brightness | \
129 kPictureAttributeSupported_Contrast | \
130 kPictureAttributeSupported_Colour | \
131 kPictureAttributeSupported_Hue | \
132 kPictureAttributeSupported_Range)
133
134enum StereoscopicMode : std::uint8_t
135{
141
142enum PrimariesMode : std::uint8_t
143{
148
150{
151 if (PrimariesMode::PrimariesDisabled == Mode) return QObject::tr("Disabled");
152 if (PrimariesMode::PrimariesExact == Mode) return QObject::tr("Exact");
153 return QObject::tr("Auto");
154}
155
157{
158 if (Mode == PrimariesDisabled) return "disabled";
159 if (Mode == PrimariesExact) return "exact";
160 return "auto";
161}
162
163inline PrimariesMode toPrimariesMode(const QString& Mode)
164{
165 if (Mode == "disabled") return PrimariesDisabled;
166 if (Mode == "exact") return PrimariesExact;
167 return PrimariesRelaxed;
168}
169
171{
172 switch (Mode)
173 {
174 case kStereoscopicModeAuto: return QObject::tr("Auto 3D");
175 case kStereoscopicModeIgnore3D: return QObject::tr("Ignore 3D");
176 case kStereoscopicModeSideBySideDiscard: return QObject::tr("Discard 3D Side by Side");
177 case kStereoscopicModeTopAndBottomDiscard: return QObject::tr("Discard 3D Top and Bottom");
178 }
179 return QObject::tr("Unknown");
180}
181
182enum VideoErrorState : std::uint8_t
183{
186};
187
189{
190 return (kScan_Interlaced == Scan) || (kScan_Intr2ndField == Scan);
191}
192
194{
195 return (kScan_Progressive == Scan);
196}
197
198inline QString ScanTypeToUserString(FrameScanType Scan, bool Forced = false)
199{
200 switch (Scan)
201 {
202 case kScan_Ignore: return QObject::tr("Ignore");
203 case kScan_Detect: return QObject::tr("Detect");
204 case kScan_Progressive: return Forced ? QObject::tr("Progressive (Forced)") : QObject::tr("Progressive");
205 case kScan_Interlaced: return Forced ? QObject::tr("Interlaced (Forced)") : QObject::tr("Interlaced");
206 case kScan_Intr2ndField: return Forced ? QObject::tr("Interlaced (Reversed, Forced)") : QObject::tr("Interlaced (Reversed)");
207 }
208 return QObject::tr("Unknown");
209}
210
211inline QString ScanTypeToString(FrameScanType Scan)
212{
213 switch (Scan)
214 {
215 case kScan_Ignore: return {"Ignore Scan"};
216 case kScan_Detect: return {"Detect Scan"};
217 case kScan_Interlaced: return {"Interlaced Scan"};
218 case kScan_Progressive: return {"Progressive Scan"};
219 default: return {"Unknown Scan"};
220 }
221}
222
223inline QString toString(AspectOverrideMode Aspectmode)
224{
225 switch (Aspectmode)
226 {
227 case kAspect_4_3: return QObject::tr("4:3");
228 case kAspect_14_9: return QObject::tr("14:9");
229 case kAspect_16_9: return QObject::tr("16:9");
230 case kAspect_2_35_1: return QObject::tr("2.35:1");
231 case kAspect_Toggle:
232 case kAspect_Off:
233 case kAspect_END: break;
234 }
235 return QObject::tr("Off");
236}
237
238inline QString toString(LetterBoxColour LetterboxColour)
239{
240 switch (LetterboxColour)
241 {
242 case kLetterBoxColour_Gray25: return QObject::tr("Gray");
245 case kLetterBoxColour_END: break;
246 }
247 return QObject::tr("Black");
248}
249
250inline float get_aspect_override(AspectOverrideMode Aspectmode, float Original)
251{
252 switch (Aspectmode)
253 {
254 case kAspect_4_3: return 4.0F / 3.0F;
255 case kAspect_14_9: return 14.0F / 9.0F;
256 case kAspect_16_9: return 16.0F / 9.0F;
257 case kAspect_2_35_1: return 2.35F;
258 case kAspect_Toggle:
259 case kAspect_Off:
260 case kAspect_END: break;
261 }
262 return Original;
263}
264
265inline QString toString(AdjustFillMode Aspectmode)
266{
267 switch (Aspectmode)
268 {
269 case kAdjustFill_Half: return QObject::tr("Half");
270 case kAdjustFill_Full: return QObject::tr("Full");
271 case kAdjustFill_HorizontalStretch: return QObject::tr("H.Stretch");
272 case kAdjustFill_VerticalStretch: return QObject::tr("V.Stretch");
273 case kAdjustFill_VerticalFill: return QObject::tr("V.Fill");
274 case kAdjustFill_HorizontalFill: return QObject::tr("H.Fill");
275 case kAdjustFill_AutoDetect_DefaultOff: return QObject::tr("Auto Detect (Default Off)");
276 case kAdjustFill_AutoDetect_DefaultHalf: return QObject::tr("Auto Detect (Default Half)");
278 case kAdjustFill_Off:
279 case kAdjustFill_END: break;
280 }
281 return QObject::tr("Off");
282}
283
285{
286 switch (PictureAttribute)
287 {
288 case kPictureAttribute_Brightness: return QObject::tr("Brightness");
289 case kPictureAttribute_Contrast: return QObject::tr("Contrast");
290 case kPictureAttribute_Colour: return QObject::tr("Color");
291 case kPictureAttribute_Hue: return QObject::tr("Hue");
292 case kPictureAttribute_Range: return QObject::tr("Range");
293 case kPictureAttribute_Volume: return QObject::tr("Volume");
294 case kPictureAttribute_MAX: return "MAX";
295 case kPictureAttribute_None: break;
296 }
297 return QObject::tr("None");
298}
299
301{
302 switch (PictureAttribute)
303 {
304 case kPictureAttribute_Brightness: return "brightness";
305 case kPictureAttribute_Contrast: return "contrast";
306 case kPictureAttribute_Colour: return "colour";
307 case kPictureAttribute_Hue: return "hue";
311 case kPictureAttribute_MAX: break;
312 }
313 return "";
314}
315
316inline QString toString(PictureAttributeSupported Supported)
317{
318 QStringList list;
320 list += "Brightness";
322 list += "Contrast";
323 if (kPictureAttributeSupported_Colour & Supported)
324 list += "Colour";
325 if (kPictureAttributeSupported_Hue & Supported)
326 list += "Hue";
327 if (kPictureAttributeSupported_Range & Supported)
328 list += "Range";
329 if (kPictureAttributeSupported_Volume & Supported)
330 list += "Volume";
331 return list.join(",");
332}
333
335{
336 switch (PictureAttribute)
337 {
345 case kPictureAttribute_MAX: break;
346 }
348}
349
351{
352 int i = static_cast<int>(Attribute + 1) % static_cast<int>(kPictureAttribute_MAX);
353 for (int j = 0; j < kPictureAttribute_MAX; (i = (i +1 ) % kPictureAttribute_MAX), j++)
354 if (toMask(static_cast<PictureAttribute>(i)) & Supported)
355 return static_cast<PictureAttribute>(i);
357}
358
359inline QString GetZoomString(float HorizScale, float VertScale, QPoint Move)
360{
361 return QObject::tr("Zoom %1x%2 @ (%3,%4)")
362 .arg(static_cast<double>(HorizScale), 0, 'f', 2)
363 .arg(static_cast<double>(VertScale), 0, 'f', 2)
364 .arg(Move.x()).arg(Move.y());
365}
366
367#endif
unsigned int uint
Definition: freesurround.h:24
unsigned short uint16_t
Definition: iso6937tables.h:3
Mode
Definition: synaesthesia.h:23
PictureAttribute next_picattr(PictureAttributeSupported Supported, PictureAttribute Attribute)
QString GetZoomString(float HorizScale, float VertScale, QPoint Move)
AspectOverrideMode
Definition: videoouttypes.h:61
@ kAspect_Toggle
Definition: videoouttypes.h:62
@ kAspect_16_9
Definition: videoouttypes.h:65
@ kAspect_4_3
Definition: videoouttypes.h:64
@ kAspect_Off
Definition: videoouttypes.h:63
@ kAspect_14_9
Definition: videoouttypes.h:66
@ kAspect_END
Definition: videoouttypes.h:68
@ kAspect_2_35_1
Definition: videoouttypes.h:67
VideoErrorState
@ kError_None
@ kError_Unknown
QString toDBString(PrimariesMode Mode)
@ kDisplayCC608
Definition: videoouttypes.h:16
@ kDisplayNone
Definition: videoouttypes.h:12
@ kDisplayAVSubtitle
Definition: videoouttypes.h:15
@ kDisplayRawTextSubtitle
Definition: videoouttypes.h:20
@ kDisplayTeletextMenu
Definition: videoouttypes.h:22
@ kDisplayAllTextCaptions
Definition: videoouttypes.h:23
@ kDisplayAllCaptions
Definition: videoouttypes.h:21
@ kDisplayNUVTeletextCaptions
Definition: videoouttypes.h:13
@ kDisplayTextSubtitle
Definition: videoouttypes.h:18
@ kDisplayTeletextCaptions
Definition: videoouttypes.h:14
@ kDisplayDVDButton
Definition: videoouttypes.h:19
@ kDisplayCC708
Definition: videoouttypes.h:17
float get_aspect_override(AspectOverrideMode Aspectmode, float Original)
AdjustFillMode
Definition: videoouttypes.h:72
@ kAdjustFill_Off
Definition: videoouttypes.h:74
@ kAdjustFill_Full
Definition: videoouttypes.h:76
@ kAdjustFill_HorizontalFill
Definition: videoouttypes.h:79
@ kAdjustFill_VerticalFill
Definition: videoouttypes.h:80
@ kAdjustFill_Half
Definition: videoouttypes.h:75
@ kAdjustFill_AutoDetect_DefaultHalf
Definition: videoouttypes.h:83
@ kAdjustFill_VerticalStretch
Definition: videoouttypes.h:78
@ kAdjustFill_HorizontalStretch
Definition: videoouttypes.h:77
@ kAdjustFill_Toggle
Definition: videoouttypes.h:73
@ kAdjustFill_AutoDetect_DefaultOff
Definition: videoouttypes.h:82
@ kAdjustFill_END
Definition: videoouttypes.h:81
PictureAttributeSupported
@ kPictureAttributeSupported_Colour
@ kPictureAttributeSupported_Volume
@ kPictureAttributeSupported_Brightness
@ kPictureAttributeSupported_Range
@ kPictureAttributeSupported_Hue
@ kPictureAttributeSupported_Contrast
@ kPictureAttributeSupported_None
QString StereoscopictoString(StereoscopicMode Mode)
bool is_progressive(FrameScanType Scan)
PrimariesMode toPrimariesMode(const QString &Mode)
QString toUserString(PrimariesMode Mode)
FrameScanType
Definition: videoouttypes.h:95
@ kScan_Intr2ndField
Definition: videoouttypes.h:99
@ kScan_Ignore
Definition: videoouttypes.h:96
@ kScan_Interlaced
Definition: videoouttypes.h:98
@ kScan_Detect
Definition: videoouttypes.h:97
@ kScan_Progressive
PictureAttribute
@ kPictureAttribute_MIN
@ kPictureAttribute_Range
@ kPictureAttribute_Contrast
@ kPictureAttribute_Brightness
@ kPictureAttribute_Volume
@ kPictureAttribute_None
@ kPictureAttribute_Colour
@ kPictureAttribute_MAX
@ kPictureAttribute_Hue
QString toString(AspectOverrideMode Aspectmode)
QString ScanTypeToUserString(FrameScanType Scan, bool Forced=false)
QString ScanTypeToString(FrameScanType Scan)
ZoomDirection
Definition: videoouttypes.h:43
@ kZoomVerticalOut
Definition: videoouttypes.h:48
@ kZoomRight
Definition: videoouttypes.h:54
@ kZoomAspectUp
Definition: videoouttypes.h:55
@ kZoom_END
Definition: videoouttypes.h:57
@ kZoomVerticalIn
Definition: videoouttypes.h:47
@ kZoomHome
Definition: videoouttypes.h:44
@ kZoomUp
Definition: videoouttypes.h:51
@ kZoomDown
Definition: videoouttypes.h:52
@ kZoomLeft
Definition: videoouttypes.h:53
@ kZoomOut
Definition: videoouttypes.h:46
@ kZoomIn
Definition: videoouttypes.h:45
@ kZoomAspectDown
Definition: videoouttypes.h:56
@ kZoomHorizontalIn
Definition: videoouttypes.h:49
@ kZoomHorizontalOut
Definition: videoouttypes.h:50
LetterBoxColour
Definition: videoouttypes.h:87
@ kLetterBoxColour_Toggle
Definition: videoouttypes.h:88
@ kLetterBoxColour_END
Definition: videoouttypes.h:91
@ kLetterBoxColour_Black
Definition: videoouttypes.h:89
@ kLetterBoxColour_Gray25
Definition: videoouttypes.h:90
bool is_interlaced(FrameScanType Scan)
StereoscopicMode
@ kStereoscopicModeAuto
@ kStereoscopicModeTopAndBottomDiscard
@ kStereoscopicModeSideBySideDiscard
@ kStereoscopicModeIgnore3D
PictureAttributeSupported toMask(PictureAttribute PictureAttribute)
bool OptionalCaptionEnabled(uint Captions)
Return whether any optional captions are enabled.
Definition: videoouttypes.h:30
PrimariesMode
@ PrimariesDisabled
@ PrimariesExact
@ PrimariesRelaxed