diff --git a/configure.ac b/configure.ac index 84eb5a9b..a99c62bf 100644 --- a/configure.ac +++ b/configure.ac @@ -16,7 +16,7 @@ dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA dnl 02111-1307, USA. AC_PREREQ(2.54) -AC_REVISION([$Id: configure.ac,v 1.47 2003/09/28 22:11:00 rocky Exp $])dnl +AC_REVISION([$Id: configure.ac,v 1.48 2003/09/29 02:56:22 rocky Exp $])dnl AC_INIT(lib/cdio.c) AM_INIT_AUTOMAKE(libcdio, 0.64-cvs) AM_CONFIG_HEADER(config.h) @@ -93,7 +93,7 @@ AM_PATH_LIBPOPT(, [enable_cd_info=no]) dnl headers AC_STDC_HEADERS -AC_CHECK_HEADERS(stdint.h inttypes.h stdbool.h) +AC_CHECK_HEADERS(stdint.h glob.h inttypes.h stdbool.h) dnl compiler AC_C_BIGENDIAN diff --git a/example/.cvsignore b/example/.cvsignore index c16cffc9..1779eaba 100644 --- a/example/.cvsignore +++ b/example/.cvsignore @@ -1,4 +1,6 @@ .cvsignore +.deps +.libs Makefile.in Makfile sample1 diff --git a/example/sample5.c b/example/sample5.c index ebc61b2a..934e4838 100644 --- a/example/sample5.c +++ b/example/sample5.c @@ -1,5 +1,5 @@ /* - $Id: sample5.c,v 1.2 2003/09/28 22:11:00 rocky Exp $ + $Id: sample5.c,v 1.3 2003/09/29 02:56:22 rocky Exp $ Copyright (C) 2003 Rocky Bernstein @@ -49,7 +49,7 @@ main(int argc, const char *argv[]) cdio_log_set_handler (log_handler); /* Print out a list of CD-drives */ - cd_drives = cdio_get_devices(NULL); + cd_drives = cdio_get_devices(DRIVER_DEVICE); for( c = cd_drives; *c != NULL; *c++ ) { printf("Drive %s\n", *c); } @@ -74,7 +74,7 @@ main(int argc, const char *argv[]) printf("CD-DA drives...\n"); cd_drives = NULL; /* Print out a list of CD-drives with CD-DA's in them. */ - cd_drives = cdio_get_devices_with_cap(NULL, CDIO_FS_AUDIO, true); + cd_drives = cdio_get_devices_with_cap(NULL, CDIO_FS_AUDIO, false); if (NULL != cd_drives) { for( c = cd_drives; *c != NULL; *c++ ) { diff --git a/include/cdio/cdio.h b/include/cdio/cdio.h index b2b53411..d7b92eab 100644 --- a/include/cdio/cdio.h +++ b/include/cdio/cdio.h @@ -1,5 +1,5 @@ /* -*- c -*- - $Id: cdio.h,v 1.24 2003/09/28 17:14:20 rocky Exp $ + $Id: cdio.h,v 1.25 2003/09/29 02:56:22 rocky Exp $ Copyright (C) 2001 Herbert Valerio Riedel Copyright (C) 2003 Rocky Bernstein @@ -143,18 +143,19 @@ extern "C" { */ char ** cdio_get_devices_with_cap (char* search_devices[], cdio_fs_anal_t capabilities, bool any); - /*! - Return an array of device names. if CdIo is NULL (we haven't - initialized a specific device driver), then find a suitable device - driver. + + /*!Return an array of device names. If you want a specific + devices, dor a driver give that device, if you want hardware + devices, give DRIVER_DEVICE and if you want all possible devices, + image drivers and hardware drivers give DRIVER_UNKNOWN. NULL is returned if we couldn't return a list of devices. */ - char ** cdio_get_devices (const CdIo *obj); + char ** cdio_get_devices (driver_id_t driver); /*! - Return a string containing the default CD device if none is specified. - if CdIo is NULL (we haven't initialized a specific device driver), + Return a string containing the default CD device. + if obj is NULL (we haven't initialized a specific device driver), then find a suitable one and return the default device for that. NULL is returned if we couldn't get a default device. diff --git a/lib/_cdio_linux.c b/lib/_cdio_linux.c index d732a351..42f8b499 100644 --- a/lib/_cdio_linux.c +++ b/lib/_cdio_linux.c @@ -1,5 +1,5 @@ /* - $Id: _cdio_linux.c,v 1.24 2003/09/28 17:14:20 rocky Exp $ + $Id: _cdio_linux.c,v 1.25 2003/09/29 02:56:22 rocky Exp $ Copyright (C) 2001 Herbert Valerio Riedel Copyright (C) 2002,2003 Rocky Bernstein @@ -27,7 +27,7 @@ # include "config.h" #endif -static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.24 2003/09/28 17:14:20 rocky Exp $"; +static const char _rcsid[] = "$Id: _cdio_linux.c,v 1.25 2003/09/29 02:56:22 rocky Exp $"; #include @@ -841,7 +841,7 @@ static char checklist2[][40] = { Return a string containing the default VCD device if none is specified. */ static char ** -_cdio_get_devices (const CdIo *obj) +_cdio_get_devices (void) { unsigned int i; char drive[40]; @@ -893,7 +893,7 @@ _cdio_get_devices (const CdIo *obj) #endif /* HAVE_LINUX_CDROM */ /*! - Return a string containing the default VCD device if none is specified. + Return a string containing the default CD device. */ char * cdio_get_default_device_linux(void) diff --git a/lib/_cdio_nrg.c b/lib/_cdio_nrg.c index 06c08a2e..444db86d 100644 --- a/lib/_cdio_nrg.c +++ b/lib/_cdio_nrg.c @@ -1,5 +1,5 @@ /* - $Id: _cdio_nrg.c,v 1.18 2003/09/25 09:38:16 rocky Exp $ + $Id: _cdio_nrg.c,v 1.19 2003/09/29 02:56:22 rocky Exp $ Copyright (C) 2001,2003 Herbert Valerio Riedel @@ -25,9 +25,18 @@ # include "config.h" #endif +#ifdef HAVE_STDIO_H #include +#endif +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_STRING_H #include +#endif +#ifdef HAVE_GLOB_H +#include +#endif #include #include @@ -38,7 +47,7 @@ #include "cdio_private.h" #include "_cdio_stdio.h" -static const char _rcsid[] = "$Id: _cdio_nrg.c,v 1.18 2003/09/25 09:38:16 rocky Exp $"; +static const char _rcsid[] = "$Id: _cdio_nrg.c,v 1.19 2003/09/29 02:56:22 rocky Exp $"; /* structures used */ @@ -756,10 +765,37 @@ _cdio_get_arg (void *env, const char key[]) /*! Return a string containing the default VCD device if none is specified. */ -char * -cdio_get_default_device_nrg() +static char ** +_cdio_get_devices (void) { - return strdup(DEFAULT_CDIO_DEVICE); + char **drives = NULL; + unsigned int num_files=0; +#ifdef HAVE_GLOB_H + unsigned int i; + glob_t globbuf; + globbuf.gl_offs = 0; + glob("*.nrg", GLOB_DOOFFS, NULL, &globbuf); + for (i=0; i Copyright (C) 2001 Herbert Valerio Riedel @@ -37,7 +37,7 @@ #include #include "cdio_private.h" -static const char _rcsid[] = "$Id: cdio.c,v 1.28 2003/09/28 17:14:20 rocky Exp $"; +static const char _rcsid[] = "$Id: cdio.c,v 1.29 2003/09/29 02:56:22 rocky Exp $"; const char *track_format2str[6] = @@ -266,23 +266,31 @@ cdio_get_default_device (const CdIo *obj) } } -/*! - Return an array of device names. if CdIo is NULL (we haven't - initialized a specific device driver), then find a suitable device - driver. +/*!Return an array of device names. If you want a specific + devices, dor a driver give that device, if you want hardware + devices, give DRIVER_DEVICE and if you want all possible devices, + image drivers and hardware drivers give DRIVER_UNKNOWN. NULL is returned if we couldn't return a list of devices. */ char ** -cdio_get_devices (const CdIo *cdio) +cdio_get_devices (driver_id_t driver_id) { - const CdIo *c = (cdio == NULL) - ? scan_for_driver(DRIVER_UNKNOWN, CDIO_MAX_DRIVER, NULL) - : cdio; + CdIo *cdio; + + switch (driver_id) { + /* FIXME: spit out unknown to give image drivers as well. */ + case DRIVER_UNKNOWN: + case DRIVER_DEVICE: + cdio = scan_for_driver(DRIVER_UNKNOWN, CDIO_MAX_DRIVER, NULL); + break; + default: + cdio = scan_for_driver(driver_id, driver_id, NULL); + } - if (c == NULL) return NULL; - if (c->op.get_devices) { - return c->op.get_devices (c->env); + if (cdio == NULL) return NULL; + if (cdio->op.get_devices) { + return cdio->op.get_devices (); } else { return NULL; } @@ -310,7 +318,7 @@ cdio_get_devices_with_cap (char* search_devices[], char **drives_ret=NULL; int num_drives=0; - if (NULL == drives) drives=cdio_get_devices(NULL); + if (NULL == drives) drives=cdio_get_devices(DRIVER_DEVICE); if (capabilities == CDIO_FS_MATCH_ALL) { /* Duplicate drives into drives_ret. */ @@ -321,9 +329,7 @@ cdio_get_devices_with_cap (char* search_devices[], cdio_fs_anal_t got_fs=0; cdio_fs_anal_t need_fs = CDIO_FSTYPE(capabilities); cdio_fs_anal_t need_fs_ext; - need_fs_ext = any - ? capabilities | CDIO_FS_MASK - : capabilities & ~CDIO_FS_MASK; + need_fs_ext = capabilities & ~CDIO_FS_MASK; for( ; *drives != NULL; drives++ ) { CdIo *cdio = cdio_open(*drives, DRIVER_UNKNOWN); diff --git a/lib/cdio_private.h b/lib/cdio_private.h index 66fa10c9..1224dbef 100644 --- a/lib/cdio_private.h +++ b/lib/cdio_private.h @@ -1,5 +1,5 @@ /* - $Id: cdio_private.h,v 1.15 2003/09/28 17:14:21 rocky Exp $ + $Id: cdio_private.h,v 1.16 2003/09/29 02:56:23 rocky Exp $ Copyright (C) 2003 Rocky Bernstein @@ -62,7 +62,7 @@ extern "C" { NULL is returned if we couldn't return a list of devices. */ - char ** (*get_devices) (const CdIo *obj); + char ** (*get_devices) (void); /*! Return a string containing the default CD device if none is specified. diff --git a/test/Makefile.am b/test/Makefile.am index 80e4118f..e97d4bcb 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.13 2003/09/28 22:14:44 rocky Exp $ +# $Id: Makefile.am,v 1.14 2003/09/29 02:56:23 rocky Exp $ # # Copyright (C) 2003 Rocky Bernstein # @@ -20,14 +20,15 @@ # Things to regression testing #################################################### # -noinst_PROGRAMS = testassert testischar testiso9660 check_sizeof +noinst_PROGRAMS = testassert testischar testdefault testiso9660 check_sizeof INCLUDES = -I$(top_srcdir) $(LIBCDIO_CFLAGS) -testassert_LDADD = $(LIBCDIO_LIBS) -testischar_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS) -testiso9660_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS) -check_sizeof_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS) +testassert_LDADD = $(LIBCDIO_LIBS) +testdefault_LDADD = $(LIBCDIO_LIBS) +testischar_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS) +testiso9660_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS) +check_sizeof_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS) check_SCRIPTS = check_nrg.sh check_cue.sh check_cd_read.sh check_opts.sh diff --git a/test/check_cue.sh.in b/test/check_cue.sh.in index 9958d96b..fded2ef1 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.12 2003/09/20 00:28:32 rocky Exp $ +#$Id: check_cue.sh.in,v 1.13 2003/09/29 02:56:23 rocky Exp $ # Tests to see that BIN/CUE file iamge reading is correct (via cd-info). if test -z "@VCDINFO_LIBS@" ; then vcd_opt='--no-vcd' @@ -41,10 +41,15 @@ else fi fname=vcd_demo +if test -z "@VCDINFO_LIBS@" ; then + right=${srcdir}/${fname}.right +else + right=${srcdir}/${fname}_vcdinfo.right +fi testnum='Video CD' if test -f ${srcdir}/${fname}.cue ; then - test_cdinfo "-c ${srcdir}/vcd_demo.cue $vcd_opt --iso9660" \ - ${fname}.dump ${srcdir}/${fname}.right + test_cdinfo "-c ${srcdir}/vcd_demo.cue --iso9660" \ + ${fname}.dump $right RC=$? check_result $RC "cd-info CUE test $testnum" else diff --git a/test/vcd_demo_vcdinfo.right b/test/vcd_demo_vcdinfo.right new file mode 100644 index 00000000..942b7521 --- /dev/null +++ b/test/vcd_demo_vcdinfo.right @@ -0,0 +1,97 @@ +This is free software; see the source for copying conditions. +There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A +PARTICULAR PURPOSE. +__________________________________ +CD-ROM Track List (1 - 3) + #: MSF LSN Type + 1: 00:02:00 000000 XA + 2: 00:17:57 001182 XA + 3: 00:24:71 001721 XA +170: 00:30:10 002110 leadout +Media Catalog Number (MCN): not available +__________________________________ +CD Analysis Report +CD-ROM with CD-RTOS and ISO 9660 filesystem +ISO 9660: 1032 blocks, label `V0469 ' +ISO9660 filesystem + root dir in PVD set to lsn 18 + +/: + d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Jul 14 1978 00:00 . + d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Jul 14 1978 00:00 .. + d d---1xrxrxr 0 0 [fn 00] [LSN 19] 2048 Jul 14 1978 00:00 ext + d d---1xrxrxr 0 0 [fn 00] [LSN 20] 2048 Jul 14 1978 00:00 mpegav + d d---1xrxrxr 0 0 [fn 00] [LSN 21] 2048 Jul 14 1978 00:00 segment + d d---1xrxrxr 0 0 [fn 00] [LSN 22] 2048 Jul 14 1978 00:00 sources + d d---1xrxrxr 0 0 [fn 00] [LSN 25] 2048 Jul 14 1978 00:00 vcd + +/EXT/: + d d---1xrxrxr 0 0 [fn 00] [LSN 19] 2048 Jul 14 1978 00:00 . + d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Jul 14 1978 00:00 .. + - ----1xrxrxr 0 0 [fn 01] [LSN 375] 65536 Jul 14 1978 00:00 lot_x.vcd + - ----1xrxrxr 0 0 [fn 01] [LSN 407] 144 Jul 14 1978 00:00 psd_x.vcd + +/MPEGAV/: + d d---1xrxrxr 0 0 [fn 00] [LSN 20] 2048 Jul 14 1978 00:00 . + d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Jul 14 1978 00:00 .. + - ---2-xrxrxr 0 0 [fn 01] [LSN 1182] 904036 ( 796672) Jul 14 1978 00:00 avseq01.dat + - ---2-xrxrxr 0 0 [fn 02] [LSN 1721] 904036 ( 796672) Jul 14 1978 00:00 avseq02.dat + +/SEGMENT/: + d d---1xrxrxr 0 0 [fn 00] [LSN 21] 2048 Jul 14 1978 00:00 . + d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Jul 14 1978 00:00 .. + - ---2-xrxrxr 0 0 [fn 01] [LSN 225] 220780 ( 194560) Jul 14 1978 00:00 item0001.dat + +/Sources/: + d d---1xrxrxr 0 0 [fn 00] [LSN 22] 2048 Jul 14 1978 00:00 . + d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Jul 14 1978 00:00 .. + d d---1xrxrxr 0 0 [fn 00] [LSN 23] 2048 Jul 14 1978 00:00 html + - ----1xrxrxr 0 0 [fn 01] [LSN 434] 842 Dec 11 2002 10:33 index.htm + - ----1xrxrxr 0 0 [fn 01] [LSN 435] 1216557 Jan 7 2003 18:01 menu.ppm + - ----1xrxrxr 0 0 [fn 01] [LSN 1030] 2793 Jan 7 2003 18:08 source.xml + +/Sources/HTML/: + d d---1xrxrxr 0 0 [fn 00] [LSN 23] 2048 Jul 14 1978 00:00 . + d d---1xrxrxr 0 0 [fn 00] [LSN 22] 2048 Jul 14 1978 00:00 .. + - ----1xrxrxr 0 0 [fn 01] [LSN 425] 1067 Jan 7 2003 17:51 0.xml + - ----1xrxrxr 0 0 [fn 01] [LSN 426] 1067 Jan 7 2003 17:51 1.xml + d d---1xrxrxr 0 0 [fn 00] [LSN 24] 2048 Jul 14 1978 00:00 img + - ----1xrxrxr 0 0 [fn 01] [LSN 427] 1327 Jan 7 2003 17:51 movies.css + - ----1xrxrxr 0 0 [fn 01] [LSN 428] 12024 Jan 7 2003 17:51 toc.xsl + +/Sources/HTML/img/: + d d---1xrxrxr 0 0 [fn 00] [LSN 24] 2048 Jul 14 1978 00:00 . + d d---1xrxrxr 0 0 [fn 00] [LSN 23] 2048 Jul 14 1978 00:00 .. + - ----1xrxrxr 0 0 [fn 01] [LSN 408] 1999 Nov 13 2002 07:27 al.gif + - ----1xrxrxr 0 0 [fn 01] [LSN 409] 7626 Jan 7 2003 17:42 loeki_groep_01.gif + - ----1xrxrxr 0 0 [fn 01] [LSN 413] 9986 Jan 7 2003 17:42 loeki_groep_02.gif + - ----1xrxrxr 0 0 [fn 01] [LSN 418] 207 Nov 14 2002 19:33 a_left.gif + - ----1xrxrxr 0 0 [fn 01] [LSN 419] 207 Nov 14 2002 19:33 a_right.gif + - ----1xrxrxr 0 0 [fn 01] [LSN 420] 441 Nov 13 2002 10:54 animatie.gif + - ----1xrxrxr 0 0 [fn 01] [LSN 421] 250 Nov 14 2002 11:44 face_up2.gif + - ----1xrxrxr 0 0 [fn 01] [LSN 422] 259 Nov 13 2002 11:09 familie.gif + - ----1xrxrxr 0 0 [fn 01] [LSN 423] 1010 Nov 14 2002 11:52 goldstar2.gif + - ----1xrxrxr 0 0 [fn 01] [LSN 424] 1783 Nov 13 2002 07:15 vcd.gif + +/VCD/: + d d---1xrxrxr 0 0 [fn 00] [LSN 25] 2048 Jul 14 1978 00:00 . + d d---1xrxrxr 0 0 [fn 00] [LSN 18] 2048 Jul 14 1978 00:00 .. + - ----1xrxrxr 0 0 [fn 00] [LSN 151] 2048 Jul 14 1978 00:00 entries.vcd + - ----1xrxrxr 0 0 [fn 00] [LSN 150] 2048 Jul 14 1978 00:00 info.vcd + - ----1xrxrxr 0 0 [fn 00] [LSN 152] 65536 Jul 14 1978 00:00 lot.vcd + - ----1xrxrxr 0 0 [fn 00] [LSN 184] 72 Jul 14 1978 00:00 psd.vcd + +XA sectors Video CD + +format: VCD 2.0 +album id: `LOEKI' +volume count: 1 +volume number: 1 +system id: `CD-RTOS CD-BRIDGE' +volume id: `V0469' +volumeset id: `' +publisher id: `LAURENS KOEHOORN' +preparer id: `LKVCDIMAGER 5.0.7.10(WIN32)' +application id: `' +session #2 starts at track 2, LSN: 1182, ISO 9660 blocks: 1032 +ISO 9660: 1032 blocks, label `V0469 '