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
10 enum
11 {
12  kDisplayNone = 0x000,
16  kDisplayCC608 = 0x008,
17  kDisplayCC708 = 0x010,
24 };
25 
30 inline 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 
43 {
44  kZoomHome = 0,
58 };
59 
61 {
66  kAspect_14_9, // added after 16:9 so as not to upset existing setups.
69 };
70 
72 {
84 };
85 
87 {
92 };
93 
95 {
101 };
102 
104 {
114 };
115 
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 
135 {
140 };
141 
143 {
147 };
148 
149 inline QString toUserString(PrimariesMode Mode)
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 
156 inline QString toDBString(PrimariesMode Mode)
157 {
158  if (Mode == PrimariesDisabled) return "disabled";
159  if (Mode == PrimariesExact) return "exact";
160  return "auto";
161 }
162 
163 inline 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 
183 {
184  kError_None = 0x00,
186 };
187 
188 inline bool is_interlaced(FrameScanType Scan)
189 {
190  return (kScan_Interlaced == Scan) || (kScan_Intr2ndField == Scan);
191 }
192 
193 inline bool is_progressive(FrameScanType Scan)
194 {
195  return (kScan_Progressive == Scan);
196 }
197 
198 inline 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 
211 inline QString ScanTypeToString(FrameScanType Scan)
212 {
213  switch (Scan)
214  {
215  case kScan_Ignore: return QString("Ignore Scan");
216  case kScan_Detect: return QString("Detect Scan");
217  case kScan_Interlaced: return QString("Interlaced Scan");
218  case kScan_Progressive: return QString("Progressive Scan");
219  default: return QString("Unknown Scan");
220  }
221 }
222 
223 inline 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 
238 inline 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 
250 inline 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 
265 inline 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)");
277  case kAdjustFill_Toggle:
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 
316 inline QString toString(PictureAttributeSupported Supported)
317 {
318  QStringList list;
320  list += "Brightness";
321  if (kPictureAttributeSupported_Contrast & Supported)
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);
356  return kPictureAttribute_None;
357 }
358 
359 inline 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
PrimariesMode
PrimariesMode
Definition: videoouttypes.h:142
kAspect_Toggle
@ kAspect_Toggle
Definition: videoouttypes.h:62
kAspect_4_3
@ kAspect_4_3
Definition: videoouttypes.h:64
kPictureAttribute_None
@ kPictureAttribute_None
Definition: videoouttypes.h:105
StereoscopictoString
QString StereoscopictoString(StereoscopicMode Mode)
Definition: videoouttypes.h:170
kAdjustFill_Toggle
@ kAdjustFill_Toggle
Definition: videoouttypes.h:73
PrimariesRelaxed
@ PrimariesRelaxed
Definition: videoouttypes.h:145
PictureAttributeSupported
PictureAttributeSupported
Definition: videoouttypes.h:116
kAspect_14_9
@ kAspect_14_9
Definition: videoouttypes.h:66
ScanTypeToUserString
QString ScanTypeToUserString(FrameScanType Scan, bool Forced=false)
Definition: videoouttypes.h:198
kZoomHorizontalIn
@ kZoomHorizontalIn
Definition: videoouttypes.h:49
kScan_Detect
@ kScan_Detect
Definition: videoouttypes.h:97
kPictureAttributeSupported_Colour
@ kPictureAttributeSupported_Colour
Definition: videoouttypes.h:121
kDisplayTeletextMenu
@ kDisplayTeletextMenu
Definition: videoouttypes.h:22
kZoomIn
@ kZoomIn
Definition: videoouttypes.h:45
kDisplayNone
@ kDisplayNone
Definition: videoouttypes.h:12
kAdjustFill_HorizontalStretch
@ kAdjustFill_HorizontalStretch
Definition: videoouttypes.h:77
GetZoomString
QString GetZoomString(float HorizScale, float VertScale, QPoint Move)
Definition: videoouttypes.h:359
kZoomAspectUp
@ kZoomAspectUp
Definition: videoouttypes.h:55
kError_None
@ kError_None
Definition: videoouttypes.h:184
is_progressive
bool is_progressive(FrameScanType Scan)
Definition: videoouttypes.h:193
kAdjustFill_Off
@ kAdjustFill_Off
Definition: videoouttypes.h:74
kLetterBoxColour_END
@ kLetterBoxColour_END
Definition: videoouttypes.h:91
kZoomUp
@ kZoomUp
Definition: videoouttypes.h:51
kLetterBoxColour_Black
@ kLetterBoxColour_Black
Definition: videoouttypes.h:89
VideoErrorState
VideoErrorState
Definition: videoouttypes.h:182
kAspect_2_35_1
@ kAspect_2_35_1
Definition: videoouttypes.h:67
kZoomHome
@ kZoomHome
Definition: videoouttypes.h:44
toString
QString toString(AspectOverrideMode Aspectmode)
Definition: videoouttypes.h:223
kPictureAttribute_Contrast
@ kPictureAttribute_Contrast
Definition: videoouttypes.h:108
FrameScanType
FrameScanType
Definition: videoouttypes.h:94
toUserString
QString toUserString(PrimariesMode Mode)
Definition: videoouttypes.h:149
kAspect_Off
@ kAspect_Off
Definition: videoouttypes.h:63
kAdjustFill_VerticalStretch
@ kAdjustFill_VerticalStretch
Definition: videoouttypes.h:78
kZoomRight
@ kZoomRight
Definition: videoouttypes.h:54
toDBString
QString toDBString(PrimariesMode Mode)
Definition: videoouttypes.h:156
kZoomVerticalOut
@ kZoomVerticalOut
Definition: videoouttypes.h:48
kPictureAttributeSupported_Volume
@ kPictureAttributeSupported_Volume
Definition: videoouttypes.h:124
kZoom_END
@ kZoom_END
Definition: videoouttypes.h:57
get_aspect_override
float get_aspect_override(AspectOverrideMode Aspectmode, float Original)
Definition: videoouttypes.h:250
kPictureAttributeSupported_None
@ kPictureAttributeSupported_None
Definition: videoouttypes.h:118
kError_Unknown
@ kError_Unknown
Definition: videoouttypes.h:185
kPictureAttributeSupported_Brightness
@ kPictureAttributeSupported_Brightness
Definition: videoouttypes.h:119
PrimariesDisabled
@ PrimariesDisabled
Definition: videoouttypes.h:144
kZoomLeft
@ kZoomLeft
Definition: videoouttypes.h:53
kDisplayCC708
@ kDisplayCC708
Definition: videoouttypes.h:17
kPictureAttributeSupported_Contrast
@ kPictureAttributeSupported_Contrast
Definition: videoouttypes.h:120
kScan_Intr2ndField
@ kScan_Intr2ndField
Definition: videoouttypes.h:99
kDisplayNUVTeletextCaptions
@ kDisplayNUVTeletextCaptions
Definition: videoouttypes.h:13
kAspect_END
@ kAspect_END
Definition: videoouttypes.h:68
kPictureAttribute_MIN
@ kPictureAttribute_MIN
Definition: videoouttypes.h:106
kAdjustFill_END
@ kAdjustFill_END
Definition: videoouttypes.h:81
kScan_Progressive
@ kScan_Progressive
Definition: videoouttypes.h:100
AspectOverrideMode
AspectOverrideMode
Definition: videoouttypes.h:60
kZoomAspectDown
@ kZoomAspectDown
Definition: videoouttypes.h:56
ScanTypeToString
QString ScanTypeToString(FrameScanType Scan)
Definition: videoouttypes.h:211
kStereoscopicModeIgnore3D
@ kStereoscopicModeIgnore3D
Definition: videoouttypes.h:137
kZoomOut
@ kZoomOut
Definition: videoouttypes.h:46
PrimariesExact
@ PrimariesExact
Definition: videoouttypes.h:146
kPictureAttribute_Brightness
@ kPictureAttribute_Brightness
Definition: videoouttypes.h:107
kStereoscopicModeTopAndBottomDiscard
@ kStereoscopicModeTopAndBottomDiscard
Definition: videoouttypes.h:139
next_picattr
PictureAttribute next_picattr(PictureAttributeSupported Supported, PictureAttribute Attribute)
Definition: videoouttypes.h:350
kDisplayRawTextSubtitle
@ kDisplayRawTextSubtitle
Definition: videoouttypes.h:20
kZoomDown
@ kZoomDown
Definition: videoouttypes.h:52
uint
unsigned int uint
Definition: compat.h:140
kStereoscopicModeAuto
@ kStereoscopicModeAuto
Definition: videoouttypes.h:136
kDisplayAllTextCaptions
@ kDisplayAllTextCaptions
Definition: videoouttypes.h:23
kAdjustFill_VerticalFill
@ kAdjustFill_VerticalFill
Definition: videoouttypes.h:80
kPictureAttribute_Range
@ kPictureAttribute_Range
Definition: videoouttypes.h:111
kAdjustFill_HorizontalFill
@ kAdjustFill_HorizontalFill
Definition: videoouttypes.h:79
PictureAttribute
PictureAttribute
Definition: videoouttypes.h:103
StereoscopicMode
StereoscopicMode
Definition: videoouttypes.h:134
kLetterBoxColour_Toggle
@ kLetterBoxColour_Toggle
Definition: videoouttypes.h:88
kDisplayDVDButton
@ kDisplayDVDButton
Definition: videoouttypes.h:19
kPictureAttributeSupported_Range
@ kPictureAttributeSupported_Range
Definition: videoouttypes.h:123
OptionalCaptionEnabled
bool OptionalCaptionEnabled(uint Captions)
Return whether any optional captions are enabled.
Definition: videoouttypes.h:30
kScan_Interlaced
@ kScan_Interlaced
Definition: videoouttypes.h:98
kAspect_16_9
@ kAspect_16_9
Definition: videoouttypes.h:65
kLetterBoxColour_Gray25
@ kLetterBoxColour_Gray25
Definition: videoouttypes.h:90
AdjustFillMode
AdjustFillMode
Definition: videoouttypes.h:71
LetterBoxColour
LetterBoxColour
Definition: videoouttypes.h:86
kDisplayAllCaptions
@ kDisplayAllCaptions
Definition: videoouttypes.h:21
kAdjustFill_AutoDetect_DefaultHalf
@ kAdjustFill_AutoDetect_DefaultHalf
Definition: videoouttypes.h:83
kDisplayCC608
@ kDisplayCC608
Definition: videoouttypes.h:16
toMask
PictureAttributeSupported toMask(PictureAttribute PictureAttribute)
Definition: videoouttypes.h:334
kZoomVerticalIn
@ kZoomVerticalIn
Definition: videoouttypes.h:47
kAdjustFill_Half
@ kAdjustFill_Half
Definition: videoouttypes.h:75
kPictureAttributeSupported_Hue
@ kPictureAttributeSupported_Hue
Definition: videoouttypes.h:122
kAdjustFill_AutoDetect_DefaultOff
@ kAdjustFill_AutoDetect_DefaultOff
Definition: videoouttypes.h:82
kPictureAttribute_Volume
@ kPictureAttribute_Volume
Definition: videoouttypes.h:112
kDisplayAVSubtitle
@ kDisplayAVSubtitle
Definition: videoouttypes.h:15
kDisplayTextSubtitle
@ kDisplayTextSubtitle
Definition: videoouttypes.h:18
is_interlaced
bool is_interlaced(FrameScanType Scan)
Definition: videoouttypes.h:188
kZoomHorizontalOut
@ kZoomHorizontalOut
Definition: videoouttypes.h:50
kStereoscopicModeSideBySideDiscard
@ kStereoscopicModeSideBySideDiscard
Definition: videoouttypes.h:138
kPictureAttribute_Hue
@ kPictureAttribute_Hue
Definition: videoouttypes.h:110
toPrimariesMode
PrimariesMode toPrimariesMode(const QString &Mode)
Definition: videoouttypes.h:163
kPictureAttribute_MAX
@ kPictureAttribute_MAX
Definition: videoouttypes.h:113
kScan_Ignore
@ kScan_Ignore
Definition: videoouttypes.h:96
ZoomDirection
ZoomDirection
Definition: videoouttypes.h:42
kAdjustFill_Full
@ kAdjustFill_Full
Definition: videoouttypes.h:76
kPictureAttribute_Colour
@ kPictureAttribute_Colour
Definition: videoouttypes.h:109
kDisplayTeletextCaptions
@ kDisplayTeletextCaptions
Definition: videoouttypes.h:14