Commit ebed7e21 authored by Max Kellermann's avatar Max Kellermann

playlist/cue/Parser: parse tags after "INDEX 01"

Instead of setting state=IGNORE_TRACK, ignore only the following "INDEX" lines. Correction for commit 8461d71b. Closes #227
parent 53f5d4c7
...@@ -229,6 +229,8 @@ CueParser::Feed2(char *p) noexcept ...@@ -229,6 +229,8 @@ CueParser::Feed2(char *p) noexcept
} }
state = TRACK; state = TRACK;
ignore_index = false;
current.reset(new DetachedSong(filename)); current.reset(new DetachedSong(filename));
assert(!current->GetTag().IsDefined()); assert(!current->GetTag().IsDefined());
...@@ -238,6 +240,9 @@ CueParser::Feed2(char *p) noexcept ...@@ -238,6 +240,9 @@ CueParser::Feed2(char *p) noexcept
} else if (state == IGNORE_TRACK) { } else if (state == IGNORE_TRACK) {
return; return;
} else if (state == TRACK && strcmp(command, "INDEX") == 0) { } else if (state == TRACK && strcmp(command, "INDEX") == 0) {
if (ignore_index)
return;
const char *nr = cue_next_token(&p); const char *nr = cue_next_token(&p);
if (nr == nullptr) if (nr == nullptr)
return; return;
...@@ -255,7 +260,7 @@ CueParser::Feed2(char *p) noexcept ...@@ -255,7 +260,7 @@ CueParser::Feed2(char *p) noexcept
current->SetStartTime(SongTime::FromMS(position_ms)); current->SetStartTime(SongTime::FromMS(position_ms));
if(strcmp(nr, "00") != 0 || previous == nullptr) if(strcmp(nr, "00") != 0 || previous == nullptr)
state = IGNORE_TRACK; ignore_index = true;
} }
} }
......
...@@ -88,6 +88,13 @@ class CueParser { ...@@ -88,6 +88,13 @@ class CueParser {
std::unique_ptr<DetachedSong> finished; std::unique_ptr<DetachedSong> finished;
/** /**
* Ignore "INDEX" lines? Only up the first one after "00" is
* used. If there is a pregap (INDEX 00..01), it is assigned
* to the previous song.
*/
bool ignore_index;
/**
* Tracks whether Finish() has been called. If true, then all * Tracks whether Finish() has been called. If true, then all
* remaining (partial) results will be delivered by Get(). * remaining (partial) results will be delivered by Get().
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment