Add type for holding MCN and ISRC. Add type for session

Replace magic constant 100 with CDIO_MAX_TRACK+1 where appropriate.

_cdio_osx: save session number and presumably some tighter coding.
nrg.c: make sure we add zero byte to end of MCN.
This commit is contained in:
rocky
2004-06-27 15:29:20 +00:00
parent 1e59a360a2
commit 79ea450a56
12 changed files with 216 additions and 85 deletions

View File

@@ -19,7 +19,7 @@ define(RELEASE_NUM, 70)
define(CDIO_VERSION_STR, 0.$1cvs) define(CDIO_VERSION_STR, 0.$1cvs)
AC_PREREQ(2.52) AC_PREREQ(2.52)
AC_REVISION([$Id: configure.ac,v 1.88 2004/06/26 19:26:36 rocky Exp $])dnl AC_REVISION([$Id: configure.ac,v 1.89 2004/06/27 15:29:20 rocky Exp $])dnl
AC_INIT(libcdio, CDIO_VERSION_STR(RELEASE_NUM)) AC_INIT(libcdio, CDIO_VERSION_STR(RELEASE_NUM))
AC_CONFIG_SRCDIR(src/cd-info.c) AC_CONFIG_SRCDIR(src/cd-info.c)
AM_INIT_AUTOMAKE AM_INIT_AUTOMAKE
@@ -230,7 +230,7 @@ AC_SUBST(LIBCDIO_CFLAGS)
AC_SUBST(LIBCDIO_LIBS) AC_SUBST(LIBCDIO_LIBS)
AC_SUBST(LIBISO9660_LIBS) AC_SUBST(LIBISO9660_LIBS)
case $host_os in case $target_os in
darwin6*|darwin7*) darwin6*|darwin7*)
AC_CHECK_HEADERS(IOKit/IOKitLib.h CoreFoundation/CFBase.h, AC_CHECK_HEADERS(IOKit/IOKitLib.h CoreFoundation/CFBase.h,
[have_iokit_h="yes"]) [have_iokit_h="yes"])

View File

@@ -57,6 +57,13 @@ layer. Mode 2 is for audio and video data and has no extra correction
layer. CD-ROM/XA An expansion of the CD-ROM Mode 2 format that allows layer. CD-ROM/XA An expansion of the CD-ROM Mode 2 format that allows
both computer and audio/video to be mixed in the same track. both computer and audio/video to be mixed in the same track.
@item CD Text
CD Text is a technology developed by Sony Corporation and Philips
Electronics in 1996 that allows storing in an audio CD and its tracks
information such as artist name, title, songwriter, composer, or
arranger. Commercially available audio CDs sometimes contain CD Text
information.
@item CD XA @item CD XA
CD-ROM EXtended Architecture. A modification to the CD-ROM CD-ROM EXtended Architecture. A modification to the CD-ROM
specification that defines two new types of sectors. CD-ROM XA was specification that defines two new types of sectors. CD-ROM XA was

View File

@@ -1,5 +1,5 @@
/* -*- c -*- /* -*- c -*-
$Id: cdio.h,v 1.53 2004/06/19 10:39:30 rocky Exp $ $Id: cdio.h,v 1.54 2004/06/27 15:29:21 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -232,7 +232,7 @@ extern "C" {
string when done with it. string when done with it.
*/ */
char *cdio_get_mcn (const CdIo *obj); char * cdio_get_mcn (const CdIo *obj);
/*! /*!
Get a string containing the name of the driver in use. Get a string containing the name of the driver in use.

View File

@@ -1,5 +1,5 @@
/* /*
$Id: sector.h,v 1.13 2004/06/02 00:43:53 rocky Exp $ $Id: sector.h,v 1.14 2004/06/27 15:29:21 rocky Exp $
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -119,16 +119,31 @@
#define CDIO_CDROM_CDI_TRACK 0x10 #define CDIO_CDROM_CDI_TRACK 0x10
#define CDIO_CDROM_XA_TRACK 0x20 #define CDIO_CDROM_XA_TRACK 0x20
/*! The leadout track is always 0xAA, regardless of # of tracks on disc */ /*! The leadout track is always 0xAA, regardless of # of tracks on
disc, or what value may be used internally. For example although
OS X uses a different value for the lead-out track internally than
given below, programmers should use CDIO_CDROM_LEADOUT_TRACK and
not worry about this.
*/
#define CDIO_CDROM_LEADOUT_TRACK 0xAA #define CDIO_CDROM_LEADOUT_TRACK 0xAA
#define M2F2_SECTOR_SIZE 2324 #define M2F2_SECTOR_SIZE 2324
#define M2SUB_SECTOR_SIZE 2332 #define M2SUB_SECTOR_SIZE 2332
#define M2RAW_SECTOR_SIZE 2336 #define M2RAW_SECTOR_SIZE 2336
/*! Largest CD track number */
#define CDIO_CD_MAX_TRACKS 99 #define CDIO_CD_MAX_TRACKS 99
/*! Smallest CD track number */
#define CDIO_CD_MIN_TRACK_NO 1 #define CDIO_CD_MIN_TRACK_NO 1
/*! Largest CD session number */
#define CDIO_CD_MAX_SESSIONS 99
/*! Smallest CD session number */
#define CDIO_CD_MIN_SESSION_NO 1
/*! Largest LSN in a CD */
#define CDIO_CD_MAX_LSN 450150 #define CDIO_CD_MAX_LSN 450150
/*! Smallest LSN in a CD */
#define CDIO_CD_MIN_LSN -450150 #define CDIO_CD_MIN_LSN -450150

