MCPcopy Create free account
hub / github.com/QNapi/qnapi / encodeEntry

Method encodeEntry

libqnapi/src/subconvert/formats/subrip.cpp:117–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117QStringList SubRipSubtitleFormat::encodeEntry(const SubEntry &entry,
118 int i) const {
119 QString tokensBuff;
120 foreach (const SubToken &token, entry.tokens) {
121 tokensBuff += encodeToken(token);
122 }
123
124 int h1 = entry.frameStart / 3600000;
125 int m1 = (entry.frameStart - h1 * 3600000) / 60000;
126 int s1 = (entry.frameStart - h1 * 3600000 - m1 * 60000) / 1000;
127 int ms1 = entry.frameStart - h1 * 3600000 - m1 * 60000 - s1 * 1000;
128
129 int h2 = entry.frameStop / 3600000;
130 int m2 = (entry.frameStop - h2 * 3600000) / 60000;
131 int s2 = (entry.frameStop - h2 * 3600000 - m2 * 60000) / 1000;
132 int ms2 = entry.frameStop - h2 * 3600000 - m2 * 60000 - s2 * 1000;
133
134 QStringList out;
135 out << QString::number(i)
136 << QString("%1:%2:%3,%4 --> %5:%6:%7,%8")
137 .arg(h1, 2, 10, QChar('0'))
138 .arg(m1, 2, 10, QChar('0'))
139 .arg(s1, 2, 10, QChar('0'))
140 .arg(ms1, 3, 10, QChar('0'))
141 .arg(h2, 2, 10, QChar('0'))
142 .arg(m2, 2, 10, QChar('0'))
143 .arg(s2, 2, 10, QChar('0'))
144 .arg(ms2, 3, 10, QChar('0'))
145 << tokensBuff.split("\n");
146 return out;
147}
148
149QString SubRipSubtitleFormat::encodeToken(const SubToken &entry) const {
150 switch (entry.type) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected