Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#10569 closed Bug Report - General (fixed)

libcdio broken on OS X?

Reported by: Nigel Owned by: JYA
Priority: minor Milestone: 0.26.1
Component: Ports - OSX Version: Master Head
Severity: low Keywords:
Cc: Ticket locked: no

Description

Since libcdio/CDDB rewrite, MythMusic uses libcdio for reading CD Audio tracks on all platforms. It doesn't work for me on OS X:

% ./mythfrontend -v media --loglevel debug
...
2012-04-09 10:36:26.605672 E  MythMusic hasn't found any tracks! That's ok with me if it's ok with you.
2012-04-09 10:36:26.743117 I  CdDecoder: cdio_open(/dev/rdisk1) failed
2012-04-09 10:36:26.743234 I  CdDecoder: cdio_open(/dev/rdisk1) failed
2012-04-09 10:36:27.743453 I  CdDecoder: cdio_open(/dev/rdisk1) failed
2012-04-09 10:36:27.743525 I  CdDecoder: cdio_open(/dev/rdisk1) failed
2012-04-09 10:36:28.743626 I  CdDecoder: cdio_open(/dev/rdisk1) failed
2012-04-09 10:36:28.743657 I  CdDecoder: cdio_open(/dev/rdisk1) failed

It looks like the libcdio built by osx-packager.pl on 10.6.7 or 10.6.8 is bad:

macbook% cd .osx-packager/src/libcdio-0.83/src
macbook% ./cd-info -C /dev/disk1
cd-info version 0.83 x86_64-apple-darwin10.8.0
Copyright (c) 2003, 2004, 2005, 2007, 2008, 2011 R. Bernstein
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
cd-info: Cannot use CD-ROM device /dev/disk1. Is a CD loaded?
macbook% df | grep disk1
/dev/disk1          827800    827800         0   100%    /Volumes/Audio CD
macbook% ./cd-info -C /dev/rdisk1
cd-info version 0.83 x86_64-apple-darwin10.8.0
Copyright (c) 2003, 2004, 2005, 2007, 2008, 2011 R. Bernstein
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
cd-info: Cannot use CD-ROM device /dev/rdisk1. Is a CD loaded?
macbook% ./cd-info -C disk1        
cd-info version 0.83 x86_64-apple-darwin10.8.0
Copyright (c) 2003, 2004, 2005, 2007, 2008, 2011 R. Bernstein
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
cd-info: Cannot use CD-ROM device . Is a CD loaded?
macbook% 

but I'm still snooping around in its src code and configure - seems to have been built without HAVE_DARWIN_CDROM

Change History (6)

comment:1 Changed 12 years ago by JYA

I don't use osx-packager.pl and I have no intention on supporting it. If it was only up to me, it would have disappeared a while ago.

Try the new qtsdk one...

comment:2 Changed 12 years ago by Nigel

Existing bug with libcdio: http://savannah.gnu.org/bugs/?30019 - independent of the packager?

After hacking it's configure to support darwin10, and lib/drivers/osx.c to have the correct IOKit/scsi/ include paths, it now does something:

