* Correctly detect Enhanced CDs, and take their extra lead gap into account.

* This fixes bug #3025.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41290 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2011-04-28 19:28:02 +00:00
parent 67f2df2363
commit a0bc939256
2 changed files with 11 additions and 4 deletions
+2 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2007-2008, Axel Dörfler, [email protected].
* Copyright 2007-2011, Axel Dörfler, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef CDDA_H
@@ -12,6 +12,7 @@
static const uint32 kFramesPerSecond = 75;
static const uint32 kFramesPerMinute = kFramesPerSecond * 60;
static const uint32 kFrameSize = 2352;
static const uint32 kDataTrackLeadGap = 11400;
static const uint8 kMaxTracks = 0x63;
struct cdtext {
@@ -653,10 +653,10 @@ Volume::Mount(const char* device)
// We do not seem to have an attribute file so this is probably the
// first time this CD is inserted. In this case, try to read CD-Text
// data.
if (read_cdtext(fDevice, text) != B_OK)
dprintf("CDDA: no CD-Text found.\n");
else
if (read_cdtext(fDevice, text) == B_OK)
doLookup = false;
else
TRACE(("CDDA: no CD-Text found.\n"));
} else {
doLookup = false;
}
@@ -677,6 +677,12 @@ Volume::Mount(const char* device)
+ next.second * kFramesPerSecond + next.frame
- startFrame;
// Adjust length of the last audio track according to the Blue Book
// specification in case of an Enhanced CD
if (i + 1 < trackCount && is_data_track(toc->tracks[i + 1])
&& !is_data_track(toc->tracks[i]))
frames -= kDataTrackLeadGap;
totalFrames += frames;
if (is_data_track(toc->tracks[i]))