MythTV  master
programtypes.cpp
Go to the documentation of this file.
1 // -*- Mode: c++ -*-
2 
3 #include <QDateTime>
4 #include <QMutex>
5 #include <QObject>
6 
7 #include "programtypes.h"
8 #include "mythdate.h"
9 
10 #include <deque>
11 using std::deque;
12 
13 const char *kPlayerInUseID = "player";
14 const char *kPIPPlayerInUseID = "pipplayer";
15 const char *kPBPPlayerInUseID = "pbpplayer";
16 const char *kImportRecorderInUseID = "import_recorder";
17 const char *kRecorderInUseID = "recorder";
18 const char *kFileTransferInUseID = "filetransfer";
19 const char *kTruncatingDeleteInUseID = "truncatingdelete";
20 const char *kFlaggerInUseID = "flagger";
21 const char *kTranscoderInUseID = "transcoder";
22 const char *kPreviewGeneratorInUseID = "preview_generator";
23 const char *kJobQueueInUseID = "jobqueue";
24 const char *kCCExtractorInUseID = "ccextractor";
25 
27 {
28  switch (type)
29  {
30  case MARK_ALL: return "ALL";
31  case MARK_UNSET: return "UNSET";
32  case MARK_TMP_CUT_END: return "TMP_CUT_END";
33  case MARK_TMP_CUT_START:return "TMP_CUT_START";
34  case MARK_UPDATED_CUT: return "UPDATED_CUT";
35  case MARK_PLACEHOLDER: return "PLACEHOLDER";
36  case MARK_CUT_END: return "CUT_END";
37  case MARK_CUT_START: return "CUT_START";
38  case MARK_BOOKMARK: return "BOOKMARK";
39  case MARK_BLANK_FRAME: return "BLANK_FRAME";
40  case MARK_COMM_START: return "COMM_START";
41  case MARK_COMM_END: return "COMM_END";
42  case MARK_GOP_START: return "GOP_START";
43  case MARK_KEYFRAME: return "KEYFRAME";
44  case MARK_SCENE_CHANGE: return "SCENE_CHANGE";
45  case MARK_GOP_BYFRAME: return "GOP_BYFRAME";
46  case MARK_ASPECT_1_1: return "ASPECT_1_1 (depreciated)";
47  case MARK_ASPECT_4_3: return "ASPECT_4_3";
48  case MARK_ASPECT_16_9: return "ASPECT_16_9";
49  case MARK_ASPECT_2_21_1:return "ASPECT_2_21_1";
50  case MARK_ASPECT_CUSTOM:return "ASPECT_CUSTOM";
51  case MARK_SCAN_PROGRESSIVE: return "PROGRESSIVE";
52  case MARK_VIDEO_WIDTH: return "VIDEO_WIDTH";
53  case MARK_VIDEO_HEIGHT: return "VIDEO_HEIGHT";
54  case MARK_VIDEO_RATE: return "VIDEO_RATE";
55  case MARK_DURATION_MS: return "DURATION_MS";
56  case MARK_TOTAL_FRAMES: return "TOTAL_FRAMES";
57  case MARK_UTIL_PROGSTART: return "UTIL_PROGSTART";
58  case MARK_UTIL_LASTPLAYPOS: return "UTIL_LASTPLAYPOS";
59  }
60 
61  return "unknown";
62 }
63 
65 {
66  switch (status)
67  {
68  case asAvailable: return "Available";
69  case asNotYetAvailable: return "NotYetAvailable";
70  case asPendingDelete: return "PendingDelete";
71  case asFileNotFound: return "FileNotFound";
72  case asZeroByte: return "ZeroByte";
73  case asDeleted: return "Deleted";
74  }
75  return QString("Unknown(%1)").arg((int)status);
76 }
77 
78 
79 QString SkipTypeToString(int flags)
80 {
81  if (COMM_DETECT_COMMFREE == flags)
82  return QObject::tr("Commercial Free");
83  if (COMM_DETECT_UNINIT == flags)
84  return QObject::tr("Use Global Setting");
85 
86  QChar chr = '0';
87  QString ret = QString("0x%1").arg(flags,3,16,chr);
88  bool blank = (COMM_DETECT_BLANK & flags) != 0;
89  bool scene = (COMM_DETECT_SCENE & flags) != 0;
90  bool logo = (COMM_DETECT_LOGO & flags) != 0;
91  bool exp = (COMM_DETECT_2 & flags) != 0;
92  bool prePst= (COMM_DETECT_PREPOSTROLL & flags) != 0;
93 
94  if (blank && scene && logo)
95  ret = QObject::tr("All Available Methods");
96  else if (blank && scene && !logo)
97  ret = QObject::tr("Blank Frame + Scene Change");
98  else if (blank && !scene && logo)
99  ret = QObject::tr("Blank Frame + Logo Detection");
100  else if (!blank && scene && logo)
101  ret = QObject::tr("Scene Change + Logo Detection");
102  else if (blank && !scene && !logo)
103  ret = QObject::tr("Blank Frame Detection");
104  else if (!blank && scene && !logo)
105  ret = QObject::tr("Scene Change Detection");
106  else if (!blank && !scene && logo)
107  ret = QObject::tr("Logo Detection");
108 
109  if (exp)
110  ret = QObject::tr("Experimental") + ": " + ret;
111  else if(prePst)
112  ret = QObject::tr("Pre & Post Roll") + ": " + ret;
113 
114  return ret;
115 }
116 
118 {
119  deque<int> tmp;
121  tmp.push_back(COMM_DETECT_BLANK);
123  tmp.push_back(COMM_DETECT_SCENE);
124  tmp.push_back(COMM_DETECT_LOGO);
128  return tmp;
129 }
130 
131 /* vim: set expandtab tabstop=4 shiftwidth=4: */
COMM_DETECT_SCENE
@ COMM_DETECT_SCENE
Definition: programtypes.h:98
MARK_KEYFRAME
@ MARK_KEYFRAME
Definition: programtypes.h:62
MARK_ASPECT_16_9
@ MARK_ASPECT_16_9
Definition: programtypes.h:67
MARK_COMM_END
@ MARK_COMM_END
Definition: programtypes.h:60
MARK_ASPECT_2_21_1
@ MARK_ASPECT_2_21_1
Definition: programtypes.h:68
kFlaggerInUseID
const char * kFlaggerInUseID
Definition: programtypes.cpp:20
asFileNotFound
@ asFileNotFound
Definition: programtypes.h:222
kRecorderInUseID
const char * kRecorderInUseID
Definition: programtypes.cpp:17
MARK_PLACEHOLDER
@ MARK_PLACEHOLDER
Definition: programtypes.h:54
asAvailable
@ asAvailable
Definition: programtypes.h:219
kImportRecorderInUseID
const char * kImportRecorderInUseID
Definition: programtypes.cpp:16
MARK_CUT_END
@ MARK_CUT_END
Definition: programtypes.h:55
COMM_DETECT_PREPOSTROLL
@ COMM_DETECT_PREPOSTROLL
Definition: programtypes.h:112
asDeleted
@ asDeleted
Definition: programtypes.h:224
kTruncatingDeleteInUseID
const char * kTruncatingDeleteInUseID
Definition: programtypes.cpp:19
SkipTypeToString
QString SkipTypeToString(int flags)
Definition: programtypes.cpp:79
AvailableStatusType
AvailableStatusType
Definition: programtypes.h:218
MARK_UTIL_PROGSTART
@ MARK_UTIL_PROGSTART
Definition: programtypes.h:76
tmp
static guint32 * tmp
Definition: goom_core.cpp:31
programtypes.h
toString
QString toString(MarkTypes type)
Definition: programtypes.cpp:26
mythdate.h
asPendingDelete
@ asPendingDelete
Definition: programtypes.h:221
kPreviewGeneratorInUseID
const char * kPreviewGeneratorInUseID
Definition: programtypes.cpp:22
COMM_DETECT_COMMFREE
@ COMM_DETECT_COMMFREE
Definition: programtypes.h:93
MARK_DURATION_MS
@ MARK_DURATION_MS
Definition: programtypes.h:74
kPBPPlayerInUseID
const char * kPBPPlayerInUseID
Definition: programtypes.cpp:15
MARK_GOP_START
@ MARK_GOP_START
Definition: programtypes.h:61
MARK_ASPECT_CUSTOM
@ MARK_ASPECT_CUSTOM
Definition: programtypes.h:69
kJobQueueInUseID
const char * kJobQueueInUseID
Definition: programtypes.cpp:23
MARK_ALL
@ MARK_ALL
Definition: programtypes.h:49
MARK_TMP_CUT_END
@ MARK_TMP_CUT_END
Definition: programtypes.h:51
MARK_VIDEO_WIDTH
@ MARK_VIDEO_WIDTH
Definition: programtypes.h:71
MARK_BOOKMARK
@ MARK_BOOKMARK
Definition: programtypes.h:57
asZeroByte
@ asZeroByte
Definition: programtypes.h:223
MARK_VIDEO_HEIGHT
@ MARK_VIDEO_HEIGHT
Definition: programtypes.h:72
MARK_VIDEO_RATE
@ MARK_VIDEO_RATE
Definition: programtypes.h:73
GetPreferredSkipTypeCombinations
deque< int > GetPreferredSkipTypeCombinations(void)
Definition: programtypes.cpp:117
MARK_TOTAL_FRAMES
@ MARK_TOTAL_FRAMES
Definition: programtypes.h:75
kTranscoderInUseID
const char * kTranscoderInUseID
Definition: programtypes.cpp:21
MARK_ASPECT_4_3
@ MARK_ASPECT_4_3
Definition: programtypes.h:66
COMM_DETECT_UNINIT
@ COMM_DETECT_UNINIT
Definition: programtypes.h:94
kPIPPlayerInUseID
const char * kPIPPlayerInUseID
Definition: programtypes.cpp:14
MARK_CUT_START
@ MARK_CUT_START
Definition: programtypes.h:56
MARK_ASPECT_1_1
@ MARK_ASPECT_1_1
deprecated, it is only 1:1 sample aspect ratio
Definition: programtypes.h:65
MARK_UTIL_LASTPLAYPOS
@ MARK_UTIL_LASTPLAYPOS
Definition: programtypes.h:77
MARK_GOP_BYFRAME
@ MARK_GOP_BYFRAME
Definition: programtypes.h:64
MARK_UPDATED_CUT
@ MARK_UPDATED_CUT
Definition: programtypes.h:53
MARK_SCENE_CHANGE
@ MARK_SCENE_CHANGE
Definition: programtypes.h:63
MarkTypes
MarkTypes
Definition: programtypes.h:48
kFileTransferInUseID
const char * kFileTransferInUseID
Definition: programtypes.cpp:18
MARK_UNSET
@ MARK_UNSET
Definition: programtypes.h:50
COMM_DETECT_LOGO
@ COMM_DETECT_LOGO
Definition: programtypes.h:99
kCCExtractorInUseID
const char * kCCExtractorInUseID
Definition: programtypes.cpp:24
MARK_SCAN_PROGRESSIVE
@ MARK_SCAN_PROGRESSIVE
Definition: programtypes.h:70
asNotYetAvailable
@ asNotYetAvailable
Definition: programtypes.h:220
MARK_COMM_START
@ MARK_COMM_START
Definition: programtypes.h:59
kPlayerInUseID
const char * kPlayerInUseID
Definition: programtypes.cpp:13
COMM_DETECT_2
@ COMM_DETECT_2
Definition: programtypes.h:104
MARK_TMP_CUT_START
@ MARK_TMP_CUT_START
Definition: programtypes.h:52
MARK_BLANK_FRAME
@ MARK_BLANK_FRAME
Definition: programtypes.h:58
COMM_DETECT_BLANK
@ COMM_DETECT_BLANK
Definition: programtypes.h:96