macbook% ./cd-info -C /dev/disk1
cd-info version 0.83 x86_64-apple-darwin10.8.0
Copyright (c) 2003, 2004, 2005, 2007, 2008, 2011 R. Bernstein
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
++ WARN: open (/dev/disk1): Resource busy
cd-info: Cannot use CD-ROM device /dev/disk1. Is a CD loaded?
macbook% df                     
Filesystem      512-blocks      Used Available Capacity  Mounted on
/dev/disk0s3     104857600  99153280   5192320    96%    /
devfs                  253       253         0   100%    /dev
/dev/disk0s4      83886080  71483824  12402256    86%    /Volumes/Users
/dev/disk0s5     214309152 197662672  16646480    93%    /Volumes/Backups
map -hosts               0         0         0   100%    /net
map auto_home            0         0         0   100%    /home
/dev/disk1s12s2      18100     18100         0   100%    /Volumes/Chris Tomlin
/dev/disk1          827800    827800         0   100%    /Volumes/Audio CD
macbook% umount /Volumes/Chris\ Tomlin 
umount: unmount(/Volumes/Chris Tomlin): Operation not permitted
macbook% sudo umount /Volumes/Chris\ Tomlin
Password:
macbook% df
Filesystem    512-blocks      Used Available Capacity  Mounted on
/dev/disk0s3   104857600  99153360   5192240    96%    /
devfs                253       253         0   100%    /dev
/dev/disk0s4    83886080  71483824  12402256    86%    /Volumes/Users
/dev/disk0s5   214309152 197662672  16646480    93%    /Volumes/Backups
map -hosts             0         0         0   100%    /net
map auto_home          0         0         0   100%    /home
/dev/disk1        827800    827800         0   100%    /Volumes/Audio CD
macbook% 
macbook% 
macbook% 
macbook% ./cd-info -C /dev/disk1           
cd-info version 0.83 x86_64-apple-darwin10.8.0
Copyright (c) 2003, 2004, 2005, 2007, 2008, 2011 R. Bernstein
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
++ WARN: open (/dev/disk1): Resource busy
cd-info: Cannot use CD-ROM device /dev/disk1. Is a CD loaded?
macbook% sudo umount /Volumes/Audio\ CD    
macbook% ./cd-info -C /dev/disk1       
cd-info version 0.83 x86_64-apple-darwin10.8.0
Copyright (c) 2003, 2004, 2005, 2007, 2008, 2011 R. Bernstein
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
CD location   : /dev/disk1
CD driver name: OS X
   access mode: OS X

Vendor                      : MATSHITA
Model                       : CD-RW  CW-8221
Revision                    : GA0K
Hardware                                  : CD-ROM or DVD
Can eject                                 : Yes
Can close tray                            : Yes
Can disable manual eject                  : Yes
Can select juke-box disc                  : No

Can set drive speed                       : Yes
Can read multiple sessions (e.g. PhotoCD) : Yes
Can hard reset device                     : Yes

Reading....
  Can read Mode 2 Form 1                  : No
  Can read Mode 2 Form 2                  : No
  Can read (S)VCD (i.e. Mode 2 Form 1/2)  : No
  Can read C2 Errors                      : No
  Can read IRSC                           : No
  Can read Media Channel Number (or UPC)  : No
  Can play audio                          : No
  Can read CD-DA                          : No
  Can read CD-R                           : No
  Can read CD-RW                          : No
  Can read DVD-ROM                        : Yes

Writing....
  Can write CD-RW                         : No
  Can write DVD-R                         : No
  Can write DVD-RAM                       : No
  Can write DVD-RW                        : No
  Can write DVD+RW                        : No
__________________________________

Disc mode is listed as: CD-ROM Mixed
CD-ROM Track List (1 - 12)
  #: MSF       LSN    Type   Green? Copy? Channels Premphasis?
  1: 00:02:00  000000 audio  false  yes   2        no
  2: 03:59:74  017849 audio  false  yes   2        no
  3: 08:11:69  036744 audio  false  yes   2        no
  4: 12:38:38  056738 audio  false  yes   2        no
  5: 16:47:37  075412 audio  false  yes   2        no
  6: 20:47:35  093410 audio  false  yes   2        no
  7: 24:21:04  109429 audio  false  yes   2        no
  8: 30:25:49  136774 audio  false  yes   2        no
  9: 34:32:13  155263 audio  false  yes   2        no
 10: 38:09:08  171533 audio  false  yes   2        no
 11: 41:17:10  185635 audio  false  yes   2        no
 12: 48:33:14  218339 data   true   no   
