diff --git a/lib/driver/MSWindows/win32_ioctl.c b/lib/driver/MSWindows/win32_ioctl.c index 06c38a75..5e3a1ee0 100644 --- a/lib/driver/MSWindows/win32_ioctl.c +++ b/lib/driver/MSWindows/win32_ioctl.c @@ -1,5 +1,5 @@ /* - $Id: win32_ioctl.c,v 1.13 2005/02/07 03:36:02 rocky Exp $ + $Id: win32_ioctl.c,v 1.14 2005/02/07 04:16:19 rocky Exp $ Copyright (C) 2004, 2005 Rocky Bernstein @@ -26,7 +26,7 @@ # include "config.h" #endif -static const char _rcsid[] = "$Id: win32_ioctl.c,v 1.13 2005/02/07 03:36:02 rocky Exp $"; +static const char _rcsid[] = "$Id: win32_ioctl.c,v 1.14 2005/02/07 04:16:19 rocky Exp $"; #ifdef HAVE_WIN32_CDROM @@ -684,19 +684,28 @@ read_toc_win32ioctl (_img_private_t *p_env) The MMC5 spec says: For media other than CD, information may be fabricated in order ^^^ ^^ - to emulate a CD structure for teh specific media. + to emulate a CD structure for the specific media. There is no requirement though that it *has* to and some DVD drives like one by Thompson for XBOX don't support a - IOCTL_CDROM_READ_TOC for DVD's. So if we have a DVD we will not + IOCTL_CDROM_READ_TOC for DVD's. So if we have a DVD we should not prefer getting the TOC via MMC. + + But on the other hand in GNU/Linux it is reported that using the + TOC via MMC gives better information such as for CD DATA Form 2 (used + in SVCDs). So if we *don't* have a DVD I think we want to try MMC + first. + + Is this complicated enough? I could be wrong... + */ b_fulltoc_first = (CDIO_DISC_MODE_NO_INFO == dvd_discmode_win32ioctl(p_env)); if ( b_fulltoc_first && read_fulltoc_win32mmc(p_env) ) return true; - /* SCSI-MMC READ_TOC (FULTOC) read failed. Try reading TOC via - DeviceIoControl instead */ + /* SCSI-MMC READ_TOC (FULTOC) read failed or we don't want to try it + initiaily. Try reading TOC via DeviceIoControl... */ + if( DeviceIoControl( p_env->h_device_handle, IOCTL_CDROM_READ_TOC, NULL, 0, &cdrom_toc, sizeof(CDROM_TOC), diff --git a/lib/driver/_cdio_linux.c b/lib/driver/_cdio_linux.c index 087867ed..6fd12b4f 100644 --- a/lib/driver/_cdio_linux.c +++ b/lib/driver/_cdio_linux.c @@ -1,5 +1,5 @@ /* - $Id: _cdio_linux.c,v 1.23 2005/02/07 03:36:02 rocky Exp $ + $Id: _cdio_linux.c,v 1.24 2005/02/07 04:16:19 rocky Exp $ Copyright (C) 2001 Herbert Valerio Riedel Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein @@ -27,7 +27,7 @@ # include "config.h" #endif -static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.23 2005/02/07 03:36:02 rocky Exp $"; +static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.24 2005/02/07 04:16:19 rocky Exp $"; #include @@ -462,14 +462,12 @@ eject_media_linux (void *p_user_data) { } /*! - Get disc type associated with the cd object. + Get disc type associated with cd object. */ static discmode_t -get_discmode_linux (void *p_user_data) +dvd_discmode_linux (_img_private_t *p_env) { - _img_private_t *p_env = p_user_data; - - discmode_t discmode = CDIO_DISC_MODE_NO_INFO; + discmode_t discmode=CDIO_DISC_MODE_NO_INFO; /* See if this is a DVD. */ cdio_dvd_struct_t dvd; /* DVD READ STRUCT for layer 0. */ @@ -487,13 +485,32 @@ get_discmode_linux (void *p_user_data) default: return CDIO_DISC_MODE_DVD_OTHER; } } + return discmode; +} +/*! + Get disc type associated with the cd object. +*/ +static discmode_t +get_discmode_linux (void *p_user_data) +{ + _img_private_t *p_env = p_user_data; + + discmode_t discmode; + + if (!p_env) return CDIO_DISC_MODE_ERROR; + + /* Try DVD types first. See note below. */ + discmode = dvd_discmode_linux(p_env); + + if (CDIO_DISC_MODE_NO_INFO != discmode) return discmode; /* Justin B Ruggles reports that the GNU/Linux ioctl(.., CDROM_DISC_STATUS) does not return "CD DATA - Form 2" for SVCD's even though they are are form 2. There we - issue a SCSI MMC-2 FULL TOC command first to try get more - accurate information. + Form 2" for SVCD's even though they are are form 2. In + mmc_get_discmode we issue a SCSI MMC-2 TOC command first to + try get more accurate information. But we took care above *not* + to issue a FULL TOC on DVD media. */ discmode = mmc_get_discmode(p_env->gen.cdio); if (CDIO_DISC_MODE_NO_INFO != discmode) @@ -503,7 +520,6 @@ get_discmode_linux (void *p_user_data) if (i_discmode < 0) return CDIO_DISC_MODE_ERROR; - /* FIXME Need to add getting DVD types. */ switch(i_discmode) { case CDS_AUDIO: return CDIO_DISC_MODE_CD_DA;