From ad4aadc3cb7c074ee6e379660a47c002a1e5715a Mon Sep 17 00:00:00 2001 From: rocky Date: Thu, 2 Mar 2006 18:57:31 +0000 Subject: [PATCH] iso1.c{,pp} Show PVD info as well. README: revise for the programs we've got. --- example/C++/README | 29 +++++++++++++++++++++++++++-- example/C++/iso1.cpp | 23 +++++++++++++++++++++-- example/README | 5 +++-- example/iso1.c | 23 +++++++++++++++++++++-- 4 files changed, 72 insertions(+), 8 deletions(-) diff --git a/example/C++/README b/example/C++/README index 851240d2..b41430a7 100644 --- a/example/C++/README +++ b/example/C++/README @@ -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 library. 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 - 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 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 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) + + + + + diff --git a/example/C++/iso1.cpp b/example/C++/iso1.cpp index 94c0f227..14072ab5 100644 --- a/example/C++/iso1.cpp +++ b/example/C++/iso1.cpp @@ -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 @@ -19,7 +19,8 @@ */ /* 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 use in the listing. Otherwise a compiled-in default ISO 9660 image @@ -56,6 +57,13 @@ #include #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 main(int argc, const char *argv[]) @@ -79,6 +87,17 @@ main(int argc, const char *argv[]) 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); /* Iterate over the list of nodes that iso9660_ifs_readdir gives */ diff --git a/example/README b/example/README index 58a45fc5..3a5e1dd4 100644 --- a/example/README +++ b/example/README @@ -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 library. @@ -30,7 +30,8 @@ eject.c: A program eject a CD from a CD-ROM drive and then close the door again. 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 from a CDRWIN cue/bin CD image. diff --git a/example/iso1.c b/example/iso1.c index 5678422a..9d32b5e5 100644 --- a/example/iso1.c +++ b/example/iso1.c @@ -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 @@ -19,7 +19,8 @@ */ /* 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 use in the listing. Otherwise a compiled-in default ISO 9660 image @@ -52,6 +53,13 @@ #include #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 main(int argc, const char *argv[]) @@ -75,6 +83,17 @@ main(int argc, const char *argv[]) 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); /* Iterate over the list of nodes that iso9660_ifs_readdir gives */