View File

@@ -1,5 +1,5 @@
/* /*
$Id: types.h,v 1.17 2004/05/26 06:29:15 rocky Exp $ $Id: types.h,v 1.18 2004/06/27 15:29:21 rocky Exp $
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -218,7 +218,7 @@ extern "C" {
*/ */
typedef int32_t lsn_t; typedef int32_t lsn_t;
/*! The type of an track number 0..99. */ /*! The type of a track number 0..99. */
typedef uint8_t track_t; typedef uint8_t track_t;
/*! /*!
@@ -226,6 +226,14 @@ extern "C" {
*/ */
#define CDIO_INVALID_TRACK 0xFF #define CDIO_INVALID_TRACK 0xFF
/*! The type of a session number 0..99. */
typedef uint8_t session_t;
/*!
Constant for invalid session number
*/
#define CDIO_INVALID_SESSION 0xFF
/*! /*!
Constant for invalid LBA. It is 151 less than the most negative Constant for invalid LBA. It is 151 less than the most negative
LBA -45150. This provide slack for the 150-frame offset in LBA -45150. This provide slack for the 150-frame offset in
@@ -243,18 +251,36 @@ extern "C" {
*/ */
#define CDIO_MCN_SIZE 13 #define CDIO_MCN_SIZE 13
typedef int cdio_fs_anal_t; /*!
Type to hold ASCII bytes in a media catalog number (MCN).
We include an extra 0 byte so these can be used as C strings.
*/
typedef char cdio_mcn_t[CDIO_MCN_SIZE+1];
/*! The type of an drive capability bit mask. See below for values*/
/*!
Number of ASCII bytes in International Standard Recording Codes (ISRC)
*/
#define CDIO_ISRC_SIZE 12
/*!
Type to hold ASCII bytes in a media catalog number (MCN).
We include an extra 0 byte so these can be used as C strings.
*/
typedef char cdio_isrc_t[CDIO_ISRC_SIZE+1];
typedef int cdio_fs_anal_t;
/*! The type of an drive capability bit mask. See below for values*/
typedef uint32_t cdio_drive_cap_t; typedef uint32_t cdio_drive_cap_t;
/*! /*!
\brief Drive types returned by cdio_get_drive_cap() \brief Drive types returned by cdio_get_drive_cap()
Most are copied from the GNU/Linux the uniform CD-ROM driver header Most are copied from the GNU/Linux the uniform CD-ROM driver header
linux/cdrom.h> NOTE: Setting a bit here means the presence of linux/cdrom.h> NOTE: Setting a bit here means the presence of
a capability. a capability.
*/ */
#define CDIO_DRIVE_CAP_CLOSE_TRAY 0x00001 /**< caddy systems can't #define CDIO_DRIVE_CAP_CLOSE_TRAY 0x00001 /**< caddy systems can't
close... */ close... */
@@ -298,20 +324,20 @@ typedef int cdio_fs_anal_t;
#define CDIO_DRIVE_CAP_DVD_WRITER \ #define CDIO_DRIVE_CAP_DVD_WRITER \
(CDIO_DRIVE_CAP_DVD_R|CDIO_DRIVE_CAP_DVD_RAM) (CDIO_DRIVE_CAP_DVD_R|CDIO_DRIVE_CAP_DVD_RAM)
/**< Has some sort of DVD writer ability */ /**< Has some sort of DVD writer ability */
/*! /*!
track flags track flags
Q Sub-channel Control Field (4.2.3.3) Q Sub-channel Control Field (4.2.3.3)
*/ */
typedef enum { typedef enum {
CDIO_TRACK_FLAG_NONE = 0x00, /**< no flags set */ CDIO_TRACK_FLAG_NONE = 0x00, /**< no flags set */
CDIO_TRACK_FLAG_PRE_EMPHASIS = 0x01, /**< audio track recorded with CDIO_TRACK_FLAG_PRE_EMPHASIS = 0x01, /**< audio track recorded with
pre-emphasis */ pre-emphasis */
CDIO_TRACK_FLAG_COPY_PERMITTED = 0x02, /**< digital copy permitted */ CDIO_TRACK_FLAG_COPY_PERMITTED = 0x02, /**< digital copy permitted */
CDIO_TRACK_FLAG_DATA = 0x04, /**< data track */ CDIO_TRACK_FLAG_DATA = 0x04, /**< data track */
CDIO_TRACK_FLAG_FOUR_CHANNEL_AUDIO = 0x08, /**< 4 audio channels */ CDIO_TRACK_FLAG_FOUR_CHANNEL_AUDIO = 0x08, /**< 4 audio channels */
CDIO_TRACK_FLAG_SCMS = 0x10 /**< SCMS (5.29.2.7) */ CDIO_TRACK_FLAG_SCMS = 0x10 /**< SCMS (5.29.2.7) */
} cdio_track_flag; } cdio_track_flag;
#ifdef __cplusplus #ifdef __cplusplus

