[haiku-commits] r41290 - haiku/trunk/src/add-ons/kernel/file_systems/cdda

  • From: axeld@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 28 Apr 2011 21:28:02 +0200 (CEST)

Author: axeld
Date: 2011-04-28 21:28:02 +0200 (Thu, 28 Apr 2011)
New Revision: 41290
Changeset: https://dev.haiku-os.org/changeset/41290
Ticket: https://dev.haiku-os.org/ticket/3025

Modified:
   haiku/trunk/src/add-ons/kernel/file_systems/cdda/cdda.h
   haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp
Log:
* Correctly detect Enhanced CDs, and take their extra lead gap into account.
* This fixes bug #3025.


Modified: haiku/trunk/src/add-ons/kernel/file_systems/cdda/cdda.h
===================================================================
--- haiku/trunk/src/add-ons/kernel/file_systems/cdda/cdda.h     2011-04-28 
18:57:22 UTC (rev 41289)
+++ haiku/trunk/src/add-ons/kernel/file_systems/cdda/cdda.h     2011-04-28 
19:28:02 UTC (rev 41290)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007-2008, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx
+ * Copyright 2007-2011, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx
  * 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 {

Modified: haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp
===================================================================
--- haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp       
2011-04-28 18:57:22 UTC (rev 41289)
+++ haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp       
2011-04-28 19:28:02 UTC (rev 41290)
@@ -653,10 +653,10 @@
                // 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");
+               if (read_cdtext(fDevice, text) == B_OK)
+                       doLookup = false;
                else
-                       doLookup = false;
+                       TRACE(("CDDA: no CD-Text found.\n"));
        } else {
                doLookup = false;
        }
@@ -677,6 +677,12 @@
                        + 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]))


Other related posts:

  • » [haiku-commits] r41290 - haiku/trunk/src/add-ons/kernel/file_systems/cdda - axeld