170: 49:36:31  223081 leadout (500 MB raw, 496 MB formatted)
Media Catalog Number (MCN): not supported by drive/driver
Last CD Session LSN: failed
audio status: not implemented
__________________________________
CD Analysis Report
CD-Plus/Extra   
session #2 starts at track 12, LSN: 218339, ISO 9660 blocks: 222929
ISO 9660: 222929 blocks, label `CHRIS_TOMLIN                    '
macbook% 

It looks like, after patching libcdio upstream, MythMusic will need an OS X-specific hack to unmount audio CDs. i.e. libcdio doesn't play nicely with the OS X environment of DIskArbitration and the Finder. Not thrilled - would prefer to put cddecoder-darwin.cpp back :-(

comment:3 Changed 12 years ago by Nigel

libcdio-git is patched upstream, but a new release may be a while, so...

MacBook% diff -rwu libcdio-0.83.orig libcdio-0.83                                   
diff -rwu libcdio-0.83.orig/configure libcdio-0.83/configure
--- libcdio-0.83.orig/configure	2011-10-27 13:23:40.000000000 +1100
+++ libcdio-0.83/configure	2012-04-09 19:11:50.000000000 +1000
@@ -16675,7 +16675,7 @@
        ## AC_DEFINE([HAVE_AIX_CDROM], [1],
        ##     [Define 1 if you have AIX CD-ROM support])
        ;;
-     darwin6*|darwin7*|darwin8*|darwin9*)
+     darwin6*|darwin7*|darwin8*|darwin9*|darwin10*)
        for ac_header in IOKit/IOKitLib.h CoreFoundation/CFBase.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`

diff -rwu libcdio-0.83.orig/lib/driver/osx.c libcdio-0.83/lib/driver/osx.c
--- libcdio-0.83.orig/lib/driver/osx.c	2011-10-21 10:16:20.000000000 +1100
+++ libcdio-0.83/lib/driver/osx.c	2012-04-26 14:23:02.000000000 +1000
@@ -56,7 +56,7 @@
 
 #include <mach/mach.h>
 #include <Carbon/Carbon.h>
-#include <IOKit/scsi-commands/SCSITaskLib.h>
+#include <IOKit/scsi/SCSITaskLib.h>
 #include <IOKit/IOCFPlugIn.h>
 #include <mach/mach_error.h>
 
@@ -75,7 +75,7 @@
 #include <CoreFoundation/CoreFoundation.h>
 #include <IOKit/IOKitLib.h>
 #include <IOKit/IOBSD.h>
-#include <IOKit/scsi-commands/IOSCSIMultimediaCommandsDevice.h>
+#include <IOKit/scsi/IOSCSIMultimediaCommandsDevice.h>
 #include <IOKit/storage/IOCDTypes.h>
 #include <IOKit/storage/IODVDTypes.h>
 #include <IOKit/storage/IOMedia.h>
@@ -1826,6 +1827,11 @@
       
       do
         {
+          /* Skip other removable media, like USB flash memory keys:  */
+          if (!IOObjectConformsTo(next_media, kIODVDMediaClass) &&
+              !IOObjectConformsTo(next_media, kIOCDMediaClass))
+            continue;
+
           str_bsd_path = IORegistryEntryCreateCFProperty( next_media,
                                                           CFSTR( kIOBSDNameKey ),
                                                           kCFAllocatorDefault,
@@ -1856,6 +1862,7 @@
         } while( ( next_media = IOIteratorNext( media_iterator ) ) != 0 );
     }
   IOObjectRelease( media_iterator );
+  cdio_warn ("cdio_get_default_device() - No mounted CDs or DVDs - returning NULL");
   return NULL;
 #endif /* HAVE_DARWIN_CDROM */
 }
MacBook% 

I still think some small MythMusic mods are required on OS X, though.

comment:4 Changed 11 years ago by Nigel Pearson <npearson@…>

Resolution: fixed
Status: newclosed

In e44fbab1238c40ed88034f626ef2445cb0003596/packaging:

Newer libcdio, to support Mac OS 10.6, 10.7 & 10.8. Closes #10569

comment:5 Changed 11 years ago by Nigel Pearson <npearson@…>

In 162a3b67bb6a8c9c22e0062b1d152c978fa38124/packaging:

Newer libcdio, to support Mac OS 10.6, 10.7 & 10.8. Closes #10569
(cherry picked from commit e44fbab1238c40ed88034f626ef2445cb0003596)

comment:6 Changed 11 years ago by Raymond Wagner

Milestone: unknown0.26.1
Note: See TracTickets for help on using tickets.