iso1.c{,pp} Show PVD info as well.

README: revise for the programs we've got.
This commit is contained in:
rocky
2006-03-02 18:57:31 +00:00
parent c2d5b7e0fe
commit ad4aadc3cb
4 changed files with 72 additions and 8 deletions

View File

@@ -1,12 +1,19 @@
$Id: README,v 1.1 2005/02/19 11:42:18 rocky Exp $ $Id: README,v 1.2 2006/03/02 18:57:31 rocky Exp $
This directory contains some simple C++ examples of the use of the libcdio This directory contains some simple C++ examples of the use of the libcdio
library. library.
Descriptions of the programs in this example directory are as follows... Descriptions of the programs in this example directory are as follows...
device.cpp: A program to show drivers installed and what the default
CD-ROM drive is and what CD drives are available.
eject.cpp: A program eject a CD from a CD-ROM drive and then close the door
again.
iso1.cpp: A program to show using libiso9660 to list files in a iso1.cpp: A program to show using libiso9660 to list files in a
directory of an ISO-9660 image. directory of an ISO-9660 image and give basic iso9660
information.
iso2.cpp: A program to show using libiso9660 to extract a file iso2.cpp: A program to show using libiso9660 to extract a file
from a CDRWIN cue/bin CD image. from a CDRWIN cue/bin CD image.
@@ -14,3 +21,21 @@ iso2.cpp: A program to show using libiso9660 to extract a file
iso3.cpp: A program to show using libiso9660 to extract a file from an iso3.cpp: A program to show using libiso9660 to extract a file from an
ISO-9660 image. ISO-9660 image.
mmc1.cpp: A program to show issuing a simple MMC command (INQUIRY).
mmc2.cpp: A more involved MMC command to list features from
a MMC GET_CONFIGURATION command.
paranoia.cpp: A program to show using CD-DA paranoia (a library for jitter
detection and audio-read error correction). This program uses
an interface compatible (mostly) with cdparanoia.
paranoia2.cpp: Another program to show using CD-DA paranoia using a more
libcdio-oriented initialization. Probably more suited to
things that otherwise use libcdio such as media players
(e.g. for getting CDDB or CD-Text info)

View File

@@ -1,5 +1,5 @@
/* /*
$Id: iso1.cpp,v 1.4 2006/03/02 01:28:58 rocky Exp $ $Id: iso1.cpp,v 1.5 2006/03/02 18:57:31 rocky Exp $
Copyright (C) 2004, 2006 Rocky Bernstein <rocky@panix.com> Copyright (C) 2004, 2006 Rocky Bernstein <rocky@panix.com>
@@ -19,7 +19,8 @@
*/ */
/* Simple program to show using libiso9660 to list files in a directory of /* Simple program to show using libiso9660 to list files in a directory of
an ISO-9660 image. an ISO-9660 image and give some iso9660 information. See the code
to iso-info for a more complete example.
If a single argument is given, it is used as the ISO 9660 image to If a single argument is given, it is used as the ISO 9660 image to
use in the listing. Otherwise a compiled-in default ISO 9660 image use in the listing. Otherwise a compiled-in default ISO 9660 image
@@ -56,6 +57,13 @@
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#define print_vd_info(title, fn) \
if (fn(p_iso, &psz_str)) { \
printf(title ": %s\n", psz_str); \
} \
free(psz_str); \
psz_str = NULL;
int int
main(int argc, const char *argv[]) main(int argc, const char *argv[])
@@ -79,6 +87,17 @@ main(int argc, const char *argv[])
return 1; return 1;
} }
/* Show basic CD info from the Primary Volume Descriptor. */
{
char *psz_str = NULL;
print_vd_info("Application", iso9660_ifs_get_application_id);
print_vd_info("Preparer ", iso9660_ifs_get_preparer_id);
print_vd_info("Publisher ", iso9660_ifs_get_publisher_id);
print_vd_info("System ", iso9660_ifs_get_system_id);
print_vd_info("Volume ", iso9660_ifs_get_volume_id);
print_vd_info("Volume Set ", iso9660_ifs_get_volumeset_id);
}
p_entlist = iso9660_ifs_readdir (p_iso, psz_path); p_entlist = iso9660_ifs_readdir (p_iso, psz_path);
/* Iterate over the list of nodes that iso9660_ifs_readdir gives */ /* Iterate over the list of nodes that iso9660_ifs_readdir gives */

View File

@@ -1,4 +1,4 @@
$Id: README,v 1.21 2006/01/25 15:41:45 rocky Exp $ $Id: README,v 1.22 2006/03/02 18:57:31 rocky Exp $
This directory contains some simple examples of the use of the libcdio This directory contains some simple examples of the use of the libcdio
library. library.
@@ -30,7 +30,8 @@ eject.c: A program eject a CD from a CD-ROM drive and then close the door
again. again.
iso1.c: A program to show using libiso9660 to list files in a iso1.c: A program to show using libiso9660 to list files in a
directory of an ISO-9660 image. directory of an ISO-9660 image and give basic iso9660
information.
iso2.c: A program to show using libiso9660 to extract a file iso2.c: A program to show using libiso9660 to extract a file
from a CDRWIN cue/bin CD image. from a CDRWIN cue/bin CD image.

View File

@@ -1,5 +1,5 @@
/* /*
$Id: iso1.c,v 1.9 2006/03/02 01:28:58 rocky Exp $ $Id: iso1.c,v 1.10 2006/03/02 18:57:31 rocky Exp $
Copyright (C) 2004, 2005, 2006 Rocky Bernstein <rocky@panix.com> Copyright (C) 2004, 2005, 2006 Rocky Bernstein <rocky@panix.com>
@@ -19,7 +19,8 @@
*/ */
/* Simple program to show using libiso9660 to list files in a directory of /* Simple program to show using libiso9660 to list files in a directory of
an ISO-9660 image. an ISO-9660 image and give some iso9660 information. See the code
to iso-info for a more complete example.
If a single argument is given, it is used as the ISO 9660 image to If a single argument is given, it is used as the ISO 9660 image to
use in the listing. Otherwise a compiled-in default ISO 9660 image use in the listing. Otherwise a compiled-in default ISO 9660 image
@@ -52,6 +53,13 @@
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#define print_vd_info(title, fn) \
if (fn(p_iso, &psz_str)) { \
printf(title ": %s\n", psz_str); \
} \
free(psz_str); \
psz_str = NULL;
int int
main(int argc, const char *argv[]) main(int argc, const char *argv[])
@@ -75,6 +83,17 @@ main(int argc, const char *argv[])
return 1; return 1;
} }
/* Show basic CD info from the Primary Volume Descriptor. */
{
char *psz_str = NULL;
print_vd_info("Application", iso9660_ifs_get_application_id);
print_vd_info("Preparer ", iso9660_ifs_get_preparer_id);
print_vd_info("Publisher ", iso9660_ifs_get_publisher_id);
print_vd_info("System ", iso9660_ifs_get_system_id);
print_vd_info("Volume ", iso9660_ifs_get_volume_id);
print_vd_info("Volume Set ", iso9660_ifs_get_volumeset_id);
}
p_entlist = iso9660_ifs_readdir (p_iso, psz_path); p_entlist = iso9660_ifs_readdir (p_iso, psz_path);
/* Iterate over the list of nodes that iso9660_ifs_readdir gives */ /* Iterate over the list of nodes that iso9660_ifs_readdir gives */