Support for wierd CDs with two data tracks before audio.

Minor enhancements to CTDB download routine, fixed support for parity files without header
This commit is contained in:
chudov
2011-06-03 19:15:28 +00:00
parent 1b5336164c
commit 020610a2ea
35 changed files with 350 additions and 27 deletions

View File

@@ -2244,6 +2244,7 @@ namespace Bwg.Scsi
/// Read the CD text information from the leadin using the ReadTocPmaAtip command form /// Read the CD text information from the leadin using the ReadTocPmaAtip command form
/// </summary> /// </summary>
/// <param name="data"></param> /// <param name="data"></param>
/// <param name="_timeout"></param>
/// <returns></returns> /// <returns></returns>
public CommandStatus ReadCDText(out byte [] data, int _timeout) public CommandStatus ReadCDText(out byte [] data, int _timeout)
{ {

View File

@@ -148,6 +148,10 @@ namespace CUETools.CTDB
req.UserAgent = this.userAgent; req.UserAgent = this.userAgent;
req.Timeout = connectTimeout; req.Timeout = connectTimeout;
req.ReadWriteTimeout = socketTimeout; req.ReadWriteTimeout = socketTimeout;
req.AutomaticDecompression = DecompressionMethods.None;
if (uploadHelper.onProgress != null)
uploadHelper.onProgress(url, new UploadProgressEventArgs(req.RequestUri.AbsoluteUri, 0.0));
currentReq = req; currentReq = req;
try try
@@ -156,30 +160,34 @@ namespace CUETools.CTDB
{ {
entry.httpStatus = resp.StatusCode; entry.httpStatus = resp.StatusCode;
if (entry.httpStatus == HttpStatusCode.OK)
{
if (resp.ContentLength < entry.npar * entry.stride * 4 ||
resp.ContentLength > entry.npar * entry.stride * 8)
{
entry.httpStatus = HttpStatusCode.PartialContent;
}
}
if (entry.httpStatus == HttpStatusCode.OK) if (entry.httpStatus == HttpStatusCode.OK)
{ {
using (Stream responseStream = resp.GetResponseStream()) using (Stream responseStream = resp.GetResponseStream())
{ {
using (MemoryStream memoryStream = new MemoryStream()) byte[] contents = new byte[resp.ContentLength];
{ int pos = 0, count = 0;
byte[] buffer = new byte[16536];
int count = 0, pos = 0;
do do
{ {
if (uploadHelper.onProgress != null) count = responseStream.Read(contents, pos, Math.Min(contents.Length - pos, 32768));
uploadHelper.onProgress(url, new UploadProgressEventArgs(req.RequestUri.AbsoluteUri, ((double)pos) / resp.ContentLength));
count = responseStream.Read(buffer, 0, buffer.Length);
memoryStream.Write(buffer, 0, count);
pos += count; pos += count;
if (uploadHelper.onProgress != null)
uploadHelper.onProgress(url, new UploadProgressEventArgs(req.RequestUri.AbsoluteUri, ((double)pos) / contents.Length));
} while (count != 0); } while (count != 0);
var contents = memoryStream.ToArray();
if (!Parse(contents, entry)) if (!Parse(contents, entry))
entry.httpStatus = HttpStatusCode.NoContent; entry.httpStatus = HttpStatusCode.NoContent;
} }
} }
} }
} }
}
catch (WebException ex) catch (WebException ex)
{ {
if (ex.Status == WebExceptionStatus.ProtocolError) if (ex.Status == WebExceptionStatus.ProtocolError)
@@ -319,7 +327,7 @@ namespace CUETools.CTDB
private bool Parse(byte[] contents, DBEntry entry) private bool Parse(byte[] contents, DBEntry entry)
{ {
if (contents.Length == entry.npar * entry.stride) if (contents.Length == entry.npar * entry.stride * 4)
{ {
entry.parity = contents; entry.parity = contents;
entry.pos = 0; entry.pos = 0;

View File

@@ -2758,8 +2758,7 @@ string status = processor.Go();
if (_sourcePaths.Count > 0) if (_sourcePaths.Count > 0)
throw new Exception("Extra file in embedded CUE sheet: \"" + line.Params[1] + "\"."); throw new Exception("Extra file in embedded CUE sheet: \"" + line.Params[1] + "\".");
} }
_sourcePaths.Add(pathAudio);
absoluteFileStartTime += fileTimeLengthFrames;
if (pathAudio == null) if (pathAudio == null)
{ {
throw new Exception("Unable to locate file \"" + line.Params[1] + "\"."); throw new Exception("Unable to locate file \"" + line.Params[1] + "\".");
@@ -2772,7 +2771,19 @@ string status = processor.Go();
} }
else else
{ {
// Wierd case: audio file after data track with only index 00 specified.
if (!isAudioTrack && _sourcePaths.Count == 0 && indexes.Count > 0 && indexes[indexes.Count - 1].Index == 0)
{
indexInfo.Track = indexes[indexes.Count - 1].Track;
indexInfo.Index = 1;
indexInfo.Time = indexes[indexes.Count - 1].Time + 150;
indexes.Add(indexInfo);
absoluteFileStartTime += 150;
}
TagLib.File fileInfo; TagLib.File fileInfo;
_sourcePaths.Add(pathAudio);
absoluteFileStartTime += fileTimeLengthFrames;
fileTimeLengthSamples = GetSampleLength(pathAudio, out fileInfo); fileTimeLengthSamples = GetSampleLength(pathAudio, out fileInfo);
if ((fileTimeLengthSamples % 588) == 492 && _config.truncate4608ExtraSamples) if ((fileTimeLengthSamples % 588) == 492 && _config.truncate4608ExtraSamples)
{ {
@@ -3120,16 +3131,33 @@ string status = processor.Go();
} }
// use data track length from log // use data track length from log
if (tocFromLog != null && tocFromLog.AudioTracks == _toc.AudioTracks && tocFromLog.TrackCount == tocFromLog.AudioTracks + 1) if (tocFromLog != null && tocFromLog.AudioTracks == _toc.AudioTracks)
{ {
if (!tocFromLog[tocFromLog.TrackCount].IsAudio) if (tocFromLog.TrackCount == tocFromLog.AudioTracks + 1 && !tocFromLog[tocFromLog.TrackCount].IsAudio)
{ {
DataTrackLength = tocFromLog[tocFromLog.TrackCount].Length; DataTrackLength = tocFromLog[tocFromLog.TrackCount].Length;
_toc[_toc.TrackCount].Start = tocFromLog[_toc.TrackCount].Start; _toc[_toc.TrackCount].Start = tocFromLog[_toc.TrackCount].Start;
_toc[_toc.TrackCount][0].Start = tocFromLog[_toc.TrackCount].Start; _toc[_toc.TrackCount][0].Start = tocFromLog[_toc.TrackCount].Start;
_toc[_toc.TrackCount][1].Start = tocFromLog[_toc.TrackCount].Start; _toc[_toc.TrackCount][1].Start = tocFromLog[_toc.TrackCount].Start;
} else }
DataTrackLength = tocFromLog[1].Length; else if (tocFromLog.TrackCount == _toc.TrackCount
&& tocFromLog.FirstAudio == _toc.FirstAudio
&& tocFromLog.TrackCount == tocFromLog.FirstAudio + tocFromLog.AudioTracks - 1)
{
//DataTrackLength = tocFromLog[1].Length;
uint delta = tocFromLog[_toc.FirstAudio].Start - _toc[_toc.FirstAudio].Start;
for (int itr = 1; itr < _toc.FirstAudio; itr++)
{
_toc[itr].Start = tocFromLog[itr].Start;
_toc[itr].Length = tocFromLog[itr].Length;
}
for (int itr = _toc.FirstAudio; itr <= _toc.TrackCount; itr++)
{
_toc[itr].Start += delta;
for (int j = 0; j <= _toc[itr].LastIndex; j++)
_toc[itr][j].Start += delta;
}
}
} }
// use data track length from log // use data track length from log
@@ -4127,7 +4155,7 @@ string status = processor.Go();
(_CUEToolsDB.Total < 100) ? "{0:00}/{1:00}" : "{0:000}/{1:000}"; (_CUEToolsDB.Total < 100) ? "{0:00}/{1:00}" : "{0:000}/{1:000}";
string conf = string.Format(confFormat, entry.conf, _CUEToolsDB.Total); string conf = string.Format(confFormat, entry.conf, _CUEToolsDB.Total);
string dataTrackInfo = !entry.toc[entry.toc.TrackCount].IsAudio ? string.Format("CD-Extra data track length {0}", entry.toc[entry.toc.TrackCount].LengthMSF) : string dataTrackInfo = !entry.toc[entry.toc.TrackCount].IsAudio ? string.Format("CD-Extra data track length {0}", entry.toc[entry.toc.TrackCount].LengthMSF) :
!entry.toc[1].IsAudio ? string.Format("Playstation type data track length {0}", entry.toc[1].LengthMSF) : "Has no data track"; !entry.toc[1].IsAudio ? string.Format("Playstation type data track length {0}", entry.toc[entry.toc.FirstAudio].StartMSF) : "Has no data track";
string status = string status =
entry.toc.Pregap != _toc.Pregap ? string.Format("Has pregap length {0}", CDImageLayout.TimeToString(entry.toc.Pregap)) : entry.toc.Pregap != _toc.Pregap ? string.Format("Has pregap length {0}", CDImageLayout.TimeToString(entry.toc.Pregap)) :
entry.toc.AudioLength != _toc.AudioLength ? string.Format("Has audio length {0}", CDImageLayout.TimeToString(entry.toc.AudioLength)) : entry.toc.AudioLength != _toc.AudioLength ? string.Format("Has audio length {0}", CDImageLayout.TimeToString(entry.toc.AudioLength)) :
@@ -4149,7 +4177,7 @@ string status = processor.Go();
if (PreGapLength != 0) if (PreGapLength != 0)
sw.WriteLine("Pregap length {0}.", PreGapLengthMSF); sw.WriteLine("Pregap length {0}.", PreGapLengthMSF);
if (!_toc[1].IsAudio) if (!_toc[1].IsAudio)
sw.WriteLine("Playstation type data track length {0}.", _toc[1].LengthMSF); sw.WriteLine("Playstation type data track length {0}.", _toc[_toc.FirstAudio].StartMSF);
if (!_toc[_toc.TrackCount].IsAudio) if (!_toc[_toc.TrackCount].IsAudio)
sw.WriteLine("CD-Extra data track length {0}.", sw.WriteLine("CD-Extra data track length {0}.",
_toc[_toc.TrackCount].Length == 0 && _minDataTrackLength.HasValue ? _toc[_toc.TrackCount].Length == 0 && _minDataTrackLength.HasValue ?

View File

@@ -82,17 +82,23 @@ namespace CUETools.TestProcessor
// test playstation-type CD-Extra // test playstation-type CD-Extra
CUESheet target = new CUESheet(new CUEConfig()); CUESheet target = new CUESheet(new CUEConfig());
target.Open("Circuitry\\1.cue"); target.Open("Circuitry\\1.cue");
Assert.AreEqual<string>("00078c13-001b4ab9-40086205", AccurateRipVerify.CalculateAccurateRipId(target.TOC), "Wrong TOC"); Assert.AreEqual<string>("-0:37001:70001:99814:126819:160976", target.TOC.ToString(), "Wrong TOC");
// test playstation-type CD-Extra with nonstandard pregap // test playstation-type CD-Extra with nonstandard pregap
target = new CUESheet(new CUEConfig()); target = new CUESheet(new CUEConfig());
target.Open("Headcandy\\Headcandy.cue"); target.Open("Headcandy\\Headcandy.cue");
Assert.AreEqual<string>("0014fc22-0052b286-62104a06", AccurateRipVerify.CalculateAccurateRipId(target.TOC), "Wrong TOC"); Assert.AreEqual<string>("-0:141942:168581:223645:248699:279575:312824", target.TOC.ToString(), "Wrong TOC");
// test playstation-type CD-Extra with no info in cuesheet // test playstation-type CD-Extra with no info in cuesheet
target = new CUESheet(new CUEConfig()); target = new CUESheet(new CUEConfig());
target.Open("Anatomy\\Anatomy.cue"); target.Open("Anatomy\\Anatomy.cue");
Assert.AreEqual<string>("002a09da-01e82f64-f00f4811", AccurateRipVerify.CalculateAccurateRipId(target.TOC), "Wrong TOC"); Assert.AreEqual<string>("-0:19687:33144:50680:69872:89822:108084:132098:150625:166271:194882:200172:215884:236046:242815:269518:282018:293416", target.TOC.ToString(), "Wrong TOC");
// test playstation-type CD-Extra with two data tracks
target = new CUESheet(new CUEConfig());
target.Open("Les Mysterieuses Cites d'Or\\Les Mysterieuses Cites d'Or.cue");
Assert.AreEqual<string>("-0:-31952:127883:137816:149173:160223:171479:180777:186738:196134:205613:214526:221674:227031:232824:239376:249495:259604:266115:267080:275100:281599:284452:291422:295511:297642:302114:309263:312269:320051:326235:333841", target.TOC.ToString(), "Wrong TOC");
} }
/// <summary> /// <summary>

View File

@@ -0,0 +1,96 @@
REM GENRE Anime
REM DISCID F211631F
REM COMMENT "ExactAudioCopy v0.99pb5"
FILE "<Filename>.iso" BINARY
TRACK 01 MODEx/2xxx
INDEX 01 00:00:00
TRACK 02 MODEx/2xxx
INDEX 00 07:04:02
FILE "03.dummy" WAVE
TRACK 03 AUDIO
PREGAP 00:00:03
INDEX 01 00:00:00
FILE "04.dummy" WAVE
TRACK 04 AUDIO
INDEX 01 00:00:00
FILE "05.dummy" WAVE
TRACK 05 AUDIO
INDEX 01 00:00:00
FILE "06.dummy" WAVE
TRACK 06 AUDIO
INDEX 01 00:00:00
FILE "07.dummy" WAVE
TRACK 07 AUDIO
INDEX 01 00:00:00
FILE "08.dummy" WAVE
TRACK 08 AUDIO
INDEX 01 00:00:00
FILE "09.dummy" WAVE
TRACK 09 AUDIO
INDEX 01 00:00:00
FILE "10.dummy" WAVE
TRACK 10 AUDIO
INDEX 01 00:00:00
FILE "11.dummy" WAVE
TRACK 11 AUDIO
INDEX 01 00:00:00
FILE "12.dummy" WAVE
TRACK 12 AUDIO
INDEX 01 00:00:00
FILE "13.dummy" WAVE
TRACK 13 AUDIO
INDEX 01 00:00:00
FILE "14.dummy" WAVE
TRACK 14 AUDIO
INDEX 01 00:00:00
FILE "15.dummy" WAVE
TRACK 15 AUDIO
INDEX 01 00:00:00
FILE "16.dummy" WAVE
TRACK 16 AUDIO
INDEX 01 00:00:00
FILE "17.dummy" WAVE
TRACK 17 AUDIO
INDEX 01 00:00:00
FILE "18.dummy" WAVE
TRACK 18 AUDIO
INDEX 01 00:00:00
FILE "19.dummy" WAVE
TRACK 19 AUDIO
INDEX 01 00:00:00
FILE "20.dummy" WAVE
TRACK 20 AUDIO
INDEX 01 00:00:00
FILE "21.dummy" WAVE
TRACK 21 AUDIO
INDEX 01 00:00:00
FILE "22.dummy" WAVE
TRACK 22 AUDIO
INDEX 01 00:00:00
FILE "23.dummy" WAVE
TRACK 23 AUDIO
INDEX 01 00:00:00
FILE "24.dummy" WAVE
TRACK 24 AUDIO
INDEX 01 00:00:00
FILE "25.dummy" WAVE
TRACK 25 AUDIO
INDEX 01 00:00:00
FILE "26.dummy" WAVE
TRACK 26 AUDIO
INDEX 01 00:00:00
FILE "27.dummy" WAVE
TRACK 27 AUDIO
INDEX 01 00:00:00
FILE "28.dummy" WAVE
TRACK 28 AUDIO
INDEX 01 00:00:00
FILE "29.dummy" WAVE
TRACK 29 AUDIO
INDEX 01 00:00:00
FILE "30.dummy" WAVE
TRACK 30 AUDIO
INDEX 01 00:00:00
FILE "31.dummy" WAVE
TRACK 31 AUDIO
INDEX 01 00:00:00

View File

@@ -0,0 +1,155 @@
Exact Audio Copy V0.99 prebeta 5 from 4. May 2009
EAC extraction logfile from 12. October 2010, 19:17
Haim Saban & Shuki Levy / Les Mystérieuses Cités d'Or
Used drive : ATAPI iHAS324 Y Adapter: 6 ID: 0
Read mode : Secure
Utilize accurate stream : Yes
Defeat audio cache : Yes
Make use of C2 pointers : No
Read offset correction : 48
Overread into Lead-In and Lead-Out : No
Fill up missing offset samples with silence : Yes
Delete leading and trailing silent blocks : No
Null samples used in CRC calculations : Yes
Used interface : Native Win32 interface for Win NT & 2000
Gap handling : Appended to previous track
Used output format : User Defined Encoder
Selected bitrate : 128 kBit/s
Quality : High
Add ID3 tag : No
Command line compressor : C:\Program Files (x86)\FLAC\flac.exe
Additional command line options : -V -8 -T "artist=%a" -T "title=%t" -T "album=%g" -T "date=%y" -T "tracknumber=%n" -T "genre=%m" %s
TOC of the extracted CD
Track | Start | Length | Start sector | End sector
---------------------------------------------------------
1 | 0:00.00 | 7:06.02 | 0 | 31951
2 | 7:06.02 | 21:19.06 | 31952 | 127882
3 | 28:25.08 | 2:12.33 | 127883 | 137815
4 | 30:37.41 | 2:31.32 | 137816 | 149172
5 | 33:08.73 | 2:27.25 | 149173 | 160222
6 | 35:36.23 | 2:30.06 | 160223 | 171478
7 | 38:06.29 | 2:03.73 | 171479 | 180776
8 | 40:10.27 | 1:19.36 | 180777 | 186737
9 | 41:29.63 | 2:05.21 | 186738 | 196133
10 | 43:35.09 | 2:06.29 | 196134 | 205612
11 | 45:41.38 | 1:58.63 | 205613 | 214525
12 | 47:40.26 | 1:35.23 | 214526 | 221673
13 | 49:15.49 | 1:11.32 | 221674 | 227030
14 | 50:27.06 | 1:17.18 | 227031 | 232823
15 | 51:44.24 | 1:27.27 | 232824 | 239375
16 | 53:11.51 | 2:14.69 | 239376 | 249494
17 | 55:26.45 | 2:14.59 | 249495 | 259603
18 | 57:41.29 | 1:26.61 | 259604 | 266114
19 | 59:08.15 | 0:12.65 | 266115 | 267079
20 | 59:21.05 | 1:46.70 | 267080 | 275099
21 | 61:08.00 | 1:26.49 | 275100 | 281598
22 | 62:34.49 | 0:38.03 | 281599 | 284451
23 | 63:12.52 | 1:32.70 | 284452 | 291421
24 | 64:45.47 | 0:54.39 | 291422 | 295510
25 | 65:40.11 | 0:28.31 | 295511 | 297641
26 | 66:08.42 | 0:59.47 | 297642 | 302113
27 | 67:08.14 | 1:35.24 | 302114 | 309262
28 | 68:43.38 | 0:40.06 | 309263 | 312268
29 | 69:23.44 | 1:43.57 | 312269 | 320050
30 | 71:07.26 | 1:22.34 | 320051 | 326234
31 | 72:29.60 | 1:41.31 | 326235 | 333840
Track 3
Filename D:\Music Madness\Soundtracks\1998 - Les Mystérieuses Cités d'Or [FLAC]\03 - Les Cités d'Or (Générique).wav
Pre-gap length 0:00:03.00
Peak level 100.0 %
Track quality 100.0 %
Test CRC 5B513BDC
Copy CRC 5B513BDC
Accurately ripped (confidence 2) [813C9D32]
Copy OK
Track 4
Filename D:\Music Madness\Soundtracks\1998 - Les Mystérieuses Cités d'Or [FLAC]\04 - Le thème de Zia.wav
Pre-gap length 0:00:02.00
Peak level 100.0 %
Track quality 99.9 %
Test CRC 76674B12
Copy CRC 76674B12
Accurately ripped (confidence 2) [1AC98E42]
Copy OK
<<<snip>>>
Track 28
Filename D:\Music Madness\Soundtracks\1998 - Les Mystérieuses Cités d'Or [FLAC]\28 - L'aventure continue.wav
Pre-gap length 0:00:02.00
Peak level 92.6 %
Track quality 100.0 %
Test CRC E471A040
Copy CRC E471A040
Accurately ripped (confidence 2) [9C394487]
Copy OK
Track 29
Filename D:\Music Madness\Soundtracks\1998 - Les Mystérieuses Cités d'Or [FLAC]\29 - Les Olmèques.wav
Pre-gap length 0:00:02.00
Peak level 92.6 %
Track quality 100.0 %
Test CRC 99FBCE76
Copy CRC 99FBCE76
Accurately ripped (confidence 2) [FE9F299F]
Copy OK
Track 30
Filename D:\Music Madness\Soundtracks\1998 - Les Mystérieuses Cités d'Or [FLAC]\30 - La fille du peuple Inca.wav
Pre-gap length 0:00:02.00
Peak level 100.0 %
Track quality 100.0 %
Test CRC 4F2F0F85
Copy CRC 4F2F0F85
Track not present in AccurateRip database
Copy OK
Track 31
Filename D:\Music Madness\Soundtracks\1998 - Les Mystérieuses Cités d'Or [FLAC]\31 - Tao l'inventeur.wav
Pre-gap length 0:00:02.00
Peak level 92.6 %
Track quality 100.0 %
Test CRC DB2EFF8C
Copy CRC DB2EFF8C
Track not present in AccurateRip database
Copy OK
27 track(s) accurately ripped
2 track(s) not present in the AccurateRip database
Some tracks could not be verified as accurate
No errors occurred
End of status report