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