From f29360b3df5b19c78ef6ad756648749c3845101a Mon Sep 17 00:00:00 2001 From: rocky Date: Sat, 16 Aug 2003 15:34:58 +0000 Subject: [PATCH] Move routine to analyze/guess what type of CD image we have got into the library. --- include/cdio/Makefile.am | 5 +- include/cdio/cd_types.h | 101 ++++++++++++++ lib/Makefile.am | 3 +- src/Makefile.am | 4 +- src/analyze.c | 289 --------------------------------------- src/analyze.h | 61 --------- src/cd-info.c | 92 ++++++------- test/check_cue.sh | 2 +- 8 files changed, 155 insertions(+), 402 deletions(-) create mode 100644 include/cdio/cd_types.h delete mode 100644 src/analyze.c delete mode 100644 src/analyze.h diff --git a/include/cdio/Makefile.am b/include/cdio/Makefile.am index 54797500..fbf95869 100644 --- a/include/cdio/Makefile.am +++ b/include/cdio/Makefile.am @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.5 2003/04/22 12:40:42 rocky Exp $ +# $Id: Makefile.am,v 1.6 2003/08/16 15:34:58 rocky Exp $ # # Copyright (C) 2003 Rocky Bernstein # @@ -22,7 +22,8 @@ # libcdioincludedir=$(includedir)/cdio -libcdioinclude_HEADERS = cdio.h logging.h sector.h types.h util.h version.h +libcdioinclude_HEADERS = cdio.h cd_types.h logging.h sector.h \ + types.h util.h version.h EXTRA_DIST = version.h.in BUILT_SOURCES = version.h diff --git a/include/cdio/cd_types.h b/include/cdio/cd_types.h new file mode 100644 index 00000000..3bd66026 --- /dev/null +++ b/include/cdio/cd_types.h @@ -0,0 +1,101 @@ +/* + $Id: cd_types.h,v 1.1 2003/08/16 15:34:58 rocky Exp $ + + Copyright (C) 2003 Rocky Bernstein + Copyright (C) 1996,1997,1998 Gerd Knorr + and Heiko Eißfeldt + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +/* + Filesystem types we understand. The highest-numbered fs type should + be less than CDIO_FS_MASK defined below. +*/ + +#ifndef __CDIO_CD_TYPES_H__ +#define __CDIO_CD_TYPES_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define CDIO_FS_NO_DATA 0 /* audio only */ +#define CDIO_FS_HIGH_SIERRA 1 +#define CDIO_FS_ISO_9660 2 +#define CDIO_FS_INTERACTIVE 3 +#define CDIO_FS_HFS 4 +#define CDIO_FS_UFS 5 +#define CDIO_FS_EXT2 6 +#define CDIO_FS_ISO_HFS 7 /* both hfs & isofs filesystem */ +#define CDIO_FS_ISO_9660_INTERACTIVE 8 /* both CD-RTOS and isofs filesystem */ +#define CDIO_FS_3DO 9 + +#define CDIO_FS_MASK 15 /* Should be 2*n-1 and > above */ +#define CDIO_FS_UNKNOWN CDIO_FS_MASK + +/* Macro to extract just the FS type portion defined above */ +#define CDIO_FSTYPE(fs) (fs & CDIO_FS_MASK) + +/* + Bit masks for the classes of CD-images. These are generally + higher-level than the fs-type information above and may be determined + based of the fs type information. + */ +#define CDIO_FS_ANAL_XA 16 +#define CDIO_FS_ANAL_MULTISESSION 32 +#define CDIO_FS_ANAL_PHOTO_CD 64 +#define CDIO_FS_ANAL_HIDDEN_TRACK 128 +#define CDIO_FS_ANAL_CDTV 256 +#define CDIO_FS_ANAL_BOOTABLE 512 +#define CDIO_FS_ANAL_VIDEOCDI 1024 +#define CDIO_FS_ANAL_ROCKRIDGE 2048 +#define CDIO_FS_ANAL_JOLIET 4096 +#define CDIO_FS_ANAL_SVCD 8192 /* Super VCD or Choiji Video CD */ +#define CDIO_FS_ANAL_CVD 16384 /* Choiji Video CD */ + + +typedef int cdio_fs_anal_t; + +typedef struct +{ + unsigned int joliet_level; + char iso_label[33]; /* 32 + 1 for null byte at the end in + formatting the string */ + unsigned int isofs_size; +} cdio_analysis_t; + +/* + Try to determine what kind of CD-image and/or filesystem we + have at track track_num. Return information about the CD image + is returned in cdio_analysis and the return value. +*/ +cdio_fs_anal_t cdio_guess_cd_type(/*in*/ CdIo *cdio, int start_session, + track_t track_num, + /*out*/ cdio_analysis_t *cdio_analysis); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __CDIO_CD_TYPES_H__ */ + +/* + * Local variables: + * c-file-style: "gnu" + * tab-width: 8 + * indent-tabs-mode: nil + * End: + */ diff --git a/lib/Makefile.am b/lib/Makefile.am index 7ad2257f..1ad68d7a 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.7 2003/05/27 02:55:58 rocky Exp $ +# $Id: Makefile.am,v 1.8 2003/08/16 15:34:58 rocky Exp $ # # Copyright (C) 2003 Rocky Bernstein # @@ -39,6 +39,7 @@ libcdio_sources = \ bytesex.h \ bytesex_asm.h \ cdio.c \ + cd_types.c \ ds.c \ ds.h \ logging.c \ diff --git a/src/Makefile.am b/src/Makefile.am index a5510ee8..2394fcff 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.12 2003/08/16 13:25:13 rocky Exp $ +# $Id: Makefile.am,v 1.13 2003/08/16 15:34:58 rocky Exp $ # # Copyright (C) 2003 Rocky Bernstein # @@ -22,7 +22,7 @@ CDDB_LIBS=@CDDB_LIBS@ if BUILD_CDINFO -cd_info_SOURCES = cd-info.c analyze.c analyze.h +cd_info_SOURCES = cd-info.c cd_info_LDADD = $(LIBCDIO_LIBS) $(LIBPOPT_LIBS) $(CDDB_LIBS) $(VCDINFO_LIBS) if BUILD_CDINFO_LINUX diff --git a/src/analyze.c b/src/analyze.c deleted file mode 100644 index bf487324..00000000 --- a/src/analyze.c +++ /dev/null @@ -1,289 +0,0 @@ -/* - $Id: analyze.c,v 1.2 2003/08/16 12:59:03 rocky Exp $ - - Copyright (C) 2003 Rocky Bernstein - Copyright (C) 1996,1997,1998 Gerd Knorr - and Heiko Eißfeldt - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -#include -#include -#include -#include - -#include "config.h" - -#include -#include -#include - -#include -#ifdef __linux__ -# include -# include -# if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,50) -# include -# endif -#endif - -#include -#include "analyze.h" - -#ifdef ENABLE_NLS -#include -# include -# define _(String) dgettext ("cdinfo", String) -#else -/* Stubs that do something close enough. */ -# define _(String) (String) -#endif - -#define dbg_print(level, s, args...) - -/* -Subject: -65- How can I read an IRIX (EFS) CD-ROM on a machine which - doesn't use EFS? -Date: 18 Jun 1995 00:00:01 EST - - You want 'efslook', at - ftp://viz.tamu.edu/pub/sgi/software/efslook.tar.gz. - -and -! Robert E. Seastrom 's software (with source -! code) for using an SGI CD-ROM on a Macintosh is at -! ftp://bifrost.seastrom.com/pub/mac/CDROM-Jumpstart.sit151.hqx. - -*/ - -static char buffer[6][CDIO_CD_FRAMESIZE_RAW]; /* for CD-Data */ - -/* Some interesting sector numbers stored in the above buffer. */ -#define ISO_SUPERBLOCK_SECTOR 16 /* buffer[0] */ -#define UFS_SUPERBLOCK_SECTOR 4 /* buffer[2] */ -#define BOOT_SECTOR 17 /* buffer[3] */ -#define VCD_INFO_SECTOR 150 /* buffer[4] */ - - -typedef struct signature -{ - unsigned int buf_num; - unsigned int offset; - const char *sig_str; - const char *description; -} signature_t; - -static signature_t sigs[] = - { -/*buffer[x] off look for description */ - {0, 1, "CD001", "ISO 9660"}, - {0, 1, "CD-I", "CD-I"}, - {0, 8, "CDTV", "CDTV"}, - {0, 8, "CD-RTOS", "CD-RTOS"}, - {0, 9, "CDROM", "HIGH SIERRA"}, - {0, 16, "CD-BRIDGE", "BRIDGE"}, - {0, 1024, "CD-XA001", "XA"}, - {1, 64, "PPPPHHHHOOOOTTTTOOOO____CCCCDDDD", "PHOTO CD"}, - {1, 0x438, "\x53\xef", "EXT2 FS"}, - {2, 1372, "\x54\x19\x01\x0", "UFS"}, - {3, 7, "EL TORITO", "BOOTABLE"}, - {4, 0, "VIDEO_CD", "VIDEO CD"}, - {4, 0, "SUPERVCD", "SVCD or Chaoji VCD"}, - { 0 } - }; - - -#define IS_ISOFS 0 -#define IS_CD_I 1 -#define IS_CDTV 2 -#define IS_CD_RTOS 3 -#define IS_HS 4 -#define IS_BRIDGE 5 -#define IS_XA 6 -#define IS_PHOTO_CD 7 -#define IS_EXT2 8 -#define IS_UFS 9 -#define IS_BOOTABLE 10 -#define IS_VIDEO_CD 11 /* Video CD */ -#define IS_SVCD 12 /* CVD *or* SVCD */ -#define IS_CVD 13 /* CVD - slightly incompatible with SVCD */ - -/* ------------------------------------------------------------------------ */ -/* some ISO 9660 fiddling */ - -static int -read_block(CdIo *cdio, int superblock, uint32_t offset, uint8_t bufnum, - track_t track_num) -{ - unsigned int track_sec_count = cdio_get_track_sec_count(cdio, track_num); - memset(buffer[bufnum], 0, CDIO_CD_FRAMESIZE); - - if ( track_sec_count < superblock) { - dbg_print(1, "reading block %u skipped track %d has only %u sectors\n", - superblock, track_num, track_sec_count); - return -1; - } - - dbg_print(2, "about to read sector %u\n", offset+superblock); - - if (cdio_get_track_green(cdio, track_num)) { - if (0 > cdio_read_mode2_sector(cdio, buffer[bufnum], - offset+superblock, false)) - return -1; - } else { - if (0 > cdio_read_yellow_sector(cdio, buffer[bufnum], - offset+superblock, false)) - return -1; - } - - return 0; -} - -static bool -_cdio_is_it(int num) -{ - signature_t *sigp=&sigs[num]; - int len=strlen(sigp->sig_str); - - /* TODO: check that num < largest sig. */ - return 0 == memcmp(&buffer[sigp->buf_num][sigp->offset], sigp->sig_str, len); -} - -static int -_cdio_is_hfs(void) -{ - return (0 == memcmp(&buffer[1][512],"PM",2)) || - (0 == memcmp(&buffer[1][512],"TS",2)) || - (0 == memcmp(&buffer[1][1024], "BD",2)); -} - -static int -_cdio_is_3do(void) -{ - return (0 == memcmp(&buffer[1][0],"\x01\x5a\x5a\x5a\x5a\x5a\x01", 7)) && - (0 == memcmp(&buffer[1][40], "CD-ROM", 6)); -} - -static int -_cdio_is_joliet(void) -{ - return 2 == buffer[3][0] && buffer[3][88] == 0x25 && buffer[3][89] == 0x2f; -} - -/* ISO 9660 volume space in M2F1_SECTOR_SIZE byte units */ -static int -_cdio_get_iso9660_fs_sec_count(void) -{ - int sec_count = - ((buffer[0][80] & 0xff) | - ((buffer[0][81] & 0xff) << 8) | - ((buffer[0][82] & 0xff) << 16) | - ((buffer[0][83] & 0xff) << 24)); - return sec_count; -} - -static int -_cdio_get_joliet_level( void ) -{ - switch (buffer[3][90]) { - case 0x40: return 1; - case 0x43: return 2; - case 0x45: return 3; - } - return 0; -} - -#define is_it_dbg(sig) \ - if (is_it(sig)) printf("%s, ", sigs[sig].description) - -int -cdio_guess_filesystem(/*in*/ CdIo *cdio, int start_session, track_t track_num, - /*out*/ cdio_analysis_t *cdio_analysis) -{ - int ret = 0; - - if (read_block(cdio, ISO_SUPERBLOCK_SECTOR, start_session, 0, track_num) < 0) - return CDIO_FS_UNKNOWN; - - /* filesystem */ - if (_cdio_is_it(IS_CD_I) && _cdio_is_it(IS_CD_RTOS) - && !_cdio_is_it(IS_BRIDGE) && !_cdio_is_it(IS_XA)) { - return CDIO_FS_INTERACTIVE; - } else { - /* read sector 0 ONLY, when NO greenbook CD-I !!!! */ - - if (read_block(cdio, 0, start_session, 1, track_num) < 0) - return ret; - - if (_cdio_is_it(IS_HS)) - ret |= CDIO_FS_HIGH_SIERRA; - else if (_cdio_is_it(IS_ISOFS)) { - if (_cdio_is_it(IS_CD_RTOS) && _cdio_is_it(IS_BRIDGE)) - ret = CDIO_FS_ISO_9660_INTERACTIVE; - else if (_cdio_is_hfs()) - ret = CDIO_FS_ISO_HFS; - else - ret = CDIO_FS_ISO_9660; - cdio_analysis->isofs_size = _cdio_get_iso9660_fs_sec_count(); - sprintf(cdio_analysis->iso_label, buffer[0]+40); - -#if 0 - if (_cdio_is_rockridge()) - ret |= ROCKRIDGE; -#endif - - if (read_block(cdio, BOOT_SECTOR, start_session, 3, track_num) < 0) - return ret; - - if (_cdio_is_joliet()) { - cdio_analysis->joliet_level = _cdio_get_joliet_level(); - ret |= JOLIET; - } - if (_cdio_is_it(IS_BOOTABLE)) - ret |= BOOTABLE; - - if (_cdio_is_it(IS_XA) && _cdio_is_it(IS_ISOFS) - && !_cdio_is_it(IS_PHOTO_CD)) { - - if (read_block(cdio, VCD_INFO_SECTOR, start_session, 4, track_num) < 0) - return ret; - - if (_cdio_is_it(IS_BRIDGE) && _cdio_is_it(IS_CD_RTOS)) { - if (_cdio_is_it(IS_VIDEO_CD)) ret |= VIDEOCDI; - else if (_cdio_is_it(IS_SVCD)) ret |= SVCD; - } else if (_cdio_is_it(IS_SVCD)) ret |= CVD; - - } - } - else if (_cdio_is_hfs()) ret |= CDIO_FS_HFS; - else if (_cdio_is_it(IS_EXT2)) ret |= CDIO_FS_EXT2; - else if (_cdio_is_3do()) ret |= CDIO_FS_3DO; - else { - if (read_block(cdio, UFS_SUPERBLOCK_SECTOR, start_session, 2, track_num) < 0) - return ret; - - if (_cdio_is_it(IS_UFS)) - ret |= CDIO_FS_UFS; - else - ret |= CDIO_FS_UNKNOWN; - } - } - - /* other checks */ - if (_cdio_is_it(IS_XA)) ret |= XA; - if (_cdio_is_it(IS_PHOTO_CD)) ret |= PHOTO_CD; - if (_cdio_is_it(IS_CDTV)) ret |= CDTV; - return ret; -} diff --git a/src/analyze.h b/src/analyze.h deleted file mode 100644 index de65000b..00000000 --- a/src/analyze.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - $Id: analyze.h,v 1.2 2003/08/16 12:59:03 rocky Exp $ - - Copyright (C) 2003 Rocky Bernstein - Copyright (C) 1996,1997,1998 Gerd Knorr - and Heiko Eißfeldt - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#define XA 16 -#define MULTISESSION 32 -#define PHOTO_CD 64 -#define HIDDEN_TRACK 128 -#define CDTV 256 -#define BOOTABLE 512 -#define VIDEOCDI 1024 -#define ROCKRIDGE 2048 -#define JOLIET 4096 -#define SVCD 8192 /* Super VCD or Choiji Video CD */ -#define CVD 16384 /* Choiji Video CD */ - - -#define CDIO_FS_NO_DATA 0 /* audio only */ -#define CDIO_FS_HIGH_SIERRA 1 -#define CDIO_FS_ISO_9660 2 -#define CDIO_FS_INTERACTIVE 3 -#define CDIO_FS_HFS 4 -#define CDIO_FS_UFS 5 -#define CDIO_FS_EXT2 6 -#define CDIO_FS_ISO_HFS 7 /* both hfs & isofs filesystem */ -#define CDIO_FS_ISO_9660_INTERACTIVE 8 /* both CD-RTOS and isofs filesystem */ -#define CDIO_FS_3DO 9 -#define CDIO_FS_UNKNOWN 15 -#define CDIO_FS_MASK 15 - -typedef struct -{ - int joliet_level; - char iso_label[33]; /* 32 + 1 for null byte at the end in formatting */ - int isofs_size; -} cdio_analysis_t; - -/* - Try to determine what kind of filesystem is at track track_num -*/ -int cdio_guess_filesystem(/*in*/ CdIo *cdio, int start_session, - track_t track_num, - /*out*/ cdio_analysis_t *cdio_analysis); diff --git a/src/cd-info.c b/src/cd-info.c index fdaabbdf..625ec4ae 100644 --- a/src/cd-info.c +++ b/src/cd-info.c @@ -1,5 +1,5 @@ /* - $Id: cd-info.c,v 1.19 2003/08/16 12:59:03 rocky Exp $ + $Id: cd-info.c,v 1.20 2003/08/16 15:34:58 rocky Exp $ Copyright (C) 2003 Rocky Bernstein Copyright (C) 1996,1997,1998 Gerd Knorr @@ -52,6 +52,7 @@ #include #include #include +#include #include #ifdef __linux__ @@ -63,7 +64,6 @@ #endif #include -#include "analyze.h" #ifdef ENABLE_NLS #include @@ -108,8 +108,8 @@ #define NORMAL "" #endif -CdIo *cdio; -cdio_analysis_t cdio_analysis; +/* Used figure out what type of filesystem or CD image we've got. */ +cdio_analysis_t cdio_analysis; #if CDIO_IOCTL_FINISHED struct cdrom_mcn mcn; @@ -117,12 +117,6 @@ struct cdrom_multisession ms; struct cdrom_subchnl sub; #endif -int first_data = -1; /* # of first data track */ -int num_data = 0; /* # of data tracks */ -int first_audio = -1; /* # of first audio track */ -int num_audio = 0; /* # of audio tracks */ - - char *source_name = NULL; char *program_name; @@ -479,7 +473,7 @@ _log_handler (cdio_log_level_t level, const char message[]) #ifdef HAVE_CDDB static void -print_cddb_info(track_t num_tracks, track_t first_track_num) { +print_cddb_info(CdIo *cdio, track_t num_tracks, track_t first_track_num) { int i, matches; cddb_conn_t *conn = cddb_new(); @@ -570,9 +564,9 @@ print_vcd_info(void) { return; } fprintf (stdout, "format: %s\n", vcdinfo_get_format_version_str(obj)); - fprintf (stdout, "album id: `%.16s'\n", vcdinfo_get_album_id(obj)); - fprintf (stdout, "volume count: %d\n", vcdinfo_get_volume_count(obj)); - fprintf (stdout, "volume number: %d\n", vcdinfo_get_volume_num(obj)); + fprintf (stdout, "album id: `%.16s'\n", vcdinfo_get_album_id(obj)); + fprintf (stdout, "volume count: %d\n", vcdinfo_get_volume_count(obj)); + fprintf (stdout, "volume number: %d\n", vcdinfo_get_volume_num(obj)); fprintf (stdout, "system id: `%s'\n", vcdinfo_get_system_id(obj)); fprintf (stdout, "volume id: `%s'\n", vcdinfo_get_volume_id(obj)); fprintf (stdout, "volumeset id: `%s'\n", vcdinfo_get_volumeset_id(obj)); @@ -603,22 +597,22 @@ print_analysis(int ms_offset, cdio_analysis_t cdio_analysis, { int need_lf; - switch(fs & CDIO_FS_MASK) { + switch(CDIO_FSTYPE(fs)) { case CDIO_FS_NO_DATA: if (num_audio > 0) { printf("Audio CD, CDDB disc ID is %08lx\n", cddb_discid(cdio, num_tracks)); #ifdef HAVE_CDDB - if (!opts.no_cddb) print_cddb_info(num_tracks, first_track_num); + if (!opts.no_cddb) print_cddb_info(cdio, num_tracks, first_track_num); #endif } break; case CDIO_FS_ISO_9660: printf("CD-ROM with ISO 9660 filesystem"); - if (fs & JOLIET) { + if (fs & CDIO_FS_ANAL_JOLIET) { printf(" and joliet extension level %d", cdio_analysis.joliet_level); } - if (fs & ROCKRIDGE) + if (fs & CDIO_FS_ANAL_ROCKRIDGE) printf(" and rockridge extensions"); printf("\n"); break; @@ -650,7 +644,7 @@ print_analysis(int ms_offset, cdio_analysis_t cdio_analysis, printf("CD-ROM with unknown filesystem\n"); break; } - switch(fs & CDIO_FS_MASK) { + switch(CDIO_FSTYPE(fs)) { case CDIO_FS_ISO_9660: case CDIO_FS_ISO_9660_INTERACTIVE: case CDIO_FS_ISO_HFS: @@ -661,22 +655,22 @@ print_analysis(int ms_offset, cdio_analysis_t cdio_analysis, need_lf = 0; if (first_data == 1 && num_audio > 0) need_lf += printf("mixed mode CD "); - if (fs & XA) + if (fs & CDIO_FS_ANAL_XA) need_lf += printf("XA sectors "); - if (fs & MULTISESSION) + if (fs & CDIO_FS_ANAL_MULTISESSION) need_lf += printf("Multisession, offset = %i ", ms_offset); - if (fs & HIDDEN_TRACK) + if (fs & CDIO_FS_ANAL_HIDDEN_TRACK) need_lf += printf("Hidden Track "); - if (fs & PHOTO_CD) + if (fs & CDIO_FS_ANAL_PHOTO_CD) need_lf += printf("%sPhoto CD ", num_audio > 0 ? " Portfolio " : ""); - if (fs & CDTV) + if (fs & CDIO_FS_ANAL_CDTV) need_lf += printf("Commodore CDTV "); if (first_data > 1) need_lf += printf("CD-Plus/Extra "); - if (fs & BOOTABLE) + if (fs & CDIO_FS_ANAL_BOOTABLE) need_lf += printf("bootable CD "); - if (fs & VIDEOCDI && num_audio == 0) { + if (fs & CDIO_FS_ANAL_VIDEOCDI && num_audio == 0) { need_lf += printf("Video CD "); #ifdef HAVE_VCDINFO if (!opts.no_vcd) { @@ -685,9 +679,9 @@ print_analysis(int ms_offset, cdio_analysis_t cdio_analysis, } #endif } - if (fs & SVCD) + if (fs & CDIO_FS_ANAL_SVCD) need_lf += printf("Super Video CD (SVCD) or Chaoji Video CD (CVD)"); - if (fs & CVD) + if (fs & CDIO_FS_ANAL_CVD) need_lf += printf("Chaoji Video CD (CVD)"); if (need_lf) printf("\n"); } @@ -698,14 +692,19 @@ int main(int argc, const char *argv[]) { - int fs=0; + CdIo *cdio=NULL; + cdio_fs_anal_t fs=0; int i; - lsn_t start_track; /* first sector of track */ - lsn_t data_start =0; /* start of data area */ - int ms_offset = 0; - track_t num_tracks=0; - track_t first_track_num=0; - + lsn_t start_track; /* first sector of track */ + lsn_t data_start =0; /* start of data area */ + int ms_offset = 0; + track_t num_tracks=0; + track_t first_track_num = 0; + unsigned int num_audio = 0; /* # of audio tracks */ + unsigned int num_data = 0; /* # of data tracks */ + int first_data = -1; /* # of first data track */ + int first_audio = -1; /* # of first audio track */ + poptContext optCon = poptGetContext (NULL, argc, argv, optionsTable, 0); gl_default_cdio_log_handler = cdio_log_set_handler (_log_handler); @@ -928,9 +927,9 @@ main(int argc, const char *argv[]) /* CD-I/Ready says start_track <= 30*75 then CDDA */ if (start_track > 100 /* 100 is just a guess */) { - fs = cdio_guess_filesystem(cdio, 0, 1, &cdio_analysis); - if ((fs & CDIO_FS_MASK) != CDIO_FS_UNKNOWN) - fs |= HIDDEN_TRACK; + fs = cdio_guess_cd_type(cdio, 0, 1, &cdio_analysis); + if ((CDIO_FSTYPE(fs)) != CDIO_FS_UNKNOWN) + fs |= CDIO_FS_ANAL_HIDDEN_TRACK; else { fs &= ~CDIO_FS_MASK; /* del filesystem info */ printf("Oops: %i unused sectors at start, " @@ -971,7 +970,7 @@ main(int argc, const char *argv[]) if (start_track < data_start + cdio_analysis.isofs_size) continue; - fs = cdio_guess_filesystem(cdio, start_track, i, &cdio_analysis); + fs = cdio_guess_cd_type(cdio, start_track, i, &cdio_analysis); if (i > 1) { /* track is beyond last session -> new session found */ @@ -981,18 +980,19 @@ main(int argc, const char *argv[]) j++, i, start_track, cdio_analysis.isofs_size); printf("ISO 9660: %i blocks, label `%.32s'\n", cdio_analysis.isofs_size, cdio_analysis.iso_label); - fs |= MULTISESSION; + fs |= CDIO_FS_ANAL_MULTISESSION; } else { print_analysis(ms_offset, cdio_analysis, fs, first_data, num_audio, num_tracks, first_track_num, cdio); } - - if (!(((fs & CDIO_FS_MASK) == CDIO_FS_ISO_9660 || - (fs & CDIO_FS_MASK) == CDIO_FS_ISO_HFS || - /* (fs & CDIO_FS_MASK) == CDIO_FS_ISO_9660_INTERACTIVE) + + if ( !(CDIO_FSTYPE(fs) == CDIO_FS_ISO_9660 || + CDIO_FSTYPE(fs) == CDIO_FS_ISO_HFS || + /* CDIO_FSTYPE(fs) == CDIO_FS_ISO_9660_INTERACTIVE) && (fs & XA))) */ - (fs & CDIO_FS_MASK) == CDIO_FS_ISO_9660_INTERACTIVE))) - break; /* no method for non-iso9660 multisessions */ + CDIO_FSTYPE(fs) == CDIO_FS_ISO_9660_INTERACTIVE) ) + /* no method for non-ISO9660 multisessions */ + break; } } } diff --git a/test/check_cue.sh b/test/check_cue.sh index b8137bac..17be2631 100644 --- a/test/check_cue.sh +++ b/test/check_cue.sh @@ -1,5 +1,5 @@ #!/bin/sh -#$Id: check_cue.sh,v 1.2 2003/08/16 12:59:03 rocky Exp $ +#$Id: check_cue.sh,v 1.3 2003/08/16 15:34:58 rocky Exp $ if test -n "@CDDB_LIB@" ; then cddb_opt='--no-cddb' fi