@@ -1218,8 +1218,13 @@ void Playlist::loadXSPF(const QString & filename) {
1218
1218
QString location = QUrl::fromPercentEncoding (track.firstChildElement (" location" ).text ().toLatin1 ());
1219
1219
QString title = track.firstChildElement (" title" ).text ();
1220
1220
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
+ }
1223
1228
1224
1229
qDebug () << " Playlist::loadXSPF: location:" << location;
1225
1230
qDebug () << " Playlist::loadXSPF: title:" << title;
@@ -1453,12 +1458,16 @@ bool Playlist::saveXSPF(const QString & filename) {
1453
1458
stream << " \t\t\t <location>" << filename << " </location>\n " ;
1454
1459
stream << " \t\t\t <title>" << title << " </title>\n " ;
1455
1460
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
+ }
1462
1471
stream << " \t\t </track>\n " ;
1463
1472
}
1464
1473
0 commit comments