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 {
24 };
25 
27 {
28  kZoomHome = 0,
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 {
125 };
126 
128 {
132 };
133 
134 inline QString toUserString(PrimariesMode Mode)
135 {
136  if (PrimariesMode::PrimariesDisabled == Mode) return QObject::tr("Disabled");
137  if (PrimariesMode::PrimariesExact == Mode) return QObject::tr("Exact");
138  return QObject::tr("Auto");
139 }
140 
141 inline QString toDBString(PrimariesMode Mode)
142 {
143  if (Mode == PrimariesDisabled) return "disabled";
144  if (Mode == PrimariesExact) return "exact";
145  return "auto";
146 }
147 
148 inline PrimariesMode toPrimariesMode(QString Mode)
149 {
150  if (Mode == "disabled") return PrimariesDisabled;
151  if (Mode == "exact") return PrimariesExact;
152  return PrimariesRelaxed;
153 }
154 
156 {
157  switch (Mode)
158  {
159  case kStereoscopicModeNone: return QObject::tr("No 3D");
160  case kStereoscopicModeSideBySide: return QObject::tr("3D Side by Side");
161  case kStereoscopicModeSideBySideDiscard: return QObject::tr("Discard 3D Side by Side");
162  case kStereoscopicModeTopAndBottom: return QObject::tr("3D Top and Bottom");
163  case kStereoscopicModeTopAndBottomDiscard: return QObject::tr("Discard 3D Top and Bottom");
164  }
165  return QObject::tr("Unknown");
166 }
167 
169 {
170  kError_None = 0x00,
172 };
173 
174 inline bool is_interlaced(FrameScanType Scan)
175 {
176  return (kScan_Interlaced == Scan) || (kScan_Intr2ndField == Scan);
177 }
178 
179 inline bool is_progressive(FrameScanType Scan)
180 {
181  return (kScan_Progressive == Scan);
182 }
183 
184 inline QString toString(FrameScanType Scan, bool Brief = false)
185 {
186  switch (Scan)
187  {
188  case kScan_Ignore: return QObject::tr("Ignore");
189  case kScan_Detect: return QObject::tr("Detect");
190  case kScan_Progressive: return QObject::tr("Progressive");
191  case kScan_Interlaced: return Brief ? QObject::tr("Interlaced") : QObject::tr("Interlaced (Normal)");
192  case kScan_Intr2ndField: return Brief ? QObject::tr("Interlaced") : QObject::tr("Interlaced (Reversed)");
193  }
194  return QObject::tr("Unknown");
195 }
196 
197 inline QString toString(PIPState State)
198 {
199  switch (State)
200  {
201  case kPIPOff: return QString("Pip Off");
202  case kPIPonTV: return QString("Pip on TV");
203  case kPIPStandAlone: return QString("Pip Standalone");
204  case kPBPLeft: return QString("PBP Left");
205  case kPBPRight: return QString("PBP Right");
206  }
207  return QString("Unknown");
208 }
209 
210 inline QString toString(PIPLocation Location)
211 {
212  switch (Location)
213  {
214  case kPIPTopLeft: return QObject::tr("Top Left");
215  case kPIPBottomLeft: return QObject::tr("Bottom Left");
216  case kPIPTopRight: return QObject::tr("Top Right");
217  case kPIPBottomRight: return QObject::tr("Bottom Right");
218  case kPIP_END: break;
219  }
220  return "";
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  PictureAttribute Attribute)
352 {
353  int i = static_cast<int>(Attribute + 1) % static_cast<int>(kPictureAttribute_MAX);
354  for (int j = 0; j < kPictureAttribute_MAX; (i = (i +1 ) % kPictureAttribute_MAX), j++)
355  if (toMask(static_cast<PictureAttribute>(i)) & Supported)
356  return static_cast<PictureAttribute>(i);
357  return kPictureAttribute_None;
358 }
359 
360 #endif // VIDEOOUT_TYPES_H_
PrimariesMode
QString StereoscopictoString(StereoscopicMode Mode)
bool is_progressive(FrameScanType Scan)
PictureAttributeSupported
QString toString(FrameScanType Scan, bool Brief=false)
PrimariesMode toPrimariesMode(QString Mode)
QString toDBString(PrimariesMode Mode)
FrameScanType
Definition: videoouttypes.h:78
float get_aspect_override(AspectOverrideMode Aspectmode, float Original)
VideoErrorState
QString toUserString(PrimariesMode Mode)
State
Definition: zmserver.h:62
AspectOverrideMode
Definition: videoouttypes.h:44
PictureAttribute
Definition: videoouttypes.h:87
PIPLocation
Definition: videoouttypes.h:17
AdjustFillMode
Definition: videoouttypes.h:55
StereoscopicMode
PictureAttribute next(PictureAttributeSupported Supported, PictureAttribute Attribute)
PIPState
Definition: videoouttypes.h:8
PictureAttributeSupported toMask(PictureAttribute PictureAttribute)
LetterBoxColour
Definition: videoouttypes.h:70
bool is_interlaced(FrameScanType Scan)
ZoomDirection
Definition: videoouttypes.h:26