Add mode1 reading Lint changes, routine renaming to be like
others. More const's, fewer void *. Attempt drive detection. There are still many bugs. The code is just a little less bogus.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
$Id: aspi32.c,v 1.6 2004/05/16 13:33:28 rocky Exp $
|
||||
$Id: aspi32.c,v 1.7 2004/06/20 15:06:42 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.6 2004/05/16 13:33:28 rocky Exp $";
|
||||
static const char _rcsid[] = "$Id: aspi32.c,v 1.7 2004/06/20 15:06:42 rocky Exp $";
|
||||
|
||||
#include <cdio/cdio.h>
|
||||
#include <cdio/sector.h>
|
||||
@@ -55,7 +55,7 @@ static const char _rcsid[] = "$Id: aspi32.c,v 1.6 2004/05/16 13:33:28 rocky Exp
|
||||
|
||||
/* General ioctl() CD-ROM command function */
|
||||
static bool
|
||||
wnaspi32_mciSendCommand(int id, UINT msg, DWORD flags, void *arg)
|
||||
mciSendCommand_aspi(int id, UINT msg, DWORD flags, void *arg)
|
||||
{
|
||||
MCIERROR mci_error;
|
||||
|
||||
@@ -70,14 +70,14 @@ wnaspi32_mciSendCommand(int id, UINT msg, DWORD flags, void *arg)
|
||||
}
|
||||
|
||||
const char *
|
||||
wnaspi32_is_cdrom(const char drive_letter)
|
||||
is_cdrom_aspi(const char drive_letter)
|
||||
{
|
||||
static char psz_win32_drive[7];
|
||||
HMODULE hASPI = NULL;
|
||||
long (*lpGetSupport)( void ) = NULL;
|
||||
long (*lpSendCommand)( void* ) = NULL;
|
||||
DWORD dwSupportInfo;
|
||||
int i_adapter, i_num_adapters;
|
||||
int i_adapter, i_hostadapters;
|
||||
char c_drive;
|
||||
|
||||
hASPI = LoadLibrary( "wnaspi32.dll" );
|
||||
@@ -94,7 +94,7 @@ wnaspi32_is_cdrom(const char drive_letter)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* ASPI support seems to be there */
|
||||
/* ASPI support seems to be there. */
|
||||
|
||||
dwSupportInfo = lpGetSupport();
|
||||
|
||||
@@ -110,15 +110,15 @@ wnaspi32_is_cdrom(const char drive_letter)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
i_num_adapters = LOBYTE( LOWORD( dwSupportInfo ) );
|
||||
if( i_num_adapters == 0 ) {
|
||||
i_hostadapters = LOBYTE( LOWORD( dwSupportInfo ) );
|
||||
if( i_hostadapters == 0 ) {
|
||||
FreeLibrary( hASPI );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
c_drive = toupper(drive_letter) - 'A';
|
||||
|
||||
for( i_adapter = 0; i_adapter < i_num_adapters; i_adapter++ ) {
|
||||
for( i_adapter = 0; i_adapter < i_hostadapters; i_adapter++ ) {
|
||||
struct SRB_GetDiskInfo srbDiskInfo;
|
||||
int i_target;
|
||||
SRB_HAInquiry srbInquiry;
|
||||
@@ -147,7 +147,7 @@ wnaspi32_is_cdrom(const char drive_letter)
|
||||
|
||||
if( (srbDiskInfo.SRB_Status == SS_COMP) &&
|
||||
(srbDiskInfo.SRB_Int13HDriveInfo == c_drive) ) {
|
||||
/* Make sure this is a cdrom device */
|
||||
/* Make sure this is a CD-ROM device. */
|
||||
struct SRB_GDEVBlock srbGDEVBlock;
|
||||
|
||||
memset( &srbGDEVBlock, 0, sizeof(struct SRB_GDEVBlock) );
|
||||
@@ -175,13 +175,13 @@ wnaspi32_is_cdrom(const char drive_letter)
|
||||
Initialize CD device.
|
||||
*/
|
||||
bool
|
||||
wnaspi32_init_win32 (_img_private_t *env)
|
||||
init_aspi (_img_private_t *env)
|
||||
{
|
||||
HMODULE hASPI = NULL;
|
||||
long (*lpGetSupport)( void ) = NULL;
|
||||
long (*lpSendCommand)( void* ) = NULL;
|
||||
DWORD dwSupportInfo;
|
||||
int i, j, i_num_adapters;
|
||||
int i_adapter, i_hostadapters;
|
||||
char c_drive;
|
||||
|
||||
if (2 == strlen(env->gen.source_name) && isalpha(env->gen.source_name[0]) )
|
||||
@@ -206,7 +206,7 @@ wnaspi32_init_win32 (_img_private_t *env)
|
||||
return false;
|
||||
}
|
||||
|
||||
/* ASPI support seems to be there */
|
||||
/* ASPI support seems to be there. */
|
||||
|
||||
dwSupportInfo = lpGetSupport();
|
||||
|
||||
@@ -222,62 +222,73 @@ wnaspi32_init_win32 (_img_private_t *env)
|
||||
return false;
|
||||
}
|
||||
|
||||
i_num_adapters = LOBYTE( LOWORD( dwSupportInfo ) );
|
||||
if( i_num_adapters == 0 ) {
|
||||
i_hostadapters = LOBYTE( LOWORD( dwSupportInfo ) );
|
||||
if( i_hostadapters == 0 ) {
|
||||
FreeLibrary( hASPI );
|
||||
return false;
|
||||
}
|
||||
|
||||
c_drive = toupper(c_drive) - 'A';
|
||||
|
||||
for( i = 0; i < i_num_adapters; i++ ) {
|
||||
for( j = 0; j < 15; j++ ) {
|
||||
struct SRB_GetDiskInfo srbDiskInfo;
|
||||
int lun;
|
||||
|
||||
for (lun = 0; lun < 8; lun++ ) {
|
||||
srbDiskInfo.SRB_Cmd = SC_GET_DISK_INFO;
|
||||
srbDiskInfo.SRB_HaId = i;
|
||||
srbDiskInfo.SRB_Flags = 0;
|
||||
srbDiskInfo.SRB_Hdr_Rsvd = 0;
|
||||
srbDiskInfo.SRB_Target = j;
|
||||
srbDiskInfo.SRB_Lun = lun;
|
||||
|
||||
lpSendCommand( (void*) &srbDiskInfo );
|
||||
|
||||
if( (srbDiskInfo.SRB_Status == SS_COMP) ) {
|
||||
for( i_adapter = 0; i_adapter < i_hostadapters; i_adapter++ ) {
|
||||
struct SRB_GetDiskInfo srbDiskInfo;
|
||||
int i_target;
|
||||
SRB_HAInquiry srbInquiry;
|
||||
|
||||
srbInquiry.SRB_Cmd = SC_HA_INQUIRY;
|
||||
srbInquiry.SRB_HaId = i_adapter;
|
||||
|
||||
lpSendCommand( (void*) &srbInquiry );
|
||||
|
||||
if( srbInquiry.SRB_Status != SS_COMP ) continue;
|
||||
if( !srbInquiry.HA_Unique[3]) srbInquiry.HA_Unique[3]=8;
|
||||
|
||||
for(i_target=0; i_target < srbInquiry.HA_Unique[3]; i_target++)
|
||||
{
|
||||
int i_lun;
|
||||
for (i_lun = 0; i_lun < 8; i_lun++ ) {
|
||||
srbDiskInfo.SRB_Cmd = SC_GET_DISK_INFO;
|
||||
srbDiskInfo.SRB_Flags = 0;
|
||||
srbDiskInfo.SRB_Hdr_Rsvd = 0;
|
||||
srbDiskInfo.SRB_HaId = i_adapter;
|
||||
srbDiskInfo.SRB_Target = i_target;
|
||||
srbDiskInfo.SRB_Lun = i_lun;
|
||||
|
||||
if (srbDiskInfo.SRB_Int13HDriveInfo != c_drive)
|
||||
{
|
||||
continue;
|
||||
} else {
|
||||
/* Make sure this is a cdrom device */
|
||||
struct SRB_GDEVBlock srbGDEVBlock;
|
||||
|
||||
memset( &srbGDEVBlock, 0, sizeof(struct SRB_GDEVBlock) );
|
||||
srbGDEVBlock.SRB_Cmd = SC_GET_DEV_TYPE;
|
||||
srbGDEVBlock.SRB_HaId = i;
|
||||
srbGDEVBlock.SRB_Target = j;
|
||||
|
||||
lpSendCommand( (void*) &srbGDEVBlock );
|
||||
|
||||
if( ( srbGDEVBlock.SRB_Status == SS_COMP ) &&
|
||||
( srbGDEVBlock.SRB_DeviceType == DTYPE_CDROM ) ) {
|
||||
env->i_sid = MAKEWORD( i, j );
|
||||
env->hASPI = (long)hASPI;
|
||||
env->lpSendCommand = lpSendCommand;
|
||||
env->b_aspi_init = true;
|
||||
cdio_debug("Using ASPI layer");
|
||||
|
||||
return true;
|
||||
lpSendCommand( (void*) &srbDiskInfo );
|
||||
|
||||
if( (srbDiskInfo.SRB_Status == SS_COMP) ) {
|
||||
|
||||
if (srbDiskInfo.SRB_Int13HDriveInfo != c_drive)
|
||||
{
|
||||
continue;
|
||||
} else {
|
||||
FreeLibrary( hASPI );
|
||||
cdio_debug( "%c: is not a CD-ROM drive",
|
||||
env->gen.source_name[0] );
|
||||
return false;
|
||||
/* Make sure this is a CD-ROM device. */
|
||||
struct SRB_GDEVBlock srbGDEVBlock;
|
||||
|
||||
memset( &srbGDEVBlock, 0, sizeof(struct SRB_GDEVBlock) );
|
||||
srbGDEVBlock.SRB_Cmd = SC_GET_DEV_TYPE;
|
||||
srbGDEVBlock.SRB_HaId = i_adapter;
|
||||
srbGDEVBlock.SRB_Target = i_target;
|
||||
|
||||
lpSendCommand( (void*) &srbGDEVBlock );
|
||||
|
||||
if( ( srbGDEVBlock.SRB_Status == SS_COMP ) &&
|
||||
( srbGDEVBlock.SRB_DeviceType == DTYPE_CDROM ) ) {
|
||||
env->i_sid = MAKEWORD( i_adapter, i_target );
|
||||
env->hASPI = (long)hASPI;
|
||||
env->lpSendCommand = lpSendCommand;
|
||||
env->b_aspi_init = true;
|
||||
cdio_debug("Using ASPI layer");
|
||||
|
||||
return true;
|
||||
} else {
|
||||
FreeLibrary( hASPI );
|
||||
cdio_debug( "%c: is not a CD-ROM drive",
|
||||
env->gen.source_name[0] );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -292,21 +303,26 @@ wnaspi32_init_win32 (_img_private_t *env)
|
||||
Returns 0 if no error.
|
||||
*/
|
||||
static int
|
||||
wnaspi32_mmc_read_sectors (_img_private_t *env, void *data, lsn_t lsn,
|
||||
int sector_type, unsigned int nblocks)
|
||||
mmc_read_sectors_aspi (const _img_private_t *env, void *data, lsn_t lsn,
|
||||
int sector_type, unsigned int nblocks)
|
||||
{
|
||||
unsigned char buf[CDIO_CD_FRAMESIZE_RAW] = { 0, };
|
||||
HANDLE hEvent;
|
||||
struct SRB_ExecSCSICmd ssc;
|
||||
|
||||
#if 1
|
||||
|
||||
#if 0
|
||||
sector_type = 0; /*all types */
|
||||
/*sector_type = 1;*/ /* CD-DA */
|
||||
/*sector_type = 2;*/ /* mode1 */
|
||||
/*sector_type = 3;*/ /* mode2 */
|
||||
/*sector_type = 4;*/ /* mode2/form1 */
|
||||
/*sector_type = 5;*/ /* mode2/form2 */
|
||||
#endif
|
||||
int sync = 0;
|
||||
int header_code = 2;
|
||||
int i_user_data = 1;
|
||||
int edc_ecc = 0;
|
||||
int error_field = 0;
|
||||
#endif
|
||||
|
||||
|
||||
/* Create the transfer completion event */
|
||||
@@ -376,11 +392,13 @@ wnaspi32_mmc_read_sectors (_img_private_t *env, void *data, lsn_t lsn,
|
||||
Returns 0 if no error.
|
||||
*/
|
||||
int
|
||||
wnaspi32_read_audio_sectors (_img_private_t *env, void *data, lsn_t lsn,
|
||||
read_audio_sectors_aspi (_img_private_t *env, void *data, lsn_t lsn,
|
||||
unsigned int nblocks)
|
||||
{
|
||||
return wnaspi32_mmc_read_sectors( env, data, lsn, CDIO_MMC_READ_TYPE_CDDA,
|
||||
nblocks );
|
||||
if (mmc_read_sectors_aspi(env, data, lsn, CDIO_MMC_READ_TYPE_CDDA, 1)) {
|
||||
return mmc_read_sectors_aspi(env, data, lsn, CDIO_MMC_READ_TYPE_ANY, 1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -388,10 +406,31 @@ wnaspi32_read_audio_sectors (_img_private_t *env, void *data, lsn_t lsn,
|
||||
from lsn. Returns 0 if no error.
|
||||
*/
|
||||
int
|
||||
wnaspi32_read_mode2_sector (_img_private_t *env, void *data, lsn_t lsn)
|
||||
read_mode2_sector_aspi (const _img_private_t *env, void *data, lsn_t lsn,
|
||||
bool b_form2)
|
||||
{
|
||||
return wnaspi32_mmc_read_sectors(env, data, lsn, CDIO_MMC_READ_TYPE_ANY,
|
||||
1);
|
||||
|
||||
if (mmc_read_sectors_aspi(env, data, lsn, b_form2
|
||||
? CDIO_MMC_READ_TYPE_M2F2
|
||||
: CDIO_MMC_READ_TYPE_M2F1,
|
||||
1)) {
|
||||
return mmc_read_sectors_aspi(env, data, lsn, CDIO_MMC_READ_TYPE_ANY, 1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
Reads a single mode2 sector from cd device into data starting
|
||||
from lsn. Returns 0 if no error.
|
||||
*/
|
||||
int
|
||||
read_mode1_sector_aspi (const _img_private_t *env, void *data, lsn_t lsn,
|
||||
bool b_form2)
|
||||
{
|
||||
if (mmc_read_sectors_aspi(env, data, lsn, CDIO_MMC_READ_TYPE_MODE1, 1)) {
|
||||
return mmc_read_sectors_aspi(env, data, lsn, CDIO_MMC_READ_TYPE_ANY, 1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -399,7 +438,7 @@ wnaspi32_read_mode2_sector (_img_private_t *env, void *data, lsn_t lsn)
|
||||
Return true if successful or false if an error.
|
||||
*/
|
||||
bool
|
||||
wnaspi32_read_toc (_img_private_t *env)
|
||||
read_toc_aspi (_img_private_t *env)
|
||||
{
|
||||
HANDLE hEvent;
|
||||
struct SRB_ExecSCSICmd ssc;
|
||||
@@ -434,8 +473,8 @@ wnaspi32_read_toc (_img_private_t *env)
|
||||
/* Allocation length and buffer */
|
||||
ssc.SRB_BufLen = sizeof( p_tocheader );
|
||||
ssc.SRB_BufPointer = p_tocheader;
|
||||
ssc.CDBByte[ 7 ] = ( ssc.SRB_BufLen >> 8 ) & 0xff;
|
||||
ssc.CDBByte[ 8 ] = ( ssc.SRB_BufLen ) & 0xff;
|
||||
ssc.CDBByte[ 7 ] = (unsigned char) ( ssc.SRB_BufLen >> 8 ) & 0xff;
|
||||
ssc.CDBByte[ 8 ] = (unsigned char) ( ssc.SRB_BufLen ) & 0xff;
|
||||
|
||||
/* Initiate transfer */
|
||||
ResetEvent( hEvent );
|
||||
@@ -452,8 +491,8 @@ wnaspi32_read_toc (_img_private_t *env)
|
||||
return false;
|
||||
}
|
||||
|
||||
env->first_track_num = p_tocheader[2];
|
||||
env->total_tracks = p_tocheader[3] - p_tocheader[2] + 1;
|
||||
env->i_first_track = p_tocheader[2];
|
||||
env->total_tracks = p_tocheader[3] - p_tocheader[2] + 1;
|
||||
|
||||
{
|
||||
int i, i_toclength;
|
||||
@@ -473,8 +512,8 @@ wnaspi32_read_toc (_img_private_t *env)
|
||||
/* Allocation length and buffer */
|
||||
ssc.SRB_BufLen = i_toclength;
|
||||
ssc.SRB_BufPointer = p_fulltoc;
|
||||
ssc.CDBByte[ 7 ] = ( ssc.SRB_BufLen >> 8 ) & 0xff;
|
||||
ssc.CDBByte[ 8 ] = ( ssc.SRB_BufLen ) & 0xff;
|
||||
ssc.CDBByte[ 7 ] = (unsigned char) ( ssc.SRB_BufLen >> 8 ) & 0xff;
|
||||
ssc.CDBByte[ 8 ] = (unsigned char) ( ssc.SRB_BufLen ) & 0xff;
|
||||
|
||||
/* Initiate transfer */
|
||||
ResetEvent( hEvent );
|
||||
@@ -486,8 +525,10 @@ wnaspi32_read_toc (_img_private_t *env)
|
||||
WaitForSingleObject( hEvent, INFINITE );
|
||||
|
||||
/* check that the transfer went as planned */
|
||||
#if 0
|
||||
if( ssc.SRB_Status != SS_COMP )
|
||||
env->total_tracks = 0;
|
||||
#endif
|
||||
|
||||
for( i = 0 ; i <= env->total_tracks ; i++ ) {
|
||||
int i_index = 8 + 8 * i;
|
||||
@@ -536,13 +577,13 @@ wnaspi32_eject_media (void *user_data) {
|
||||
i_flags = MCI_OPEN_TYPE | MCI_OPEN_TYPE_ID |
|
||||
MCI_OPEN_ELEMENT | MCI_OPEN_SHAREABLE;
|
||||
|
||||
if( wnaspi32_mciSendCommand( 0, MCI_OPEN, i_flags, &op ) ) {
|
||||
if( mciSendCommand_aspi( 0, MCI_OPEN, i_flags, &op ) ) {
|
||||
st.dwItem = MCI_STATUS_READY;
|
||||
/* Eject disc */
|
||||
ret = wnaspi32_mciSendCommand( op.wDeviceID, MCI_SET,
|
||||
ret = mciSendCommand_aspi( op.wDeviceID, MCI_SET,
|
||||
MCI_SET_DOOR_OPEN, 0 ) != 0;
|
||||
/* Release access to the device */
|
||||
wnaspi32_mciSendCommand( op.wDeviceID, MCI_CLOSE, MCI_WAIT, 0 );
|
||||
mciSendCommand_aspi( op.wDeviceID, MCI_CLOSE, MCI_WAIT, 0 );
|
||||
} else
|
||||
ret = 0;
|
||||
|
||||
@@ -550,11 +591,95 @@ wnaspi32_eject_media (void *user_data) {
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
Return the the kind of drive capabilities of device.
|
||||
|
||||
Note: string is malloc'd so caller should free() then returned
|
||||
string when done with it.
|
||||
|
||||
*/
|
||||
cdio_drive_cap_t
|
||||
get_drive_cap_aspi (const _img_private_t *env)
|
||||
{
|
||||
int32_t i_drivetype = CDIO_DRIVE_CAP_CD_AUDIO | CDIO_DRIVE_CAP_UNKNOWN;
|
||||
unsigned char buf[192] = { 0, };
|
||||
|
||||
HANDLE hEvent;
|
||||
struct SRB_ExecSCSICmd ssc;
|
||||
|
||||
/* Create the transfer completion event */
|
||||
hEvent = CreateEvent( NULL, TRUE, FALSE, NULL );
|
||||
if( hEvent == NULL ) {
|
||||
return CDIO_DRIVE_CAP_ERROR;
|
||||
}
|
||||
|
||||
memset( &ssc, 0, sizeof( ssc ) );
|
||||
|
||||
/* If device supports SCSI-3, then we can get the CD drive
|
||||
capabilities, i.e. ability to read/write to CD-ROM/R/RW
|
||||
or/and read/write to DVD-ROM/R/RW. */
|
||||
|
||||
ssc.SRB_Cmd = SC_EXEC_SCSI_CMD;
|
||||
ssc.SRB_Flags = SRB_DIR_IN | SRB_EVENT_NOTIFY;
|
||||
ssc.SRB_HaId = LOBYTE( env->i_sid );
|
||||
ssc.SRB_Target = HIBYTE( env->i_sid );
|
||||
ssc.SRB_SenseLen = SENSE_LEN;
|
||||
|
||||
ssc.SRB_PostProc = (LPVOID) hEvent;
|
||||
ssc.SRB_CDBLen = 6;
|
||||
|
||||
/* Operation code */
|
||||
CDIO_MMC_SET_COMMAND(ssc.CDBByte, CDIO_MMC_MODE_SENSE);
|
||||
|
||||
/*ssc.CDBByte[1] = 0x08; /+ doesn't return block descriptors */
|
||||
ssc.CDBByte[1] = 0x0;
|
||||
ssc.CDBByte[2] = 0x2a; /*MODE_PAGE_CAPABILITIES*/;
|
||||
ssc.CDBByte[3] = 0; /* Not used */
|
||||
ssc.CDBByte[4] = 128;
|
||||
ssc.CDBByte[5] = 0; /* Not used */
|
||||
|
||||
/* Allocation length and buffer */
|
||||
ssc.SRB_BufPointer = buf;
|
||||
ssc.SRB_BufLen = sizeof( buf );
|
||||
|
||||
/* Initiate transfer */
|
||||
ResetEvent( hEvent );
|
||||
env->lpSendCommand( (void*) &ssc );
|
||||
|
||||
/* If the command has still not been processed, wait until it's
|
||||
* finished */
|
||||
if( ssc.SRB_Status == SS_PENDING )
|
||||
WaitForSingleObject( hEvent, INFINITE );
|
||||
|
||||
/* check that the transfer went as planned */
|
||||
if( ssc.SRB_Status != SS_COMP ) {
|
||||
CloseHandle( hEvent );
|
||||
return i_drivetype;
|
||||
}
|
||||
{
|
||||
unsigned int n=buf[3]+4;
|
||||
/* Reader? */
|
||||
if (buf[n+5] & 0x01) i_drivetype |= CDIO_DRIVE_CAP_CD_AUDIO;
|
||||
if (buf[n+2] & 0x02) i_drivetype |= CDIO_DRIVE_CAP_CD_RW;
|
||||
if (buf[n+2] & 0x08) i_drivetype |= CDIO_DRIVE_CAP_DVD;
|
||||
|
||||
/* Writer? */
|
||||
if (buf[n+3] & 0x01) i_drivetype |= CDIO_DRIVE_CAP_CD_R;
|
||||
if (buf[n+3] & 0x10) i_drivetype |= CDIO_DRIVE_CAP_DVD_R;
|
||||
if (buf[n+3] & 0x20) i_drivetype |= CDIO_DRIVE_CAP_DVD_RAM;
|
||||
|
||||
if (buf[n+6] & 0x08) i_drivetype |= CDIO_DRIVE_CAP_OPEN_TRAY;
|
||||
if (buf[n+6] >> 5 != 0)
|
||||
i_drivetype |= CDIO_DRIVE_CAP_CLOSE_TRAY;
|
||||
}
|
||||
return i_drivetype;
|
||||
}
|
||||
|
||||
/*!
|
||||
Get format of track.
|
||||
*/
|
||||
track_format_t
|
||||
wnaspi32_get_track_format(_img_private_t *env, track_t track_num)
|
||||
get_track_format_aspi(const _img_private_t *env, track_t track_num)
|
||||
{
|
||||
MCI_OPEN_PARMS op;
|
||||
MCI_STATUS_PARMS st;
|
||||
@@ -569,14 +694,14 @@ wnaspi32_get_track_format(_img_private_t *env, track_t track_num)
|
||||
i_flags = MCI_OPEN_TYPE | MCI_OPEN_TYPE_ID |
|
||||
MCI_OPEN_ELEMENT | MCI_OPEN_SHAREABLE;
|
||||
|
||||
if( wnaspi32_mciSendCommand( 0, MCI_OPEN, i_flags, &op ) ) {
|
||||
if( mciSendCommand_aspi( 0, MCI_OPEN, i_flags, &op ) ) {
|
||||
st.dwItem = MCI_CDA_STATUS_TYPE_TRACK;
|
||||
st.dwTrack = track_num;
|
||||
i_flags = MCI_TRACK | MCI_STATUS_ITEM ;
|
||||
ret = wnaspi32_mciSendCommand( op.wDeviceID, MCI_STATUS, i_flags, &st );
|
||||
ret = mciSendCommand_aspi( op.wDeviceID, MCI_STATUS, i_flags, &st );
|
||||
|
||||
/* Release access to the device */
|
||||
wnaspi32_mciSendCommand( op.wDeviceID, MCI_CLOSE, MCI_WAIT, 0 );
|
||||
mciSendCommand_aspi( op.wDeviceID, MCI_CLOSE, MCI_WAIT, 0 );
|
||||
|
||||
switch(st.dwReturn) {
|
||||
case MCI_CDA_TRACK_AUDIO:
|
||||
|
||||
Reference in New Issue
Block a user