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