Modified for expanded CD-TEXT handling.

This commit is contained in:
rocky
2004-07-18 06:51:49 +00:00
parent 50d780d342
commit 752d81db4d
5 changed files with 53 additions and 35 deletions

View File

@@ -1,5 +1,5 @@
/*
$Id: aspi32.c,v 1.28 2004/07/17 15:31:00 rocky Exp $
$Id: aspi32.c,v 1.29 2004/07/18 06:51:49 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
@@ -27,7 +27,7 @@
# include "config.h"
#endif
static const char _rcsid[] = "$Id: aspi32.c,v 1.28 2004/07/17 15:31:00 rocky Exp $";
static const char _rcsid[] = "$Id: aspi32.c,v 1.29 2004/07/18 06:51:49 rocky Exp $";
#include <cdio/cdio.h>
#include <cdio/sector.h>
@@ -730,11 +730,13 @@ init_cdtext_aspi (_img_private_t *env)
Return the the kind of drive capabilities of device.
*/
cdio_drive_cap_t
get_drive_cap_aspi (const _img_private_t *env)
void
get_drive_cap_aspi (const _img_private_t *env,
cdio_drive_read_cap_t *p_read_cap,
cdio_drive_write_cap_t *p_write_cap,
cdio_drive_misc_cap_t *p_misc_cap)
{
uint8_t scsi_cdb[10] = { 0, };
int32_t i_drivetype = CDIO_DRIVE_CAP_CD_AUDIO | CDIO_DRIVE_CAP_UNKNOWN;
uint8_t buf[256] = { 0, };
/* Set up passthrough command */
@@ -746,13 +748,14 @@ get_drive_cap_aspi (const _img_private_t *env)
if (!scsi_passthrough_aspi(env, scsi_cdb, sizeof(scsi_cdb),
buf, sizeof(buf))) {
return i_drivetype;
*p_read_cap = CDIO_DRIVE_CAP_UNKNOWN;
*p_write_cap = CDIO_DRIVE_CAP_UNKNOWN;
*p_misc_cap = CDIO_DRIVE_CAP_UNKNOWN;
} else {
BYTE *p;
int lenData = ((unsigned int)buf[0] << 8) + buf[1];
BYTE *pMax = buf + 256;
i_drivetype = 0;
/* set to first sense mask, and then walk through the masks */
p = buf + 8;
while( (p < &(buf[2+lenData])) && (p < pMax) ) {
@@ -767,14 +770,13 @@ get_drive_cap_aspi (const _img_private_t *env)
/* Don't handle these yet. */
break;
case CDIO_MMC_CAPABILITIES_PAGE:
i_drivetype |= cdio_get_drive_cap_mmc(p);
cdio_get_drive_cap_mmc(p, p_read_cap, p_write_cap, p_misc_cap);
break;
default: ;
}
p += (p[1] + 2);
}
}
return i_drivetype;
}
/*!

View File

@@ -1,6 +1,6 @@
/* Win32 aspi specific */
/*
$Id: aspi32.h,v 1.8 2004/07/17 09:12:21 rocky Exp $
$Id: aspi32.h,v 1.9 2004/07/18 06:51:49 rocky Exp $
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -172,7 +172,10 @@ SRB_HAInquiry;
string when done with it.
*/
cdio_drive_cap_t get_drive_cap_aspi (const _img_private_t *env);
void get_drive_cap_aspi (const _img_private_t *env,
cdio_drive_read_cap_t *p_read_cap,
cdio_drive_write_cap_t *p_write_cap,
cdio_drive_misc_cap_t *p_misc_cap);
/*!
Return the the kind of drive capabilities of device.

View File

@@ -1,5 +1,5 @@
/*
$Id: win32.c,v 1.24 2004/07/17 10:05:54 rocky Exp $
$Id: win32.c,v 1.25 2004/07/18 06:51:49 rocky Exp $
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -26,7 +26,7 @@
# include "config.h"
#endif
static const char _rcsid[] = "$Id: win32.c,v 1.24 2004/07/17 10:05:54 rocky Exp $";
static const char _rcsid[] = "$Id: win32.c,v 1.25 2004/07/18 06:51:49 rocky Exp $";
#include <cdio/cdio.h>
#include <cdio/sector.h>
@@ -107,16 +107,20 @@ cdio_is_cdrom(const char drive_letter) {
string when done with it.
*/
static cdio_drive_cap_t
_cdio_get_drive_cap (const void *env) {
static void
_cdio_get_drive_cap (const void *env,
cdio_drive_read_cap_t *p_read_cap,
cdio_drive_write_cap_t *p_write_cap,
cdio_drive_misc_cap_t *p_misc_cap)
{
const _img_private_t *_obj = env;
if (_obj->hASPI) {
/* A safe guess */
return get_drive_cap_aspi (env);
get_drive_cap_aspi (env, p_read_cap, p_write_cap, p_misc_cap);
} else {
return get_drive_cap_win32ioctl (env);
get_drive_cap_win32ioctl (env, p_read_cap, p_write_cap, p_misc_cap);
}
}

View File

@@ -1,5 +1,5 @@
/*
$Id: win32.h,v 1.12 2004/07/17 10:05:54 rocky Exp $
$Id: win32.h,v 1.13 2004/07/18 06:51:49 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
@@ -120,7 +120,10 @@ bool init_cdtext_win32ioctl (_img_private_t *env);
string when done with it.
*/
cdio_drive_cap_t get_drive_cap_aspi (const _img_private_t *env);
void get_drive_cap_aspi (const _img_private_t *env,
cdio_drive_read_cap_t *p_read_cap,
cdio_drive_write_cap_t *p_write_cap,
cdio_drive_misc_cap_t *p_misc_cap);
/*!
Return the the kind of drive capabilities of device.
@@ -129,7 +132,10 @@ cdio_drive_cap_t get_drive_cap_aspi (const _img_private_t *env);
string when done with it.
*/
cdio_drive_cap_t get_drive_cap_win32ioctl (const _img_private_t *env);
void get_drive_cap_win32ioctl (const _img_private_t *env,
cdio_drive_read_cap_t *p_read_cap,
cdio_drive_write_cap_t *p_write_cap,
cdio_drive_misc_cap_t *p_misc_cap);
/*!
Get the format (XA, DATA, AUDIO) of a track.

View File

@@ -1,5 +1,5 @@
/*
$Id: win32_ioctl.c,v 1.17 2004/07/17 15:31:00 rocky Exp $
$Id: win32_ioctl.c,v 1.18 2004/07/18 06:51:49 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
@@ -26,7 +26,7 @@
# include "config.h"
#endif
static const char _rcsid[] = "$Id: win32_ioctl.c,v 1.17 2004/07/17 15:31:00 rocky Exp $";
static const char _rcsid[] = "$Id: win32_ioctl.c,v 1.18 2004/07/18 06:51:49 rocky Exp $";
#include <cdio/cdio.h>
#include <cdio/sector.h>
@@ -514,10 +514,12 @@ get_track_format_win32ioctl(const _img_private_t *env, track_t i_track)
string when done with it.
*/
cdio_drive_cap_t
get_drive_cap_win32ioctl (const _img_private_t *env)
void
get_drive_cap_win32ioctl (const _img_private_t *env,
cdio_drive_read_cap_t *p_read_cap,
cdio_drive_write_cap_t *p_write_cap,
cdio_drive_misc_cap_t *p_misc_cap)
{
int32_t i_drivetype = 0;
SCSI_PASS_THROUGH_WITH_BUFFERS sptwb;
ULONG returned = 0;
ULONG length;
@@ -559,16 +561,17 @@ get_drive_cap_win32ioctl (const _img_private_t *env)
&sptwb,
length,
&returned,
FALSE) )
{
FALSE) ) {
unsigned int n=sptwb.DataBuf[3]+4;
/* Reader? */
i_drivetype |= cdio_get_drive_cap_mmc(&(sptwb.DataBuf[n]));
return i_drivetype;
cdio_get_drive_cap_mmc(&(sptwb.DataBuf[n]), p_read_cap,
p_write_cap, p_misc_cap);
} else {
i_drivetype = CDIO_DRIVE_CAP_CD_AUDIO | CDIO_DRIVE_CAP_UNKNOWN;
*p_read_cap = CDIO_DRIVE_CAP_UNKNOWN;
*p_write_cap = CDIO_DRIVE_CAP_UNKNOWN;
*p_misc_cap = CDIO_DRIVE_CAP_UNKNOWN;
}
return CDIO_DRIVE_CAP_ERROR;
return;
}
#endif /*HAVE_WIN32_CDROM*/