Reduce overall size yet again by replaing isofs-m1 for fsf-tompox.

cdinfo: Add options for CDDB port and CDDB http enable
        fix bug if no CD in cdrom drive.
This commit is contained in:
rocky
2003-04-20 17:24:48 +00:00
parent 0eb0f06f87
commit 43a4b8ce3b
19 changed files with 82 additions and 406 deletions

View File

@@ -1,4 +1,4 @@
AC_REVISION([$Id: configure.ac,v 1.13 2003/04/20 15:34:31 rocky Exp $])dnl
AC_REVISION([$Id: configure.ac,v 1.14 2003/04/20 17:24:48 rocky Exp $])dnl
AC_INIT(lib/cdio.c)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(libcdio, 0.3)
@@ -210,8 +210,7 @@ fi
AC_SUBST(CDDB_LIB)
AC_CONFIG_COMMANDS([checks],
[chmod +x tests/check_opts.sh;
chmod +x tests/check_cue.sh;
[chmod +x tests/check_cue.sh
])
AC_OUTPUT([ \
@@ -221,7 +220,6 @@ AC_OUTPUT([ \
include/cdio/cdio.h \
lib/Makefile \
src/Makefile \
tests/check_opts.sh \
tests/check_cue.sh \
tests/Makefile \
])

View File

@@ -1,324 +0,0 @@
/*
$Id: cdio.h,v 1.4 2003/04/20 15:35:37 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
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
*/
/* Public CD Input and Control Interface . */
#ifndef __CDIO_H__
#define __CDIO_H__
/* Application Interface or Protocol version number. If the public
interface changes, we increase this number.
*/
#define CDIO_API_VERSION 1
/* Version of cdio package. */
#define CDIO_VERSION 0.3
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "types.h"
#include "sector.h"
/* Flags specifying the category of device to open or is opened. */
#define CDIO_SRC_IS_DISK_IMAGE_MASK 0x0001
#define CDIO_SRC_IS_DEVICE_MASK 0x0002
#define CDIO_SRC_IS_SCSI_MASK 0x0004
#define CDIO_SRC_IS_NATIVE_MASK 0x0008
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* opaque structure */
typedef struct _CdIo CdIo;
/* The below enumerations may be used to tag a specific driver
that is opened or is desired to be opened. Note that this is
different than what is available on a given host.
Order is a little significant since the order is used in scans.
We have to start with UNKNOWN and devices should come before
disk-image readers. By putting something towards the top (a lower
enumeration number), in an iterative scan we prefer that to something
with a higher enumeration number.
NOTE: IF YOU MODIFY ENUM MAKE SURE INITIALIZATION IN CDIO.C AGREES.
*/
typedef enum {
DRIVER_UNKNOWN,
DRIVER_BSDI,
DRIVER_FREEBSD,
DRIVER_LINUX,
DRIVER_SOLARIS,
DRIVER_BINCUE, /* Prefer bincue over nrg when both exist */
DRIVER_NRG,
DRIVER_DEVICE /* Is really a set of the above; should come last */
} driver_id_t;
/* Make sure what's listed below is the last one above. Since we have
a bogus (but useful) 0th entry above we don't have to add one below.
*/
#define MAX_DRIVER DRIVER_NRG
#define MAX_DEVICE_DRIVER DRIVER_SOLARIS
#define MIN_DEVICE_DRIVER DRIVER_BSDI
typedef enum {
TRACK_FORMAT_AUDIO, /* Audio track, e.g. CD-DA */
TRACK_FORMAT_CDI, /* CD-i. How this is different from DATA below? */
TRACK_FORMAT_XA, /* Mode2 of some sort */
TRACK_FORMAT_DATA, /* Mode1 of some sort */
TRACK_FORMAT_PSX, /* Playstation CD. Like audio but only 2336 bytes
of user data.
*/
TRACK_FORMAT_ERROR /* Dunno what is or some other error. */
} track_format_t;
/* Printable tags for above enumeration. */
extern const char *track_format2str[5];
/*!
Eject media in CD drive if there is a routine to do so.
Return 0 if success and 1 for failure, and 2 if no routine.
*/
int cdio_eject_media (const CdIo *obj);
/*!
Free any resources associated with obj.
*/
void cdio_destroy (CdIo *obj);
/*!
Return the value associated with the key "arg".
*/
const char * cdio_get_arg (const CdIo *obj, const char key[]);
/*!
Return a string containing the default CD device if none is specified.
if CdIo 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.
*/
char * cdio_get_default_device (const CdIo *obj);
/*!
Return the number of of the first track.
CDIO_INVALID_TRACK is returned on error.
*/
track_t cdio_get_first_track_num(const CdIo *obj);
/*!
Return a string containing the default CD device if none is specified.
*/
track_t cdio_get_num_tracks (const CdIo *obj);
/*!
Get format of track.
*/
track_format_t cdio_get_track_format(const CdIo *obj, track_t track_num);
/*!
Return true if we have XA data (green, mode2 form1) or
XA data (green, mode2 form2). That is track begins:
sync - header - subheader
12 4 - 8
FIXME: there's gotta be a better design for this and get_track_format?
*/
bool cdio_get_track_green(const CdIo *obj, track_t track_num);
/*!
Return the starting LBA for track number
track_num in obj. Tracks numbers start at 1.
The "leadout" track is specified either by
using track_num LEADOUT_TRACK or the total tracks+1.
CDIO_INVALID_LBA is returned on error.
*/
lba_t cdio_get_track_lba(const CdIo *obj, track_t track_num);
/*!
Return the starting LSN for track number
track_num in obj. Tracks numbers start at 1.
The "leadout" track is specified either by
using track_num LEADOUT_TRACK or the total tracks+1.
CDIO_INVALID_LBA is returned on error.
*/
lsn_t cdio_get_track_lsn(const CdIo *obj, track_t track_num);
/*!
Return the starting MSF (minutes/secs/frames) for track number
track_num in obj. Track numbers start at 1.
The "leadout" track is specified either by
using track_num LEADOUT_TRACK or the total tracks+1.
False is returned if there is no track entry.
*/
bool cdio_get_track_msf(const CdIo *obj, track_t track_num,
/*out*/ msf_t *msf);
/*!
Return the number of sectors between this track an the next. This
includes any pregap sectors before the start of the next track.
Tracks start at 1.
0 is returned if there is an error.
*/
unsigned int cdio_get_track_sec_count(const CdIo *obj, track_t track_num);
/*!
lseek - reposition read/write file offset
Returns (off_t) -1 on error.
Similar to (if not the same as) libc's lseek()
*/
off_t cdio_lseek(CdIo *obj, off_t offset, int whence);
/*!
Reads into buf the next size bytes.
Returns -1 on error.
Similar to (if not the same as) libc's read()
*/
ssize_t cdio_read(CdIo *obj, void *buf, size_t size);
/*!
Reads a single mode2 sector from cd device into data starting
from lsn. Returns 0 if no error.
*/
int cdio_read_audio_sector (CdIo *obj, void *buf, lsn_t lsn);
/*!
Reads a single mode2 sector from cd device into data starting
from lsn. Returns 0 if no error.
*/
int cdio_read_mode2_sector (CdIo *obj, void *buf, lsn_t lsn, bool mode2raw);
/*!
Reads nblocks of mode2 sectors from cd device into data starting
from lsn.
Returns 0 if no error.
*/
int cdio_read_mode2_sectors (CdIo *obj, void *buf, lsn_t lsn, bool mode2raw,
unsigned int num_sectors);
/*!
Set the arg "key" with "value" in the source device.
*/
int cdio_set_arg (CdIo *obj, const char key[], const char value[]);
/*!
Return the size of the CD in logical block address (LBA) units.
*/
uint32_t cdio_stat_size (CdIo *obj);
/*!
Initialize CD Reading and control routines. Should be called first.
*/
bool cdio_init(void);
/* True if xxx driver is available. where xxx=linux, solaris, nrg, ...
*/
bool cdio_have_bsdi (void);
bool cdio_have_freebsd (void);
bool cdio_have_linux (void);
bool cdio_have_solaris (void);
bool cdio_have_nrg (void);
bool cdio_have_bincue (void);
/* Like above but uses the enumeration instead. */
bool cdio_have_driver (driver_id_t driver_id);
/*! Sets up to read from place specified by source_name and
driver_id This should be called before using any other routine,
except cdio_init. This will call cdio_init, if that hasn't been
done previously. to call one of the specific routines below.
NULL is returned on error.
*/
CdIo * cdio_open (const char *source_name, driver_id_t driver_id);
/*! cdrao BIN/CUE CD disk-image routines. Source is the .bin file
NULL is returned on error.
*/
CdIo * cdio_open_bincue (const char *bin_name);
char * cdio_get_default_device_bincue(void);
/*! CD routines. Source is the some sort of device.
NULL is returned on error.
*/
CdIo * cdio_open_cd (const char *cue_name);
/*! cdrao BIN/CUE CD disk-image routines. Source is the .cue file
NULL is returned on error.
*/
CdIo * cdio_open_cue (const char *cue_name);
/*! BSDI CD-reading routines.
NULL is returned on error.
*/
CdIo * cdio_open_bsdi (const char *source_name);
char * cdio_get_default_device_bsdi(void);
/*! BSDI CD-reading routines.
NULL is returned on error.
*/
CdIo * cdio_open_freebsd (const char *source_name);
char * cdio_get_default_device_freebsd(void);
/*! Linux CD-reading routines.
NULL is returned on error.
*/
CdIo * cdio_open_linux (const char *source_name);
char * cdio_get_default_device_linux(void);
/*! Solaris CD-reading routines.
NULL is returned on error.
*/
CdIo * cdio_open_solaris (const char *soruce_name);
char * cdio_get_default_device_solaris(void);
/*! Nero CD disk-image routines.
NULL is returned on error.
*/
CdIo * cdio_open_nrg (const char *source_name);
char * cdio_get_default_device_nrg(void);
/*! Return true if cue_name is a cue file. */
char *cdio_is_cuefile(const char *cue_name);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __CDIO_H__ */

View File

@@ -1,5 +1,5 @@
/*
$Id: cdio.h.in,v 1.1 2003/04/19 09:13:06 rocky Exp $
$Id: cdio.h.in,v 1.2 2003/04/20 17:24:49 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
@@ -84,7 +84,8 @@ extern "C" {
a bogus (but useful) 0th entry above we don't have to add one below.
*/
#define MAX_DRIVER DRIVER_NRG
#define MAX_DEVICE_DRIVER DRIVER_SOLARIS
#define MIN_DEVICE_DRIVER DRIVER_BSDI
typedef enum {
TRACK_FORMAT_AUDIO, /* Audio track, e.g. CD-DA */

View File

@@ -1,5 +1,5 @@
/*
$Id: cdinfo.c,v 1.13 2003/04/20 01:39:23 rocky Exp $
$Id: cdinfo.c,v 1.14 2003/04/20 17:24:49 rocky Exp $
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
Copyright (C) 1996,1997,1998 Gerd Knorr <kraxel@bytesex.org>
@@ -232,9 +232,6 @@ typedef enum
IMAGE_UNKNOWN
} source_image_t;
#ifdef HAVE_CDDB
#endif
/* Used by `main' to communicate with `parse_opt'. And global options
*/
struct arguments
@@ -244,6 +241,8 @@ struct arguments
int no_analysis;
#ifdef HAVE_CDDB
int no_cddb;
int cddb_port; /* port number to contact CDDB server. */
int cddb_http; /* 1 if use http proxy */
#endif
int debug_level;
int silent;
@@ -291,6 +290,12 @@ struct poptOption optionsTable[] = {
#ifdef HAVE_CDDB
{"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 number to use (default 8880)"},
{"cddb-http", 'H', POPT_ARG_NONE, &opts.cddb_http, 0,
"Lookup CDDB via HTTP proxy (default no proxy)"},
#endif
{"no-ioctl", 'I', POPT_ARG_NONE, &opts.no_ioctl, 0,
@@ -623,6 +628,7 @@ guess_filesystem(int start_session, track_t track_num)
static void
myexit(int rc)
{
if (NULL != cdio)
cdio_destroy(cdio);
exit(rc);
}
@@ -717,7 +723,10 @@ print_cddb_info() {
cddb_set_email_address(conn, "me@home");
cddb_set_server_name(conn, "freedb.freedb.org");
cddb_set_server_port(conn, 8880);
cddb_set_server_port(conn, opts.cddb_port);
if (opts.cddb_http)
cddb_http_enable(conn);
else
cddb_http_disable(conn);
disc = cddb_disc_new();
@@ -743,12 +752,16 @@ print_cddb_info() {
matches = cddb_query(conn, disc);
if (-1 == matches)
printf("%s: %s\n", program_name, cddb_error_str(errno));
else {
printf("%s: Found %d matches in CDDB\n", program_name, matches);
for (i=1; i<=matches; i++) {
cddb_read(conn, disc);
cddb_disc_print(disc);
cddb_query_next(conn, disc);
}
}
cddb_disc_destroy(disc);
cddb_destroy:
@@ -858,6 +871,8 @@ main(int argc, const char *argv[])
opts.no_tracks = 0;
#ifdef HAVE_CDDB
opts.no_cddb = 0;
opts.cddb_port = 8880;
opts.cddb_http = 0;
#endif
opts.no_ioctl = 0;
opts.no_analysis = 0;

View File

@@ -1,4 +1,4 @@
# $Id: Makefile.am,v 1.8 2003/04/20 15:34:31 rocky Exp $
# $Id: Makefile.am,v 1.9 2003/04/20 17:24:49 rocky Exp $
#
# Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
#
@@ -24,13 +24,13 @@ check_SCRIPTS = check_nrg.sh check_cue.sh check_opts.sh
check_DATA = vcd_demo.right \
cdda.right cdda.cue cdda.bin \
fsf-tompox.right fsf-tompox.cue fsf-tompox.bin \
isofs-m1.right isofs-m1.cue isofs-m1.bin \
check_opts0.right check_opts1.right check_opts2.right \
check_opts3.right check_opts4.right check_opts5.right \
check_opts6.right check_opts7.right
EXTRA_DIST = $(check_SCRIPTS) $(check_DATA) \
check_common_fn check_opts.sh.in
check_common_fn check_cue.sh.in
TESTS = $(check_SCRIPTS)

View File

@@ -1,5 +1,5 @@
#!/bin/sh
#$Id: check_cue.sh,v 1.6 2003/04/20 15:34:31 rocky Exp $
#$Id: check_cue.sh,v 1.7 2003/04/20 17:24:49 rocky Exp $
if test -n "-lcddb" ; then
cddb_opt='--no-cddb'
fi
@@ -19,8 +19,19 @@ test_cdinfo "--cue-file ${srcdir}/${fname}.cue $cddb_opt" \
RC=$?
check_result $RC "cdinfo CUE test $testnum"
fname=isofs-m1
testnum='ISO 9660 mode1'
if test -f ${srcdir}/${fname}.bin ; then
test_cdinfo "--cue-file ${srcdir}/${fname}.cue" \
${fname}.dump ${srcdir}/${fname}.right
RC=$?
check_result $RC "cdinfo CUE test $testnum"
else
echo "Don't see CUE file ${srcdir}/${fname}.bin. Test $testum skipped."
fi
fname=vcd_demo
testnum=2
testnum='Video CD'
if test -f ${srcdir}/${fname}.cue ; then
test_cdinfo "-c ${srcdir}/vcd_demo.cue" \
${fname}.dump ${srcdir}/${fname}.right
@@ -31,7 +42,7 @@ else
fi
fname=svcd_ogt_test_ntsc
testnum=3
testnum='Super Video CD'
if test -f ${srcdir}/${fname}.bin ; then
test_cdinfo "--cue-file ${srcdir}/${fname}.cue" \
${fname}.dump ${srcdir}/${fname}.right
@@ -41,17 +52,6 @@ else
echo "Don't see CUE file ${srcdir}/${fname}.bin. Test $testnum skipped."
fi
fname=fsf
testnum=4
if test -f ${srcdir}/${fname}.bin ; then
test_cdinfo "--cue-file ${srcdir}/${fname}.cue --no-cddb" \
${fname}.dump ${srcdir}/${fname}.right
RC=$?
check_result $RC "cdinfo CUE test $testnum"
else
echo "Don't see CUE file ${srcdir}/${fname}.bin. Test $testum skipped."
fi
exit $RC
#;;; Local Variables: ***

View File

@@ -1,10 +1,6 @@
#!/bin/sh
#$Id: check_opts.sh.in,v 1.2 2003/04/19 19:12:06 rocky Exp $
#$Id: check_opts.sh,v 1.3 2003/04/20 17:24:49 rocky Exp $
# Check cdinfo options
if test -n "@CDDB_LIB@" ; then
cddb_opt='--no-cddb'
fi
if test -z "$srcdir" ; then
srcdir=`pwd`
fi
@@ -13,15 +9,15 @@ fi
BASE=`basename $0 .sh`
fname=fsf-tompox
fname=isofs-m1
i=0
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 $cddb_opt $opt" \
test_cdinfo "--cue-file ${srcdir}/${fname}.cue $opt" \
${testname}.dump ${srcdir}/${testname}.right
RC=$?
check_result $RC "cdinfo option test $i"
check_result $RC "cdinfo option test $opt"
i=`expr $i + 1`
done

View File

@@ -4,5 +4,5 @@ There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
__________________________________
try to find out what sort of CD this is
CD-ROM with ISO 9660 filesystem and joliet extension level 3
ISO 9660: 1744 blocks, label `Free Software Song '
CD-ROM with ISO 9660 filesystem
ISO 9660: 64 blocks, label `CDROM '

View File

@@ -4,5 +4,5 @@ There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
__________________________________
try to find out what sort of CD this is
CD-ROM with ISO 9660 filesystem and joliet extension level 3
ISO 9660: 1744 blocks, label `Free Software Song '
CD-ROM with ISO 9660 filesystem
ISO 9660: 64 blocks, label `CDROM '

View File

@@ -6,4 +6,4 @@ __________________________________
CD-ROM Track List (1 - 1)
#: MSF LSN Type
1: 00:02:00 000000 data
170: 00:25:34 001759 leadout
170: 00:06:02 000302 leadout

View File

@@ -6,4 +6,4 @@ __________________________________
CD-ROM Track List (1 - 1)
#: MSF LSN Type
1: 00:02:00 000000 data
170: 00:25:34 001759 leadout
170: 00:06:02 000302 leadout

View File

@@ -6,8 +6,8 @@ __________________________________
CD-ROM Track List (1 - 1)
#: MSF LSN Type
1: 00:02:00 000000 data
170: 00:25:34 001759 leadout
170: 00:06:02 000302 leadout
__________________________________
try to find out what sort of CD this is
CD-ROM with ISO 9660 filesystem and joliet extension level 3
ISO 9660: 1744 blocks, label `Free Software Song '
CD-ROM with ISO 9660 filesystem
ISO 9660: 64 blocks, label `CDROM '

View File

@@ -6,8 +6,8 @@ __________________________________
CD-ROM Track List (1 - 1)
#: MSF LSN Type
1: 00:02:00 000000 data
170: 00:25:34 001759 leadout
170: 00:06:02 000302 leadout
__________________________________
try to find out what sort of CD this is
CD-ROM with ISO 9660 filesystem and joliet extension level 3
ISO 9660: 1744 blocks, label `Free Software Song '
CD-ROM with ISO 9660 filesystem
ISO 9660: 64 blocks, label `CDROM '

View File

@@ -6,8 +6,8 @@ __________________________________
CD-ROM Track List (1 - 1)
#: MSF LSN Type
1: 00:02:00 000000 data
170: 00:25:34 001759 leadout
170: 00:06:02 000302 leadout
__________________________________
try to find out what sort of CD this is
CD-ROM with ISO 9660 filesystem and joliet extension level 3
ISO 9660: 1744 blocks, label `Free Software Song '
CD-ROM with ISO 9660 filesystem
ISO 9660: 64 blocks, label `CDROM '

View File

@@ -6,8 +6,8 @@ __________________________________
CD-ROM Track List (1 - 1)
#: MSF LSN Type
1: 00:02:00 000000 data
170: 00:25:34 001759 leadout
170: 00:06:02 000302 leadout
__________________________________
try to find out what sort of CD this is
CD-ROM with ISO 9660 filesystem and joliet extension level 3
ISO 9660: 1744 blocks, label `Free Software Song '
CD-ROM with ISO 9660 filesystem
ISO 9660: 64 blocks, label `CDROM '

Binary file not shown.

View File

@@ -1,13 +0,0 @@
CD Info 2.0 | (c) 2003 Gerd Knorr, Heiko Ei<45>feldt & R. Bernstein
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 - 1)
#: MSF LSN Type
1: 00:02:00 000000 data
170: 00:25:34 001759 leadout
__________________________________
try to find out what sort of CD this is
CD-ROM with ISO 9660 filesystem and joliet extension level 3
ISO 9660: 1744 blocks, label `Free Software Song '

BIN
tests/isofs-m1.bin Normal file

Binary file not shown.

3
tests/isofs-m1.cue Normal file
View File

@@ -0,0 +1,3 @@
FILE "ISOFS-M1.BIN" BINARY
TRACK 01 MODE1/2352
INDEX 01 00:00:00