CueParser.cxx: Append pregap to previous track
Only ignore indexes after first nonzero, preserving pregaps but appending them to the previous track instead of prepending to the current. The first index of the first track is used for the start time regardless of its number. Unneeded bool last_updated removed.
This commit is contained in:
		 Will Tiffany
					Will Tiffany
				
			
				
					committed by
					
						 Max Kellermann
						Max Kellermann
					
				
			
			
				
	
			
			
			 Max Kellermann
						Max Kellermann
					
				
			
						parent
						
							e31cdf0df9
						
					
				
				
					commit
					8461d71b52
				
			| @@ -250,7 +250,6 @@ CueParser::Feed2(char *p) | |||||||
| 		song_tag = header_tag; | 		song_tag = header_tag; | ||||||
| 		song_tag.AddItem(TAG_TRACK, nr); | 		song_tag.AddItem(TAG_TRACK, nr); | ||||||
|  |  | ||||||
| 		last_updated = false; |  | ||||||
| 	} 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) { | ||||||
| @@ -266,14 +265,12 @@ CueParser::Feed2(char *p) | |||||||
| 		if (position_ms < 0) | 		if (position_ms < 0) | ||||||
| 			return; | 			return; | ||||||
|  |  | ||||||
| 		if (!last_updated && previous != nullptr && | 		if (previous != nullptr && previous->GetStartTime().ToMS() < (unsigned)position_ms) | ||||||
| 		    previous->GetStartTime().ToMS() < (unsigned)position_ms) { |  | ||||||
| 			last_updated = true; |  | ||||||
| 			previous->SetEndTime(SongTime::FromMS(position_ms)); | 			previous->SetEndTime(SongTime::FromMS(position_ms)); | ||||||
| 		} |  | ||||||
|  |  | ||||||
| 		current->SetStartTime(SongTime::FromMS(position_ms)); | 		current->SetStartTime(SongTime::FromMS(position_ms)); | ||||||
| 		state = IGNORE_TRACK; | 		if(strcmp(nr, "00") != 0 || previous == nullptr) | ||||||
|  | 			state = IGNORE_TRACK; | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -88,12 +88,6 @@ class CueParser { | |||||||
| 	 */ | 	 */ | ||||||
| 	DetachedSong *finished; | 	DetachedSong *finished; | ||||||
|  |  | ||||||
| 	/** |  | ||||||
| 	 * Set to true after previous.end_time has been updated to the |  | ||||||
| 	 * start time of the current song. |  | ||||||
| 	 */ |  | ||||||
| 	bool last_updated; |  | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Tracks whether cue_parser_finish() has been called.  If | 	 * Tracks whether cue_parser_finish() has been called.  If | ||||||
| 	 * true, then all remaining (partial) results will be | 	 * true, then all remaining (partial) results will be | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user