Break out DVD detection. More verbose comments about the issues here.

This commit is contained in:
rocky
2005-02-07 04:16:19 +00:00
parent 10245d8901
commit 7bb03d5c93
2 changed files with 42 additions and 17 deletions

View File

@@ -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 <rocky@panix.com>
@@ -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),

View File

@@ -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 <hvr@gnu.org>
Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -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 <string.h>
@@ -462,13 +462,11 @@ 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;
/* See if this is a DVD. */
@@ -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 <jruggle@earthlink.net> 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;