Add getting UDF label and major/minor version numbers.
cd_types.c: also replace unsafe use of sprintf with strncpy.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: cd_types.h,v 1.10 2004/06/23 03:56:25 rocky Exp $
|
$Id: cd_types.h,v 1.11 2004/06/23 09:28:02 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
|
||||||
Copyright (C) 1996,1997,1998 Gerd Knorr <kraxel@bytesex.org>
|
Copyright (C) 1996,1997,1998 Gerd Knorr <kraxel@bytesex.org>
|
||||||
@@ -127,6 +127,8 @@ typedef struct
|
|||||||
char iso_label[33]; /**< This is 32 + 1 for null byte at the end in
|
char iso_label[33]; /**< This is 32 + 1 for null byte at the end in
|
||||||
formatting the string */
|
formatting the string */
|
||||||
unsigned int isofs_size;
|
unsigned int isofs_size;
|
||||||
|
uint8_t UDFVerMinor; /**< For UDF filesystems only */
|
||||||
|
uint8_t UDFVerMajor; /**< For UDF filesystems only */
|
||||||
} cdio_iso_analysis_t;
|
} cdio_iso_analysis_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: cd_types.c,v 1.9 2004/06/23 03:56:25 rocky Exp $
|
$Id: cd_types.c,v 1.10 2004/06/23 09:28:02 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -83,6 +83,8 @@ typedef struct signature
|
|||||||
static signature_t sigs[] =
|
static signature_t sigs[] =
|
||||||
{
|
{
|
||||||
/*buffer[x] off look for description */
|
/*buffer[x] off look for description */
|
||||||
|
{0, 0, "MICROSOFT*XBOX*MEDIA", "XBOX CD"},
|
||||||
|
{0, 1, "BEA01", "UDF"},
|
||||||
{0, 1, ISO_STANDARD_ID, "ISO 9660"},
|
{0, 1, ISO_STANDARD_ID, "ISO 9660"},
|
||||||
{0, 1, "CD-I", "CD-I"},
|
{0, 1, "CD-I", "CD-I"},
|
||||||
{0, 8, "CDTV", "CDTV"},
|
{0, 8, "CDTV", "CDTV"},
|
||||||
@@ -96,28 +98,26 @@ static signature_t sigs[] =
|
|||||||
{3, 7, "EL TORITO", "BOOTABLE"},
|
{3, 7, "EL TORITO", "BOOTABLE"},
|
||||||
{4, 0, "VIDEO_CD", "VIDEO CD"},
|
{4, 0, "VIDEO_CD", "VIDEO CD"},
|
||||||
{4, 0, "SUPERVCD", "SVCD or Chaoji VCD"},
|
{4, 0, "SUPERVCD", "SVCD or Chaoji VCD"},
|
||||||
{0, 0, "MICROSOFT*XBOX*MEDIA", "XBOX CD"},
|
|
||||||
{0, 1, "BEA01", "UDF"},
|
|
||||||
{ 0 }
|
{ 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* The below index into the above sigs array. Make sure things match. */
|
/* The below index into the above sigs array. Make sure things match. */
|
||||||
#define INDEX_ISOFS 0
|
#define INDEX_XISO 0 /* Microsoft X-BOX filesystem */
|
||||||
#define INDEX_CD_I 1
|
#define INDEX_UDF 1
|
||||||
#define INDEX_CDTV 2
|
#define INDEX_ISOFS 2
|
||||||
#define INDEX_CD_RTOS 3
|
#define INDEX_CD_I 3
|
||||||
#define INDEX_HS 4
|
#define INDEX_CDTV 4
|
||||||
#define INDEX_BRIDGE 5
|
#define INDEX_CD_RTOS 5
|
||||||
#define INDEX_XA 6
|
#define INDEX_HS 6
|
||||||
#define INDEX_PHOTO_CD 7
|
#define INDEX_BRIDGE 7
|
||||||
#define INDEX_EXT2 8
|
#define INDEX_XA 8
|
||||||
#define INDEX_UFS 9
|
#define INDEX_PHOTO_CD 9
|
||||||
#define INDEX_BOOTABLE 10
|
#define INDEX_EXT2 10
|
||||||
#define INDEX_VIDEO_CD 11 /* Video CD */
|
#define INDEX_UFS 11
|
||||||
#define INDEX_SVCD 12 /* CVD *or* SVCD */
|
#define INDEX_BOOTABLE 12
|
||||||
#define INDEX_XISO 13 /* Microsoft X-BOX filesystem */
|
#define INDEX_VIDEO_CD 13 /* Video CD */
|
||||||
#define INDEX_UDF 14
|
#define INDEX_SVCD 14 /* CVD *or* SVCD */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -247,14 +247,14 @@ cdio_guess_cd_type(const CdIo *cdio, int start_session, track_t i_track,
|
|||||||
if (_cdio_read_block(cdio, 35, start_session, 5, i_track) < 0)
|
if (_cdio_read_block(cdio, 35, start_session, 5, i_track) < 0)
|
||||||
return CDIO_FS_UNKNOWN;
|
return CDIO_FS_UNKNOWN;
|
||||||
|
|
||||||
#if 0
|
iso_analysis->UDFVerMinor=(unsigned int)buffer[5][240];
|
||||||
m_nUDFVerMinor=(int)buffer[5][240];
|
iso_analysis->UDFVerMajor=(unsigned int)buffer[5][241];
|
||||||
m_nUDFVerMajor=(int)buffer[5][241];
|
|
||||||
/* Read disc label */
|
/* Read disc label */
|
||||||
if (_cdio_read_block(cdio, 32, start_session, 5, i_track) < 0)
|
if (_cdio_read_block(cdio, 32, start_session, 5, i_track) < 0)
|
||||||
return CDIO_FS_UDF;
|
return CDIO_FS_UDF;
|
||||||
m_strDiscLabel=buffer[5]+25;
|
|
||||||
#endif
|
strncpy(iso_analysis->iso_label, buffer[5]+25, 33);
|
||||||
|
iso_analysis->iso_label[32] = '\0';
|
||||||
return CDIO_FS_UDF;
|
return CDIO_FS_UDF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -278,8 +278,34 @@ cdio_guess_cd_type(const CdIo *cdio, int start_session, track_t i_track,
|
|||||||
else
|
else
|
||||||
ret = CDIO_FS_ISO_9660;
|
ret = CDIO_FS_ISO_9660;
|
||||||
iso_analysis->isofs_size = _cdio_get_iso9660_fs_sec_count();
|
iso_analysis->isofs_size = _cdio_get_iso9660_fs_sec_count();
|
||||||
sprintf(iso_analysis->iso_label, buffer[0]+40);
|
strncpy(iso_analysis->iso_label, buffer[0]+40,33);
|
||||||
|
iso_analysis->iso_label[32] = '\0';
|
||||||
|
|
||||||
|
if ( _cdio_read_block(cdio, UDF_ANCHOR_SECTOR, start_session, 5,
|
||||||
|
i_track) < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
/* Maybe there is an UDF anchor in IOS session
|
||||||
|
so its ISO/UDF session and we prefere UDF */
|
||||||
|
if ( _cdio_is_UDF() ) {
|
||||||
|
/* Detect UDF version.
|
||||||
|
Test if we have a valid version of UDF the xbox can read natively */
|
||||||
|
if ( _cdio_read_block(cdio, 35, start_session, 5, i_track) < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
iso_analysis->UDFVerMinor=(unsigned int)buffer[5][240];
|
||||||
|
iso_analysis->UDFVerMajor=(unsigned int)buffer[5][241];
|
||||||
|
#if 0
|
||||||
|
/* We are using ISO/UDF cd's as iso,
|
||||||
|
no need to get UDF disc label */
|
||||||
|
if (_cdio_read_block(cdio, 32, start_session, 5, i_track) < 0)
|
||||||
|
return ret;
|
||||||
|
stnrcpy(iso_analysis->iso_label, buffer[5]+25, 33);
|
||||||
|
iso_analysis->iso_label[32] = '\0';
|
||||||
|
#endif
|
||||||
|
ret=CDIO_FS_ISO_UDF;
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (_cdio_is_rockridge())
|
if (_cdio_is_rockridge())
|
||||||
ret |= CDIO_FS_ANAL_ROCKRIDGE;
|
ret |= CDIO_FS_ANAL_ROCKRIDGE;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: cd-info.c,v 1.69 2004/06/23 03:56:25 rocky Exp $
|
$Id: cd-info.c,v 1.70 2004/06/23 09:28:02 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
Copyright (C) 1996, 1997, 1998 Gerd Knorr <kraxel@bytesex.org>
|
Copyright (C) 1996, 1997, 1998 Gerd Knorr <kraxel@bytesex.org>
|
||||||
@@ -709,8 +709,17 @@ print_analysis(int ms_offset, cdio_iso_analysis_t cdio_iso_analysis,
|
|||||||
print_iso9660_fs(p_cdio, fs, track_format);
|
print_iso9660_fs(p_cdio, fs, track_format);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch(CDIO_FSTYPE(fs)) {
|
||||||
|
case CDIO_FS_UDF:
|
||||||
|
case CDIO_FS_ISO_UDF:
|
||||||
|
fprintf(stdout, "UDF: version %x.%2.2x\n",
|
||||||
|
cdio_iso_analysis.UDFVerMajor, cdio_iso_analysis.UDFVerMinor);
|
||||||
|
break;
|
||||||
|
default: ;
|
||||||
|
}
|
||||||
|
|
||||||
need_lf = 0;
|
need_lf = 0;
|
||||||
if (first_data == 1 && num_audio > 0)
|
if (first_data == 1 && num_audio > 0)
|
||||||
need_lf += printf("mixed mode CD ");
|
need_lf += printf("mixed mode CD ");
|
||||||
|
|||||||
Reference in New Issue
Block a user