Skip to content

Commit

Permalink
Markers A and B are now XSPF extensions
Browse files Browse the repository at this point in the history
Signed-off-by: Vladimir V. Bychkov <[email protected]>
  • Loading branch information
bvfalcon committed Mar 29, 2021
1 parent 606ba72 commit 1c9391f
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions src/playlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1212,8 +1212,13 @@ void Playlist::loadXSPF(const QString & filename) {
QString location = QUrl::fromPercentEncoding(track.firstChildElement("location").text().toLatin1());
QString title = track.firstChildElement("title").text();
int duration = track.firstChildElement("duration").text().toInt();
int markerA = track.firstChildElement("smp:markerA").text().toInt();
int markerB = track.firstChildElement("smp:markerB").text().toInt();
QDomNode extension = track.firstChildElement("extension");
int markerA = -1;
int markerB = -1;
if (!extension.isNull()) {
markerA = extension.firstChildElement("smp:markerA").text().toInt();
markerB = extension.firstChildElement("smp:markerB").text().toInt();
}

qDebug() << "Playlist::loadXSPF: location:" << location;
qDebug() << "Playlist::loadXSPF: title:" << title;
Expand Down Expand Up @@ -1447,12 +1452,16 @@ bool Playlist::saveXSPF(const QString & filename) {
stream << "\t\t\t<location>" << filename << "</location>\n";
stream << "\t\t\t<title>" << title << "</title>\n";
stream << "\t\t\t<duration>" << duration << "</duration>\n";
if (i->markerA() > 0) {
stream << "\t\t\t<smp:markerA>" << i->markerA() << "</smp:markerA>\n";
}
if (i->markerB() > 0) {
stream << "\t\t\t<smp:markerB>" << i->markerB() << "</smp:markerB>\n";
}
if (i->markerA() > 0 || i->markerB() > 0) {
stream << "\t\t\t<extension application=\"http://smplayer.info\">\n";
if (i->markerA() > 0) {
stream << "\t\t\t\t<smp:markerA>" << i->markerA() << "</smp:markerA>\n";
}
if (i->markerB() > 0) {
stream << "\t\t\t\t<smp:markerB>" << i->markerB() << "</smp:markerB>\n";
}
stream << "\t\t\t</extension>\n";
}
stream << "\t\t</track>\n";
}

Expand Down

0 comments on commit 1c9391f

Please sign in to comment.