Use more common routines. ioctl - not tested. ASPI has bug probably
in running scsi command.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: aspi32.c,v 1.45 2004/07/28 11:45:22 rocky Exp $
|
$Id: aspi32.c,v 1.46 2004/07/29 04:14:44 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char _rcsid[] = "$Id: aspi32.c,v 1.45 2004/07/28 11:45:22 rocky Exp $";
|
static const char _rcsid[] = "$Id: aspi32.c,v 1.46 2004/07/29 04:14:44 rocky Exp $";
|
||||||
|
|
||||||
#include <cdio/cdio.h>
|
#include <cdio/cdio.h>
|
||||||
#include <cdio/sector.h>
|
#include <cdio/sector.h>
|
||||||
@@ -212,7 +212,7 @@ get_discmode_aspi (_img_private_t *p_env)
|
|||||||
return CDIO_DISC_MODE_NO_INFO;
|
return CDIO_DISC_MODE_NO_INFO;
|
||||||
|
|
||||||
for (i_track = p_env->gen.i_first_track;
|
for (i_track = p_env->gen.i_first_track;
|
||||||
i_track < p_env->gen.i_first_track + p_env->i_tracks ;
|
i_track < p_env->gen.i_first_track + p_env->gen.i_tracks ;
|
||||||
i_track ++) {
|
i_track ++) {
|
||||||
track_format_t track_fmt=get_track_format_aspi(p_env, i_track);
|
track_format_t track_fmt=get_track_format_aspi(p_env, i_track);
|
||||||
|
|
||||||
@@ -676,7 +676,7 @@ read_toc_aspi (_img_private_t *p_env)
|
|||||||
if (0 != i_status) return false;
|
if (0 != i_status) return false;
|
||||||
|
|
||||||
p_env->gen.i_first_track = tocheader[2];
|
p_env->gen.i_first_track = tocheader[2];
|
||||||
p_env->i_tracks = tocheader[3] - tocheader[2] + 1;
|
p_env->gen.i_tracks = tocheader[3] - tocheader[2] + 1;
|
||||||
|
|
||||||
{
|
{
|
||||||
int i, i_toclength;
|
int i, i_toclength;
|
||||||
@@ -699,10 +699,10 @@ read_toc_aspi (_img_private_t *p_env)
|
|||||||
&cdb, SCSI_MMC_DATA_READ,
|
&cdb, SCSI_MMC_DATA_READ,
|
||||||
i_toclength, p_fulltoc);
|
i_toclength, p_fulltoc);
|
||||||
if( 0 != i_status ) {
|
if( 0 != i_status ) {
|
||||||
p_env->i_tracks = 0;
|
p_env->gen.i_tracks = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( i = 0 ; i <= p_env->i_tracks ; i++ ) {
|
for( i = 0 ; i <= p_env->gen.i_tracks ; i++ ) {
|
||||||
int i_index = 8 + 8 * i;
|
int i_index = 8 + 8 * i;
|
||||||
p_env->tocent[ i ].start_lsn = ((int)p_fulltoc[ i_index ] << 24) +
|
p_env->tocent[ i ].start_lsn = ((int)p_fulltoc[ i_index ] << 24) +
|
||||||
((int)p_fulltoc[ i_index+1 ] << 16) +
|
((int)p_fulltoc[ i_index+1 ] << 16) +
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: win32.c,v 1.35 2004/07/28 03:17:56 rocky Exp $
|
$Id: win32.c,v 1.36 2004/07/29 04:14:44 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char _rcsid[] = "$Id: win32.c,v 1.35 2004/07/28 03:17:56 rocky Exp $";
|
static const char _rcsid[] = "$Id: win32.c,v 1.36 2004/07/29 04:14:44 rocky Exp $";
|
||||||
|
|
||||||
#include <cdio/cdio.h>
|
#include <cdio/cdio.h>
|
||||||
#include <cdio/sector.h>
|
#include <cdio/sector.h>
|
||||||
@@ -175,28 +175,28 @@ run_scsi_cmd_win32( const void *p_user_data, unsigned int i_timeout_ms,
|
|||||||
static bool
|
static bool
|
||||||
_cdio_init_win32 (void *user_data)
|
_cdio_init_win32 (void *user_data)
|
||||||
{
|
{
|
||||||
_img_private_t *env = user_data;
|
_img_private_t *p_env = user_data;
|
||||||
if (env->gen.init) {
|
if (p_env->gen.init) {
|
||||||
cdio_error ("init called more than once");
|
cdio_error ("init called more than once");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
env->gen.init = true;
|
p_env->gen.init = true;
|
||||||
env->toc_init = false;
|
p_env->gen.toc_init = false;
|
||||||
|
|
||||||
/* Initializations */
|
/* Initializations */
|
||||||
env->h_device_handle = NULL;
|
p_env->h_device_handle = NULL;
|
||||||
env->i_sid = 0;
|
p_env->i_sid = 0;
|
||||||
env->hASPI = 0;
|
p_env->hASPI = 0;
|
||||||
env->lpSendCommand = 0;
|
p_env->lpSendCommand = 0;
|
||||||
env->b_aspi_init = false;
|
p_env->b_aspi_init = false;
|
||||||
env->b_ioctl_init = false;
|
p_env->b_ioctl_init = false;
|
||||||
env->b_cdtext_init = false;
|
p_env->b_cdtext_init = false;
|
||||||
|
|
||||||
if ( _AM_IOCTL == env->access_mode ) {
|
if ( _AM_IOCTL == p_env->access_mode ) {
|
||||||
return init_win32ioctl(env);
|
return init_win32ioctl(p_env);
|
||||||
} else {
|
} else {
|
||||||
return init_aspi(env);
|
return init_aspi(p_env);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,17 +206,17 @@ _cdio_init_win32 (void *user_data)
|
|||||||
static void
|
static void
|
||||||
_free_win32 (void *user_data)
|
_free_win32 (void *user_data)
|
||||||
{
|
{
|
||||||
_img_private_t *env = user_data;
|
_img_private_t *p_env = user_data;
|
||||||
|
|
||||||
if (NULL == env) return;
|
if (NULL == p_env) return;
|
||||||
free (env->gen.source_name);
|
free (p_env->gen.source_name);
|
||||||
|
|
||||||
if( env->h_device_handle )
|
if( p_env->h_device_handle )
|
||||||
CloseHandle( env->h_device_handle );
|
CloseHandle( p_env->h_device_handle );
|
||||||
if( env->hASPI )
|
if( p_env->hASPI )
|
||||||
FreeLibrary( (HMODULE)env->hASPI );
|
FreeLibrary( (HMODULE)p_env->hASPI );
|
||||||
|
|
||||||
free (env);
|
free (p_env);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -227,11 +227,11 @@ static int
|
|||||||
_cdio_read_audio_sectors (void *user_data, void *data, lsn_t lsn,
|
_cdio_read_audio_sectors (void *user_data, void *data, lsn_t lsn,
|
||||||
unsigned int nblocks)
|
unsigned int nblocks)
|
||||||
{
|
{
|
||||||
_img_private_t *env = user_data;
|
_img_private_t *p_env = user_data;
|
||||||
if ( env->hASPI ) {
|
if ( p_env->hASPI ) {
|
||||||
return read_audio_sectors_aspi( env, data, lsn, nblocks );
|
return read_audio_sectors_aspi( p_env, data, lsn, nblocks );
|
||||||
} else {
|
} else {
|
||||||
return read_audio_sectors_win32ioctl( env, data, lsn, nblocks );
|
return read_audio_sectors_win32ioctl( p_env, data, lsn, nblocks );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,26 +243,26 @@ static int
|
|||||||
_cdio_read_mode1_sector (void *user_data, void *data, lsn_t lsn,
|
_cdio_read_mode1_sector (void *user_data, void *data, lsn_t lsn,
|
||||||
bool b_form2)
|
bool b_form2)
|
||||||
{
|
{
|
||||||
_img_private_t *env = user_data;
|
_img_private_t *p_env = user_data;
|
||||||
|
|
||||||
if (env->gen.ioctls_debugged == 75)
|
if (p_env->gen.ioctls_debugged == 75)
|
||||||
cdio_debug ("only displaying every 75th ioctl from now on");
|
cdio_debug ("only displaying every 75th ioctl from now on");
|
||||||
|
|
||||||
if (env->gen.ioctls_debugged == 30 * 75)
|
if (p_env->gen.ioctls_debugged == 30 * 75)
|
||||||
cdio_debug ("only displaying every 30*75th ioctl from now on");
|
cdio_debug ("only displaying every 30*75th ioctl from now on");
|
||||||
|
|
||||||
if (env->gen.ioctls_debugged < 75
|
if (p_env->gen.ioctls_debugged < 75
|
||||||
|| (env->gen.ioctls_debugged < (30 * 75)
|
|| (p_env->gen.ioctls_debugged < (30 * 75)
|
||||||
&& env->gen.ioctls_debugged % 75 == 0)
|
&& p_env->gen.ioctls_debugged % 75 == 0)
|
||||||
|| env->gen.ioctls_debugged % (30 * 75) == 0)
|
|| p_env->gen.ioctls_debugged % (30 * 75) == 0)
|
||||||
cdio_debug ("reading %lu", (unsigned long int) lsn);
|
cdio_debug ("reading %lu", (unsigned long int) lsn);
|
||||||
|
|
||||||
env->gen.ioctls_debugged++;
|
p_env->gen.ioctls_debugged++;
|
||||||
|
|
||||||
if ( env->hASPI ) {
|
if ( p_env->hASPI ) {
|
||||||
return read_mode1_sector_aspi( env, data, lsn, b_form2 );
|
return read_mode1_sector_aspi( p_env, data, lsn, b_form2 );
|
||||||
} else {
|
} else {
|
||||||
return read_mode1_sector_win32ioctl( env, data, lsn, b_form2 );
|
return read_mode1_sector_win32ioctl( p_env, data, lsn, b_form2 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,19 +275,19 @@ static int
|
|||||||
_cdio_read_mode1_sectors (void *user_data, void *data, lsn_t lsn,
|
_cdio_read_mode1_sectors (void *user_data, void *data, lsn_t lsn,
|
||||||
bool b_form2, unsigned int nblocks)
|
bool b_form2, unsigned int nblocks)
|
||||||
{
|
{
|
||||||
_img_private_t *env = user_data;
|
_img_private_t *p_env = user_data;
|
||||||
int i;
|
int i;
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
for (i = 0; i < nblocks; i++) {
|
for (i = 0; i < nblocks; i++) {
|
||||||
if (b_form2) {
|
if (b_form2) {
|
||||||
if ( (retval = _cdio_read_mode1_sector (env,
|
if ( (retval = _cdio_read_mode1_sector (p_env,
|
||||||
((char *)data) + (M2RAW_SECTOR_SIZE * i),
|
((char *)data) + (M2RAW_SECTOR_SIZE * i),
|
||||||
lsn + i, true)) )
|
lsn + i, true)) )
|
||||||
return retval;
|
return retval;
|
||||||
} else {
|
} else {
|
||||||
char buf[M2RAW_SECTOR_SIZE] = { 0, };
|
char buf[M2RAW_SECTOR_SIZE] = { 0, };
|
||||||
if ( (retval = _cdio_read_mode1_sector (env, buf, lsn + i, false)) )
|
if ( (retval = _cdio_read_mode1_sector (p_env, buf, lsn + i, false)) )
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
memcpy (((char *)data) + (CDIO_CD_FRAMESIZE * i),
|
memcpy (((char *)data) + (CDIO_CD_FRAMESIZE * i),
|
||||||
@@ -306,23 +306,23 @@ _cdio_read_mode2_sector (void *user_data, void *data, lsn_t lsn,
|
|||||||
bool b_form2)
|
bool b_form2)
|
||||||
{
|
{
|
||||||
char buf[CDIO_CD_FRAMESIZE_RAW] = { 0, };
|
char buf[CDIO_CD_FRAMESIZE_RAW] = { 0, };
|
||||||
_img_private_t *env = user_data;
|
_img_private_t *p_env = user_data;
|
||||||
|
|
||||||
if (env->gen.ioctls_debugged == 75)
|
if (p_env->gen.ioctls_debugged == 75)
|
||||||
cdio_debug ("only displaying every 75th ioctl from now on");
|
cdio_debug ("only displaying every 75th ioctl from now on");
|
||||||
|
|
||||||
if (env->gen.ioctls_debugged == 30 * 75)
|
if (p_env->gen.ioctls_debugged == 30 * 75)
|
||||||
cdio_debug ("only displaying every 30*75th ioctl from now on");
|
cdio_debug ("only displaying every 30*75th ioctl from now on");
|
||||||
|
|
||||||
if (env->gen.ioctls_debugged < 75
|
if (p_env->gen.ioctls_debugged < 75
|
||||||
|| (env->gen.ioctls_debugged < (30 * 75)
|
|| (p_env->gen.ioctls_debugged < (30 * 75)
|
||||||
&& env->gen.ioctls_debugged % 75 == 0)
|
&& p_env->gen.ioctls_debugged % 75 == 0)
|
||||||
|| env->gen.ioctls_debugged % (30 * 75) == 0)
|
|| p_env->gen.ioctls_debugged % (30 * 75) == 0)
|
||||||
cdio_debug ("reading %lu", (unsigned long int) lsn);
|
cdio_debug ("reading %lu", (unsigned long int) lsn);
|
||||||
|
|
||||||
env->gen.ioctls_debugged++;
|
p_env->gen.ioctls_debugged++;
|
||||||
|
|
||||||
if ( env->hASPI ) {
|
if ( p_env->hASPI ) {
|
||||||
int ret;
|
int ret;
|
||||||
ret = read_mode2_sector_aspi(user_data, buf, lsn, 1);
|
ret = read_mode2_sector_aspi(user_data, buf, lsn, 1);
|
||||||
if( ret != 0 ) return ret;
|
if( ret != 0 ) return ret;
|
||||||
@@ -332,7 +332,7 @@ _cdio_read_mode2_sector (void *user_data, void *data, lsn_t lsn,
|
|||||||
memcpy (((char *)data), buf + CDIO_CD_SUBHEADER_SIZE, CDIO_CD_FRAMESIZE);
|
memcpy (((char *)data), buf + CDIO_CD_SUBHEADER_SIZE, CDIO_CD_FRAMESIZE);
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
return read_mode2_sector_win32ioctl( env, data, lsn, b_form2 );
|
return read_mode2_sector_win32ioctl( p_env, data, lsn, b_form2 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -362,37 +362,37 @@ _cdio_read_mode2_sectors (void *user_data, void *data, lsn_t lsn,
|
|||||||
Return the size of the CD in logical block address (LBA) units.
|
Return the size of the CD in logical block address (LBA) units.
|
||||||
*/
|
*/
|
||||||
static uint32_t
|
static uint32_t
|
||||||
_cdio_stat_size (void *user_data)
|
stat_size_win32 (void *user_data)
|
||||||
{
|
{
|
||||||
_img_private_t *env = user_data;
|
_img_private_t *p_env = user_data;
|
||||||
|
|
||||||
return env->tocent[env->i_tracks].start_lsn;
|
return p_env->tocent[p_env->gen.i_tracks].start_lsn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Set the key "arg" to "value" in source device.
|
Set the key "arg" to "value" in source device.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
_set_arg_win32 (void *user_data, const char key[], const char value[])
|
set_arg_win32 (void *user_data, const char key[], const char value[])
|
||||||
{
|
{
|
||||||
_img_private_t *env = user_data;
|
_img_private_t *p_env = user_data;
|
||||||
|
|
||||||
if (!strcmp (key, "source"))
|
if (!strcmp (key, "source"))
|
||||||
{
|
{
|
||||||
if (!value)
|
if (!value)
|
||||||
return -2;
|
return -2;
|
||||||
|
|
||||||
free (env->gen.source_name);
|
free (p_env->gen.source_name);
|
||||||
|
|
||||||
env->gen.source_name = strdup (value);
|
p_env->gen.source_name = strdup (value);
|
||||||
}
|
}
|
||||||
else if (!strcmp (key, "access-mode"))
|
else if (!strcmp (key, "access-mode"))
|
||||||
{
|
{
|
||||||
env->access_mode = str_to_access_mode_win32(value);
|
p_env->access_mode = str_to_access_mode_win32(value);
|
||||||
if (env->access_mode == _AM_ASPI && !env->b_aspi_init)
|
if (p_env->access_mode == _AM_ASPI && !p_env->b_aspi_init)
|
||||||
return init_aspi(env) ? 1 : -3;
|
return init_aspi(p_env) ? 1 : -3;
|
||||||
else if (env->access_mode == _AM_IOCTL && !env->b_ioctl_init)
|
else if (p_env->access_mode == _AM_IOCTL && !p_env->b_ioctl_init)
|
||||||
return init_win32ioctl(env) ? 1 : -3;
|
return init_win32ioctl(p_env) ? 1 : -3;
|
||||||
else
|
else
|
||||||
return -4;
|
return -4;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -408,8 +408,9 @@ _set_arg_win32 (void *user_data, const char key[], const char value[])
|
|||||||
Return true if successful or false if an error.
|
Return true if successful or false if an error.
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
_cdio_read_toc (_img_private_t *p_env)
|
read_toc_win32 (void *p_user_data)
|
||||||
{
|
{
|
||||||
|
_img_private_t *p_env;
|
||||||
bool ret;
|
bool ret;
|
||||||
if( p_env->hASPI ) {
|
if( p_env->hASPI ) {
|
||||||
ret = read_toc_aspi( p_env );
|
ret = read_toc_aspi( p_env );
|
||||||
@@ -505,7 +506,7 @@ _get_cdtext_win32 (void *user_data, track_t i_track)
|
|||||||
|
|
||||||
if ( NULL == env ||
|
if ( NULL == env ||
|
||||||
(0 != i_track
|
(0 != i_track
|
||||||
&& i_track >= env->i_tracks + env->gen.i_first_track ) )
|
&& i_track >= env->gen.i_tracks + env->gen.i_first_track ) )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (env->hASPI) {
|
if (env->hASPI) {
|
||||||
@@ -523,20 +524,6 @@ _get_cdtext_win32 (void *user_data, track_t i_track)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
Return the number of of the first track.
|
|
||||||
CDIO_INVALID_TRACK is returned on error.
|
|
||||||
*/
|
|
||||||
static track_t
|
|
||||||
_cdio_get_first_track_num(void *user_data)
|
|
||||||
{
|
|
||||||
_img_private_t *env = user_data;
|
|
||||||
|
|
||||||
if (!env->toc_init) _cdio_read_toc (env) ;
|
|
||||||
|
|
||||||
return env->gen.i_first_track;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Return the media catalog number MCN.
|
Return the media catalog number MCN.
|
||||||
|
|
||||||
@@ -555,20 +542,6 @@ _cdio_get_mcn (const void *p_user_data) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
Return the number of tracks in the current medium.
|
|
||||||
CDIO_INVALID_TRACK is returned on error.
|
|
||||||
*/
|
|
||||||
static track_t
|
|
||||||
_cdio_get_num_tracks(void *user_data)
|
|
||||||
{
|
|
||||||
_img_private_t *env = user_data;
|
|
||||||
|
|
||||||
if (!env->toc_init) _cdio_read_toc (env) ;
|
|
||||||
|
|
||||||
return env->i_tracks;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Get format of track.
|
Get format of track.
|
||||||
*/
|
*/
|
||||||
@@ -579,7 +552,7 @@ _cdio_get_track_format(void *obj, track_t i_track)
|
|||||||
|
|
||||||
if ( NULL == p_env ||
|
if ( NULL == p_env ||
|
||||||
( i_track < p_env->gen.i_first_track
|
( i_track < p_env->gen.i_first_track
|
||||||
|| i_track >= p_env->i_tracks + p_env->gen.i_first_track ) )
|
|| i_track >= p_env->gen.i_tracks + p_env->gen.i_first_track ) )
|
||||||
return TRACK_FORMAT_ERROR;
|
return TRACK_FORMAT_ERROR;
|
||||||
|
|
||||||
if( p_env->hASPI ) {
|
if( p_env->hASPI ) {
|
||||||
@@ -630,20 +603,20 @@ _cdio_get_track_green(void *obj, track_t i_track)
|
|||||||
False is returned if there is no track entry.
|
False is returned if there is no track entry.
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
_cdio_get_track_msf(void *p_env, track_t i_tracks, msf_t *msf)
|
_cdio_get_track_msf(void *p_user_data, track_t i_tracks, msf_t *msf)
|
||||||
{
|
{
|
||||||
_img_private_t *_obj = p_env;
|
_img_private_t *p_env = p_user_data;
|
||||||
|
|
||||||
if (NULL == msf) return false;
|
if (NULL == msf) return false;
|
||||||
|
|
||||||
if (!_obj->toc_init) _cdio_read_toc (_obj) ;
|
if (!p_env->gen.toc_init) read_toc_win32 (p_env) ;
|
||||||
|
|
||||||
if (i_tracks == CDIO_CDROM_LEADOUT_TRACK) i_tracks = _obj->i_tracks+1;
|
if (i_tracks == CDIO_CDROM_LEADOUT_TRACK) i_tracks = p_env->gen.i_tracks+1;
|
||||||
|
|
||||||
if (i_tracks > _obj->i_tracks+1 || i_tracks == 0) {
|
if (i_tracks > p_env->gen.i_tracks+1 || i_tracks == 0) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
cdio_lsn_to_msf(_obj->tocent[i_tracks-1].start_lsn, msf);
|
cdio_lsn_to_msf(p_env->tocent[i_tracks-1].start_lsn, msf);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -787,9 +760,9 @@ cdio_open_am_win32 (const char *psz_orig_source, const char *psz_access_mode)
|
|||||||
.get_devices = cdio_get_devices_win32,
|
.get_devices = cdio_get_devices_win32,
|
||||||
.get_discmode = get_discmode_win32,
|
.get_discmode = get_discmode_win32,
|
||||||
.get_drive_cap = _cdio_get_drive_cap,
|
.get_drive_cap = _cdio_get_drive_cap,
|
||||||
.get_first_track_num= _cdio_get_first_track_num,
|
.get_first_track_num= get_first_track_num_generic,
|
||||||
.get_mcn = _cdio_get_mcn,
|
.get_mcn = _cdio_get_mcn,
|
||||||
.get_num_tracks = _cdio_get_num_tracks,
|
.get_num_tracks = get_num_tracks_generic,
|
||||||
.get_track_format = _cdio_get_track_format,
|
.get_track_format = _cdio_get_track_format,
|
||||||
.get_track_green = _cdio_get_track_green,
|
.get_track_green = _cdio_get_track_green,
|
||||||
.get_track_lba = NULL, /* This could be implemented if need be. */
|
.get_track_lba = NULL, /* This could be implemented if need be. */
|
||||||
@@ -801,9 +774,10 @@ cdio_open_am_win32 (const char *psz_orig_source, const char *psz_access_mode)
|
|||||||
.read_mode1_sectors = _cdio_read_mode1_sectors,
|
.read_mode1_sectors = _cdio_read_mode1_sectors,
|
||||||
.read_mode2_sector = _cdio_read_mode2_sector,
|
.read_mode2_sector = _cdio_read_mode2_sector,
|
||||||
.read_mode2_sectors = _cdio_read_mode2_sectors,
|
.read_mode2_sectors = _cdio_read_mode2_sectors,
|
||||||
.run_scsi_mmc_cmd = run_scsi_cmd_win32,
|
.read_toc = &read_toc_win32,
|
||||||
.set_arg = _set_arg_win32,
|
.run_scsi_mmc_cmd = &run_scsi_cmd_win32,
|
||||||
.stat_size = _cdio_stat_size
|
.set_arg = set_arg_win32,
|
||||||
|
.stat_size = stat_size_win32
|
||||||
};
|
};
|
||||||
|
|
||||||
_data = _cdio_malloc (sizeof (_img_private_t));
|
_data = _cdio_malloc (sizeof (_img_private_t));
|
||||||
@@ -814,11 +788,11 @@ cdio_open_am_win32 (const char *psz_orig_source, const char *psz_access_mode)
|
|||||||
if (NULL == psz_orig_source) {
|
if (NULL == psz_orig_source) {
|
||||||
psz_source=cdio_get_default_device_win32();
|
psz_source=cdio_get_default_device_win32();
|
||||||
if (NULL == psz_source) return NULL;
|
if (NULL == psz_source) return NULL;
|
||||||
_set_arg_win32(_data, "source", psz_source);
|
set_arg_win32(_data, "source", psz_source);
|
||||||
free(psz_source);
|
free(psz_source);
|
||||||
} else {
|
} else {
|
||||||
if (cdio_is_device_win32(psz_orig_source))
|
if (cdio_is_device_win32(psz_orig_source))
|
||||||
_set_arg_win32(_data, "source", psz_orig_source);
|
set_arg_win32(_data, "source", psz_orig_source);
|
||||||
else {
|
else {
|
||||||
/* The below would be okay if all device drivers worked this way. */
|
/* The below would be okay if all device drivers worked this way. */
|
||||||
#if 0
|
#if 0
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: win32.h,v 1.17 2004/07/28 03:17:56 rocky Exp $
|
$Id: win32.h,v 1.18 2004/07/29 04:14:44 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -44,12 +44,9 @@ typedef struct {
|
|||||||
track_info_t tocent[CDIO_CD_MAX_TRACKS+1];
|
track_info_t tocent[CDIO_CD_MAX_TRACKS+1];
|
||||||
|
|
||||||
cdtext_t cdtext; /* CD-TEXT */
|
cdtext_t cdtext; /* CD-TEXT */
|
||||||
track_t i_tracks; /* number of tracks in image */
|
|
||||||
|
|
||||||
access_mode_t access_mode;
|
access_mode_t access_mode;
|
||||||
|
|
||||||
/* Some of the more OS specific things. */
|
/* Some of the more OS specific things. */
|
||||||
bool toc_init; /* if true, info below is valid. */
|
|
||||||
HANDLE h_device_handle; /* device descriptor */
|
HANDLE h_device_handle; /* device descriptor */
|
||||||
long hASPI;
|
long hASPI;
|
||||||
short i_sid;
|
short i_sid;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: win32_ioctl.c,v 1.32 2004/07/28 16:51:15 rocky Exp $
|
$Id: win32_ioctl.c,v 1.33 2004/07/29 04:14:44 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char _rcsid[] = "$Id: win32_ioctl.c,v 1.32 2004/07/28 16:51:15 rocky Exp $";
|
static const char _rcsid[] = "$Id: win32_ioctl.c,v 1.33 2004/07/29 04:14:44 rocky Exp $";
|
||||||
|
|
||||||
#include <cdio/cdio.h>
|
#include <cdio/cdio.h>
|
||||||
#include <cdio/sector.h>
|
#include <cdio/sector.h>
|
||||||
@@ -228,7 +228,7 @@ get_discmode_win32ioctl (_img_private_t *p_env)
|
|||||||
return CDIO_DISC_MODE_NO_INFO;
|
return CDIO_DISC_MODE_NO_INFO;
|
||||||
|
|
||||||
for (i_track = p_env->gen.i_first_track;
|
for (i_track = p_env->gen.i_first_track;
|
||||||
i_track < p_env->gen.i_first_track + p_env->i_tracks ;
|
i_track < p_env->gen.i_first_track + p_env->gen.i_tracks ;
|
||||||
i_track ++) {
|
i_track ++) {
|
||||||
track_format_t track_fmt=get_track_format_win32ioctl(p_env, i_track);
|
track_format_t track_fmt=get_track_format_win32ioctl(p_env, i_track);
|
||||||
|
|
||||||
@@ -486,10 +486,10 @@ read_toc_win32ioctl (_img_private_t *env)
|
|||||||
}
|
}
|
||||||
|
|
||||||
env->gen.i_first_track = cdrom_toc.FirstTrack;
|
env->gen.i_first_track = cdrom_toc.FirstTrack;
|
||||||
env->i_tracks = cdrom_toc.LastTrack - cdrom_toc.FirstTrack + 1;
|
env->gen.i_tracks = cdrom_toc.LastTrack - cdrom_toc.FirstTrack + 1;
|
||||||
|
|
||||||
|
|
||||||
for( i = 0 ; i <= env->i_tracks ; i++ ) {
|
for( i = 0 ; i <= env->gen.i_tracks ; i++ ) {
|
||||||
env->tocent[ i ].start_lsn = cdio_msf3_to_lba(
|
env->tocent[ i ].start_lsn = cdio_msf3_to_lba(
|
||||||
cdrom_toc.TrackData[i].Address[1],
|
cdrom_toc.TrackData[i].Address[1],
|
||||||
cdrom_toc.TrackData[i].Address[2],
|
cdrom_toc.TrackData[i].Address[2],
|
||||||
|
|||||||
Reference in New Issue
Block a user