Skip to content

Commit a05669b

Browse files
committed
Markers A and B are now XSPF extensions
Signed-off-by: Vladimir V. Bychkov <[email protected]>
1 parent 2834de7 commit a05669b

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

src/playlist.cpp

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,8 +1218,13 @@ void Playlist::loadXSPF(const QString & filename) {
12181218
QString location = QUrl::fromPercentEncoding(track.firstChildElement("location").text().toLatin1());
12191219
QString title = track.firstChildElement("title").text();
12201220
int duration = track.firstChildElement("duration").text().toInt();
1221-
int markerA = track.firstChildElement("smp:markerA").text().toInt();
1222-
int markerB = track.firstChildElement("smp:markerB").text().toInt();
1221+
QDomNode extension = track.firstChildElement("extension");
1222+
int markerA = -1;
1223+
int markerB = -1;
1224+
if (!extension.isNull()) {
1225+
markerA = extension.firstChildElement("smp:markerA").text().toInt();
1226+
markerB = extension.firstChildElement("smp:markerB").text().toInt();
1227+
}
12231228

12241229
qDebug() << "Playlist::loadXSPF: location:" << location;
12251230
qDebug() << "Playlist::loadXSPF: title:" << title;
@@ -1453,12 +1458,16 @@ bool Playlist::saveXSPF(const QString & filename) {
14531458
stream << "\t\t\t<location>" << filename << "</location>\n";
14541459
stream << "\t\t\t<title>" << title << "</title>\n";
14551460
stream << "\t\t\t<duration>" << duration << "</duration>\n";
1456-
if (i->markerA() > 0) {
1457-
stream << "\t\t\t<smp:markerA>" << i->markerA() << "</smp:markerA>\n";
1458-
}
1459-
if (i->markerB() > 0) {
1460-
stream << "\t\t\t<smp:markerB>" << i->markerB() << "</smp:markerB>\n";
1461-
}
1461+
if (i->markerA() > 0 || i->markerB() > 0) {
1462+
stream << "\t\t\t<extension application=\"http://smplayer.info\">\n";
1463+
if (i->markerA() > 0) {
1464+
stream << "\t\t\t\t<smp:markerA>" << i->markerA() << "</smp:markerA>\n";
1465+
}
1466+
if (i->markerB() > 0) {
1467+
stream << "\t\t\t\t<smp:markerB>" << i->markerB() << "</smp:markerB>\n";
1468+
}
1469+
stream << "\t\t\t</extension>\n";
1470+
}
14621471
stream << "\t\t</track>\n";
14631472
}
14641473

0 commit comments

Comments
 (0)