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
13
14#include "programtypes.h"
15
16const QString kPlayerInUseID { QStringLiteral("player") };
17const QString kPIPPlayerInUseID { QStringLiteral("pipplayer") };
18const QString kPBPPlayerInUseID { QStringLiteral("pbpplayer") };
19const QString kImportRecorderInUseID { QStringLiteral("import_recorder") };
20const QString kRecorderInUseID { QStringLiteral("recorder") };
21const QString kFileTransferInUseID { QStringLiteral("filetransfer") };
22const QString kTruncatingDeleteInUseID { QStringLiteral("truncatingdelete") };
23const QString kFlaggerInUseID { QStringLiteral("flagger") };
24const QString kTranscoderInUseID { QStringLiteral("transcoder") };
25const QString kPreviewGeneratorInUseID { QStringLiteral("preview_generator") };
26const QString kJobQueueInUseID { QStringLiteral("jobqueue") };
27const 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
68MarkTypes 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
91QString 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
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: */
static guint32 * tmp
Definition: goom_core.cpp:26
std::deque< int > GetPreferredSkipTypeCombinations(void)
const QString kTranscoderInUseID
const QString kPlayerInUseID
const QString kPreviewGeneratorInUseID
const QString kImportRecorderInUseID
QString SkipTypeToString(int flags)
const QString kJobQueueInUseID
const QString kPBPPlayerInUseID
MarkTypes markTypeFromString(const QString &str)
const QString kFlaggerInUseID
const QString kFileTransferInUseID
const QString kRecorderInUseID
QString toString(MarkTypes type)
const QString kCCExtractorInUseID
const QString kPIPPlayerInUseID
const QString kTruncatingDeleteInUseID
AvailableStatusType
Definition: programtypes.h:175
@ asAvailable
Definition: programtypes.h:176
@ asNotYetAvailable
Definition: programtypes.h:177
@ asZeroByte
Definition: programtypes.h:180
@ asPendingDelete
Definition: programtypes.h:178
@ asFileNotFound
Definition: programtypes.h:179
@ asDeleted
Definition: programtypes.h:181
MarkTypes
Definition: programtypes.h:46
@ MARK_ASPECT_4_3
Definition: programtypes.h:65
@ MARK_CUT_START
Definition: programtypes.h:55
@ MARK_INVALID
Definition: programtypes.h:47
@ MARK_SCAN_PROGRESSIVE
Definition: programtypes.h:69
@ MARK_KEYFRAME
Definition: programtypes.h:61
@ MARK_BOOKMARK
Definition: programtypes.h:56
@ MARK_UTIL_PROGSTART
Definition: programtypes.h:75
@ MARK_ASPECT_1_1
deprecated, it is only 1:1 sample aspect ratio
Definition: programtypes.h:64
@ MARK_TOTAL_FRAMES
Definition: programtypes.h:74
@ MARK_GOP_BYFRAME
Definition: programtypes.h:63
@ MARK_SCENE_CHANGE
Definition: programtypes.h:62
@ MARK_CUT_END
Definition: programtypes.h:54
@ MARK_ASPECT_2_21_1
Definition: programtypes.h:67
@ MARK_BLANK_FRAME
Definition: programtypes.h:57
@ MARK_UNSET
Definition: programtypes.h:49
@ MARK_VIDEO_RATE
Definition: programtypes.h:72
@ MARK_VIDEO_HEIGHT
Definition: programtypes.h:71
@ MARK_TMP_CUT_END
Definition: programtypes.h:50
@ MARK_UPDATED_CUT
Definition: programtypes.h:52
@ MARK_UTIL_LASTPLAYPOS
Definition: programtypes.h:76
@ MARK_ASPECT_16_9
Definition: programtypes.h:66
@ MARK_TMP_CUT_START
Definition: programtypes.h:51
@ MARK_PLACEHOLDER
Definition: programtypes.h:53
@ MARK_ALL
Definition: programtypes.h:48
@ MARK_VIDEO_WIDTH
Definition: programtypes.h:70
@ MARK_COMM_END
Definition: programtypes.h:59
@ MARK_COMM_START
Definition: programtypes.h:58
@ MARK_DURATION_MS
Definition: programtypes.h:73
@ MARK_ASPECT_CUSTOM
Definition: programtypes.h:68
@ MARK_GOP_START
Definition: programtypes.h:60
@ COMM_DETECT_COMMFREE
Definition: programtypes.h:128
@ COMM_DETECT_SCENE
Definition: programtypes.h:133
@ COMM_DETECT_PREPOSTROLL
Definition: programtypes.h:147
@ COMM_DETECT_BLANK
Definition: programtypes.h:131
@ COMM_DETECT_2
Definition: programtypes.h:139
@ COMM_DETECT_UNINIT
Definition: programtypes.h:129
@ COMM_DETECT_LOGO
Definition: programtypes.h:134
static stringMarkMap MarkTypeStrings
Definition: programtypes.h:82