View File

@@ -1,5 +1,5 @@
/* /*
$Id: freebsd.h,v 1.12 2004/06/19 16:34:45 rocky Exp $ $Id: freebsd.h,v 1.13 2004/06/27 15:29:22 rocky Exp $
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -140,7 +140,9 @@ typedef struct {
/* Track information */ /* Track information */
bool toc_init; /* if true, info below is valid. */ bool toc_init; /* if true, info below is valid. */
struct ioc_toc_header tochdr; struct ioc_toc_header tochdr;
struct ioc_read_toc_single_entry tocent[100]; /* entry info for each track */
/* Entry info for each track. Add 1 for leadout. */
struct ioc_read_toc_single_entry tocent[CDIO_CD_MAX_TRACKS+1;
} _img_private_t; } _img_private_t;

View File

@@ -1,5 +1,5 @@
/* /*
$Id: aspi32.c,v 1.9 2004/06/25 01:47:06 rocky Exp $ $Id: aspi32.c,v 1.10 2004/06/27 15:29:22 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.9 2004/06/25 01:47:06 rocky Exp $"; static const char _rcsid[] = "$Id: aspi32.c,v 1.10 2004/06/27 15:29:22 rocky Exp $";
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <cdio/sector.h> #include <cdio/sector.h>
@@ -53,6 +53,75 @@ static const char _rcsid[] = "$Id: aspi32.c,v 1.9 2004/06/25 01:47:06 rocky Exp
#include <sys/types.h> #include <sys/types.h>
#include "aspi32.h" #include "aspi32.h"
const char *aspierror(int nErrorCode)
{
switch (nErrorCode)
{
case SS_PENDING:
return "SRB being processed";
break;
case SS_COMP:
return "SRB completed without error";
break;
case SS_ABORTED:
return "SRB aborted";
break;
case SS_ABORT_FAIL:
return "Unable to abort SRB";
break;
case SS_ERR:
return "SRB completed with error";
break;
case SS_INVALID_CMD:
return "Invalid ASPI command";
break;
case SS_INVALID_HA:
return "Invalid host adapter number";
break;
case SS_NO_DEVICE:
return "SCSI device not installed";
break;
case SS_INVALID_SRB:
return "Invalid parameter set in SRB";
break;
case SS_OLD_MANAGER:
return "ASPI manager doesn't support";
break;
case SS_ILLEGAL_MODE:
return "Unsupported Windows mode";
break;
case SS_NO_ASPI:
return "No ASPI managers";
break;
case SS_FAILED_INIT:
return "ASPI for windows failed init";
break;
case SS_ASPI_IS_BUSY:
return "No resources available to execute command";
break;
case SS_BUFFER_TOO_BIG:
return "Buffer size too big to handle";
break;
case SS_MISMATCHED_COMPONENTS:
return "The DLLs/EXEs of ASPI don't version check";
break;
case SS_NO_ADAPTERS:
return "No host adapters found";
break;
case SS_INSUFFICIENT_RESOURCES:
return "Couldn't allocate resources needed to init";
break;
case SS_ASPI_IS_SHUTDOWN:
return "Call came to ASPI after PROCESS_DETACH";
break;
case SS_BAD_INSTALL:
return "The DLL or other components are installed wrong";
break;
default:
return "Unknow ASPI error");
}
}
/* General ioctl() CD-ROM command function */ /* General ioctl() CD-ROM command function */
static bool static bool
mciSendCommand_aspi(int id, UINT msg, DWORD flags, void *arg) mciSendCommand_aspi(int id, UINT msg, DWORD flags, void *arg)
@@ -111,6 +180,7 @@ is_cdrom_aspi(const char drive_letter)
DWORD dwSupportInfo; DWORD dwSupportInfo;
int i_adapter, i_hostadapters; int i_adapter, i_hostadapters;
char c_drive; char c_drive;
int i_rc;
if ( !have_aspi(&hASPI, &lpGetSupport, &lpSendCommand) ) if ( !have_aspi(&hASPI, &lpGetSupport, &lpSendCommand) )
return NULL; return NULL;
@@ -119,14 +189,10 @@ is_cdrom_aspi(const char drive_letter)
dwSupportInfo = lpGetSupport(); dwSupportInfo = lpGetSupport();
if( HIBYTE( LOWORD ( dwSupportInfo ) ) == SS_NO_ADAPTERS ) { i_rc = HIBYTE( LOWORD ( dwSupportInfo ) );
cdio_debug("no host adapters found (ASPI)");
FreeLibrary( hASPI );
return NULL;
}
if( HIBYTE( LOWORD ( dwSupportInfo ) ) != SS_COMP ) { if( SS_COMP != rc ) {
cdio_debug("Unable to initalize ASPI layer"); cdio_debug("ASPI: %s", aspierror(i_rc));
FreeLibrary( hASPI ); FreeLibrary( hASPI );
return NULL; return NULL;
} }
@@ -205,6 +271,7 @@ init_aspi (_img_private_t *env)
DWORD dwSupportInfo; DWORD dwSupportInfo;
int i_adapter, i_hostadapters; int i_adapter, i_hostadapters;
char c_drive; char c_drive;
int i_rc;
if (2 == strlen(env->gen.source_name) && isalpha(env->gen.source_name[0]) ) if (2 == strlen(env->gen.source_name) && isalpha(env->gen.source_name[0]) )
{ {
@@ -221,14 +288,10 @@ init_aspi (_img_private_t *env)
dwSupportInfo = lpGetSupport(); dwSupportInfo = lpGetSupport();
if( HIBYTE( LOWORD ( dwSupportInfo ) ) == SS_NO_ADAPTERS ) { i_rc = HIBYTE( LOWORD ( dwSupportInfo ) );
cdio_debug("no host adapters found (ASPI)");
FreeLibrary( hASPI );
return false;
}
if( HIBYTE( LOWORD ( dwSupportInfo ) ) != SS_COMP ) { if( SS_COMP != rc ) {
cdio_debug("unable to initalize ASPI layer"); cdio_info("ASPI: %s", aspierror(i_rc));
FreeLibrary( hASPI ); FreeLibrary( hASPI );
return false; return false;
} }
@@ -402,6 +465,7 @@ mmc_read_sectors_aspi (const _img_private_t *env, void *data, lsn_t lsn,
/* check that the transfer went as planned */ /* check that the transfer went as planned */
if( ssc.SRB_Status != SS_COMP ) { if( ssc.SRB_Status != SS_COMP ) {
cdio_info("ASPI: %s", aspierror(ssc.SRB_Status));
return 1; return 1;
} }
@@ -502,6 +566,7 @@ read_toc_aspi (_img_private_t *env)
/* check that the transfer went as planned */ /* check that the transfer went as planned */
if( ssc.SRB_Status != SS_COMP ) { if( ssc.SRB_Status != SS_COMP ) {
cdio_info("ASPI: %s", aspierror(ssc.SRB_Status));
CloseHandle( hEvent ); CloseHandle( hEvent );
return false; return false;
} }
@@ -540,10 +605,10 @@ read_toc_aspi (_img_private_t *env)
WaitForSingleObject( hEvent, INFINITE ); WaitForSingleObject( hEvent, INFINITE );
/* check that the transfer went as planned */ /* check that the transfer went as planned */
#if 0 if( ssc.SRB_Status != SS_COMP ) {
if( ssc.SRB_Status != SS_COMP ) cdio_info("ASPI: %s", aspierror(ssc.SRB_Status));
env->total_tracks = 0; env->total_tracks = 0;
#endif }
for( i = 0 ; i <= env->total_tracks ; i++ ) { for( i = 0 ; i <= env->total_tracks ; i++ ) {
int i_index = 8 + 8 * i; int i_index = 8 + 8 * i;
@@ -664,6 +729,7 @@ get_drive_cap_aspi (const _img_private_t *env)
/* check that the transfer went as planned */ /* check that the transfer went as planned */
if( ssc.SRB_Status != SS_COMP ) { if( ssc.SRB_Status != SS_COMP ) {
cdio_info("ASPI: %s", aspierror(ssc.SRB_Status));
return i_drivetype; return i_drivetype;
} else { } else {
BYTE *p; BYTE *p;

View File

@@ -1,5 +1,5 @@
/* /*
$Id: _cdio_linux.c,v 1.57 2004/06/26 00:39:00 rocky Exp $ $Id: _cdio_linux.c,v 1.58 2004/06/27 15:29:21 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -27,7 +27,7 @@
# include "config.h" # include "config.h"
#endif #endif
static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.57 2004/06/26 00:39:00 rocky Exp $"; static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.58 2004/06/27 15:29:21 rocky Exp $";
#include <string.h> #include <string.h>
@@ -819,7 +819,7 @@ _get_first_track_num_linux(void *user_data)
string when done with it. string when done with it.
*/ */
static char * static cdio_mcn_t
_get_mcn_linux (const void *env) { _get_mcn_linux (const void *env) {
struct cdrom_mcn mcn; struct cdrom_mcn mcn;

View File

@@ -1,5 +1,5 @@
/* /*
$Id: _cdio_osx.c,v 1.47 2004/06/26 01:20:41 rocky Exp $ $Id: _cdio_osx.c,v 1.48 2004/06/27 15:29:22 rocky Exp $
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
from vcdimager code: from vcdimager code:
@@ -34,7 +34,7 @@
#include "config.h" #include "config.h"
#endif #endif
static const char _rcsid[] = "$Id: _cdio_osx.c,v 1.47 2004/06/26 01:20:41 rocky Exp $"; static const char _rcsid[] = "$Id: _cdio_osx.c,v 1.48 2004/06/27 15:29:22 rocky Exp $";
#include <cdio/sector.h> #include <cdio/sector.h>
#include <cdio/util.h> #include <cdio/util.h>
@@ -95,6 +95,8 @@ typedef struct {
int i_descriptors; int i_descriptors;
track_t i_last_track; /* highest track number */ track_t i_last_track; /* highest track number */
track_t i_first_track; /* first track */ track_t i_first_track; /* first track */
track_t i_last_session; /* highest session number */
track_t i_first_session; /* first session number */
lsn_t *pp_lba; lsn_t *pp_lba;
} _img_private_t; } _img_private_t;
@@ -383,7 +385,6 @@ _cdio_read_toc (_img_private_t *env)
int i, i_leadout = -1; int i, i_leadout = -1;
CDTOCDescriptor *pTrackDescriptors; CDTOCDescriptor *pTrackDescriptors;
track_t i_track;
env->pp_lba = malloc( env->i_descriptors * sizeof(int) ); env->pp_lba = malloc( env->i_descriptors * sizeof(int) );
if( env->pp_lba == NULL ) if( env->pp_lba == NULL )
@@ -395,24 +396,27 @@ _cdio_read_toc (_img_private_t *env)
pTrackDescriptors = env->pTOC->descriptors; pTrackDescriptors = env->pTOC->descriptors;
env->i_first_track = CDIO_CD_MAX_TRACKS+1; env->i_first_track = CDIO_CD_MAX_TRACKS+1;
env->i_last_track = CDIO_CD_MIN_TRACK_NO-1; env->i_last_track = CDIO_CD_MIN_TRACK_NO;
env->i_first_session = CDIO_CD_MAX_TRACKS+1;
env->i_last_session = CDIO_CD_MIN_TRACK_NO;
for( i = 0; i <= env->i_descriptors; i++ ) for( i = 0; i <= env->i_descriptors; i++ )
{ {
i_track = pTrackDescriptors[i].point; track_t i_track = pTrackDescriptors[i].point;
session_t i_session = pTrackDescriptors[i].session;
cdio_debug( "point: %d, tno: %d, session: %d, adr: %d, control:%d, " cdio_debug( "point: %d, tno: %d, session: %d, adr: %d, control:%d, "
"address: %d:%d:%d, p: %d:%d:%d", "address: %d:%d:%d, p: %d:%d:%d",
pTrackDescriptors[i].point, i_track,
pTrackDescriptors[i].tno, pTrackDescriptors[i].session, pTrackDescriptors[i].tno, i_session
pTrackDescriptors[i].adr, pTrackDescriptors[i].control, pTrackDescriptors[i].adr, pTrackDescriptors[i].control,
pTrackDescriptors[i].address.minute, pTrackDescriptors[i].address.minute,
pTrackDescriptors[i].address.second, pTrackDescriptors[i].address.second,
pTrackDescriptors[i].address.frame, pTrackDescriptors[i].address.frame,
pTrackDescriptors[i].p.minute, pTrackDescriptors[i].p.minute,
pTrackDescriptors[i].p.second, pTrackDescriptors[i].p.second,
pTrackDescriptors[i].p.frame ); pTrackDescriptors[i].p.frame );
/* track information has adr = 1 */ /* track information has adr = 1 */
if ( 0x01 != pTrackDescriptors[i].adr ) if ( 0x01 != pTrackDescriptors[i].adr )
@@ -430,6 +434,11 @@ _cdio_read_toc (_img_private_t *env)
if (env->i_last_track < i_track) if (env->i_last_track < i_track)
env->i_last_track = i_track; env->i_last_track = i_track;
if (env->i_first_session > i_session)
env->i_first_track = i_session;
if (env->i_last_session < i_session)
env->i_last_track = i_session;
} }
/* Now that we know what the first track number is, we can make sure /* Now that we know what the first track number is, we can make sure

View File

@@ -1,5 +1,5 @@
/* /*
$Id: bincue.c,v 1.22 2004/06/19 19:15:15 rocky Exp $ $Id: bincue.c,v 1.23 2004/06/27 15:29:22 rocky Exp $
Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com>
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
@@ -24,7 +24,7 @@
(*.cue). (*.cue).
*/ */
static const char _rcsid[] = "$Id: bincue.c,v 1.22 2004/06/19 19:15:15 rocky Exp $"; static const char _rcsid[] = "$Id: bincue.c,v 1.23 2004/06/27 15:29:22 rocky Exp $";
#include "cdio_assert.h" #include "cdio_assert.h"
#include "cdio_private.h" #include "cdio_private.h"
@@ -94,8 +94,9 @@ typedef struct {
bool sector_2336; /* Playstation (PSX) uses 2336-byte sectors */ bool sector_2336; /* Playstation (PSX) uses 2336-byte sectors */
char *cue_name; char *cue_name;
char *mcn; /* Media catalog number. */ char *mcn; /* Media Catalog Number. */
track_info_t tocent[100]; /* entry info for each track */ track_info_t tocent[CDIO_CD_MAX_TRACKS+1]; /* entry info for each track
add 1 for leadout. */
track_t i_tracks; /* number of tracks in image */ track_t i_tracks; /* number of tracks in image */
track_t i_first_track; /* track number of first track */ track_t i_first_track; /* track number of first track */
bool have_cue; bool have_cue;

View File

@@ -1,5 +1,5 @@
/* /*
$Id: cdrdao.c,v 1.9 2004/06/01 11:15:58 rocky Exp $ $Id: cdrdao.c,v 1.10 2004/06/27 15:29:22 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
toc reading routine adapted from cuetools toc reading routine adapted from cuetools
@@ -25,7 +25,7 @@
(*.cue). (*.cue).
*/ */
static const char _rcsid[] = "$Id: cdrdao.c,v 1.9 2004/06/01 11:15:58 rocky Exp $"; static const char _rcsid[] = "$Id: cdrdao.c,v 1.10 2004/06/27 15:29:22 rocky Exp $";
#include "cdio_assert.h" #include "cdio_assert.h"
#include "cdio_private.h" #include "cdio_private.h"
@@ -106,7 +106,8 @@ typedef struct {
char *toc_name; char *toc_name;
char *mcn; /* Media Catalog Number (5.22.3) char *mcn; /* Media Catalog Number (5.22.3)
exactly 13 bytes */ exactly 13 bytes */
track_info_t tocent[100]; /* entry info for each track */ track_info_t tocent[CDIO_CD_MAX_TRACKS+1]; /* entry info for each track
add 1 for leadout. */
track_t i_tracks; /* number of tracks in image */ track_t i_tracks; /* number of tracks in image */
track_t i_first_track; /* track number of first track */ track_t i_first_track; /* track number of first track */
track_format_t mode; track_format_t mode;

View File

@@ -1,5 +1,5 @@
/* /*
$Id: nrg.c,v 1.23 2004/06/18 22:55:24 rocky Exp $ $Id: nrg.c,v 1.24 2004/06/27 15:29:22 rocky Exp $
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
Copyright (C) 2001, 2003 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2001, 2003 Herbert Valerio Riedel <hvr@gnu.org>
@@ -49,7 +49,7 @@
#include "_cdio_stdio.h" #include "_cdio_stdio.h"
#include "nrg.h" #include "nrg.h"
static const char _rcsid[] = "$Id: nrg.c,v 1.23 2004/06/18 22:55:24 rocky Exp $"; static const char _rcsid[] = "$Id: nrg.c,v 1.24 2004/06/27 15:29:22 rocky Exp $";
/* reader */ /* reader */
@@ -99,8 +99,9 @@ typedef struct {
/* This is a hack because I don't really understnad NERO better. */ /* This is a hack because I don't really understnad NERO better. */
bool is_cues; bool is_cues;
char *mcn; /* Media catalog number. */ char *mcn; /* Media Catalog Number (5.22.3) */
track_info_t tocent[100]; /* entry info for each track */ track_info_t tocent[CDIO_CD_MAX_TRACKS+1]; /* entry info for each track
add 1 for leadout. */
track_t i_tracks; /* number of tracks in image */ track_t i_tracks; /* number of tracks in image */
track_t i_first_track; /* track number of first track */ track_t i_first_track; /* track number of first track */
CdioList *mapping; /* List of track information */ CdioList *mapping; /* List of track information */
@@ -384,18 +385,21 @@ parse_nrg (_img_private_t *env, const char *psz_nrg_name)
track_format_t track_format; track_format_t track_format;
int form2; int form2;
env->mcn = _cdio_malloc (CDIO_MCN_SIZE); /* We include an extra 0 byte so these can be used as C strings.*/
env->mcn = _cdio_malloc (CDIO_MCN_SIZE+1);
if (DAOX_ID == opcode) { if (DAOX_ID == opcode) {
_daox_array_t *_entries = (void *) chunk->data; _daox_array_t *_entries = (void *) chunk->data;
form2 = _entries->_unknown[1]; form2 = _entries->_unknown[1];
env->dtyp = _entries->_unknown[19]; env->dtyp = _entries->_unknown[19];
memcpy(env->mcn, &(_entries->mcn), CDIO_MCN_SIZE); memcpy(env->mcn, &(_entries->mcn), CDIO_MCN_SIZE);
env->mcn[CDIO_MCN_SIZE] = '\0';
} else { } else {
_daoi_array_t *_entries = (void *) chunk->data; _daoi_array_t *_entries = (void *) chunk->data;
form2 = _entries->_unknown[1]; form2 = _entries->_unknown[1];
env->dtyp = _entries->_unknown[19]; env->dtyp = _entries->_unknown[19];
memcpy(env->mcn, &(_entries->mcn), CDIO_MCN_SIZE); memcpy(env->mcn, &(_entries->mcn), CDIO_MCN_SIZE);
env->mcn[CDIO_MCN_SIZE] = '\0';
} }
env->is_dao = true; env->is_dao = true;