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 <QString>
6 #include <QObject>
7 
8 enum PIPState
9 {
10  kPIPOff = 0,
15 };
16 
18 {
23  kPIP_END
24 };
25 
27 {
28  kZoomHome = 0,
41  kZoom_END
42 };
43 
45 {
50  kAspect_14_9, // added after 16:9 so as not to upset existing setups.
53 };
54 
56 {
68 };
69 
71 {
76 };
77 
79 {
85 };
86 
88 {
98 };
99 
101 {
109 };
110 
111 #define ALL_PICTURE_ATTRIBUTES static_cast<PictureAttributeSupported> \
112  (kPictureAttributeSupported_Brightness | \
113  kPictureAttributeSupported_Contrast | \
114  kPictureAttributeSupported_Colour | \
115  kPictureAttributeSupported_Hue | \
116  kPictureAttributeSupported_Range)
117 
119 {
124 };
125 
127 {
131 };
132 
133 inline QString toUserString(PrimariesMode Mode)
134 {
135  if (PrimariesMode::PrimariesDisabled == Mode) return QObject::tr("Disabled");
136  if (PrimariesMode::PrimariesExact == Mode) return QObject::tr("Exact");
137  return QObject::tr("Auto");
138 }
139 
140 inline QString toDBString(PrimariesMode Mode)
141 {
142  if (Mode == PrimariesDisabled) return "disabled";
143  if (Mode == PrimariesExact) return "exact";
144  return "auto";
145 }
146 
147 inline PrimariesMode toPrimariesMode(const QString& Mode)
148 {
149  if (Mode == "disabled") return PrimariesDisabled;
150  if (Mode == "exact") return PrimariesExact;
151  return PrimariesRelaxed;
152 }
153 
155 {
156  switch (Mode)
157  {
158  case kStereoscopicModeAuto: return QObject::tr("Auto 3D");
159  case kStereoscopicModeIgnore3D: return QObject::tr("Ignore 3D");
160  case kStereoscopicModeSideBySideDiscard: return QObject::tr("Discard 3D Side by Side");
161  case kStereoscopicModeTopAndBottomDiscard: return QObject::tr("Discard 3D Top and Bottom");
162  }
163  return QObject::tr("Unknown");
164 }
165 
167 {
168  kError_None = 0x00,
170 };
171 
172 inline bool is_interlaced(FrameScanType Scan)
173 {
174  return (kScan_Interlaced == Scan) || (kScan_Intr2ndField == Scan);
175 }
176 
177 inline bool is_progressive(FrameScanType Scan)
178 {
179  return (kScan_Progressive == Scan);
180 }
181 
182 inline QString ScanTypeToUserString(FrameScanType Scan, bool Forced = false)
183 {
184  switch (Scan)
185  {
186  case kScan_Ignore: return QObject::tr("Ignore");
187  case kScan_Detect: return QObject::tr("Detect");
188  case kScan_Progressive: return Forced ? QObject::tr("Progressive (Forced)") : QObject::tr("Progressive");
189  case kScan_Interlaced: return Forced ? QObject::tr("Interlaced (Forced)") : QObject::tr("Interlaced");
190  case kScan_Intr2ndField: return Forced ? QObject::tr("Interlaced (Reversed, Forced)") : QObject::tr("Interlaced (Reversed)");
191  }
192  return QObject::tr("Unknown");
193 }
194 
195 inline QString ScanTypeToString(FrameScanType Scan)
196 {
197  switch (Scan)
198  {
199  case kScan_Ignore: return QString("Ignore Scan");
200  case kScan_Detect: return QString("Detect Scan");
201  case kScan_Interlaced: return QString("Interlaced Scan");
202  case kScan_Progressive: return QString("Progressive Scan");
203  default: return QString("Unknown Scan");
204  }
205 }
206 
207 inline QString toString(PIPState State)
208 {
209  switch (State)
210  {
211  case kPIPOff: return QString("Pip Off");
212  case kPIPonTV: return QString("Pip on TV");
213  case kPIPStandAlone: return QString("Pip Standalone");
214  case kPBPLeft: return QString("PBP Left");
215  case kPBPRight: return QString("PBP Right");
216  }
217  return QString("Unknown");
218 }
219 
220 inline QString toString(PIPLocation Location)
221 {
222  switch (Location)
223  {
224  case kPIPTopLeft: return QObject::tr("Top Left");
225  case kPIPBottomLeft: return QObject::tr("Bottom Left");
226  case kPIPTopRight: return QObject::tr("Top Right");
227  case kPIPBottomRight: return QObject::tr("Bottom Right");
228  case kPIP_END: break;
229  }
230  return "";
231 }
232 
233 inline QString toString(AspectOverrideMode Aspectmode)
234 {
235  switch (Aspectmode)
236  {
237  case kAspect_4_3: return QObject::tr("4:3");
238  case kAspect_14_9: return QObject::tr("14:9");
239  case kAspect_16_9: return QObject::tr("16:9");
240  case kAspect_2_35_1: return QObject::tr("2.35:1");
241  case kAspect_Toggle:
242  case kAspect_Off:
243  case kAspect_END: break;
244  }
245  return QObject::tr("Off");
246 }
247 
248 inline QString toString(LetterBoxColour LetterboxColour)
249 {
250  switch (LetterboxColour)
251  {
252  case kLetterBoxColour_Gray25: return QObject::tr("Gray");
255  case kLetterBoxColour_END: break;
256  }
257  return QObject::tr("Black");
258 }
259 
260 inline float get_aspect_override(AspectOverrideMode Aspectmode, float Original)
261 {
262  switch (Aspectmode)
263  {
264  case kAspect_4_3: return 4.0F / 3.0F;
265  case kAspect_14_9: return 14.0F / 9.0F;
266  case kAspect_16_9: return 16.0F / 9.0F;
267  case kAspect_2_35_1: return 2.35F;
268  case kAspect_Toggle:
269  case kAspect_Off:
270  case kAspect_END: break;
271  }
272  return Original;
273 }
274 
275 inline QString toString(AdjustFillMode Aspectmode)
276 {
277  switch (Aspectmode)
278  {
279  case kAdjustFill_Half: return QObject::tr("Half");
280  case kAdjustFill_Full: return QObject::tr("Full");
281  case kAdjustFill_HorizontalStretch: return QObject::tr("H.Stretch");
282  case kAdjustFill_VerticalStretch: return QObject::tr("V.Stretch");
283  case kAdjustFill_VerticalFill: return QObject::tr("V.Fill");
284  case kAdjustFill_HorizontalFill: return QObject::tr("H.Fill");
285  case kAdjustFill_AutoDetect_DefaultOff: return QObject::tr("Auto Detect (Default Off)");
286  case kAdjustFill_AutoDetect_DefaultHalf: return QObject::tr("Auto Detect (Default Half)");
287  case kAdjustFill_Toggle:
288  case kAdjustFill_Off:
289  case kAdjustFill_END: break;
290  }
291  return QObject::tr("Off");
292 }
293 
295 {
296  switch (PictureAttribute)
297  {
298  case kPictureAttribute_Brightness: return QObject::tr("Brightness");
299  case kPictureAttribute_Contrast: return QObject::tr("Contrast");
300  case kPictureAttribute_Colour: return QObject::tr("Color");
301  case kPictureAttribute_Hue: return QObject::tr("Hue");
302  case kPictureAttribute_Range: return QObject::tr("Range");
303  case kPictureAttribute_Volume: return QObject::tr("Volume");
304  case kPictureAttribute_MAX: return "MAX";
305  case kPictureAttribute_None: break;
306  }
307  return QObject::tr("None");
308 }
309 
311 {
312  switch (PictureAttribute)
313  {
314  case kPictureAttribute_Brightness: return "brightness";
315  case kPictureAttribute_Contrast: return "contrast";
316  case kPictureAttribute_Colour: return "colour";
317  case kPictureAttribute_Hue: return "hue";
321  case kPictureAttribute_MAX: break;
322  }
323  return "";
324 }
325 
326 inline QString toString(PictureAttributeSupported Supported)
327 {
328  QStringList list;
330  list += "Brightness";
331  if (kPictureAttributeSupported_Contrast & Supported)
332  list += "Contrast";
333  if (kPictureAttributeSupported_Colour & Supported)
334  list += "Colour";
335  if (kPictureAttributeSupported_Hue & Supported)
336  list += "Hue";
337  if (kPictureAttributeSupported_Range & Supported)
338  list += "Range";
339  if (kPictureAttributeSupported_Volume & Supported)
340  list += "Volume";
341  return list.join(",");
342 }
343 
345 {
346  switch (PictureAttribute)
347  {
355  case kPictureAttribute_MAX: break;
356  }
358 }
359 
361  PictureAttribute Attribute)
362 {
363  int i = static_cast<int>(Attribute + 1) % static_cast<int>(kPictureAttribute_MAX);
364  for (int j = 0; j < kPictureAttribute_MAX; (i = (i +1 ) % kPictureAttribute_MAX), j++)
365  if (toMask(static_cast<PictureAttribute>(i)) & Supported)
366  return static_cast<PictureAttribute>(i);
367  return kPictureAttribute_None;
368 }
369 
370 #endif // VIDEOOUT_TYPES_H_
PrimariesMode
PrimariesMode
Definition: videoouttypes.h:127
kAspect_Toggle
@ kAspect_Toggle
Definition: videoouttypes.h:46
kAspect_4_3
@ kAspect_4_3
Definition: videoouttypes.h:48
kPictureAttribute_None
@ kPictureAttribute_None
Definition: videoouttypes.h:89
StereoscopictoString
QString StereoscopictoString(StereoscopicMode Mode)
Definition: videoouttypes.h:154
kAdjustFill_Toggle
@ kAdjustFill_Toggle
Definition: videoouttypes.h:57
PrimariesRelaxed
@ PrimariesRelaxed
Definition: videoouttypes.h:129
PictureAttributeSupported
PictureAttributeSupported
Definition: videoouttypes.h:101
kAspect_14_9
@ kAspect_14_9
Definition: videoouttypes.h:50
ScanTypeToUserString
QString ScanTypeToUserString(FrameScanType Scan, bool Forced=false)
Definition: videoouttypes.h:182
kZoomHorizontalIn
@ kZoomHorizontalIn
Definition: videoouttypes.h:33
kScan_Detect
@ kScan_Detect
Definition: videoouttypes.h:81
kPictureAttributeSupported_Colour
@ kPictureAttributeSupported_Colour
Definition: videoouttypes.h:105
kZoomIn
@ kZoomIn
Definition: videoouttypes.h:29
kPIP_END
@ kPIP_END
Definition: videoouttypes.h:23
kAdjustFill_HorizontalStretch
@ kAdjustFill_HorizontalStretch
Definition: videoouttypes.h:61
kZoomAspectUp
@ kZoomAspectUp
Definition: videoouttypes.h:39
kPIPonTV
@ kPIPonTV
Definition: videoouttypes.h:11
kError_None
@ kError_None
Definition: videoouttypes.h:168
is_progressive
bool is_progressive(FrameScanType Scan)
Definition: videoouttypes.h:177
kAdjustFill_Off
@ kAdjustFill_Off
Definition: videoouttypes.h:58
kLetterBoxColour_END
@ kLetterBoxColour_END
Definition: videoouttypes.h:75
kZoomUp
@ kZoomUp
Definition: videoouttypes.h:35
kLetterBoxColour_Black
@ kLetterBoxColour_Black
Definition: videoouttypes.h:73
VideoErrorState
VideoErrorState
Definition: videoouttypes.h:167
kAspect_2_35_1
@ kAspect_2_35_1
Definition: videoouttypes.h:51
kZoomHome
@ kZoomHome
Definition: videoouttypes.h:28
kPictureAttribute_Contrast
@ kPictureAttribute_Contrast
Definition: videoouttypes.h:92
FrameScanType
FrameScanType
Definition: videoouttypes.h:79
toUserString
QString toUserString(PrimariesMode Mode)
Definition: videoouttypes.h:133
kAspect_Off
@ kAspect_Off
Definition: videoouttypes.h:47
kAdjustFill_VerticalStretch
@ kAdjustFill_VerticalStretch
Definition: videoouttypes.h:62
kZoomRight
@ kZoomRight
Definition: videoouttypes.h:38
kPIPOff
@ kPIPOff
Definition: videoouttypes.h:10
toDBString
QString toDBString(PrimariesMode Mode)
Definition: videoouttypes.h:140
kZoomVerticalOut
@ kZoomVerticalOut
Definition: videoouttypes.h:32
kPictureAttributeSupported_Volume
@ kPictureAttributeSupported_Volume
Definition: videoouttypes.h:108
kZoom_END
@ kZoom_END
Definition: videoouttypes.h:41
get_aspect_override
float get_aspect_override(AspectOverrideMode Aspectmode, float Original)
Definition: videoouttypes.h:260
kPictureAttributeSupported_None
@ kPictureAttributeSupported_None
Definition: videoouttypes.h:102
kError_Unknown
@ kError_Unknown
Definition: videoouttypes.h:169
kPictureAttributeSupported_Brightness
@ kPictureAttributeSupported_Brightness
Definition: videoouttypes.h:103
PrimariesDisabled
@ PrimariesDisabled
Definition: videoouttypes.h:128
kZoomLeft
@ kZoomLeft
Definition: videoouttypes.h:37
kPictureAttributeSupported_Contrast
@ kPictureAttributeSupported_Contrast
Definition: videoouttypes.h:104
kPIPBottomRight
@ kPIPBottomRight
Definition: videoouttypes.h:22
kPIPTopLeft
@ kPIPTopLeft
Definition: videoouttypes.h:19
kScan_Intr2ndField
@ kScan_Intr2ndField
Definition: videoouttypes.h:83
kAspect_END
@ kAspect_END
Definition: videoouttypes.h:52
kPictureAttribute_MIN
@ kPictureAttribute_MIN
Definition: videoouttypes.h:90
kAdjustFill_END
@ kAdjustFill_END
Definition: videoouttypes.h:65
kScan_Progressive
@ kScan_Progressive
Definition: videoouttypes.h:84
AspectOverrideMode
AspectOverrideMode
Definition: videoouttypes.h:45
kZoomAspectDown
@ kZoomAspectDown
Definition: videoouttypes.h:40
ScanTypeToString
QString ScanTypeToString(FrameScanType Scan)
Definition: videoouttypes.h:195
kStereoscopicModeIgnore3D
@ kStereoscopicModeIgnore3D
Definition: videoouttypes.h:121
State
State
Definition: zmserver.h:67
kZoomOut
@ kZoomOut
Definition: videoouttypes.h:30
PrimariesExact
@ PrimariesExact
Definition: videoouttypes.h:130
kPictureAttribute_Brightness
@ kPictureAttribute_Brightness
Definition: videoouttypes.h:91
kStereoscopicModeTopAndBottomDiscard
@ kStereoscopicModeTopAndBottomDiscard
Definition: videoouttypes.h:123
kZoomDown
@ kZoomDown
Definition: videoouttypes.h:36
kStereoscopicModeAuto
@ kStereoscopicModeAuto
Definition: videoouttypes.h:120
kAdjustFill_VerticalFill
@ kAdjustFill_VerticalFill
Definition: videoouttypes.h:64
kPictureAttribute_Range
@ kPictureAttribute_Range
Definition: videoouttypes.h:95
kAdjustFill_HorizontalFill
@ kAdjustFill_HorizontalFill
Definition: videoouttypes.h:63
PictureAttribute
PictureAttribute
Definition: videoouttypes.h:88
StereoscopicMode
StereoscopicMode
Definition: videoouttypes.h:119
kPBPLeft
@ kPBPLeft
Definition: videoouttypes.h:13
kLetterBoxColour_Toggle
@ kLetterBoxColour_Toggle
Definition: videoouttypes.h:72
kPIPStandAlone
@ kPIPStandAlone
Definition: videoouttypes.h:12
next
PictureAttribute next(PictureAttributeSupported Supported, PictureAttribute Attribute)
Definition: videoouttypes.h:360
kPictureAttributeSupported_Range
@ kPictureAttributeSupported_Range
Definition: videoouttypes.h:107
PIPLocation
PIPLocation
Definition: videoouttypes.h:18
kScan_Interlaced
@ kScan_Interlaced
Definition: videoouttypes.h:82
kAspect_16_9
@ kAspect_16_9
Definition: videoouttypes.h:49
kLetterBoxColour_Gray25
@ kLetterBoxColour_Gray25
Definition: videoouttypes.h:74
AdjustFillMode
AdjustFillMode
Definition: videoouttypes.h:56
LetterBoxColour
LetterBoxColour
Definition: videoouttypes.h:71
kAdjustFill_AutoDetect_DefaultHalf
@ kAdjustFill_AutoDetect_DefaultHalf
Definition: videoouttypes.h:67
PIPState
PIPState
Definition: videoouttypes.h:9
toMask
PictureAttributeSupported toMask(PictureAttribute PictureAttribute)
Definition: videoouttypes.h:344
kZoomVerticalIn
@ kZoomVerticalIn
Definition: videoouttypes.h:31
kAdjustFill_Half
@ kAdjustFill_Half
Definition: videoouttypes.h:59
kPictureAttributeSupported_Hue
@ kPictureAttributeSupported_Hue
Definition: videoouttypes.h:106
kAdjustFill_AutoDetect_DefaultOff
@ kAdjustFill_AutoDetect_DefaultOff
Definition: videoouttypes.h:66
kPictureAttribute_Volume
@ kPictureAttribute_Volume
Definition: videoouttypes.h:96
kPBPRight
@ kPBPRight
Definition: videoouttypes.h:14
is_interlaced
bool is_interlaced(FrameScanType Scan)
Definition: videoouttypes.h:172
kPIPBottomLeft
@ kPIPBottomLeft
Definition: videoouttypes.h:20
kZoomHorizontalOut
@ kZoomHorizontalOut
Definition: videoouttypes.h:34
kStereoscopicModeSideBySideDiscard
@ kStereoscopicModeSideBySideDiscard
Definition: videoouttypes.h:122
kPictureAttribute_Hue
@ kPictureAttribute_Hue
Definition: videoouttypes.h:94
toPrimariesMode
PrimariesMode toPrimariesMode(const QString &Mode)
Definition: videoouttypes.h:147
kPictureAttribute_MAX
@ kPictureAttribute_MAX
Definition: videoouttypes.h:97
kPIPTopRight
@ kPIPTopRight
Definition: videoouttypes.h:21
toString
QString toString(PIPState State)
Definition: videoouttypes.h:207
kScan_Ignore
@ kScan_Ignore
Definition: videoouttypes.h:80
ZoomDirection
ZoomDirection
Definition: videoouttypes.h:27
kAdjustFill_Full
@ kAdjustFill_Full
Definition: videoouttypes.h:60
kPictureAttribute_Colour
@ kPictureAttribute_Colour
Definition: videoouttypes.h:93