From 359cf083a81f9c116eb1cb416aa08b8472361c1e Mon Sep 17 00:00:00 2001 From: rocky Date: Mon, 6 Oct 2003 04:04:05 +0000 Subject: [PATCH] cd_types: sector 0 rarely needs to be read, and when it doesn't, it's not an error if it can't be read cd-info: give more info by default - source location and driver. test/*: as a result of cd-info changes need now to pass option --quiet. --- lib/cd_types.c | 15 ++++++++------- src/cd-info.c | 22 ++++++++++------------ test/check_cue.sh.in | 12 ++++++------ test/check_nrg.sh.in | 8 ++++---- test/check_opts.sh | 6 +++--- 5 files changed, 31 insertions(+), 32 deletions(-) diff --git a/lib/cd_types.c b/lib/cd_types.c index f719252b..07fad547 100644 --- a/lib/cd_types.c +++ b/lib/cd_types.c @@ -1,5 +1,5 @@ /* - $Id: cd_types.c,v 1.5 2003/09/28 17:14:20 rocky Exp $ + $Id: cd_types.c,v 1.6 2003/10/06 04:04:05 rocky Exp $ Copyright (C) 2003 Rocky Bernstein @@ -211,6 +211,7 @@ cdio_guess_cd_type(const CdIo *cdio, int start_session, track_t track_num, /*out*/ cdio_analysis_t *cdio_analysis) { int ret = 0; + bool sector0_read_ok; if (TRACK_FORMAT_AUDIO == cdio_get_track_format(cdio, track_num)) return CDIO_FS_AUDIO; @@ -226,8 +227,8 @@ cdio_guess_cd_type(const CdIo *cdio, int start_session, track_t track_num, } else { /* read sector 0 ONLY, when NO greenbook CD-I !!!! */ - if ( _cdio_read_block(cdio, 0, start_session, 1, track_num) < 0 ) - return ret; + sector0_read_ok = + _cdio_read_block(cdio, 0, start_session, 1, track_num) == 0; if (_cdio_is_it(INDEX_HS)) ret |= CDIO_FS_HIGH_SIERRA; @@ -256,8 +257,8 @@ cdio_guess_cd_type(const CdIo *cdio, int start_session, track_t track_num, if (_cdio_is_it(INDEX_BOOTABLE)) ret |= CDIO_FS_ANAL_BOOTABLE; - if (_cdio_is_it(INDEX_XA) && _cdio_is_it(INDEX_ISOFS) - && !_cdio_is_it(INDEX_PHOTO_CD)) { + if ( _cdio_is_it(INDEX_XA) && _cdio_is_it(INDEX_ISOFS) + && !(sector0_read_ok && _cdio_is_it(INDEX_PHOTO_CD)) ) { if ( _cdio_read_block(cdio, VCD_INFO_SECTOR, start_session, 4, track_num) < 0 ) @@ -271,14 +272,14 @@ cdio_guess_cd_type(const CdIo *cdio, int start_session, track_t track_num, } } else if (_cdio_is_hfs()) ret |= CDIO_FS_HFS; - else if (_cdio_is_it(INDEX_EXT2)) ret |= CDIO_FS_EXT2; + else if (sector0_read_ok && _cdio_is_it(INDEX_EXT2)) ret |= CDIO_FS_EXT2; else if (_cdio_is_3do()) ret |= CDIO_FS_3DO; else { if ( _cdio_read_block(cdio, UFS_SUPERBLOCK_SECTOR, start_session, 2, track_num) < 0 ) return ret; - if (_cdio_is_it(INDEX_UFS)) + if (sector0_read_ok && _cdio_is_it(INDEX_UFS)) ret |= CDIO_FS_UFS; else ret |= CDIO_FS_UNKNOWN; diff --git a/src/cd-info.c b/src/cd-info.c index 203a41dc..65909557 100644 --- a/src/cd-info.c +++ b/src/cd-info.c @@ -1,5 +1,5 @@ /* - $Id: cd-info.c,v 1.41 2003/09/28 17:14:21 rocky Exp $ + $Id: cd-info.c,v 1.42 2003/10/06 04:04:05 rocky Exp $ Copyright (C) 2003 Rocky Bernstein Copyright (C) 1996,1997,1998 Gerd Knorr @@ -90,8 +90,8 @@ struct arguments #endif int no_vcd; uint32_t debug_level; - int silent; int version_only; + int silent; int no_header; int print_iso9660; source_image_t source_image; @@ -128,9 +128,6 @@ parse_options (int argc, const char *argv[]) {"debug", 'd', POPT_ARG_INT, &opts.debug_level, 0, "Set debugging to LEVEL"}, - {"quiet", 'q', POPT_ARG_NONE, &opts.silent, 0, - "Don't produce warning output" }, - {"no-tracks", 'T', POPT_ARG_NONE, &opts.no_tracks, 0, "Don't show track information"}, @@ -141,7 +138,7 @@ parse_options (int argc, const char *argv[]) {"no-cddb", 'a', POPT_ARG_NONE, &opts.no_cddb, 0, "Don't look up audio CDDB information or print that"}, - {"cddb-port", 'P', POPT_ARG_INT, &opts.cddb_port, 0, + {"cddb-port", 'P', POPT_ARG_INT, &opts.cddb_port, 8880, "CDDB port number to use (default 8880)"}, {"cddb-http", 'H', POPT_ARG_NONE, &opts.cddb_http, 0, @@ -196,8 +193,8 @@ parse_options (int argc, const char *argv[]) {"nrg-file", 'N', POPT_ARG_STRING|POPT_ARGFLAG_OPTIONAL, &source_name, OP_SOURCE_NRG, "set Nero CD-ROM disk image file as source", "FILE"}, - {"quiet", 'q', POPT_ARG_NONE, &opts.silent, 0, - "show only critical messages"}, + {"quiet", 'q', POPT_ARG_NONE, &opts.silent, 0, + "Don't produce warning output" }, {"version", 'V', POPT_ARG_NONE, &opts.version_only, 0, "display version and copyright information and exit"}, @@ -795,10 +792,6 @@ main(int argc, const char *argv[]) err_exit("%s: Error in opening device driver\n", program_name); } - if (opts.debug_level > 0) { - printf("CD driver name: %s\n", cdio_get_driver_name(cdio)); - } - if (source_name==NULL) { source_name=strdup(cdio_get_arg(cdio, "source")); if (NULL == source_name) { @@ -806,6 +799,11 @@ main(int argc, const char *argv[]) } } + if (opts.silent == 0) { + printf("CD location : %s\n", source_name); + printf("CD driver name: %s\n", cdio_get_driver_name(cdio)); + } + if (opts.access_mode!=NULL) { cdio_set_arg(cdio, "access-mode", opts.access_mode); } diff --git a/test/check_cue.sh.in b/test/check_cue.sh.in index 1f3e139b..c4d6e367 100644 --- a/test/check_cue.sh.in +++ b/test/check_cue.sh.in @@ -1,5 +1,5 @@ #!/bin/sh -#$Id: check_cue.sh.in,v 1.14 2003/09/30 03:26:11 rocky Exp $ +#$Id: check_cue.sh.in,v 1.15 2003/10/06 04:04:05 rocky Exp $ # Tests to see that BIN/CUE file iamge reading is correct (via cd-info). if test -n "@VCDINFO_LIBS@" ; then vcd_opt='--no-vcd' @@ -19,12 +19,12 @@ BASE=`basename $0 .sh` fname=cdda testnum=CD-DA -test_cdinfo "--cue-file ${srcdir}/${fname}.cue --no-cddb" \ +test_cdinfo "--quiet --cue-file ${srcdir}/${fname}.cue --no-cddb" \ ${fname}.dump ${srcdir}/${fname}.right RC=$? check_result $RC "cd-info CUE test $testnum" -test_cdinfo "--bin-file ${srcdir}/${fname}.bin --no-cddb" \ +test_cdinfo "--quiet --bin-file ${srcdir}/${fname}.bin --no-cddb" \ ${fname}.dump ${srcdir}/${fname}.right RC=$? check_result $RC "cd-info BIN test $testnum" @@ -32,7 +32,7 @@ check_result $RC "cd-info BIN test $testnum" fname=isofs-m1 testnum='ISO 9660 mode1' if test -f ${srcdir}/${fname}.bin ; then - test_cdinfo "--cue-file ${srcdir}/${fname}.cue --iso9660 " \ + test_cdinfo "-q --cue-file ${srcdir}/${fname}.cue --iso9660" \ ${fname}.dump ${srcdir}/${fname}.right RC=$? check_result $RC "cd-info CUE test $testnum" @@ -48,7 +48,7 @@ else fi testnum='Video CD' if test -f ${srcdir}/${fname}.cue ; then - test_cdinfo "-c ${srcdir}/vcd_demo.cue --iso9660" \ + test_cdinfo "-q -c ${srcdir}/vcd_demo.cue --iso9660" \ ${fname}.dump $right RC=$? check_result $RC "cd-info CUE test $testnum" @@ -59,7 +59,7 @@ fi fname=svcd_ogt_test_ntsc testnum='Super Video CD' if test -f ${srcdir}/${fname}.bin ; then - test_cdinfo "--cue-file ${srcdir}/${fname}.cue $vcd_opt --iso9660 " \ + test_cdinfo "-q --cue-file ${srcdir}/${fname}.cue $vcd_opt --iso9660" \ ${fname}.dump ${srcdir}/${fname}.right RC=$? check_result $RC "cd-info CUE test $testnum" diff --git a/test/check_nrg.sh.in b/test/check_nrg.sh.in index 6bff2c51..89ec6af6 100755 --- a/test/check_nrg.sh.in +++ b/test/check_nrg.sh.in @@ -1,5 +1,5 @@ #!/bin/sh -#$Id: check_nrg.sh.in,v 1.8 2003/09/30 03:26:11 rocky Exp $ +#$Id: check_nrg.sh.in,v 1.9 2003/10/06 04:04:05 rocky Exp $ if test -n "@VCDINFO_LIBS@" ; then vcd_opt='--no-vcd' @@ -18,7 +18,7 @@ fi BASE=`basename $0 .sh` fname=videocd -test_cdinfo "--nrg-file ${srcdir}/${fname}.nrg $vcd_opt --iso9660 " \ +test_cdinfo "--quiet --nrg-file ${srcdir}/${fname}.nrg $vcd_opt --iso9660 " \ ${fname}.dump ${srcdir}/${fname}.right RC=$? check_result $RC 'cd-info NRG test 1' @@ -27,7 +27,7 @@ BASE=`basename $0 .sh` nrg_file=${srcdir}/monvoisin.nrg if test -f $nrg_file ; then - test_cdinfo "--nrg-file $nrg_file $vcd_opt --iso9660 " \ + test_cdinfo "-q --nrg-file $nrg_file $vcd_opt --iso9660 " \ monvoisin.dump ${srcdir}/monvoisin.right RC=$? check_result $RC 'cd-info NRG test 2' @@ -38,7 +38,7 @@ fi nrg_file=${srcdir}/svcdgs.nrg if test -f $nrg_file ; then - test_cdinfo "--nrg-file $nrg_file $vcd_opt --iso9660" \ + test_cdinfo "-q --nrg-file $nrg_file $vcd_opt --iso9660" \ svcdgs.dump ${srcdir}/svcdgs.right RC=$? check_result $RC 'cd-info NRG test 3' diff --git a/test/check_opts.sh b/test/check_opts.sh index 6e9974c9..f5bbff12 100755 --- a/test/check_opts.sh +++ b/test/check_opts.sh @@ -1,5 +1,5 @@ #!/bin/sh -#$Id: check_opts.sh,v 1.4 2003/09/20 00:28:32 rocky Exp $ +#$Id: check_opts.sh,v 1.5 2003/10/06 04:04:05 rocky Exp $ # Check cd-info options if test -z "$srcdir" ; then srcdir=`pwd` @@ -15,10 +15,10 @@ BASE=`basename $0 .sh` fname=isofs-m1 i=0 -for opt in '-T' '--no-tracks' '-A' '--no-analyze' '-I' '-no-ioctl' \ +for opt in '-T' '--no-tracks' '-A' '--no-analyze' '-I' '--no-ioctl' \ '-q' '--quiet' ; do testname=${BASE}$i - test_cdinfo "--cue-file ${srcdir}/${fname}.cue $opt" \ + test_cdinfo "--cue-file ${srcdir}/${fname}.cue $opt --quiet" \ ${testname}.dump ${srcdir}/${testname}.right RC=$? check_result $RC "cd-info option test $opt"