cd-info: Use libvcdinfo if it is around to list out general Video CD

properties (format version, album description, preparer id, volume
number and count). cd-info output changed slightly.
This commit is contained in:
rocky
2003-04-26 14:24:44 +00:00
parent 4bb6abc003
commit 65e6cf33ca
18 changed files with 117 additions and 30 deletions

View File

@@ -15,7 +15,7 @@ dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
dnl 02111-1307, USA. dnl 02111-1307, USA.
AC_REVISION([$Id: configure.ac,v 1.18 2003/04/25 21:26:47 rocky Exp $])dnl AC_REVISION([$Id: configure.ac,v 1.19 2003/04/26 14:24:44 rocky Exp $])dnl
AC_INIT(lib/cdio.c) AC_INIT(lib/cdio.c)
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(libcdio, 0.5) AM_INIT_AUTOMAKE(libcdio, 0.5)
@@ -66,10 +66,15 @@ AC_STDC_HEADERS
AC_CHECK_HEADERS(stdint.h inttypes.h stdbool.h) AC_CHECK_HEADERS(stdint.h inttypes.h stdbool.h)
AC_CHECK_HEADER(cddb/cddb.h, , AC_CHECK_HEADER(cddb/cddb.h, ,
[ AC_MSG_RESULT([*** CDDB support be disabled from cdinfo program]) [ AC_MSG_RESULT([*** CDDB support disabled from cdinfo program])
enable_cddb=no ], enable_cddb=no ],
) )
AC_CHECK_HEADER(libvcd/info.h, ,
[ AC_MSG_RESULT([*** Video CD info disabled from cdinfo program])
enable_vcdinfo=no ],
)
dnl compiler dnl compiler
AC_C_BIGENDIAN AC_C_BIGENDIAN
AC_C_CONST AC_C_CONST
@@ -226,8 +231,21 @@ fi
AC_SUBST(CDDB_LIB) AC_SUBST(CDDB_LIB)
if test x$enable_vcdinfo = x; then
AC_ARG_ENABLE(vcdinfo,
[ --disable-vcdinfo don't include Video CD Info from libvcd],
enable_vcdinfo=no,
enable_vcdinfo=yes)
fi
if test x$enable_vcdinfo = xyes; then
AC_DEFINE([HAVE_VCDINFO],1, [Define this if you have libvcdinfo installed])
VCDINFO_LIB="-lvcd -lvcdinfo"
fi
AC_SUBST(VCDINFO_LIB)
AC_CONFIG_COMMANDS([checks], AC_CONFIG_COMMANDS([checks],
[chmod +x test/check_cue.sh [chmod +x test/check_cue.sh; chmod +x test/check_nrg.sh
]) ])
AC_OUTPUT([ \ AC_OUTPUT([ \
@@ -239,6 +257,7 @@ AC_OUTPUT([ \
include/cdio/version.h \ include/cdio/version.h \
lib/Makefile \ lib/Makefile \
src/Makefile \ src/Makefile \
test/check_nrg.sh \
test/check_cue.sh \ test/check_cue.sh \
test/Makefile \ test/Makefile \
]) ])

View File

@@ -1,4 +1,4 @@
# $Id: Makefile.am,v 1.5 2003/04/25 21:28:39 rocky Exp $ # $Id: Makefile.am,v 1.6 2003/04/26 14:24:44 rocky Exp $
# #
# Copyright (C) 2003 Rocky Bernstein <rocky@panix.com> # Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
# #
@@ -23,7 +23,7 @@ CDDB_LIB=@CDDB_LIB@
if BUILD_CDINFO if BUILD_CDINFO
cd_info_SOURCES = cd-info.c cd_info_SOURCES = cd-info.c
cd_info_LDADD = $(LIBCDIO_LIBS) $(LIBPOPT_LIBS) $(CDDB_LIB) cd_info_LDADD = $(LIBCDIO_LIBS) $(LIBPOPT_LIBS) $(CDDB_LIB) $(VCDINFO_LIB)
if BUILD_CDINFO_LINUX if BUILD_CDINFO_LINUX
cdinfo_linux_SOURCES = cdinfo-linux.c cdinfo_linux_SOURCES = cdinfo-linux.c
cdinfo_linux_LDADD = $(LIBCDIO_LIBS) $(LIBPOPT_LIBS) cdinfo_linux_LDADD = $(LIBCDIO_LIBS) $(LIBPOPT_LIBS)

View File

@@ -1,5 +1,5 @@
/* /*
$Id: cd-info.c,v 1.1 2003/04/25 21:28:39 rocky Exp $ $Id: cd-info.c,v 1.2 2003/04/26 14:24:44 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>
@@ -46,6 +46,12 @@
#include <cddb/cddb.h> #include <cddb/cddb.h>
#endif #endif
#ifdef HAVE_VCDINFO
#include <libvcd/files.h>
#include <libvcd/info.h>
#include <libvcd/info_private.h>
#endif
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <cdio/logging.h> #include <cdio/logging.h>
#include <cdio/util.h> #include <cdio/util.h>
@@ -246,6 +252,9 @@ struct arguments
int no_cddb; int no_cddb;
int cddb_port; /* port number to contact CDDB server. */ int cddb_port; /* port number to contact CDDB server. */
int cddb_http; /* 1 if use http proxy */ int cddb_http; /* 1 if use http proxy */
#endif
#ifdef HAVE_VCDINFO
int no_vcd;
#endif #endif
int debug_level; int debug_level;
int silent; int silent;
@@ -301,6 +310,10 @@ struct poptOption optionsTable[] = {
"Lookup CDDB via HTTP proxy (default no proxy)"}, "Lookup CDDB via HTTP proxy (default no proxy)"},
#endif #endif
#ifdef HAVE_VCDINFO
{"no-vcd", 'v', POPT_ARG_NONE, &opts.no_vcd, 0,
"Don't look up Video CD information"},
#endif
{"no-ioctl", 'I', POPT_ARG_NONE, &opts.no_ioctl, 0, {"no-ioctl", 'I', POPT_ARG_NONE, &opts.no_ioctl, 0,
"Don't show ioctl() information"}, "Don't show ioctl() information"},
@@ -782,6 +795,46 @@ print_cddb_info() {
} }
#endif #endif
#ifdef HAVE_VCDINFO
static void
print_vcd_info(void) {
vcdinfo_open_return_t open_rc;
vcdinfo_obj_t obj;
open_rc = vcdinfo_open(&obj, &source_name, VCDINFO_SOURCE_AUTO, NULL);
switch (open_rc) {
case VCDINFO_OPEN_VCD:
if (vcdinfo_get_format_version (&obj) == VCD_TYPE_INVALID) {
fprintf(stderr, "VCD format detection failed");
vcdinfo_close(&obj);
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, "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));
fprintf (stdout, "publisher id: `%s'\n", vcdinfo_get_publisher_id(&obj));
fprintf (stdout, "preparer id: `%s'\n", vcdinfo_get_preparer_id(&obj));
fprintf (stdout, "application id: `%s'\n",
vcdinfo_get_application_id(&obj));
break;
case VCDINFO_OPEN_ERROR:
fprintf (stderr, "Error in Video CD opening of %s\n", source_name);
return;
break;
case VCDINFO_OPEN_OTHER:
fprintf (stderr, "Even though we thought this was a Video CD, "
" further inspection says it is not.\n");
break;
}
vcdinfo_close(&obj);
}
#endif
static void static void
print_analysis(int fs, int num_audio) print_analysis(int fs, int num_audio)
{ {
@@ -858,8 +911,15 @@ print_analysis(int fs, int num_audio)
need_lf += printf("CD-Plus/Extra "); need_lf += printf("CD-Plus/Extra ");
if (fs & BOOTABLE) if (fs & BOOTABLE)
need_lf += printf("bootable CD "); need_lf += printf("bootable CD ");
if (fs & VIDEOCDI && num_audio == 0) if (fs & VIDEOCDI && num_audio == 0) {
need_lf += printf("Video CD "); need_lf += printf("Video CD ");
#ifdef HAVE_VCDINFO
if (!opts.no_vcd) {
printf("\n");
print_vcd_info();
}
#endif
}
if (fs & CVD) if (fs & CVD)
need_lf += printf("Chaoji Video CD"); need_lf += printf("Chaoji Video CD");
if (need_lf) puts(""); if (need_lf) puts("");
@@ -1043,7 +1103,7 @@ main(int argc, const char *argv[])
#endif /*CDIO_IOCTL_FINISHED*/ #endif /*CDIO_IOCTL_FINISHED*/
if (!opts.no_analysis) { if (!opts.no_analysis) {
printf(STRONG "try to find out what sort of CD this is\n" NORMAL); printf(STRONG "CD Analysis Report\n" NORMAL);
/* try to find out what sort of CD we have */ /* try to find out what sort of CD we have */
if (0 == num_data) { if (0 == num_data) {

View File

@@ -8,5 +8,5 @@ CD-ROM Track List (1 - 1)
1: 00:02:00 000000 audio 1: 00:02:00 000000 audio
170: 00:06:02 000302 leadout 170: 00:06:02 000302 leadout
__________________________________ __________________________________
try to find out what sort of CD this is CD Analysis Report
Audio CD, CDDB disc ID is 02000401 Audio CD, CDDB disc ID is 02000401

View File

@@ -1,9 +1,13 @@
#!/bin/sh #!/bin/sh
#$Id: check_cue.sh.in,v 1.1 2003/04/22 12:09:09 rocky Exp $ #$Id: check_cue.sh.in,v 1.2 2003/04/26 14:24:45 rocky Exp $
if test -n "@CDDB_LIB@" ; then if test -n "@CDDB_LIB@" ; then
cddb_opt='--no-cddb' cddb_opt='--no-cddb'
fi fi
if test -n "@VCD_LIB@" ; then
vcd_opt='--no-vcd'
fi
if test -z $srcdir ; then if test -z $srcdir ; then
srcdir=`pwd` srcdir=`pwd`
fi fi
@@ -33,7 +37,7 @@ fi
fname=vcd_demo fname=vcd_demo
testnum='Video CD' testnum='Video CD'
if test -f ${srcdir}/${fname}.cue ; then if test -f ${srcdir}/${fname}.cue ; then
test_cdinfo "-c ${srcdir}/vcd_demo.cue" \ test_cdinfo "-c ${srcdir}/vcd_demo.cue $vcd_opt" \
${fname}.dump ${srcdir}/${fname}.right ${fname}.dump ${srcdir}/${fname}.right
RC=$? RC=$?
check_result $RC "cdinfo CUE test $testnum" check_result $RC "cdinfo CUE test $testnum"
@@ -44,7 +48,7 @@ fi
fname=svcd_ogt_test_ntsc fname=svcd_ogt_test_ntsc
testnum='Super Video CD' testnum='Super Video CD'
if test -f ${srcdir}/${fname}.bin ; then if test -f ${srcdir}/${fname}.bin ; then
test_cdinfo "--cue-file ${srcdir}/${fname}.cue" \ test_cdinfo "--cue-file ${srcdir}/${fname}.cue $vcd_opt" \
${fname}.dump ${srcdir}/${fname}.right ${fname}.dump ${srcdir}/${fname}.right
RC=$? RC=$?
check_result $RC "cdinfo CUE test $testnum" check_result $RC "cdinfo CUE test $testnum"

View File

@@ -1,5 +1,9 @@
#!/bin/sh #!/bin/sh
#$Id: check_nrg.sh,v 1.2 2003/04/24 02:45:04 rocky Exp $ #$Id: check_nrg.sh,v 1.3 2003/04/26 14:24:45 rocky Exp $
if test -n "-lvcd -lvcdinfo" ; then
vcd_opt='--no-vcd'
fi
if test -z $srcdir ; then if test -z $srcdir ; then
srcdir=`pwd` srcdir=`pwd`
@@ -10,19 +14,19 @@ fi
BASE=`basename $0 .sh` BASE=`basename $0 .sh`
fname=videocd fname=videocd
test_cdinfo "--nrg-file ${srcdir}/${fname}.nrg" \ test_cdinfo "--nrg-file ${srcdir}/${fname}.nrg $vcd_opt " \
${fname}.dump ${srcdir}/${fname}.right ${fname}.dump ${srcdir}/${fname}.right
RC=$? RC=$?
check_result $RC 'cdinfo NRG test 1' check_result $RC 'cd-info NRG test 1'
BASE=`basename $0 .sh` BASE=`basename $0 .sh`
nrg_file=${srcdir}/monvoisin.nrg nrg_file=${srcdir}/monvoisin.nrg
if test -f $nrg_file ; then if test -f $nrg_file ; then
test_cdinfo "--nrg-file $nrg_file" \ test_cdinfo "--nrg-file $nrg_file $vcd_opt " \
monvoisin.dump ${srcdir}/monvoisin.right monvoisin.dump ${srcdir}/monvoisin.right
RC=$? RC=$?
check_result $RC 'cdinfo NRG test 1' check_result $RC 'cd-info NRG test 1'
else else
echo "Don't see NRG file ${nrg_file}. Test skipped." echo "Don't see NRG file ${nrg_file}. Test skipped."
exit $SKIP_TEST_EXITCODE exit $SKIP_TEST_EXITCODE
@@ -33,7 +37,7 @@ if test -f $nrg_file ; then
test_cdinfo "--nrg-file $nrg_file" \ test_cdinfo "--nrg-file $nrg_file" \
svcdgs.dump ${srcdir}/svcdgs.right svcdgs.dump ${srcdir}/svcdgs.right
RC=$? RC=$?
check_result $RC 'cdinfo NRG test 2' check_result $RC 'cd-info NRG test 2'
exit $RC exit $RC
else else

View File

@@ -3,6 +3,6 @@ This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. PARTICULAR PURPOSE.
__________________________________ __________________________________
try to find out what sort of CD this is CD Analysis Report
CD-ROM with ISO 9660 filesystem CD-ROM with ISO 9660 filesystem
ISO 9660: 64 blocks, label `CDROM ' ISO 9660: 64 blocks, label `CDROM '

View File

@@ -3,6 +3,6 @@ This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. PARTICULAR PURPOSE.
__________________________________ __________________________________
try to find out what sort of CD this is CD Analysis Report
CD-ROM with ISO 9660 filesystem CD-ROM with ISO 9660 filesystem
ISO 9660: 64 blocks, label `CDROM ' ISO 9660: 64 blocks, label `CDROM '

View File

@@ -8,6 +8,6 @@ CD-ROM Track List (1 - 1)
1: 00:02:00 000000 data 1: 00:02:00 000000 data
170: 00:06:02 000302 leadout 170: 00:06:02 000302 leadout
__________________________________ __________________________________
try to find out what sort of CD this is CD Analysis Report
CD-ROM with ISO 9660 filesystem CD-ROM with ISO 9660 filesystem
ISO 9660: 64 blocks, label `CDROM ' ISO 9660: 64 blocks, label `CDROM '

View File

@@ -8,6 +8,6 @@ CD-ROM Track List (1 - 1)
1: 00:02:00 000000 data 1: 00:02:00 000000 data
170: 00:06:02 000302 leadout 170: 00:06:02 000302 leadout
__________________________________ __________________________________
try to find out what sort of CD this is CD Analysis Report
CD-ROM with ISO 9660 filesystem CD-ROM with ISO 9660 filesystem
ISO 9660: 64 blocks, label `CDROM ' ISO 9660: 64 blocks, label `CDROM '

View File

@@ -8,6 +8,6 @@ CD-ROM Track List (1 - 1)
1: 00:02:00 000000 data 1: 00:02:00 000000 data
170: 00:06:02 000302 leadout 170: 00:06:02 000302 leadout
__________________________________ __________________________________
try to find out what sort of CD this is CD Analysis Report
CD-ROM with ISO 9660 filesystem CD-ROM with ISO 9660 filesystem
ISO 9660: 64 blocks, label `CDROM ' ISO 9660: 64 blocks, label `CDROM '

View File

@@ -8,6 +8,6 @@ CD-ROM Track List (1 - 1)
1: 00:02:00 000000 data 1: 00:02:00 000000 data
170: 00:06:02 000302 leadout 170: 00:06:02 000302 leadout
__________________________________ __________________________________
try to find out what sort of CD this is CD Analysis Report
CD-ROM with ISO 9660 filesystem CD-ROM with ISO 9660 filesystem
ISO 9660: 64 blocks, label `CDROM ' ISO 9660: 64 blocks, label `CDROM '

View File

@@ -8,6 +8,6 @@ CD-ROM Track List (1 - 1)
1: 00:02:00 000000 data 1: 00:02:00 000000 data
170: 00:06:02 000302 leadout 170: 00:06:02 000302 leadout
__________________________________ __________________________________
try to find out what sort of CD this is CD Analysis Report
CD-ROM with ISO 9660 filesystem CD-ROM with ISO 9660 filesystem
ISO 9660: 64 blocks, label `CDROM ' ISO 9660: 64 blocks, label `CDROM '

View File

@@ -9,7 +9,7 @@ CD-ROM Track List (1 - 2)
2: 00:18:51 001251 XA 2: 00:18:51 001251 XA
170: 00:39:71 002846 leadout 170: 00:39:71 002846 leadout
__________________________________ __________________________________
try to find out what sort of CD this is CD Analysis Report
CD-ROM with CD-RTOS and ISO 9660 filesystem CD-ROM with CD-RTOS and ISO 9660 filesystem
ISO 9660: 1101 blocks, label `MONVOISIN ' ISO 9660: 1101 blocks, label `MONVOISIN '
XA sectors Video CD XA sectors Video CD

View File

@@ -9,7 +9,7 @@ CD-ROM Track List (1 - 2)
2: 00:09:01 000526 XA 2: 00:09:01 000526 XA
170: 00:56:56 004106 leadout 170: 00:56:56 004106 leadout
__________________________________ __________________________________
try to find out what sort of CD this is CD Analysis Report
CD-ROM with CD-RTOS and ISO 9660 filesystem CD-ROM with CD-RTOS and ISO 9660 filesystem
ISO 9660: 376 blocks, label `SVCD_OGT_TEST_NTSC ' ISO 9660: 376 blocks, label `SVCD_OGT_TEST_NTSC '
XA sectors XA sectors

View File

@@ -9,7 +9,7 @@ CD-ROM Track List (1 - 2)
2: 00:22:53 001553 XA 2: 00:22:53 001553 XA
170: 01:17:62 005687 leadout 170: 01:17:62 005687 leadout
__________________________________ __________________________________
try to find out what sort of CD this is CD Analysis Report
CD-ROM with ISO 9660 filesystem CD-ROM with ISO 9660 filesystem
ISO 9660: 6610 blocks, label `SVCD ' ISO 9660: 6610 blocks, label `SVCD '
XA sectors Chaoji Video CD XA sectors Chaoji Video CD

View File

@@ -10,7 +10,7 @@ CD-ROM Track List (1 - 3)
3: 00:24:71 001721 XA 3: 00:24:71 001721 XA
170: 00:30:10 002110 leadout 170: 00:30:10 002110 leadout
__________________________________ __________________________________
try to find out what sort of CD this is CD Analysis Report
CD-ROM with CD-RTOS and ISO 9660 filesystem CD-ROM with CD-RTOS and ISO 9660 filesystem
ISO 9660: 1032 blocks, label `V0469 ' ISO 9660: 1032 blocks, label `V0469 '
XA sectors Video CD XA sectors Video CD

View File

@@ -12,7 +12,7 @@ CD-ROM Track List (1 - 5)
5: 00:22:01 001501 XA 5: 00:22:01 001501 XA
170: 00:25:01 001726 leadout 170: 00:25:01 001726 leadout
__________________________________ __________________________________
try to find out what sort of CD this is CD Analysis Report
CD-ROM with CD-RTOS and ISO 9660 filesystem CD-ROM with CD-RTOS and ISO 9660 filesystem
ISO 9660: 676 blocks, label `SVIDEOCD ' ISO 9660: 676 blocks, label `SVIDEOCD '
XA sectors XA sectors