From 924e021fb9f19d43e7c2d7dde474dab9b47b0564 Mon Sep 17 00:00:00 2001 From: "R. Bernstein" Date: Sun, 25 Mar 2012 01:47:26 -0400 Subject: [PATCH 01/18] Expand driver test framework a little and the tests we do. --- test/driver/gnu_linux.c | 12 +++++-- test/driver/helper.c | 74 +++++++++++++++++++++++++++++++++++++++-- test/driver/helper.h | 17 +++++++++- 3 files changed, 97 insertions(+), 6 deletions(-) diff --git a/test/driver/gnu_linux.c b/test/driver/gnu_linux.c index fdf998e5..f4571b3e 100644 --- a/test/driver/gnu_linux.c +++ b/test/driver/gnu_linux.c @@ -36,8 +36,6 @@ #include #endif -#include -#include #include "helper.h" int @@ -46,6 +44,7 @@ main(int argc, const char *argv[]) CdIo_t *p_cdio; char **ppsz_drives=NULL; + cdio_log_set_handler(log_handler); cdio_loglevel_default = (argc > 1) ? CDIO_LOG_DEBUG : CDIO_LOG_INFO; /* snprintf(psz_nrgfile, sizeof(psz_nrgfile)-1, "%s/%s", TEST_DIR, cue_file[i]); @@ -60,7 +59,14 @@ main(int argc, const char *argv[]) p_cdio = cdio_open_linux(ppsz_drives[0]); if (p_cdio) { const char *psz_source = NULL, *psz_scsi_tuple; - + lsn_t lsn; + + reset_counts(); + lsn = cdio_get_track_lsn(p_cdio, CDIO_CD_MAX_TRACKS+1); + assert_equal_int(CDIO_INVALID_LSN, lsn, + "cdio_get_track_lsn with too large of a track number"); + reset_counts(); + check_get_arg_source(p_cdio, ppsz_drives[0]); check_mmc_supported(p_cdio, 3); diff --git a/test/driver/helper.c b/test/driver/helper.c index b000de40..37aecfb4 100644 --- a/test/driver/helper.c +++ b/test/driver/helper.c @@ -16,7 +16,6 @@ */ #ifdef HAVE_CONFIG_H #include "config.h" -#define __CDIO_CONFIG_H__ 1 #endif #ifdef HAVE_STDIO_H @@ -29,9 +28,51 @@ #include #endif -#include #include "helper.h" +unsigned int info_msg_count=0; +unsigned int debug_msg_count=0; +unsigned int warn_msg_count=0; +unsigned int error_msg_count=0; +const char *info_messages[6] = {NULL, NULL, NULL, NULL, NULL, NULL}; +const char *debug_messages[6] = {NULL, NULL, NULL, NULL, NULL, NULL}; +const char *warn_messages[6] = {NULL, NULL, NULL, NULL, NULL, NULL}; +const char *error_messages[6] = {NULL, NULL, NULL, NULL, NULL, NULL}; + +void +assert_equal_int(int expect, int got, const char *msg) +{ + if (expect != got) { + fprintf(stderr, "ERROR: Expected %d, got %d\n", expect, got); + if (NULL != msg) fprintf(stderr, "%s\n", msg); + exit(1); + } +} + +void +assert_no_warn(const char *msg) +{ + if (warn_msg_count != 0) { + unsigned int i; + fprintf(stderr, "ERROR: got unexpected warnings:\n"); + for (i=0; i + Copyright (C) 2010, 2012 Rocky Bernstein 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 @@ -14,8 +14,23 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ + +#include + void check_access_mode(CdIo_t *p_cdio, const char *psz_expected_access_mode); void check_get_arg_source(CdIo_t *p_cdio, const char *psz_expected_source); void check_mmc_supported(CdIo_t *p_cdio, int i_expected); +#include +void log_handler(cdio_log_level_t level, const char message[]); +extern unsigned int info_msg_count; +extern unsigned int debug_msg_count; +extern unsigned int warn_msg_count; +extern const char *info_messages[6]; +extern const char *debug_messages[6]; +extern const char *warn_messages[6]; +extern void assert_equal_int(int expect, int got, const char *msg); +extern void reset_counts(void); +extern void assert_warn(const char *msg); +extern void assert_no_warn(const char *msg); From 09e0606cd0086527689bcbbffe5196f6173d9bb2 Mon Sep 17 00:00:00 2001 From: "R. Bernstein" Date: Sun, 25 Mar 2012 03:57:16 -0400 Subject: [PATCH 02/18] Typo in C preprocessor symbol Comment #3 Savannah #35818 --- include/cdio/sector.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/cdio/sector.h b/include/cdio/sector.h index 86857159..c26fbd10 100644 --- a/include/cdio/sector.h +++ b/include/cdio/sector.h @@ -153,7 +153,7 @@ #define CDIO_CD_FRAMESIZE_RAW 2352 /**< bytes per frame, "raw" mode */ #define CDIO_CD_FRAMESIZE_RAWER 2646 /**< The maximum possible returned bytes */ -#define CDIO_CD_FRAMESIZE_RAW1 (CDIO_CD_CD_FRAMESIZE_RAW-CDIO_CD_SYNC_SIZE) /*2340*/ +#define CDIO_CD_FRAMESIZE_RAW1 (CDIO_CD_FRAMESIZE_RAW-CDIO_CD_SYNC_SIZE) /*2340*/ #define CDIO_CD_FRAMESIZE_RAW0 (CDIO_CD_FRAMESIZE_RAW-CDIO_CD_SYNC_SIZE-CDIO_CD_HEADER_SIZE) /*2336*/ /*! "before data" part of raw XA (green, mode2) frame */ From 13ba13efeebbb700a5828e3555c8bbca1e9a9981 Mon Sep 17 00:00:00 2001 From: "R. Bernstein" Date: Sun, 25 Mar 2012 10:39:20 -0400 Subject: [PATCH 03/18] track.c, gnu_linux.c: Test for exceding max track limit but allow specifying the leadout track in some cases. Makefile.am: need to build extract unconditionally since that is used in testing --- example/Makefile.am | 13 ++++++--- lib/driver/gnu_linux.c | 13 +++++++-- lib/driver/track.c | 60 +++++++++++++++++++++++++++++++++++------- 3 files changed, 71 insertions(+), 15 deletions(-) diff --git a/example/Makefile.am b/example/Makefile.am index 3afa284c..50d8a649 100644 --- a/example/Makefile.am +++ b/example/Makefile.am @@ -21,13 +21,18 @@ if ENABLE_CPP SUBDIRS = C++ endif + if BUILD_EXAMPLES -noinst_PROGRAMS = audio cdchange cdio-eject cdtext device discid drives eject \ - extract isofile isofile2 isofuzzy isolist isolsn \ - mmc1 mmc2 mmc2a mmc3 \ - sample3 sample4 tracks udf1 udffile + audio cdchange cdio-eject cdtext device \ + discid drives eject \ + extract isofile isofile2 isofuzzy isolist isolsn \ + mmc1 mmc2 mmc2a mmc3 \ + sample3 sample4 tracks udf1 udffile endif +# extract is used in tests so that has to be built regardless +noinst_PROGRAMS = extract $(noinst_programs) + INCLUDES = -I$(top_srcdir) $(LIBCDIO_CFLAGS) audio_DEPENDENCIES = $(LIBCDIO_DEPS) diff --git a/lib/driver/gnu_linux.c b/lib/driver/gnu_linux.c index d8b88533..6e4b050a 100644 --- a/lib/driver/gnu_linux.c +++ b/lib/driver/gnu_linux.c @@ -1,7 +1,7 @@ /* Copyright (C) 2001 Herbert Valerio Riedel Copyright (C) 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2011 - Rocky Bernstein + 2012 Rocky Bernstein 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 @@ -601,7 +601,9 @@ get_track_msf_linux(void *p_user_data, track_t i_track, msf_t *msf) { _img_private_t *p_env = p_user_data; - if (NULL == msf) return false; + if (NULL == msf || + (i_track > CDIO_CD_MAX_TRACKS && i_track != CDIO_CDROM_LEADOUT_TRACK)) + return false; if (!p_env->gen.toc_init) read_toc_linux (p_user_data) ; @@ -1179,6 +1181,13 @@ read_toc_linux (void *p_user_data) p_env->gen.i_first_track = p_env->tochdr.cdth_trk0; p_env->gen.i_tracks = p_env->tochdr.cdth_trk1; + if (p_env->gen.i_tracks > CDIO_CD_MAX_TRACKS) { + cdio_log(CDIO_LOG_WARN, "Number of tracks exceeds maximum (%d vs. %d)\n", + p_env->gen.i_tracks, CDIO_CD_MAX_TRACKS); + p_env->gen.i_tracks = CDIO_CD_MAX_TRACKS; + } + + /* read individual tracks */ for (i= p_env->gen.i_first_track; i<=p_env->gen.i_tracks; i++) { struct cdrom_tocentry *p_toc = diff --git a/lib/driver/track.c b/lib/driver/track.c index 31fd423f..da03d93f 100644 --- a/lib/driver/track.c +++ b/lib/driver/track.c @@ -1,5 +1,6 @@ /* - Copyright (C) 2003, 2004, 2005, 2008, 2011 Rocky Bernstein + Copyright (C) 2003, 2004, 2005, 2008, 2011, 2012 + Rocky Bernstein Copyright (C) 2001 Herbert Valerio Riedel This program is free software: you can redistribute it and/or modify @@ -20,10 +21,10 @@ #ifdef HAVE_CONFIG_H # include "config.h" -# define __CDIO_CONFIG_H__ 1 #endif #include +#include #include "cdio_private.h" const char *track_format2str[6] = @@ -39,9 +40,13 @@ enum cdio_track_enums; CDIO_INVALID_TRACK is returned on error. */ track_t -cdio_get_first_track_num (const CdIo_t *p_cdio) +cdio_get_first_track_num(const CdIo_t *p_cdio) { - if (NULL == p_cdio) return CDIO_INVALID_TRACK; + if (NULL == p_cdio) { + cdio_info("Null CdIo object passed\n"); + return CDIO_INVALID_TRACK; + } + if (p_cdio->op.get_first_track_num) { return p_cdio->op.get_first_track_num (p_cdio->env); @@ -57,7 +62,11 @@ cdio_get_first_track_num (const CdIo_t *p_cdio) track_t cdio_get_last_track_num (const CdIo_t *p_cdio) { - if (NULL == p_cdio) return CDIO_INVALID_TRACK; + if (NULL == p_cdio) { + cdio_info("Null CdIo object passed\n"); + return CDIO_INVALID_TRACK; + } + { const track_t i_first_track = cdio_get_first_track_num(p_cdio); if ( CDIO_INVALID_TRACK != i_first_track ) { @@ -76,6 +85,15 @@ cdio_get_last_track_num (const CdIo_t *p_cdio) int cdio_get_track_channels(const CdIo_t *p_cdio, track_t i_track) { + if (NULL == p_cdio) { + cdio_info("Null CdIo object passed\n"); + return -1; + } + if (i_track > CDIO_CD_MAX_TRACKS) { + cdio_log(CDIO_LOG_WARN, "Number of tracks exceeds maximum (%d vs. %d)\n", + i_track, CDIO_CD_MAX_TRACKS); + return -1; + } if (p_cdio->op.get_track_channels) { return p_cdio->op.get_track_channels (p_cdio->env, i_track); } else { @@ -209,7 +227,10 @@ cdio_get_track_green(const CdIo_t *p_cdio, track_t i_track) lba_t cdio_get_track_lba(const CdIo_t *p_cdio, track_t i_track) { - if (!p_cdio) return CDIO_INVALID_LBA; + if (NULL == p_cdio) { + cdio_info("Null CdIo object passed\n"); + return CDIO_INVALID_LBA; + } if (p_cdio->op.get_track_lba) { return p_cdio->op.get_track_lba (p_cdio->env, i_track); @@ -232,7 +253,16 @@ cdio_get_track_lba(const CdIo_t *p_cdio, track_t i_track) lsn_t cdio_get_track_lsn(const CdIo_t *p_cdio, track_t i_track) { - if (p_cdio == NULL) return CDIO_INVALID_LSN; + if (NULL == p_cdio) { + cdio_info("Null CdIo object passed\n"); + return CDIO_INVALID_LSN; + } + if (i_track > CDIO_CD_MAX_TRACKS && i_track != CDIO_CDROM_LEADOUT_TRACK) { + cdio_log(CDIO_LOG_WARN, "Number of tracks exceeds maximum (%d vs. %d)\n", + i_track, CDIO_CD_MAX_TRACKS); + return CDIO_INVALID_LSN; + } + if (p_cdio->op.get_track_lba) { return cdio_lba_to_lsn(p_cdio->op.get_track_lba (p_cdio->env, i_track)); @@ -254,7 +284,16 @@ cdio_get_track_lsn(const CdIo_t *p_cdio, track_t i_track) char * cdio_get_track_isrc (const CdIo_t *p_cdio, track_t i_track) { - if (p_cdio == NULL) return NULL; + if (NULL == p_cdio) { + cdio_info("Null CdIo object passed\n"); + return NULL; + } + + if (i_track > CDIO_CD_MAX_TRACKS) { + cdio_log(CDIO_LOG_WARN, "Number of tracks exceeds maximum (%d vs. %d)\n", + i_track, CDIO_CD_MAX_TRACKS); + return NULL; + } if (p_cdio->op.get_track_isrc) { return p_cdio->op.get_track_isrc (p_cdio->env, i_track); @@ -271,7 +310,10 @@ cdio_get_track_isrc (const CdIo_t *p_cdio, track_t i_track) lba_t cdio_get_track_pregap_lba(const CdIo_t *p_cdio, track_t i_track) { - if (p_cdio == NULL) return CDIO_INVALID_LBA; + if (NULL == p_cdio) { + cdio_info("Null CdIo object passed\n"); + return CDIO_INVALID_LBA; + } if (p_cdio->op.get_track_pregap_lba) { return p_cdio->op.get_track_pregap_lba (p_cdio->env, i_track); From f0cbb08d25b23d83a3d988c82522cdd88ed13763 Mon Sep 17 00:00:00 2001 From: "R. Bernstein" Date: Sun, 25 Mar 2012 13:10:21 -0400 Subject: [PATCH 04/18] Add catalog number to ISO 9660 cue file. --- src/util.c | 4 +++- test/check_opts0.right | 2 +- test/check_opts1.right | 2 +- test/check_opts2.right | 2 +- test/check_opts3.right | 2 +- test/check_opts4.right | 2 +- test/check_opts5.right | 2 +- test/check_opts6.right | 2 +- test/check_opts7.right | 2 +- test/data/isofs-m1.cue | 1 + 10 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/util.c b/src/util.c index 32896138..6285990a 100644 --- a/src/util.c +++ b/src/util.c @@ -56,7 +56,9 @@ print_version (char *program_name, const char *version, if (no_header == 0) { report( stdout, - "%s version %s\nCopyright (c) 2003, 2004, 2005, 2007, 2008, 2011 R. Bernstein\n", + "%s version %s\n" + "Copyright (c) 2003, 2004, 2005, 2007, 2008, 2011, 2012 " + "R. Bernstein\n", program_name, version); report( stdout, _("This is free software; see the source for copying conditions.\n\ diff --git a/test/check_opts0.right b/test/check_opts0.right index f5e163fc..5b6d6873 100644 --- a/test/check_opts0.right +++ b/test/check_opts0.right @@ -1,7 +1,7 @@ __________________________________ Disc mode is listed as: CD-DATA (Mode 1) -Media Catalog Number (MCN): not available +Media Catalog Number (MCN): 0000012101954 Last CD Session LSN: not supported by drive/driver __________________________________ CD Analysis Report diff --git a/test/check_opts1.right b/test/check_opts1.right index f5e163fc..5b6d6873 100644 --- a/test/check_opts1.right +++ b/test/check_opts1.right @@ -1,7 +1,7 @@ __________________________________ Disc mode is listed as: CD-DATA (Mode 1) -Media Catalog Number (MCN): not available +Media Catalog Number (MCN): 0000012101954 Last CD Session LSN: not supported by drive/driver __________________________________ CD Analysis Report diff --git a/test/check_opts2.right b/test/check_opts2.right index c4712945..6477819f 100644 --- a/test/check_opts2.right +++ b/test/check_opts2.right @@ -5,5 +5,5 @@ CD-ROM Track List (1 - 1) #: MSF LSN Type Green? Copy? 1: 00:02:00 000000 data false no 170: 00:06:02 000302 leadout (693 KB raw, 604 KB formatted) -Media Catalog Number (MCN): not available +Media Catalog Number (MCN): 0000012101954 Last CD Session LSN: not supported by drive/driver diff --git a/test/check_opts3.right b/test/check_opts3.right index c4712945..6477819f 100644 --- a/test/check_opts3.right +++ b/test/check_opts3.right @@ -5,5 +5,5 @@ CD-ROM Track List (1 - 1) #: MSF LSN Type Green? Copy? 1: 00:02:00 000000 data false no 170: 00:06:02 000302 leadout (693 KB raw, 604 KB formatted) -Media Catalog Number (MCN): not available +Media Catalog Number (MCN): 0000012101954 Last CD Session LSN: not supported by drive/driver diff --git a/test/check_opts4.right b/test/check_opts4.right index e4977f34..aed4e947 100644 --- a/test/check_opts4.right +++ b/test/check_opts4.right @@ -5,7 +5,7 @@ CD-ROM Track List (1 - 1) #: MSF LSN Type Green? Copy? 1: 00:02:00 000000 data false no 170: 00:06:02 000302 leadout (693 KB raw, 604 KB formatted) -Media Catalog Number (MCN): not available +Media Catalog Number (MCN): 0000012101954 Last CD Session LSN: not supported by drive/driver __________________________________ CD Analysis Report diff --git a/test/check_opts5.right b/test/check_opts5.right index e4977f34..aed4e947 100644 --- a/test/check_opts5.right +++ b/test/check_opts5.right @@ -5,7 +5,7 @@ CD-ROM Track List (1 - 1) #: MSF LSN Type Green? Copy? 1: 00:02:00 000000 data false no 170: 00:06:02 000302 leadout (693 KB raw, 604 KB formatted) -Media Catalog Number (MCN): not available +Media Catalog Number (MCN): 0000012101954 Last CD Session LSN: not supported by drive/driver __________________________________ CD Analysis Report diff --git a/test/check_opts6.right b/test/check_opts6.right index e4977f34..aed4e947 100644 --- a/test/check_opts6.right +++ b/test/check_opts6.right @@ -5,7 +5,7 @@ CD-ROM Track List (1 - 1) #: MSF LSN Type Green? Copy? 1: 00:02:00 000000 data false no 170: 00:06:02 000302 leadout (693 KB raw, 604 KB formatted) -Media Catalog Number (MCN): not available +Media Catalog Number (MCN): 0000012101954 Last CD Session LSN: not supported by drive/driver __________________________________ CD Analysis Report diff --git a/test/check_opts7.right b/test/check_opts7.right index e4977f34..aed4e947 100644 --- a/test/check_opts7.right +++ b/test/check_opts7.right @@ -5,7 +5,7 @@ CD-ROM Track List (1 - 1) #: MSF LSN Type Green? Copy? 1: 00:02:00 000000 data false no 170: 00:06:02 000302 leadout (693 KB raw, 604 KB formatted) -Media Catalog Number (MCN): not available +Media Catalog Number (MCN): 0000012101954 Last CD Session LSN: not supported by drive/driver __________________________________ CD Analysis Report diff --git a/test/data/isofs-m1.cue b/test/data/isofs-m1.cue index 677a803f..bead774e 100644 --- a/test/data/isofs-m1.cue +++ b/test/data/isofs-m1.cue @@ -1,3 +1,4 @@ +CATALOG 0000012101954 FILE "ISOFS-M1.BIN" BINARY TRACK 01 MODE1/2352 INDEX 01 00:00:00 From 1c41e1c46cdaa0ca5a3987b0daa9f15f20744578 Mon Sep 17 00:00:00 2001 From: rocky Date: Wed, 14 Mar 2012 08:12:58 -0400 Subject: [PATCH 05/18] Create CD-Text library - first round. (Second round will remove from lib/driver) --- .gitignore | 2 +- configure.ac | 2 + lib/Makefile.am | 2 +- lib/cdtext/.gitignore | 9 + lib/cdtext/Makefile.am | 139 +++++++ lib/cdtext/cdtext.c | 741 ++++++++++++++++++++++++++++++++++++ lib/cdtext/cdtext_private.h | 148 +++++++ lib/cdtext/libcdtext.sym | 13 + libcdtext.pc.in | 12 + 9 files changed, 1066 insertions(+), 2 deletions(-) create mode 100644 lib/cdtext/.gitignore create mode 100644 lib/cdtext/Makefile.am create mode 100644 lib/cdtext/cdtext.c create mode 100644 lib/cdtext/cdtext_private.h create mode 100644 lib/cdtext/libcdtext.sym create mode 100644 libcdtext.pc.in diff --git a/.gitignore b/.gitignore index 6b98b435..dd9ba4a2 100644 --- a/.gitignore +++ b/.gitignore @@ -16,9 +16,9 @@ /depcomp /install-sh /libcdio++.pc +/libcdio-*.sig /libcdio-*.tar.bz2 /libcdio-*.tar.gz -/libcdio-*.sig /libcdio.pc /libcdio_cdda.pc /libiso9660++.pc diff --git a/configure.ac b/configure.ac index d3e86fb6..7b1b2cf2 100644 --- a/configure.ac +++ b/configure.ac @@ -643,11 +643,13 @@ AC_CONFIG_FILES([ doc/Makefile \ lib/Makefile \ lib/cdio++/Makefile \ + lib/cdtext/Makefile \ lib/driver/Makefile \ lib/iso9660/Makefile \ lib/udf/Makefile \ libcdio.pc \ libcdio++.pc \ + libcdtext.pc \ libiso9660.pc \ libiso9660++.pc \ libudf.pc \ diff --git a/lib/Makefile.am b/lib/Makefile.am index 4be685e3..efee1c9d 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -21,4 +21,4 @@ if ENABLE_CXX_BINDINGS cxxdirs = cdio++ endif -SUBDIRS = driver iso9660 udf $(cxxdirs) +SUBDIRS = driver cdtext iso9660 udf $(cxxdirs) diff --git a/lib/cdtext/.gitignore b/lib/cdtext/.gitignore new file mode 100644 index 00000000..ad9ee005 --- /dev/null +++ b/lib/cdtext/.gitignore @@ -0,0 +1,9 @@ +/*.lo +/*.o +/*~ +/.deps +/.libs +/Makefile +/Makefile.in +/libcdtext.la +/libcdtext.la.ver diff --git a/lib/cdtext/Makefile.am b/lib/cdtext/Makefile.am new file mode 100644 index 00000000..58294963 --- /dev/null +++ b/lib/cdtext/Makefile.am @@ -0,0 +1,139 @@ +# Copyright (C) 2012 +# Rocky Bernstein +# +# 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 3 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, see . + +######################################################## +# Things to make the libcdtext library +######################################################## +# +# From libtool documentation amended with guidance from N. Boullis: +# +# 1. Start with version information of `0:0:0' for each libtool library. +# +# 2. It is probably not a good idea to update the version information +# several times between public releases, but rather once per public +# release. (This seems to be more an aesthetic consideration than +# a hard technical one.) +# +# 3. If the library source code has changed at all since the last +# update, then increment REVISION (`C:R:A' becomes `C:R+1:A'). +# +# 4. If any interfaces have been added, removed, or changed since the +# last update, increment CURRENT, and set REVISION to 0. +# +# 5. If any interfaces have been added since the last public release, +# then increment AGE. +# +# 6. If any interfaces have been removed or changed since the last +# public release, then set AGE to 0. A changed interface means an +# incompatibility with previous versions. + +libcdtext_la_CURRENT = 1 +libcdtext_la_REVISION = 0 +libcdtext_la_AGE = 0 + +EXTRA_DIST = cdtext.sym + +noinst_HEADERS = cdtext_private.h + +lib_LTLIBRARIES = libcdtext.la + +libcdtext_la_SOURCES = \ + cdtext.c \ + iso9660_private.h + +libcdtext_la_LIBADD = @LIBCDIO_LIBS@ +libcdtext_la_ldflags = -version-info $(libcdtext_la_CURRENT):$(libcdtext_la_REVISION):$(libcdtext_la_AGE) @LT_NO_UNDEFINED@ +libcdtext_la_dependencies = $(top_builddir)/lib/driver/libcdio.la + +INCLUDES = $(LIBCDIO_CFLAGS) + +######################################################## +# Things to version the symbols in the libraries +######################################################## + +# An explanation of the versioning problem from Nicolas Boullis and +# the versioned symbol solution he uses below... +# +# Currently, libvcdinfo uses the cdio_open function from libcdio. +# Let's imagine a program foobar that uses both the vcdinfo_open +# function from libvcdinfo and the cdio_open function from libcdio. + +# Currently, libcdio has SONAME libcdio.so.0, libvcdinfo has SONAME +# libvcdinfo.so.0 and requires libcdio.so.0, and foobar requires both +# libvcdinfo.so.0 and libcdio.so.0. Everything looks fine. +# +# Now, for some reason, you decide to change the cdio_open function. +# That's your right, but you have to bump the CURRENT version and (if I +# understand it correctly, athough this is not that clear in libtool's +# documentation) set the AGE to 0. Anyway, this bumps the SONAME, which is +# sane since the interface changes incompatibly. + +# Now, you have a new libcdio with SONAME libcdio.so.1. But libvcdinfo and +# foobar still require libcdio.so.0. Everything is still fine. + +# Now, after some minor changes, the author of foobar recompiles foobar. +# Then, foobar now requires libvcdinfo.so.0 and libcdio.so.1. And foobar +# now segfaults... + +# What is happening? When you run foobar, if brings both libvcdinfo.so.0 +# and libcdio.so.1, but libvcdinfo.so.0 also brings libcdio.so.0. So you +# have both libcdio.so.0 and libcdio.so.1 that bring their symbols to the +# global namespace. Hence, you have to incompatible versions of the +# cdio_open function in the name space. When foobar calls cdio_open, it +# may choose the wrong function, and segfaults... + +# With versioned symbols, the cdio_open function from libcdio.so.0 may be +# known as (something that looks like) cdio_open@@CDIO_0. An the cdio_open +# function from libcdio.so.1 as cdio_open@@CDIO_1. Both versions of +# libcdio would still be brought in by the most recent foobar, but foobar +# (and libvcdinfo) know which versioned function to use and then use the +# good one. + + +# This is some simple versioning where every symbol is versioned with +# something that looks like the SONAME of the library. More complex (and +# better) versioning is possible; it is for example what is used by glibc. +# But good complex versioning is something that requires much more +# work... + + +# The below is a impliments symbol versioning. First of all, I +# compute MAJOR as CURENT - AGE; that is what is used within libtool +# (at least on GNU/Linux systems) for the number in the SONAME. The +# nm command gives the list of symbols known in each of the object +# files that will be part of the shared library. And the sed command +# extracts from this list those symbols that will be shared. (This sed +# command comes from libtool.) + +libcdtext_la_MAJOR = $(shell expr $(libcdtext_la_CURRENT) - $(libcdtext_la_AGE)) +if BUILD_VERSIONED_LIBS +libcdtext_la_LDFLAGS = $(libcdtext_la_ldflags) -Wl,--version-script=libcdtext.la.ver +libcdtext_la_DEPENDENCIES = $(libcdio9660_la_dependencies) libcdtext.la.ver + +libcdtext.la.ver: $(libcdtext_la_OBJECTS) $(srcdir)/libcdtext.sym + @echo 'CDTEXT_$(libcdtext_la_MAJOR) {' > $@ + @objs=`for obj in $(libcdtext_la_OBJECTS); do sed -ne "s/^pic_object='\(.*\)'$$/\1/p" $$obj; done`; \ + if test -n "$$objs" ; then \ + nm $${objs} | sed -n -e 's/^.*[ ][ABCDGIRSTW][ABCDGIRSTW]*[ ][ ]*\([_A-Za-z][_A-Za-z0-9]*\)$$/\1/p' | sort -u | { first=true; while read symbol; do if grep -q "^$${symbol}\$$" $(srcdir)/libcdtext.sym; then if test $$first = true; then echo " global:"; first=false; fi; echo " $${symbol};"; fi; done; } >> $@; \ + nm $${objs} | sed -n -e 's/^.*[ ][ABCDGIRSTW][ABCDGIRSTW]*[ ][ ]*\([_A-Za-z][_A-Za-z0-9]*\)$$/\1/p' | sort -u | { first=true; while read symbol; do if grep -q "^$${symbol}\$$" $(srcdir)/libcdtext.sym; then :; else if test $$first = true; then echo " local:"; first=false; fi; echo " $${symbol};"; fi; done; } >> $@; \ + fi + @echo '};' >> $@ + +MOSTLYCLEANFILES = libcdtext.la.ver +else +libcdtext_la_LDFLAGS = $(libcdtext_la_ldflags) +libcdtext_la_DEPENDENCIES = $(libcdio9660_la_dependencies) +endif diff --git a/lib/cdtext/cdtext.c b/lib/cdtext/cdtext.c new file mode 100644 index 00000000..45e5bf84 --- /dev/null +++ b/lib/cdtext/cdtext.c @@ -0,0 +1,741 @@ +/* + Copyright (C) 2004, 2005, 2008, 2011, 2012 + Rocky Bernstein + + toc reading routine adapted from cuetools + Copyright (C) 2003 Svend Sanjay Sorensen + + 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 3 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, see . +*/ + +#ifdef HAVE_CONFIG_H +# include "config.h" +# define __CDIO_CONFIG_H__ 1 +#endif + +#include +#include +#include "cdtext_private.h" +#include + +#ifdef HAVE_STDLIB_H +#include +#endif + +#ifdef HAVE_STRING_H +#include +#endif + +#define _CDTEXT_DBCC +#define MAX_CDTEXT_GENRE_CODE 28 +#define MAX_CDTEXT_LANGUAGE_CODE 127 + +#ifndef CDIO_CD_MAX_TRACKS +# define CDIO_CD_MAX_TRACKS 99 /* Largest CD track number */ +#endif + +const char *cdtext_field[MAX_CDTEXT_FIELDS] = +{ + "TITLE", + "PERFORMER", + "SONGWRITER", + "COMPOSER", + "MESSAGE", + "ARRANGER", + "ISRC", + "UPC_EAN", + "GENRE", + "DISC_ID", +}; + +const char *cdtext_genre[MAX_CDTEXT_GENRE_CODE] = +{ + "Not Used", + "Not Defined", + "Adult Contemporary", + "Alternative Rock", + "Childrens Music", + "Classical", + "Contemporary Christian", + "Country", + "Dance", + "Easy Listening", + "Erotic", + "Folk", + "Gospel", + "Hip Hop", + "Jazz", + "Latin", + "Musical", + "New Age", + "Opera", + "Operetta", + "Pop Music", + "Rap", + "Reggae", + "Rock Music", + "Rhythm & Blues", + "Sound Effects", + "Spoken Word", + "World Music" +}; + +const char *cdtext_language[MAX_CDTEXT_LANGUAGE_CODE] = +{ + "Unknown", + "Albanian", + "Breton", + "Catalan", + "Croatian", + "Welsh", + "Czech", + "Danish", + "German", + "English", + "Spanish", + "Esperanto", + "Estonian", + "Basque", + "Faroese", + "French", + "Frisian", + "Irish", + "Gaelic", + "Galician", + "Icelandic", + "Italian", + "Lappish", + "Latin", + "Latvian", + "Luxembourgian", + "Lithuanian", + "Hungarian", + "Maltese", + "Dutch", + "Norwegian", + "Occitan", + "Polish", + "Portuguese", + "Romanian", + "Romansh", + "Serbian", + "Slovak", + "Slovenian", + "Finnish", + "Swedish", + "Turkish", + "Flemish", + "Wallon", + "Zulu", + "Vietnamese", + "Uzbek", + "Urdu", + "Ukrainian", + "Thai", + "Telugu", + "Tatar", + "Tamil", + "Tadzhik", + "Swahili", + "SrananTongo", + "Somali", + "Sinhalese", + "Shona", + "Serbo-croat", + "Ruthenian", + "Russian", + "Russian", + "Quechua", + "Pushtu", + "Punjabi", + "Persian", + "Papamiento", + "Oriya", + "Nepali", + "Ndebele", + "Marathi", + "Moldavian", + "Malaysian", + "Malagasay", + "Macedonian", + "Laotian", + "Korean", + "Khmer", + "Kazakh", + "Kannada", + "Japanese", + "Indonesian", + "Hindi", + "Hebrew", + "Hausa", + "Gurani", + "Gujurati", + "Greek", + "Georgian", + "Fulani", + "Dari", + "Churash", + "Chinese", + "Burmese", + "Bulgarian", + "Bengali", + "Bielorussian", + "Bambora", + "Azerbaijani", + "Assamese", + "Armenian", + "Arabic", + "Amharic" +}; + +/*! + Return string representation of given field type. +*/ +const char * +cdtext_field2str(cdtext_field_t i) +{ + if (i >= MAX_CDTEXT_FIELDS) + return "INVALID"; + else + return cdtext_field[i]; +} + +/*! + Return string representation of the given genre code. +*/ +const char * +cdtext_genre2str(cdtext_genre_t i) +{ + if (i >= MAX_CDTEXT_GENRE_CODE) + return "INVALID"; + else + return cdtext_genre[i]; +} + +/*! + Return string representation of the given language code. +*/ +const char * +cdtext_lang2str(cdtext_lang_t i) +{ + if (i >= MAX_CDTEXT_LANGUAGE_CODE) + return "INVALID"; + else + return cdtext_language[i]; +} + +/*! + Free memory associated with the given cdtext_t object. + + @param p_cdtext the CD-TEXT object +*/ +void +cdtext_destroy(cdtext_t *p_cdtext) +{ + cdtext_field_t k; + track_t j; + int i; + + if (!p_cdtext) return; + for (i=0; iblock[i].track[j].field[k]) { + free(p_cdtext->block[i].track[j].field[k]); + p_cdtext->block[i].track[j].field[k] = NULL; + } + } + } + } +} + +/*! + Returns a copy of the return value of cdtext_get_const or NULL. + + Should be freed when done. + @see cdtext_get_const +*/ +char * +cdtext_get(const cdtext_t *p_cdtext, cdtext_field_t field, track_t track) +{ + const char *ret = cdtext_get_const(p_cdtext, field, track); + if (NULL == ret) + return NULL; + else + return strdup(ret); +} + +/*! + Returns value of the given field. + + NULL is returned if key is CDTEXT_INVALID or the field is not set. + Strings are encoded in UTF-8. + + @param p_cdtext the CD-TEXT object + @param field type of the field to return + @param track specifies the track, 0 stands for disc +*/ +const char * +cdtext_get_const(const cdtext_t *p_cdtext, cdtext_field_t field, track_t track) +{ + if (CDTEXT_FIELD_INVALID == field + || NULL == p_cdtext + || 0 > track + || CDIO_CD_MAX_TRACKS < track) + return NULL; + + return p_cdtext->block[p_cdtext->block_i].track[track].field[field]; +} + + +/*! + Returns the currently active language. + + @param p_cdtext the CD-TEXT object +*/ +cdtext_lang_t +cdtext_get_language(const cdtext_t *p_cdtext) +{ + if (NULL == p_cdtext) + return CDTEXT_LANGUAGE_UNKNOWN; + return p_cdtext->block[p_cdtext->block_i].language_code; +} + +/* + Returns a list of available languages or NULL. + + Internally the list is stored in a static array. + + @param p_cdtext the CD-TEXT object +*/ +cdtext_lang_t +*cdtext_list_languages(const cdtext_t *p_cdtext) +{ + static cdtext_lang_t avail[CDTEXT_NUM_BLOCKS_MAX]; + int i, j=0; + + if (NULL == p_cdtext) + return NULL; + + for (i=0; iblock[i].language_code) + avail[j++] = p_cdtext->block[i].language_code; + } + + return avail; +} + +/*! + Try to select the given language. + Select default language if specified is not available or invalid and + return false. + + @param p_cdtext the CD-TEXT object + @param language string representation of the language + + @return true on success, false if language is not available +*/ +bool +cdtext_select_language(cdtext_t *p_cdtext, const char *language) +{ + cdtext_lang_t lang_id; + lang_id = cdtext_is_language(language); + + if(NULL == p_cdtext) + return false; + + if (CDTEXT_LANGUAGE_UNKNOWN != lang_id) + { + int i; + for (i=0; iblock[i].language_code) { + p_cdtext->block_i = i; + return true; + } + } + } else { + p_cdtext->block_i = 0; + } + return false; +} + +/*! + Initialize a new cdtext structure. + + When the structure is no longer needed, release the + resources using cdtext_delete. + +*/ +cdtext_t +*cdtext_init(void) +{ + cdtext_field_t k; + track_t j; + int i; + cdtext_t *p_cdtext; + + p_cdtext = (cdtext_t *) malloc(sizeof(struct cdtext_s)); + + for (i=0; iblock[i].track[j].field[k] = NULL; + } + } + p_cdtext->block[i].genre_code = CDTEXT_GENRE_UNUSED; + p_cdtext->block[i].language_code = CDTEXT_LANGUAGE_UNKNOWN; + } + + p_cdtext->block_i = 0; + + return p_cdtext; +} + +/*! + Returns associated cdtext_field_t if field is a CD-TEXT keyword. + + Internal function. + + @param key key to test + + @return CDTEXT_INVALID if the given keyword is invalid +*/ +cdtext_field_t +cdtext_is_field (const char *key) +{ + unsigned int i; + + for (i = 0; i < MAX_CDTEXT_FIELDS ; i++) + if (0 == strcmp(cdtext_field[i], key)) { + return i; + } + return CDTEXT_FIELD_INVALID; +} + +/*! + Returns associated cdtext_lang_t if argument is a supported language. + + Internal function. + + @param lang language to test + + @return CDTEXT_LANGUAGE_UNKNOWN if language is not supported +*/ +cdtext_lang_t +cdtext_is_language(const char *lang) +{ + unsigned int i; + + for (i = 0; i < MAX_CDTEXT_LANGUAGE_CODE; i++) + if (0 == strcmp(cdtext_language[i], lang)) { + return i; + } + return CDTEXT_LANGUAGE_UNKNOWN; +} + +/*! + Sets the given field at the given track to the given value. + + Recodes to UTF-8 if charset is not NULL. + + @param p_cdtext the CD-TEXT object + @param key field to set + @param value value to set + @param track track to work on + @param charset charset to convert from + */ +void +cdtext_set(cdtext_t *p_cdtext, cdtext_field_t key, const uint8_t *value, + track_t track, const char *charset) +{ + if (NULL == value || key == CDTEXT_FIELD_INVALID || 0 > track + || CDIO_CD_MAX_TRACKS < track) + return; + + /* free old memory */ + if (p_cdtext->block[p_cdtext->block_i].track[track].field[key]) + free(p_cdtext->block[p_cdtext->block_i].track[track].field[key]); + + /* recode to UTF-8 */ + if (NULL != charset) { + cdio_utf8_t *utf8_str = NULL; + cdio_charset_to_utf8((const char*) value, strlen((const char*)value), + &utf8_str, charset); + p_cdtext->block[p_cdtext->block_i].track[track].field[key] = (char *)utf8_str; + } else + p_cdtext->block[p_cdtext->block_i].track[track].field[key] = strdup((const char *)value); +} + +/*! + Read a binary CD-TEXT and fill a cdtext struct. + + @param p_cdtext the CD-TEXT object + @param wdata the data + @param i_data size of wdata + + @returns 0 on success, non-zero on failure +*/ +int +cdtext_data_init(cdtext_t *p_cdtext, uint8_t *wdata, size_t i_data) +{ + uint8_t *p_data; + int j; + uint8_t buffer[256]; + int i_buf = 0; + int i_block; + int i_seq = 0; + int i; + cdtext_blocksize_t blocksize; + char *charset = NULL; + + memset( buffer, 0, sizeof(buffer) ); + + p_data = wdata; + if (i_data < CDTEXT_LEN_PACK || 0 != i_data % CDTEXT_LEN_PACK) { + cdio_warn("CD-Text size is not multiple of pack size"); + return -1; + } + +#if 0 + for(i=0; i < i_data; i++) + printf("%0x%c", wdata[i], ((i+1) % 18 == 0 ? '\n' : ' ')); +#endif + + + /* Iterate over blocks */ + i_block = -1; + while(i_data > 0) { + cdtext_pack_t pack; + cdtext_read_pack(&pack, p_data); + + if (i_block != pack.block || i_seq != pack.seq) { + cdtext_pack_t tpack; + i_block = pack.block; + if (i_block >= CDTEXT_NUM_BLOCKS_MAX) { + cdio_warn("CD-TEXT: Invalid blocknumber %d.\n", i_block); + return -1; + } + p_cdtext->block_i = i_block; + i_seq = 0; + memset( &blocksize, 0, CDTEXT_LEN_BLOCKSIZE); + + /* first read block size information for sanity checks and encoding */ + for(i=0; i <= i_data-CDTEXT_LEN_PACK; i+=CDTEXT_LEN_PACK) { + + if (p_data[i+0] == CDTEXT_PACK_BLOCKSIZE) { + cdtext_read_pack(&tpack, p_data+i); + switch (tpack.i_track) { + case 0: + blocksize.charcode = tpack.text[0]; + blocksize.i_first_track = tpack.text[1]; + blocksize.i_last_track = tpack.text[2]; + blocksize.copyright = tpack.text[3]; + blocksize.i_packs[0] = tpack.text[4]; + blocksize.i_packs[1] = tpack.text[5]; + blocksize.i_packs[2] = tpack.text[6]; + blocksize.i_packs[3] = tpack.text[7]; + blocksize.i_packs[4] = tpack.text[8]; + blocksize.i_packs[5] = tpack.text[9]; + blocksize.i_packs[6] = tpack.text[10]; + blocksize.i_packs[7] = tpack.text[11]; + break; + case 1: + blocksize.i_packs[8] = tpack.text[0]; + blocksize.i_packs[9] = tpack.text[1]; + blocksize.i_packs[10] = tpack.text[2]; + blocksize.i_packs[11] = tpack.text[3]; + blocksize.i_packs[12] = tpack.text[4]; + blocksize.i_packs[13] = tpack.text[5]; + blocksize.i_packs[14] = tpack.text[6]; + blocksize.i_packs[15] = tpack.text[7]; + blocksize.lastseq[0] = tpack.text[8]; + blocksize.lastseq[1] = tpack.text[9]; + blocksize.lastseq[2] = tpack.text[10]; + blocksize.lastseq[3] = tpack.text[11]; + break; + case 2: + blocksize.lastseq[4] = tpack.text[0]; + blocksize.lastseq[5] = tpack.text[1]; + blocksize.lastseq[6] = tpack.text[2]; + blocksize.lastseq[7] = tpack.text[3]; + blocksize.langcode[0] = tpack.text[4]; + blocksize.langcode[1] = tpack.text[5]; + blocksize.langcode[2] = tpack.text[6]; + blocksize.langcode[3] = tpack.text[7]; + blocksize.langcode[4] = tpack.text[8]; + blocksize.langcode[5] = tpack.text[9]; + blocksize.langcode[6] = tpack.text[10]; + blocksize.langcode[7] = tpack.text[11]; + break; + } + } + } + + if(blocksize.i_packs[15] == 3) { + /* if there were 3 BLOCKSIZE packs */ + /* set copyright */ + p_cdtext->block[i_block].copyright = (0x03 == (blocksize.copyright & 0x03)); + + /* set Language */ + if(blocksize.langcode[i_block] <= 0x7f) + p_cdtext->block[i_block].language_code = blocksize.langcode[i_block]; + + /* determine encoding */ + switch (blocksize.charcode){ + case CDTEXT_CHARCODE_ISO_8859_1: + /* default */ + charset = (char *) "ISO-8859-1"; + break; + case CDTEXT_CHARCODE_ASCII: + charset = (char *) "ASCII"; + break; + case CDTEXT_CHARCODE_SHIFT_JIS: + charset = (char *) "SHIFT_JIS"; + break; + } + } else { + cdio_warn("CD-TEXT: No blocksize information available for block %d.\n", i_block); + return -1; + } + + } + + cdtext_read_pack(&pack, p_data); + +#ifndef _CDTEXT_DBCC + if ( pack.db_chars ) { + cdio_warn("CD-TEXT: Double-byte characters not supported"); + return -1; + } +#endif + + /* read text packs first */ + j = 0; + switch (pack.type) { + case CDTEXT_PACK_GENRE: + /* If pack.text starts with an unprintable character, it is likely to be the genre_code. + * While the specification requires the first GENRE pack to start with the 2 byte genre code, + * it is not specific about the following ones. */ + if (pack.text[0] <= 31) { + j = 2; + if (CDTEXT_GENRE_UNUSED == p_cdtext->block[i_block].genre_code) + p_cdtext->block[i_block].genre_code = CDTEXT_GET_LEN16(pack.text); + } + case CDTEXT_PACK_TITLE: + case CDTEXT_PACK_PERFORMER: + case CDTEXT_PACK_SONGWRITER: + case CDTEXT_PACK_COMPOSER: + case CDTEXT_PACK_ARRANGER: + case CDTEXT_PACK_MESSAGE: + case CDTEXT_PACK_DISCID: + case CDTEXT_PACK_UPC: + while (j < CDTEXT_LEN_TEXTDATA) { + /* not terminated */ + if (pack.text[j] != 0 || (pack.db_chars && pack.text[j+1] != 0)) { + buffer[i_buf++] = pack.text[j]; + if(pack.db_chars) + buffer[i_buf++] = pack.text[j+1]; + } else if(i_buf > 1) { + buffer[i_buf++] = 0; + if(pack.db_chars) + buffer[i_buf++] = 0; + + switch (pack.type) { + case CDTEXT_PACK_TITLE: + cdtext_set(p_cdtext, CDTEXT_FIELD_TITLE, buffer, pack.i_track, charset); + break; + case CDTEXT_PACK_PERFORMER: + cdtext_set(p_cdtext, CDTEXT_FIELD_PERFORMER, buffer, pack.i_track, charset); + break; + case CDTEXT_PACK_SONGWRITER: + cdtext_set(p_cdtext, CDTEXT_FIELD_SONGWRITER, buffer, pack.i_track, charset); + break; + case CDTEXT_PACK_COMPOSER: + cdtext_set(p_cdtext, CDTEXT_FIELD_COMPOSER, buffer, pack.i_track, charset); + break; + case CDTEXT_PACK_ARRANGER: + cdtext_set(p_cdtext, CDTEXT_FIELD_ARRANGER, buffer, pack.i_track, charset); + break; + case CDTEXT_PACK_MESSAGE: + cdtext_set(p_cdtext, CDTEXT_FIELD_MESSAGE, buffer, pack.i_track, charset); + break; + case CDTEXT_PACK_DISCID: + if (pack.i_track == 0) + cdtext_set(p_cdtext, CDTEXT_FIELD_DISCID, buffer, pack.i_track, NULL); + break; + case CDTEXT_PACK_GENRE: + cdtext_set(p_cdtext, CDTEXT_FIELD_GENRE, buffer, pack.i_track, "ASCII"); + break; + case CDTEXT_PACK_UPC: + if (pack.i_track == 0) + cdtext_set(p_cdtext, CDTEXT_FIELD_UPC_EAN, buffer, pack.i_track, "ASCII"); + else + cdtext_set(p_cdtext, CDTEXT_FIELD_ISRC, buffer, pack.i_track, "ISO-8859-1"); + break; + } + i_buf = 0; + + } + if (pack.db_chars) + j+=2; + else + j+=1; + } + break; + } + /* This would be the right place to parse TOC and TOC2 fields. */ + + i_seq++; + i_data-=CDTEXT_LEN_PACK; + p_data+=CDTEXT_LEN_PACK; + } /* end of while loop */ + + p_cdtext->block_i = 0; + return 0; +} + + +/*! + Fills cdtext_pack_t with information read from p_data + + @param p_pack out + @param p_data in +*/ +int +cdtext_read_pack(cdtext_pack_t *p_pack, const uint8_t *p_data) { + p_pack->type = p_data[0]; + p_pack->i_track = p_data[1]; + p_pack->seq = p_data[2]; + p_pack->char_pos = p_data[3] & 0x0F; + p_pack->block = (p_data[3] >> 4) & 0x07; + p_pack->db_chars = (p_data[3] >> 7) & 0x01; + p_pack->text[0] = p_data[4]; + p_pack->text[1] = p_data[5]; + p_pack->text[2] = p_data[6]; + p_pack->text[3] = p_data[7]; + p_pack->text[4] = p_data[8]; + p_pack->text[5] = p_data[9]; + p_pack->text[6] = p_data[10]; + p_pack->text[7] = p_data[11]; + p_pack->text[8] = p_data[12]; + p_pack->text[9] = p_data[13]; + p_pack->text[10] = p_data[14]; + p_pack->text[11] = p_data[15]; + p_pack->crc[0] = p_data[16]; + p_pack->crc[1] = p_data[17]; + + return 0; +} diff --git a/lib/cdtext/cdtext_private.h b/lib/cdtext/cdtext_private.h new file mode 100644 index 00000000..2f17a289 --- /dev/null +++ b/lib/cdtext/cdtext_private.h @@ -0,0 +1,148 @@ +/* + Copyright (C) 2004, 2005, 2008, 2011, 2012 + Rocky Bernstein + + 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 3 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, see . +*/ + +#ifndef __CDIO_CDTEXT_PRIVATE_H__ +#define __CDIO_CDTEXT_PRIVATE_H__ + +#include + +#define CDTEXT_GET_LEN16(p) (p[0]<<8) + p[1] + + +enum { + CDTEXT_LEN_BINARY_MAX = 9216, + CDTEXT_LEN_TEXTDATA = 12, + CDTEXT_LEN_PACK = 18, + CDTEXT_LEN_BLOCKSIZE = 36, + CDTEXT_NUM_BLOCKS_MAX = 8, + CDTEXT_NUM_TRACKS_MAX = 100, + CDTEXT_NUM_BLOCKPACKS_MAX = 255 +} cdtext_format_enum; + +/** + * From table J.2 - Pack Type Indicator Definitions from + * Working Draft NCITS XXX T10/1364-D Revision 10G. November 12, 2001. + */ +enum { + CDTEXT_PACK_TITLE = 0x80, + CDTEXT_PACK_PERFORMER = 0x81, + CDTEXT_PACK_SONGWRITER = 0x82, + CDTEXT_PACK_COMPOSER = 0x83, + CDTEXT_PACK_ARRANGER = 0x84, + CDTEXT_PACK_MESSAGE = 0x85, + CDTEXT_PACK_DISCID = 0x86, + CDTEXT_PACK_GENRE = 0x87, + CDTEXT_PACK_TOC = 0x88, + CDTEXT_PACK_TOC2 = 0x89, + CDTEXT_PACK_UPC = 0x8E, + CDTEXT_PACK_BLOCKSIZE = 0x8F +} cdtext_packtype_enum; + + +/** CD-Text character encodings */ +enum cdtext_charcode_enum_s { + CDTEXT_CHARCODE_ISO_8859_1 = 0x00, /**< ISO-8859-1 (8 bit), Latin-1 */ + CDTEXT_CHARCODE_ASCII = 0x01, /**< ASCII (7 bit) */ + CDTEXT_CHARCODE_SHIFT_JIS = 0x80 /**< Shift_JIS (double byte), JIS X 0208 Appendix 1 */ +///* The following were proposed but never implemented anywhere. +// * They are mentioned for completeness here +// * CDTEXT_CHARCODE_KOREAN = 0x81, /**< Korean */ +// * CDTEXT_CHARCODE_CHINESE = 0x82, /**< Mandarin Chinese */ +// * CDTEXT_CHARCODE_UNDEFINED = 0xFF, /**< everything else */ +// */ +} cdtext_charcode_enum; + +/** Structure of CD-TEXT data Packs */ +struct cdtext_pack_s +{ + uint8_t type; + uint8_t i_track; + uint8_t seq; + uint8_t char_pos; /* character position */ + uint8_t block; /* block number 0..7 */ + uint8_t db_chars; /* double byte character */ + uint8_t text[CDTEXT_LEN_TEXTDATA]; + uint8_t crc[2]; +}; + + +/** Structure of of block size information packs */ +struct cdtext_blocksize_s +{ + uint8_t charcode; /* character code */ + uint8_t i_first_track; /* first track number */ + uint8_t i_last_track; /* last track number */ + uint8_t copyright; /* 3 CD-TEXT is copyrighted, 0 no copyright on CD-TEXT */ + uint8_t i_packs[16]; /* number of packs of each type + * 0 TITLE; 1 PERFORMER; 2 SONGWRITER; 3 COMPOSER; + * 4 ARRANGER; 5 MESSAGE; 6 DISCID; 7 GENRE; + * 8 TOC; 9 TOC2; 10-12 RESERVED; 13 CLOSED; + * 14 UPC_ISRC; 15 BLOCKSIZE */ + uint8_t lastseq[8]; /* last sequence for block 0..7 */ + uint8_t langcode[8]; /* language code for block 0..7 */ +}; + +typedef struct cdtext_pack_s cdtext_pack_t; +typedef struct cdtext_blocksize_s cdtext_blocksize_t; + +/*! Structure for CD-TEXT of a track. */ +struct cdtext_track_s { + char *field[MAX_CDTEXT_FIELDS]; +}; + +/*! Structure for CD-TEXT of a block. */ +struct cdtext_block_s { + struct cdtext_track_s track[CDTEXT_NUM_TRACKS_MAX]; /**< 0: disc; 1..99: tracks */ + cdtext_genre_t genre_code; /**< genre code of the disc */ + cdtext_lang_t language_code; /**< language of this block */ + bool copyright; /**< CD-TEXT copyright */ +}; + +/*! Structure for CD-TEXT of a disc. + + @see cdtext_init, cdtext_destroy, cdtext_get, and cdtext_set. + */ +struct cdtext_s { + struct cdtext_block_s block[CDTEXT_NUM_BLOCKS_MAX]; /**< CD-TEXT for block 0..7 */ + uint8_t block_i; /**< index of active block */ +}; + +int cdtext_read_pack (cdtext_pack_t *pack, const uint8_t *data); + +/*! + returns enum of field if key is a CD-Text keyword, + returns CDTEXT_FIELD_INVALID otherwise. +*/ +cdtext_field_t cdtext_is_field (const char *field); + +/*! + returns enum of language if lang is a valid language, + returns CDTEXT_LANGUAGE_UNKNOWN otherwise. +*/ +cdtext_lang_t cdtext_is_language (const char *lang); + + +#endif /* __CDIO_CDTEXT_PRIVATE_H__ */ + +/* + * Local variables: + * c-file-style: "gnu" + * tab-width: 8 + * indent-tabs-mode: nil + * End: + */ diff --git a/lib/cdtext/libcdtext.sym b/lib/cdtext/libcdtext.sym new file mode 100644 index 00000000..7cf7a01d --- /dev/null +++ b/lib/cdtext/libcdtext.sym @@ -0,0 +1,13 @@ +cdio_get_cdtext +cdio_get_cdtext_raw +cdtext_destroy +cdtext_field2str +cdtext_genre2str +cdtext_lang2str +cdtext_get +cdtext_get_const +cdtext_get_language +cdtext_init +cdtext_list_languages +cdtext_set +cdtext_select_language diff --git a/libcdtext.pc.in b/libcdtext.pc.in new file mode 100644 index 00000000..ff168b47 --- /dev/null +++ b/libcdtext.pc.in @@ -0,0 +1,12 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ +libiconv=@LTLIBICONV@ + +Name: libcdtext +Description: CD-Text library of libcdio +Version: @PACKAGE_VERSION@ +Requires: libcdio +Libs: -L${libdir} -lcdtext @LTLIBICONV@ -lcdio +Cflags: -I${includedir} From 511ad638b171bbbcc29cf441cc8b933d0a103c07 Mon Sep 17 00:00:00 2001 From: "R. Bernstein" Date: Sun, 18 Mar 2012 12:02:01 -0400 Subject: [PATCH 06/18] More small header changes: * Remove leading underscores in header preprocessor names * Regularize names to include directory parts in the file name * Untabify files * Update copyright and remove unmaintained cvs $Id$ line The justification for removing leading underscores comes from a CERTS Secure Coding recommendation: https://www.securecoding.cert.org/confluence/display/cplusplus/DCL32-CPP.+Do+not+declare+or+define+a+reserved+identifier See also Savannah bug #35745 https://savannah.gnu.org/bugs/?35745 --- include/cdio++/cdio.hpp | 8 +- include/cdio++/cdtext.hpp | 4 +- include/cdio++/device.hpp | 8 +- include/cdio++/devices.hpp | 25 +- include/cdio++/iso9660.hpp | 60 +-- include/cdio/audio.h | 6 +- include/cdio/bytesex.h | 10 +- include/cdio/bytesex_asm.h | 18 +- include/cdio/cd_types.h | 46 +- include/cdio/cdtext.h | 10 +- include/cdio/device.h | 114 ++--- include/cdio/disc.h | 18 +- include/cdio/ds.h | 6 +- include/cdio/dvd.h | 6 +- include/cdio/ecma_167.h | 880 ++++++++++++++++---------------- include/cdio/iso9660.h | 72 ++- include/cdio/logging.h | 10 +- include/cdio/mmc.h | 54 +- include/cdio/mmc_cmds.h | 8 +- include/cdio/mmc_hl_cmds.h | 10 +- include/cdio/mmc_ll_cmds.h | 34 +- include/cdio/mmc_util.h | 8 +- include/cdio/posix.h | 10 +- include/cdio/read.h | 74 ++- include/cdio/rock.h | 22 +- include/cdio/sector.h | 31 +- include/cdio/track.h | 41 +- include/cdio/types.h | 22 +- include/cdio/util.h | 6 +- include/cdio/xa.h | 13 +- lib/driver/_cdio_stdio.h | 10 +- lib/driver/_cdio_stream.h | 6 +- lib/driver/cdio_assert.h | 6 +- lib/driver/cdio_private.h | 72 +-- lib/driver/cdtext_private.h | 9 +- lib/driver/filemode.h | 8 +- lib/driver/generic.h | 21 +- lib/driver/image.h | 35 +- lib/driver/image_common.h | 32 +- lib/driver/mmc/mmc_cmd_helper.h | 42 +- lib/driver/portable.h | 6 +- lib/iso9660/iso9660_private.h | 8 +- lib/udf/udf_fs.h | 10 +- lib/udf/udf_private.h | 6 +- src/getopt.h | 42 +- 45 files changed, 961 insertions(+), 986 deletions(-) diff --git a/include/cdio++/cdio.hpp b/include/cdio++/cdio.hpp index 66abc366..52639a90 100644 --- a/include/cdio++/cdio.hpp +++ b/include/cdio++/cdio.hpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2005, 2006, 2008 Rocky Bernstein + Copyright (C) 2005, 2006, 2008, 2012 Rocky Bernstein 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 @@ -21,8 +21,8 @@ * library. Applications use this for anything regarding libcdio. */ -#ifndef __CDIO_HPP__ -#define __CDIO_HPP__ +#ifndef CDIO_CDIOPP_HPP_ +#define CDIO_CDIOPP_HPP_ #include #include @@ -179,4 +179,4 @@ public: /* Things related to devices. No class or object is needed. */ #include "devices.hpp" -#endif /* __CDIO_HPP__ */ +#endif /* CDIO_CDIOPP_HPP_ */ diff --git a/include/cdio++/cdtext.hpp b/include/cdio++/cdtext.hpp index 263c2ac9..ee553792 100644 --- a/include/cdio++/cdtext.hpp +++ b/include/cdio++/cdtext.hpp @@ -1,7 +1,5 @@ /* - $Id: cdtext.hpp,v 1.2 2008/03/25 15:59:10 karl Exp $ - - Copyright (C) 2005, 2008 Rocky Bernstein + Copyright (C) 2005, 2008, 2012 Rocky Bernstein 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 diff --git a/include/cdio++/device.hpp b/include/cdio++/device.hpp index 324b5600..23509042 100644 --- a/include/cdio++/device.hpp +++ b/include/cdio++/device.hpp @@ -1,7 +1,5 @@ /* - $Id: device.hpp,v 1.7 2008/03/25 15:59:10 karl Exp $ - - Copyright (C) 2005, 2006, 2008 Rocky Bernstein + Copyright (C) 2005, 2006, 2008, 2012 Rocky Bernstein 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 @@ -111,8 +109,8 @@ getDevice () */ void getDriveCap (cdio_drive_read_cap_t &read_cap, - cdio_drive_write_cap_t &write_cap, - cdio_drive_misc_cap_t &misc_cap) + cdio_drive_write_cap_t &write_cap, + cdio_drive_misc_cap_t &misc_cap) { cdio_get_drive_cap(p_cdio, &read_cap, &write_cap, &misc_cap); } diff --git a/include/cdio++/devices.hpp b/include/cdio++/devices.hpp index 884cd8f6..a54e45f1 100644 --- a/include/cdio++/devices.hpp +++ b/include/cdio++/devices.hpp @@ -1,7 +1,5 @@ /* - $Id: devices.hpp,v 1.5 2008/03/25 15:59:10 karl Exp $ - - Copyright (C) 2005, 2006, 2008 Rocky Bernstein + Copyright (C) 2005, 2006, 2008, 2012 Rocky Bernstein 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 @@ -32,7 +30,7 @@ it was DRIVER_UNKNOWN or DRIVER_DEVICE; If this is NULL, we won't report back the driver used. */ -void closeTray (const char *psz_drive, /*in/out*/ driver_id_t &driver_id); +void closeTray(const char *psz_drive, /*in/out*/ driver_id_t &driver_id); /*! Close media tray in CD drive if there is a routine to do so. @@ -40,7 +38,7 @@ void closeTray (const char *psz_drive, /*in/out*/ driver_id_t &driver_id); @param psz_drive the name of CD-ROM to be closed. If omitted or NULL, we'll scan for a suitable CD-ROM. */ -void closeTray (const char *psz_drive=(const char *)NULL); +void closeTray(const char *psz_drive=(const char *)NULL); /*! Get a string decribing driver_id. @@ -48,14 +46,14 @@ void closeTray (const char *psz_drive=(const char *)NULL); @param driver_id the driver you want the description for @return a sring of driver description */ -const char *driverDescribe (driver_id_t driver_id); +const char *driverDescribe(driver_id_t driver_id); /*! Eject media in CD drive if there is a routine to do so. If the CD is ejected, object is destroyed. */ -void ejectMedia (const char *psz_drive); +void ejectMedia(const char *psz_drive); /*! Free device list returned by GetDevices @@ -65,7 +63,7 @@ void ejectMedia (const char *psz_drive); @see GetDevices */ -void freeDeviceList (char * device_list[]); +void freeDeviceList(char * device_list[]); /*! Return a string containing the default CD device if none is specified. @@ -96,7 +94,7 @@ char ** getDevices(driver_id_t driver_id=DRIVER_DEVICE); things up for libcdio as well. */ -char **getDevices (driver_id_t &driver_id); +char **getDevices(driver_id_t &driver_id); /*! Get an array of device names in search_devices that have at least @@ -116,7 +114,7 @@ char **getDevices (driver_id_t &driver_id); was found. */ char ** getDevices(/*in*/ char *ppsz_search_devices[], - cdio_fs_anal_t capabilities, bool b_any=false); + cdio_fs_anal_t capabilities, bool b_any=false); /*! Like GetDevices above but we return the driver we found @@ -125,11 +123,11 @@ char ** getDevices(/*in*/ char *ppsz_search_devices[], and speeds things up for libcdio as well. */ char ** getDevices(/*in*/ char* ppsz_search_devices[], - cdio_fs_anal_t capabilities, /*out*/ driver_id_t &driver_id, - bool b_any=false); + cdio_fs_anal_t capabilities, /*out*/ driver_id_t &driver_id, + bool b_any=false); /*! Return true if we Have driver for driver_id */ -bool haveDriver (driver_id_t driver_id); +bool haveDriver(driver_id_t driver_id); /*! @@ -178,4 +176,3 @@ bool isNero(const char *psz_nrg); if not a TOC file. */ bool isTocFile(const char *psz_toc); - diff --git a/include/cdio++/iso9660.hpp b/include/cdio++/iso9660.hpp index da04455b..ce6df625 100644 --- a/include/cdio++/iso9660.hpp +++ b/include/cdio++/iso9660.hpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2006, 2008, 2011 Rocky Bernstein + Copyright (C) 2006, 2008, 2011, 2012 Rocky Bernstein 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 @@ -21,12 +21,12 @@ * library. Applications use this for anything regarding libcdio. */ -#ifndef __ISO9660_HPP__ -#define __ISO9660_HPP__ +#ifndef CDIO_ISO9660_HPP_ +#define CDIO_ISO9660_HPP_ #include #include -#include // vector class library +#include // vector class library #include #include using namespace std; @@ -126,8 +126,8 @@ public: { free(p_stat); p_stat = (iso9660_stat_t *) - calloc( 1, sizeof(iso9660_stat_t) - + strlen(copy_in.p_stat->filename)+1 ); + calloc( 1, sizeof(iso9660_stat_t) + + strlen(copy_in.p_stat->filename)+1 ); p_stat = copy_in.p_stat; } @@ -181,7 +181,7 @@ public: returned result. */ bool readdir (const char psz_path[], stat_vector_t& stat_vector, - bool b_mode2=false); + bool b_mode2=false); /*! Return file status for path name psz_path. NULL is returned on @@ -202,10 +202,10 @@ public: stat (const char psz_path[], bool b_translate=false, bool b_mode2=false) { if (b_translate) - return new Stat(iso9660_fs_stat_translate (p_cdio, psz_path, - b_mode2)); + return new Stat(iso9660_fs_stat_translate (p_cdio, psz_path, + b_mode2)); else - return new Stat(iso9660_fs_stat (p_cdio, psz_path)); + return new Stat(iso9660_fs_stat (p_cdio, psz_path)); } }; @@ -321,7 +321,7 @@ public: @see open_fuzzy */ bool open(const char *psz_path, - iso_extension_mask_t iso_extension_mask=ISO_EXTENSION_NONE) + iso_extension_mask_t iso_extension_mask=ISO_EXTENSION_NONE) { if (p_iso9660) iso9660_close(p_iso9660); p_iso9660 = iso9660_open_ext(psz_path, iso_extension_mask); @@ -340,9 +340,9 @@ public: @see open */ bool open_fuzzy (const char *psz_path, - iso_extension_mask_t iso_extension_mask - =ISO_EXTENSION_NONE, - uint16_t i_fuzz=20); + iso_extension_mask_t iso_extension_mask + =ISO_EXTENSION_NONE, + uint16_t i_fuzz=20); /*! Read the Primary Volume Descriptor for an ISO 9660 image. A PVD object is returned if read, and NULL if there was an error. @@ -358,8 +358,8 @@ public: @see read_superblock */ bool read_superblock (iso_extension_mask_t iso_extension_mask - =ISO_EXTENSION_NONE, - uint16_t i_fuzz=20); + =ISO_EXTENSION_NONE, + uint16_t i_fuzz=20); /*! Read the Super block of an ISO 9660 image but determine framesize @@ -371,8 +371,8 @@ public: */ bool read_superblock_fuzzy (iso_extension_mask_t iso_extension_mask - =ISO_EXTENSION_NONE, - uint16_t i_fuzz=20); + =ISO_EXTENSION_NONE, + uint16_t i_fuzz=20); /*! Read psz_path (a directory) and return a list of iso9660_stat_t pointers for the files inside that directory. The caller must free @@ -383,16 +383,16 @@ public: CdioList_t *p_stat_list = iso9660_ifs_readdir (p_iso9660, psz_path); if (p_stat_list) { - CdioListNode_t *p_entnode; - _CDIO_LIST_FOREACH (p_entnode, p_stat_list) { - iso9660_stat_t *p_statbuf = - (iso9660_stat_t *) _cdio_list_node_data (p_entnode); - stat_vector.push_back(new ISO9660::Stat(p_statbuf)); - } - _cdio_list_free (p_stat_list, false); - return true; + CdioListNode_t *p_entnode; + _CDIO_LIST_FOREACH (p_entnode, p_stat_list) { + iso9660_stat_t *p_statbuf = + (iso9660_stat_t *) _cdio_list_node_data (p_entnode); + stat_vector.push_back(new ISO9660::Stat(p_statbuf)); + } + _cdio_list_free (p_stat_list, false); + return true; } else { - return false; + return false; } } @@ -412,9 +412,9 @@ public: stat (const char psz_path[], bool b_translate=false) { if (b_translate) - return new Stat(iso9660_ifs_stat_translate (p_iso9660, psz_path)); + return new Stat(iso9660_ifs_stat_translate (p_iso9660, psz_path)); else - return new Stat(iso9660_ifs_stat (p_iso9660, psz_path)); + return new Stat(iso9660_ifs_stat (p_iso9660, psz_path)); } private: @@ -426,4 +426,4 @@ public: typedef vector< ISO9660::Stat *> stat_vector_t; typedef vector ::iterator stat_vector_iterator_t; -#endif /* __ISO9660_HPP__ */ +#endif /* CDIO_ISO9660_HPP_ */ diff --git a/include/cdio/audio.h b/include/cdio/audio.h index e51ba3d2..099a1236 100644 --- a/include/cdio/audio.h +++ b/include/cdio/audio.h @@ -21,8 +21,8 @@ * calls. These control playing of the CD-ROM through its * line-out jack. */ -#ifndef __CDIO_AUDIO_H__ -#define __CDIO_AUDIO_H__ +#ifndef CDIO_AUDIO_H_ +#define CDIO_AUDIO_H_ #include @@ -143,4 +143,4 @@ extern "C" { } #endif /* __cplusplus */ -#endif /* __CDIO_AUDIO_H__ */ +#endif /* CDIO_AUDIO_H_ */ diff --git a/include/cdio/bytesex.h b/include/cdio/bytesex.h index a85b965e..696fbd41 100644 --- a/include/cdio/bytesex.h +++ b/include/cdio/bytesex.h @@ -1,8 +1,6 @@ /* - $Id: bytesex.h,v 1.5 2008/03/25 15:59:08 karl Exp $ - Copyright (C) 2000, 2004 Herbert Valerio Riedel - Copyright (C) 2005, 2008 Rocky Bernstein + Copyright (C) 2005, 2008, 2012 Rocky Bernstein 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 @@ -25,8 +23,8 @@ * use glib.h routines instead. */ -#ifndef __CDIO_BYTESEX_H__ -#define __CDIO_BYTESEX_H__ +#ifndef CDIO_BYTESEX_H_ +#define CDIO_BYTESEX_H_ #include #include /* also defines CDIO_INLINE */ @@ -208,7 +206,7 @@ from_733 (uint64_t p) return (UINT32_C(0xFFFFFFFF) & p); } -#endif /* __CDIO_BYTESEX_H__ */ +#endif /* CDIO_BYTESEX_H_ */ /* diff --git a/include/cdio/bytesex_asm.h b/include/cdio/bytesex_asm.h index 0ee1aaad..d68b677a 100644 --- a/include/cdio/bytesex_asm.h +++ b/include/cdio/bytesex_asm.h @@ -24,8 +24,8 @@ glib.h routines instead. */ -#ifndef __CDIO_BYTESEX_ASM_H__ -#define __CDIO_BYTESEX_ASM_H__ +#ifndef CDIO_BYTESEX_ASM_H_ +#define CDIO_BYTESEX_ASM_H_ #if !defined(DISABLE_ASM_OPTIMIZE) #include @@ -104,10 +104,10 @@ static CDIO_INLINE uint32_t uint32_swap_le_be_asm(uint32_t a) { __asm__("xchgb %b0,%h0\n\t" /* swap lower bytes */ - "rorl $16,%0\n\t" /* swap words */ - "xchgb %b0,%h0" /* swap higher bytes */ - :"=q" (a) - : "0" (a)); + "rorl $16,%0\n\t" /* swap words */ + "xchgb %b0,%h0" /* swap higher bytes */ + :"=q" (a) + : "0" (a)); return(a); } @@ -116,8 +116,8 @@ static CDIO_INLINE uint16_t uint16_swap_le_be_asm(uint16_t a) { __asm__("xchgb %b0,%h0" /* swap bytes */ - : "=q" (a) - : "0" (a)); + : "=q" (a) + : "0" (a)); return(a); } @@ -128,7 +128,7 @@ uint16_t uint16_swap_le_be_asm(uint16_t a) #endif #endif /* !defined(DISABLE_ASM_OPTIMIZE) */ -#endif /* __CDIO_BYTESEX_ASM_H__ */ +#endif /* CDIO_BYTESEX_ASM_H_ */ /* diff --git a/include/cdio/cd_types.h b/include/cdio/cd_types.h index bc1f16c0..7a2ee4e8 100644 --- a/include/cdio/cd_types.h +++ b/include/cdio/cd_types.h @@ -1,7 +1,5 @@ /* - $Id: cd_types.h,v 1.18 2008/03/25 15:59:08 karl Exp $ - - Copyright (C) 2003, 2006, 2008 Rocky Bernstein + Copyright (C) 2003, 2006, 2008, 2012 Rocky Bernstein Copyright (C) 1996,1997,1998 Gerd Knorr and Heiko Eißfeldt @@ -25,8 +23,8 @@ * */ -#ifndef __CDIO_CD_TYPES_H__ -#define __CDIO_CD_TYPES_H__ +#ifndef CDIO_CD_TYPES_H_ +#define CDIO_CD_TYPES_H_ #ifdef __cplusplus extern "C" { @@ -39,13 +37,13 @@ extern "C" { typedef enum { CDIO_FS_AUDIO = 1, /**< audio only - not really a filesystem */ - CDIO_FS_HIGH_SIERRA = 2, /**< High-Sierra Filesystem */ - CDIO_FS_ISO_9660 = 3, /**< ISO 9660 filesystem */ - CDIO_FS_INTERACTIVE = 4, - CDIO_FS_HFS = 5, /**< file system used on the Macintosh + CDIO_FS_HIGH_SIERRA = 2, /**< High-Sierra Filesystem */ + CDIO_FS_ISO_9660 = 3, /**< ISO 9660 filesystem */ + CDIO_FS_INTERACTIVE = 4, + CDIO_FS_HFS = 5, /**< file system used on the Macintosh system in MacOS 6 through MacOS 9 and deprecated in OSX. */ - CDIO_FS_UFS = 6, /**< Generic Unix file system derived + CDIO_FS_UFS = 6, /**< Generic Unix file system derived from the Berkeley fast file system. */ @@ -53,7 +51,7 @@ extern "C" { * EXT2 was the GNU/Linux native filesystem for early kernels. Newer * GNU/Linux OS's may use EXT3 which is EXT2 with a journal. */ - CDIO_FS_EXT2 = 7, + CDIO_FS_EXT2 = 7, CDIO_FS_ISO_HFS = 8, /**< both HFS & ISO-9660 filesystem */ CDIO_FS_ISO_9660_INTERACTIVE = 9, /**< both CD-RTOS and ISO filesystem */ @@ -65,15 +63,15 @@ extern "C" { * which uses a CD-player. Panasonic in the early 90's was the first * company to manufacture and market a 3DO player. */ - CDIO_FS_3DO = 10, + CDIO_FS_3DO = 10, /**< Microsoft X-BOX CD. */ - CDIO_FS_XISO = 11, - CDIO_FS_UDFX = 12, - CDIO_FS_UDF = 13, + CDIO_FS_XISO = 11, + CDIO_FS_UDFX = 12, + CDIO_FS_UDF = 13, CDIO_FS_ISO_UDF = 14 } cdio_fs_t; @@ -89,15 +87,15 @@ extern "C" { * based of the fs type information. This */ typedef enum { - CDIO_FS_MASK = 0x000f, /**< Note: this should be 2**n-1 and + CDIO_FS_MASK = 0x000f, /**< Note: this should be 2**n-1 and and greater than the highest CDIO_FS number above */ - CDIO_FS_ANAL_XA = 0x00010, /**< eXtended Architecture format */ + CDIO_FS_ANAL_XA = 0x00010, /**< eXtended Architecture format */ CDIO_FS_ANAL_MULTISESSION = 0x00020, /**< CD has multisesion */ - CDIO_FS_ANAL_PHOTO_CD = 0x00040, /**< Is a Kodak Photo CD */ + CDIO_FS_ANAL_PHOTO_CD = 0x00040, /**< Is a Kodak Photo CD */ CDIO_FS_ANAL_HIDDEN_TRACK = 0x00080, /**< Hidden track at the beginning of the CD */ - CDIO_FS_ANAL_CDTV = 0x00100, + CDIO_FS_ANAL_CDTV = 0x00100, CDIO_FS_ANAL_BOOTABLE = 0x00200, /**< CD is bootable */ CDIO_FS_ANAL_VIDEOCD = 0x00400, /**< VCD 1.1 */ CDIO_FS_ANAL_ROCKRIDGE = 0x00800, /**< Has Rock Ridge Extensions to @@ -118,7 +116,7 @@ extern "C" { } cdio_fs_cap_t; -#define CDIO_FS_UNKNOWN CDIO_FS_MASK +#define CDIO_FS_UNKNOWN CDIO_FS_MASK /** * @@ -137,7 +135,7 @@ typedef struct unsigned int joliet_level; /**< If has Joliet extensions, this is the associated level number (i.e. 1, 2, or 3). */ char iso_label[33]; /**< This is 32 + 1 for null byte at the end in - formatting the string */ + formatting the string */ unsigned int isofs_size; uint8_t UDFVerMinor; /**< For UDF filesystems only */ uint8_t UDFVerMajor; /**< For UDF filesystems only */ @@ -149,8 +147,8 @@ typedef struct * is returned in iso_analysis and the return value. */ cdio_fs_anal_t cdio_guess_cd_type(const CdIo_t *cdio, int start_session, - track_t track_num, - /*out*/ cdio_iso_analysis_t *iso_analysis); + track_t track_num, + /*out*/ cdio_iso_analysis_t *iso_analysis); #ifdef __cplusplus } @@ -164,7 +162,7 @@ cdio_fs_anal_t cdio_guess_cd_type(const CdIo_t *cdio, int start_session, extern cdio_fs_cap_t debug_cdio_fs_cap; extern cdio_fs_t debug_cdio_fs; -#endif /* __CDIO_CD_TYPES_H__ */ +#endif /* CDIO_CD_TYPES_H_ */ /* * Local variables: diff --git a/include/cdio/cdtext.h b/include/cdio/cdtext.h index 916eebc1..e947473d 100644 --- a/include/cdio/cdtext.h +++ b/include/cdio/cdtext.h @@ -1,7 +1,5 @@ /* - $Id: cdtext.h,v 1.14 2008/03/25 15:59:08 karl Exp $ - - Copyright (C) 2004, 2005, 2008 Rocky Bernstein + Copyright (C) 2004, 2005, 2008, 2012 Rocky Bernstein adapted from cuetools Copyright (C) 2003 Svend Sanjay Sorensen @@ -26,8 +24,8 @@ */ -#ifndef __CDIO_CDTEXT_H__ -#define __CDIO_CDTEXT_H__ +#ifndef CDIO_CDTEXT_H_ +#define CDIO_CDTEXT_H_ #include @@ -305,7 +303,7 @@ void cdtext_set (cdtext_t *p_cdtext, cdtext_field_t key, const uint8_t *value, t } #endif /* __cplusplus */ -#endif /* __CDIO_CDTEXT_H__ */ +#endif /* CDIO_CDTEXT_H_ */ /* * Local variables: diff --git a/include/cdio/device.h b/include/cdio/device.h index 4719d836..97c8a4e0 100644 --- a/include/cdio/device.h +++ b/include/cdio/device.h @@ -23,8 +23,8 @@ * \brief C header for driver- or device-related libcdio * calls. ("device" includes CD-image reading devices). */ -#ifndef __CDIO_DEVICE_H__ -#define __CDIO_DEVICE_H__ +#ifndef CDIO_DEVICE_H_ +#define CDIO_DEVICE_H_ #ifdef __cplusplus extern "C" { @@ -47,13 +47,13 @@ extern "C" { typedef enum { CDIO_DRIVE_CAP_ERROR = 0x40000, /**< Error */ CDIO_DRIVE_CAP_UNKNOWN = 0x80000, /**< Dunno. It can be on if we - have only partial information + have only partial information or are not completely certain - */ + */ CDIO_DRIVE_CAP_MISC_CLOSE_TRAY = 0x00001, /**< caddy systems can't close... */ CDIO_DRIVE_CAP_MISC_EJECT = 0x00002, /**< but can eject. */ - CDIO_DRIVE_CAP_MISC_LOCK = 0x00004, /**< disable manual eject */ + CDIO_DRIVE_CAP_MISC_LOCK = 0x00004, /**< disable manual eject */ CDIO_DRIVE_CAP_MISC_SELECT_SPEED = 0x00008, /**< programmable speed */ CDIO_DRIVE_CAP_MISC_SELECT_DISC = 0x00010, /**< select disc from juke-box */ @@ -61,7 +61,7 @@ extern "C" { CDIO_DRIVE_CAP_MISC_MEDIA_CHANGED= 0x00080, /**< media changed */ CDIO_DRIVE_CAP_MISC_RESET = 0x00100, /**< hard reset device */ CDIO_DRIVE_CAP_MISC_FILE = 0x20000 /**< drive is really a file, - i.e a CD file image */ + i.e a CD file image */ } cdio_drive_cap_misc_t; /** Reading masks.. */ @@ -151,7 +151,7 @@ extern "C" { */ typedef enum { DRIVER_UNKNOWN, /**< Used as input when we don't care what kind - of driver to use. */ + of driver to use. */ DRIVER_AIX, /**< AIX driver */ DRIVER_BSDI, /**< BSDI driver */ DRIVER_FREEBSD, /**< FreeBSD driver - includes CAM and ioctl access */ @@ -161,13 +161,13 @@ extern "C" { DRIVER_OS2, /**< IBM OS/2 Driver */ DRIVER_OSX, /**< Apple OSX Driver */ DRIVER_WIN32, /**< Microsoft Windows Driver. Includes ASPI and - ioctl access. */ + ioctl access. */ DRIVER_CDRDAO, /**< cdrdao format CD image. This is listed - before BIN/CUE, to make the code prefer cdrdao - over BIN/CUE when both exist. */ + before BIN/CUE, to make the code prefer cdrdao + over BIN/CUE when both exist. */ DRIVER_BINCUE, /**< CDRWIN BIN/CUE format CD image. This is - listed before NRG, to make the code prefer - BIN/CUE over NRG when both exist. */ + listed before NRG, to make the code prefer + BIN/CUE over NRG when both exist. */ DRIVER_NRG, /**< Nero NRG format CD image. */ DRIVER_DEVICE /**< Is really a set of the above; should come last */ } driver_id_t; @@ -219,30 +219,30 @@ LIBCDIO_DEPRECATED(static const driver_id_t CDIO_MAX_DEVICE_DRIVER, "please use */ typedef enum { DRIVER_OP_SUCCESS = 0, /**< in cases where an int is - returned, like cdio_set_speed, - more the negative return codes are - for errors and the positive ones - for success. */ + returned, like cdio_set_speed, + more the negative return codes are + for errors and the positive ones + for success. */ DRIVER_OP_ERROR = -1, /**< operation returned an error */ DRIVER_OP_UNSUPPORTED = -2, /**< returned when a particular driver - doesn't support a particular operation. - For example an image driver which doesn't - really "eject" a CD. - */ + doesn't support a particular operation. + For example an image driver which doesn't + really "eject" a CD. + */ DRIVER_OP_UNINIT = -3, /**< returned when a particular driver - hasn't been initialized or a null - pointer has been passed. - */ + hasn't been initialized or a null + pointer has been passed. + */ DRIVER_OP_NOT_PERMITTED = -4, /**< Operation not permitted. - For example might be a permission - problem. - */ + For example might be a permission + problem. + */ DRIVER_OP_BAD_PARAMETER = -5, /**< Bad parameter passed */ DRIVER_OP_BAD_POINTER = -6, /**< Bad pointer to memory area */ DRIVER_OP_NO_DRIVER = -7, /**< Operation called on a driver - not available on this OS */ + not available on this OS */ DRIVER_OP_MMC_SENSE_DATA = -8, /**< MMC operation returned sense data, - but no other error above recorded. */ + but no other error above recorded. */ } driver_return_code_t; /** @@ -255,7 +255,7 @@ LIBCDIO_DEPRECATED(static const driver_id_t CDIO_MAX_DEVICE_DRIVER, "please use report back the driver used. */ driver_return_code_t cdio_close_tray (const char *psz_drive, - /*in/out*/ driver_id_t *p_driver_id); + /*in/out*/ driver_id_t *p_driver_id); /** @param drc the return code you want interpreted. @@ -365,7 +365,7 @@ LIBCDIO_DEPRECATED(static const driver_id_t CDIO_MAX_DEVICE_DRIVER, "please use was found. */ char ** cdio_get_devices_with_cap (/*in*/ char *ppsz_search_devices[], - cdio_fs_anal_t capabilities, bool b_any); + cdio_fs_anal_t capabilities, bool b_any); /** Like cdio_get_devices_with_cap but we return the driver we found @@ -374,9 +374,9 @@ LIBCDIO_DEPRECATED(static const driver_id_t CDIO_MAX_DEVICE_DRIVER, "please use and speeds things up for libcdio as well. */ char ** cdio_get_devices_with_cap_ret (/*in*/ char* ppsz_search_devices[], - cdio_fs_anal_t capabilities, - bool b_any, - /*out*/ driver_id_t *p_driver_id); + cdio_fs_anal_t capabilities, + bool b_any, + /*out*/ driver_id_t *p_driver_id); /** Like cdio_get_devices, but we may change the p_driver_id if we @@ -401,9 +401,9 @@ LIBCDIO_DEPRECATED(static const driver_id_t CDIO_MAX_DEVICE_DRIVER, "please use NULL even though there isa hardware CD-ROM. */ void cdio_get_drive_cap (const CdIo_t *p_cdio, - cdio_drive_read_cap_t *p_read_cap, - cdio_drive_write_cap_t *p_write_cap, - cdio_drive_misc_cap_t *p_misc_cap); + cdio_drive_read_cap_t *p_read_cap, + cdio_drive_write_cap_t *p_write_cap, + cdio_drive_misc_cap_t *p_misc_cap); /** Get the drive capabilities for a specified device. @@ -415,9 +415,9 @@ LIBCDIO_DEPRECATED(static const driver_id_t CDIO_MAX_DEVICE_DRIVER, "please use NULL even though there isa hardware CD-ROM. */ void cdio_get_drive_cap_dev (const char *device, - cdio_drive_read_cap_t *p_read_cap, - cdio_drive_write_cap_t *p_write_cap, - cdio_drive_misc_cap_t *p_misc_cap); + cdio_drive_read_cap_t *p_read_cap, + cdio_drive_write_cap_t *p_write_cap, + cdio_drive_misc_cap_t *p_misc_cap); /** Get a string containing the name of the driver in use. @@ -441,7 +441,7 @@ LIBCDIO_DEPRECATED(static const driver_id_t CDIO_MAX_DEVICE_DRIVER, "please use False is returned if we had an error getting the information. */ bool cdio_get_hwinfo ( const CdIo_t *p_cdio, - /*out*/ cdio_hwinfo_t *p_hw_info ); + /*out*/ cdio_hwinfo_t *p_hw_info ); /** @@ -452,7 +452,7 @@ LIBCDIO_DEPRECATED(static const driver_id_t CDIO_MAX_DEVICE_DRIVER, "please use @param i_last_session pointer to the session number to be returned. */ driver_return_code_t cdio_get_last_session (CdIo_t *p_cdio, - /*out*/ lsn_t *i_last_session); + /*out*/ lsn_t *i_last_session); /** Find out if media has changed since the last call. @@ -508,7 +508,7 @@ LIBCDIO_DEPRECATED(static const driver_id_t CDIO_MAX_DEVICE_DRIVER, "please use @return the cdio object or NULL on error or no device. */ CdIo_t * cdio_open_am (const char *psz_source, - driver_id_t driver_id, const char *psz_access_mode); + driver_id_t driver_id, const char *psz_access_mode); /** Set up BIN/CUE CD disk-image for reading. Source is the .bin or @@ -525,7 +525,7 @@ LIBCDIO_DEPRECATED(static const driver_id_t CDIO_MAX_DEVICE_DRIVER, "please use @return the cdio object or NULL on error or no device.. */ CdIo_t * cdio_open_am_bincue (const char *psz_cue_name, - const char *psz_access_mode); + const char *psz_access_mode); /** Set up cdrdao CD disk-image for reading. Source is the .toc file @@ -540,7 +540,7 @@ LIBCDIO_DEPRECATED(static const driver_id_t CDIO_MAX_DEVICE_DRIVER, "please use @return the cdio object or NULL on error or no device.. */ CdIo_t * cdio_open_am_cdrdao (const char *psz_toc_name, - const char *psz_access_mode); + const char *psz_access_mode); /** Return a string containing the default CUE file that would @@ -578,7 +578,7 @@ LIBCDIO_DEPRECATED(static const driver_id_t CDIO_MAX_DEVICE_DRIVER, "please use NULL on error or there is no driver for a some sort of hardware CD-ROM. */ CdIo_t * cdio_open_am_cd (const char *psz_device, - const char *psz_access_mode); + const char *psz_access_mode); /** CDRWIN BIN/CUE CD disc-image routines. Source is the .cue file @@ -598,7 +598,7 @@ LIBCDIO_DEPRECATED(static const driver_id_t CDIO_MAX_DEVICE_DRIVER, "please use @see cdio_open */ CdIo_t * cdio_open_am_aix (const char *psz_source, - const char *psz_access_mode); + const char *psz_access_mode); /** Set up CD-ROM for reading using the AIX driver. The device_name is @@ -654,7 +654,7 @@ LIBCDIO_DEPRECATED(static const driver_id_t CDIO_MAX_DEVICE_DRIVER, "please use @see cdio_open */ CdIo_t * cdio_open_am_bsdi (const char *psz_source, - const char *psz_access_mode); + const char *psz_access_mode); /** Return a string containing the default device name that the BSDI @@ -696,7 +696,7 @@ LIBCDIO_DEPRECATED(static const driver_id_t CDIO_MAX_DEVICE_DRIVER, "please use @see cdio_open_cd, cdio_open */ CdIo_t * cdio_open_am_freebsd (const char *psz_source, - const char *psz_access_mode); + const char *psz_access_mode); /** Return a string containing the default device name that the @@ -733,7 +733,7 @@ LIBCDIO_DEPRECATED(static const driver_id_t CDIO_MAX_DEVICE_DRIVER, "please use NULL on error or there is no GNU/Linux driver. */ CdIo_t * cdio_open_am_linux (const char *psz_source, - const char *access_mode); + const char *access_mode); /** Return a string containing the default device name that the @@ -773,7 +773,7 @@ LIBCDIO_DEPRECATED(static const driver_id_t CDIO_MAX_DEVICE_DRIVER, "please use NULL on error or there is no Solaris driver. */ CdIo_t * cdio_open_am_solaris (const char *psz_source, - const char *psz_access_mode); + const char *psz_access_mode); /** Return a string containing the default device name that the @@ -819,7 +819,7 @@ LIBCDIO_DEPRECATED(static const driver_id_t CDIO_MAX_DEVICE_DRIVER, "please use @see cdio_open_cd, cdio_open */ CdIo_t * cdio_open_am_osx (const char *psz_source, - const char *psz_access_mode); + const char *psz_access_mode); /** Return a string containing the default device name that the OSX @@ -855,7 +855,7 @@ LIBCDIO_DEPRECATED(static const driver_id_t CDIO_MAX_DEVICE_DRIVER, "please use NULL is returned on error or there is no Microsof Windows driver. */ CdIo_t * cdio_open_am_win32 (const char *psz_source, - const char *psz_access_mode); + const char *psz_access_mode); /** Return a string containing the default device name that the @@ -929,7 +929,7 @@ Return a list of all of the CD-ROM devices that the OS/2 driver @return true on success; NULL on error or there is no Nero driver. */ CdIo_t * cdio_open_am_nrg (const char *psz_source, - const char *psz_access_mode); + const char *psz_access_mode); /** Get a string containing the default device name that the NRG @@ -994,7 +994,7 @@ Return a list of all of the CD-ROM devices that the OS/2 driver Set the blocksize for subsequent reads. */ driver_return_code_t cdio_set_blocksize ( const CdIo_t *p_cdio, - int i_blocksize ); + int i_blocksize ); /** Set the drive speed. @@ -1013,7 +1013,7 @@ Return a list of all of the CD-ROM devices that the OS/2 driver @see mmc_set_speed and mmc_set_drive_speed */ driver_return_code_t cdio_set_speed ( const CdIo_t *p_cdio, - int i_drive_speed ); + int i_drive_speed ); /** Get the value associatied with key. @@ -1033,7 +1033,7 @@ Return a list of all of the CD-ROM devices that the OS/2 driver @param value the value to assocaiate with key */ driver_return_code_t cdio_set_arg (CdIo_t *p_cdio, const char key[], - const char value[]); + const char value[]); /** Initialize CD Reading and control routines. Should be called first. @@ -1055,4 +1055,4 @@ extern cdio_drive_cap_write_t debug_drive_cap_write_t; extern cdio_mmc_hw_len_t debug_cdio_mmc_hw_len; extern cdio_src_category_mask_t debug_cdio_src_category_mask; -#endif /* __CDIO_DEVICE_H__ */ +#endif /* CDIO_DEVICE_H_ */ diff --git a/include/cdio/disc.h b/include/cdio/disc.h index 3e51cb80..f758111c 100644 --- a/include/cdio/disc.h +++ b/include/cdio/disc.h @@ -1,6 +1,6 @@ /* -*- c -*- - Copyright (C) 2004, 2005, 2006, 2008, 2010 Rocky Bernstein + Copyright (C) 2004, 2005, 2006, 2008, 2010, 2012 Rocky Bernstein This program is free software: you can redistribute it and/or modify @@ -21,8 +21,8 @@ \file disc.h \brief The top-level header for disc-related libcdio calls. */ -#ifndef __CDIO_DISC_H__ -#define __CDIO_DISC_H__ +#ifndef CDIO_DISC_H_ +#define CDIO_DISC_H_ #ifdef __cplusplus extern "C" { @@ -34,10 +34,10 @@ extern "C" { GNU/Linux /usr/include/linux/cdrom.h and we've added DVD. */ typedef enum { - CDIO_DISC_MODE_CD_DA, /**< CD-DA */ - CDIO_DISC_MODE_CD_DATA, /**< CD-ROM form 1 */ - CDIO_DISC_MODE_CD_XA, /**< CD-ROM XA form2 */ - CDIO_DISC_MODE_CD_MIXED, /**< Some combo of above. */ + CDIO_DISC_MODE_CD_DA, /**< CD-DA */ + CDIO_DISC_MODE_CD_DATA, /**< CD-ROM form 1 */ + CDIO_DISC_MODE_CD_XA, /**< CD-ROM XA form2 */ + CDIO_DISC_MODE_CD_MIXED, /**< Some combo of above. */ CDIO_DISC_MODE_DVD_ROM, /**< DVD ROM (e.g. movies) */ CDIO_DISC_MODE_DVD_RAM, /**< DVD-RAM */ CDIO_DISC_MODE_DVD_R, /**< DVD-R */ @@ -52,7 +52,7 @@ extern "C" { CDIO_DISC_MODE_DVD_OTHER, /**< Unknown/unclassified DVD type */ CDIO_DISC_MODE_NO_INFO, CDIO_DISC_MODE_ERROR, - CDIO_DISC_MODE_CD_I /**< CD-i. */ + CDIO_DISC_MODE_CD_I /**< CD-i. */ } discmode_t; extern const char *discmode2str[]; @@ -134,4 +134,4 @@ extern "C" { } #endif /* __cplusplus */ -#endif /* __CDIO_DISC_H__ */ +#endif /* CDIO_DISC_H_ */ diff --git a/include/cdio/ds.h b/include/cdio/ds.h index 447e30df..6662c58a 100644 --- a/include/cdio/ds.h +++ b/include/cdio/ds.h @@ -26,8 +26,8 @@ */ -#ifndef __CDIO_DS_H__ -#define __CDIO_DS_H__ +#ifndef CDIO_DS_H_ +#define CDIO_DS_H_ #include @@ -86,7 +86,7 @@ void *_cdio_list_node_data (CdioListNode_t *p_node); } #endif /* __cplusplus */ -#endif /* __CDIO_DS_H__ */ +#endif /* CDIO_DS_H_ */ /* * Local variables: diff --git a/include/cdio/dvd.h b/include/cdio/dvd.h index 8bb83e12..bc337944 100644 --- a/include/cdio/dvd.h +++ b/include/cdio/dvd.h @@ -27,8 +27,8 @@ */ -#ifndef __CDIO_DVD_H__ -#define __CDIO_DVD_H__ +#ifndef CDIO_DVD_H_ +#define CDIO_DVD_H_ #include @@ -124,4 +124,4 @@ typedef union { cdio_dvd_manufact_t manufact; } cdio_dvd_struct_t; -#endif /* __CDIO_DVD_H__ */ +#endif /* CDIO_DVD_H_ */ diff --git a/include/cdio/ecma_167.h b/include/cdio/ecma_167.h index d6cb2c8f..81a12209 100644 --- a/include/cdio/ecma_167.h +++ b/include/cdio/ecma_167.h @@ -49,8 +49,8 @@ * See http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-167.pdf */ -#ifndef _ECMA_167_H -#define _ECMA_167_H 1 +#ifndef CDIO_ECMA_167_H +#define CDIO_ECMA_167_H 1 #include @@ -59,11 +59,11 @@ distinct values of an enum. */ typedef enum { - VSD_STD_ID_SIZE = 5, /** Volume Structure Descriptor (ECMA 167r3 - 2/9.1) */ - UDF_REGID_ID_SIZE = 23, /**< See identifier (ECMA 167r3 1/7.4) */ + VSD_STD_ID_SIZE = 5, /** Volume Structure Descriptor (ECMA 167r3 + 2/9.1) */ + UDF_REGID_ID_SIZE = 23, /**< See identifier (ECMA 167r3 1/7.4) */ UDF_VOLID_SIZE = 32, - UDF_FID_SIZE = 38, + UDF_FID_SIZE = 38, UDF_VOLSET_ID_SIZE = 128 } ecma_167_enum1_t ; @@ -79,38 +79,38 @@ typedef enum { TAGID_UNALLOC_SPACE = 0x0007, TAGID_TERM = 0x0008, TAGID_LOGVOL_INTEGRITY = 0x0009, - TAGID_FSD = 0x0100, - TAGID_FID = 0x0101, - TAGID_AED = 0x0102, - TAGID_IE = 0x0103, - TAGID_TE = 0x0104, - TAGID_FILE_ENTRY = 0x0105, - TAGID_EAHD = 0x0106, - TAGID_USE = 0x0107, - TAGID_SBD = 0x0108, - TAGID_PIE = 0x0109, - TAGID_EFE = 0x010A, + TAGID_FSD = 0x0100, + TAGID_FID = 0x0101, + TAGID_AED = 0x0102, + TAGID_IE = 0x0103, + TAGID_TE = 0x0104, + TAGID_FILE_ENTRY = 0x0105, + TAGID_EAHD = 0x0106, + TAGID_USE = 0x0107, + TAGID_SBD = 0x0108, + TAGID_PIE = 0x0109, + TAGID_EFE = 0x010A, } tag_id_t ; /** Character Set Type (ECMA 167r3 1/7.2.1.1) */ typedef enum { - CHARSPEC_TYPE_CS0 = 0x00, /**< Section 1/7.2.2 */ - CHARSPEC_TYPE_CS1 = 0x01, /**< Section 1/7.2.3 */ - CHARSPEC_TYPE_CS2 = 0x02, /**< Section 1/7.2.4 */ - CHARSPEC_TYPE_CS3 = 0x03, /**< Section 1/7.2.5 */ - CHARSPEC_TYPE_CS4 = 0x04, /**< Section 1/7.2.6 */ - CHARSPEC_TYPE_CS5 = 0x05, /**< Section 1/7.2.7 */ - CHARSPEC_TYPE_CS6 = 0x06, /**< Section 1/7.2.8 */ - CHARSPEC_TYPE_CS7 = 0x07, /**< Section 1/7.2.9 */ + CHARSPEC_TYPE_CS0 = 0x00, /**< Section 1/7.2.2 */ + CHARSPEC_TYPE_CS1 = 0x01, /**< Section 1/7.2.3 */ + CHARSPEC_TYPE_CS2 = 0x02, /**< Section 1/7.2.4 */ + CHARSPEC_TYPE_CS3 = 0x03, /**< Section 1/7.2.5 */ + CHARSPEC_TYPE_CS4 = 0x04, /**< Section 1/7.2.6 */ + CHARSPEC_TYPE_CS5 = 0x05, /**< Section 1/7.2.7 */ + CHARSPEC_TYPE_CS6 = 0x06, /**< Section 1/7.2.8 */ + CHARSPEC_TYPE_CS7 = 0x07, /**< Section 1/7.2.9 */ - CHARSPEC_TYPE_CS8 = 0x08, /**< Section 1/7.2.10 */ + CHARSPEC_TYPE_CS8 = 0x08, /**< Section 1/7.2.10 */ } udf_charspec_enum_t; typedef uint8_t udf_Uint8_t; /*! Section 1/7/1.1 */ typedef uint16_t udf_Uint16_t; /*! Section 1/7.1.3 */ typedef uint32_t udf_Uint32_t; /*! Section 1/7.1.5 */ typedef uint64_t udf_Uint64_t; /*! Section 1/7.1.7 */ -typedef char udf_dstring; /*! Section 1/7.1.12 */ +typedef char udf_dstring; /*! Section 1/7.1.12 */ #define UDF_LENGTH_MASK 0x3fffffff @@ -119,8 +119,8 @@ PRAGMA_BEGIN_PACKED /** Character set specification (ECMA 167r3 1/7.2.1) */ struct udf_charspec_s { - udf_Uint8_t charset_type; - udf_Uint8_t charset_info[63]; + udf_Uint8_t charset_type; + udf_Uint8_t charset_info[63]; } GNUC_PACKED; typedef struct udf_charspec_s udf_charspec_t; @@ -128,16 +128,16 @@ typedef struct udf_charspec_s udf_charspec_t; /** Timestamp (ECMA 167r3 1/7.3) */ struct udf_timestamp_s { - udf_Uint16_t type_tz; - udf_Uint16_t year; - udf_Uint8_t month; - udf_Uint8_t day; - udf_Uint8_t hour; - udf_Uint8_t minute; - udf_Uint8_t second; - udf_Uint8_t centiseconds; - udf_Uint8_t hundreds_of_microseconds; - udf_Uint8_t microseconds; + udf_Uint16_t type_tz; + udf_Uint16_t year; + udf_Uint8_t month; + udf_Uint8_t day; + udf_Uint8_t hour; + udf_Uint8_t minute; + udf_Uint8_t second; + udf_Uint8_t centiseconds; + udf_Uint8_t hundreds_of_microseconds; + udf_Uint8_t microseconds; } GNUC_PACKED; typedef struct udf_timestamp_s udf_timestamp_t; @@ -148,19 +148,19 @@ typedef struct udf_timestamp_s udf_timestamp_t; distinct values of an enum. */ typedef enum { - TIMESTAMP_TYPE_CUT = 0x0000, - TIMESTAMP_TYPE_LOCAL = 0x1000, - TIMESTAMP_TYPE_AGREEMENT = 0x2000, + TIMESTAMP_TYPE_CUT = 0x0000, + TIMESTAMP_TYPE_LOCAL = 0x1000, + TIMESTAMP_TYPE_AGREEMENT = 0x2000, TIMESTAMP_TYPE_MASK = 0xF000, - TIMESTAMP_TIMEZONE_MASK = 0x0FFF, + TIMESTAMP_TIMEZONE_MASK = 0x0FFF, } ecma_167_timezone_enum_t ; -#define TIMESTAMP_TYPE_MASK 0xF000 -#define TIMESTAMP_TYPE_CUT 0x0000 -#define TIMESTAMP_TYPE_LOCAL 0x1000 -#define TIMESTAMP_TYPE_AGREEMENT 0x2000 -#define TIMESTAMP_TIMEZONE_MASK 0x0FFF +#define TIMESTAMP_TYPE_MASK 0xF000 +#define TIMESTAMP_TYPE_CUT 0x0000 +#define TIMESTAMP_TYPE_LOCAL 0x1000 +#define TIMESTAMP_TYPE_AGREEMENT 0x2000 +#define TIMESTAMP_TIMEZONE_MASK 0x0FFF struct udf_id_suffix_s { @@ -175,28 +175,28 @@ typedef struct udf_id_suffix_s udf_id_suffix_t; /** Entity identifier (ECMA 167r3 1/7.4) */ struct udf_regid_s { - udf_Uint8_t flags; - udf_Uint8_t id[UDF_REGID_ID_SIZE]; - udf_id_suffix_t id_suffix; + udf_Uint8_t flags; + udf_Uint8_t id[UDF_REGID_ID_SIZE]; + udf_id_suffix_t id_suffix; } GNUC_PACKED; typedef struct udf_regid_s udf_regid_t; /** Flags (ECMA 167r3 1/7.4.1) */ -#define ENTITYID_FLAGS_DIRTY 0x00 -#define ENTITYID_FLAGS_PROTECTED 0x01 +#define ENTITYID_FLAGS_DIRTY 0x00 +#define ENTITYID_FLAGS_PROTECTED 0x01 /** Volume Structure Descriptor (ECMA 167r3 2/9.1) */ struct vol_struct_desc_s { - udf_Uint8_t struct_type; - udf_Uint8_t std_id[VSD_STD_ID_SIZE]; - udf_Uint8_t struct_version; - udf_Uint8_t struct_data[2041]; + udf_Uint8_t struct_type; + udf_Uint8_t std_id[VSD_STD_ID_SIZE]; + udf_Uint8_t struct_version; + udf_Uint8_t struct_data[2041]; } GNUC_PACKED; /** Standard Identifier (EMCA 167r2 2/9.1.2) */ -#define VSD_STD_ID_NSR02 "NSR02" /* (3/9.1) */ +#define VSD_STD_ID_NSR02 "NSR02" /* (3/9.1) */ /** Standard Identifier (ECMA 167r3 2/9.1.2) */ @@ -209,60 +209,60 @@ extern const char VSD_STD_ID_CDW01[sizeof("CDW02")-1]; extern const char VSD_STD_ID_NSR03[sizeof("NSR03")-1]; extern const char VSD_STD_ID_TEA01[sizeof("TEA01")-1]; -#define VSD_STD_ID_BEA01 "BEA01" /**< ECMA-167 2/9.2 */ -#define VSD_STD_ID_BOOT2 "BOOT2" /**< ECMA-167 2/9.4 */ -#define VSD_STD_ID_CD001 "CD001" /**< ECMA-119 */ -#define VSD_STD_ID_CDW02 "CDW02" /**< ECMA-168 */ +#define VSD_STD_ID_BEA01 "BEA01" /**< ECMA-167 2/9.2 */ +#define VSD_STD_ID_BOOT2 "BOOT2" /**< ECMA-167 2/9.4 */ +#define VSD_STD_ID_CD001 "CD001" /**< ECMA-119 */ +#define VSD_STD_ID_CDW02 "CDW02" /**< ECMA-168 */ #define VSD_STD_ID_NSR02 "NSR02" /**< ECMA-167, 3/9.1 - NOTE: ECMA-167, 2nd edition */ -#define VSD_STD_ID_NSR03 "NSR03" /**< ECMA-167 3/9.1 */ -#define VSD_STD_ID_TEA01 "TEA01" /**< ECMA-168 2/9.3 */ + NOTE: ECMA-167, 2nd edition */ +#define VSD_STD_ID_NSR03 "NSR03" /**< ECMA-167 3/9.1 */ +#define VSD_STD_ID_TEA01 "TEA01" /**< ECMA-168 2/9.3 */ /** Beginning Extended Area Descriptor (ECMA 167r3 2/9.2) */ struct beginning_extended_area_desc_s { - udf_Uint8_t struct_type; - udf_Uint8_t std_id[VSD_STD_ID_SIZE]; - udf_Uint8_t struct_version; - udf_Uint8_t struct_data[2041]; + udf_Uint8_t struct_type; + udf_Uint8_t std_id[VSD_STD_ID_SIZE]; + udf_Uint8_t struct_version; + udf_Uint8_t struct_data[2041]; } GNUC_PACKED; /** Terminating Extended Area Descriptor (ECMA 167r3 2/9.3) */ struct terminating_extended_area_desc_s { - udf_Uint8_t struct_type; - udf_Uint8_t std_id[VSD_STD_ID_SIZE]; - udf_Uint8_t struct_version; - udf_Uint8_t struct_data[2041]; + udf_Uint8_t struct_type; + udf_Uint8_t std_id[VSD_STD_ID_SIZE]; + udf_Uint8_t struct_version; + udf_Uint8_t struct_data[2041]; } GNUC_PACKED; /** Boot Descriptor (ECMA 167r3 2/9.4) */ struct boot_desc_s { - udf_Uint8_t struct_type; - udf_Uint8_t std_ident[VSD_STD_ID_SIZE]; - udf_Uint8_t struct_version; - udf_Uint8_t reserved1; - udf_regid_t arch_type; - udf_regid_t boot_ident; - udf_Uint32_t bool_ext_location; - udf_Uint32_t bool_ext_length; - udf_Uint64_t load_address; - udf_Uint64_t start_address; - udf_timestamp_t desc_creation_time; - udf_Uint16_t flags; - udf_Uint8_t reserved2[32]; - udf_Uint8_t boot_use[1906]; + udf_Uint8_t struct_type; + udf_Uint8_t std_ident[VSD_STD_ID_SIZE]; + udf_Uint8_t struct_version; + udf_Uint8_t reserved1; + udf_regid_t arch_type; + udf_regid_t boot_ident; + udf_Uint32_t bool_ext_location; + udf_Uint32_t bool_ext_length; + udf_Uint64_t load_address; + udf_Uint64_t start_address; + udf_timestamp_t desc_creation_time; + udf_Uint16_t flags; + udf_Uint8_t reserved2[32]; + udf_Uint8_t boot_use[1906]; } GNUC_PACKED; /** Flags (ECMA 167r3 2/9.4.12) */ -#define BOOT_FLAGS_ERASE 0x01 +#define BOOT_FLAGS_ERASE 0x01 /** Extent Descriptor (ECMA 167r3 3/7.1) */ struct udf_extent_ad_s { - udf_Uint32_t len; - udf_Uint32_t loc; + udf_Uint32_t len; + udf_Uint32_t loc; } GNUC_PACKED; typedef struct udf_extent_ad_s udf_extent_ad_t; @@ -270,14 +270,14 @@ typedef struct udf_extent_ad_s udf_extent_ad_t; /** Descriptor Tag (ECMA 167r3 3/7.2) */ struct udf_tag_s { - udf_Uint16_t id; - udf_Uint16_t desc_version; - udf_Uint8_t cksum; - udf_Uint8_t reserved; - udf_Uint16_t i_serial; - udf_Uint16_t desc_CRC; - udf_Uint16_t desc_CRC_len; - udf_Uint32_t loc; + udf_Uint16_t id; + udf_Uint16_t desc_version; + udf_Uint8_t cksum; + udf_Uint8_t reserved; + udf_Uint16_t i_serial; + udf_Uint16_t desc_CRC; + udf_Uint16_t desc_CRC_len; + udf_Uint32_t loc; } GNUC_PACKED; typedef struct udf_tag_s udf_tag_t; @@ -285,52 +285,52 @@ typedef struct udf_tag_s udf_tag_t; /** NSR Descriptor (ECMA 167r3 3/9.1) */ struct NSR_desc_s { - udf_Uint8_t struct_type; - udf_Uint8_t std_id[VSD_STD_ID_SIZE]; - udf_Uint8_t struct_version; - udf_Uint8_t reserved; - udf_Uint8_t struct_data[2040]; + udf_Uint8_t struct_type; + udf_Uint8_t std_id[VSD_STD_ID_SIZE]; + udf_Uint8_t struct_version; + udf_Uint8_t reserved; + udf_Uint8_t struct_data[2040]; } GNUC_PACKED; /** Primary Volume Descriptor (ECMA 167r3 3/10.1) */ struct udf_pvd_s { - udf_tag_t tag; - udf_Uint32_t vol_desc_seq_num; - udf_Uint32_t primary_vol_desc_num; - udf_dstring vol_ident[UDF_VOLID_SIZE]; - udf_Uint16_t vol_seq_num; - udf_Uint16_t max_vol_seqnum; - udf_Uint16_t interchange_lvl; - udf_Uint16_t max_interchange_lvl; - udf_Uint32_t charset_list; - udf_Uint32_t max_charset_list; - udf_dstring volset_id[UDF_VOLSET_ID_SIZE]; + udf_tag_t tag; + udf_Uint32_t vol_desc_seq_num; + udf_Uint32_t primary_vol_desc_num; + udf_dstring vol_ident[UDF_VOLID_SIZE]; + udf_Uint16_t vol_seq_num; + udf_Uint16_t max_vol_seqnum; + udf_Uint16_t interchange_lvl; + udf_Uint16_t max_interchange_lvl; + udf_Uint32_t charset_list; + udf_Uint32_t max_charset_list; + udf_dstring volset_id[UDF_VOLSET_ID_SIZE]; udf_charspec_t desc_charset; udf_charspec_t explanatory_charset; udf_extent_ad_t vol_abstract; udf_extent_ad_t vol_copyright; - udf_regid_t app_ident; + udf_regid_t app_ident; udf_timestamp_t recording_time; - udf_regid_t imp_ident; - udf_Uint8_t imp_use[64]; - udf_Uint32_t predecessor_vol_desc_seq_location; - udf_Uint16_t flags; - udf_Uint8_t reserved[22]; + udf_regid_t imp_ident; + udf_Uint8_t imp_use[64]; + udf_Uint32_t predecessor_vol_desc_seq_location; + udf_Uint16_t flags; + udf_Uint8_t reserved[22]; } GNUC_PACKED; typedef struct udf_pvd_s udf_pvd_t; /** Flags (ECMA 167r3 3/10.1.21) */ -#define PVD_FLAGS_VSID_COMMON 0x0001 +#define PVD_FLAGS_VSID_COMMON 0x0001 /** Anchor Volume Descriptor Pointer (ECMA 167r3 3/10.2) */ struct anchor_vol_desc_ptr_s { - udf_tag_t tag; + udf_tag_t tag; udf_extent_ad_t main_vol_desc_seq_ext; udf_extent_ad_t reserve_vol_desc_seq_ext; - udf_Uint8_t reserved[480]; + udf_Uint8_t reserved[480]; } GNUC_PACKED; typedef struct anchor_vol_desc_ptr_s anchor_vol_desc_ptr_t; @@ -338,10 +338,10 @@ typedef struct anchor_vol_desc_ptr_s anchor_vol_desc_ptr_t; /** Volume Descriptor Pointer (ECMA 167r3 3/10.3) */ struct vol_desc_ptr_s { - udf_tag_t tag; - udf_Uint32_t vol_desc_seq_num; + udf_tag_t tag; + udf_Uint32_t vol_desc_seq_num; udf_extent_ad_t next_vol_desc_set_ext; - udf_Uint8_t reserved[484]; + udf_Uint8_t reserved[484]; } GNUC_PACKED; /** Implementation Use Volume Descriptor (ECMA 167r3 3/10.4) */ @@ -357,45 +357,45 @@ struct imp_use_vol_desc_s struct partition_desc_s { udf_tag_t tag; - udf_Uint32_t vol_desc_seq_num; - udf_Uint16_t flags; - udf_Uint16_t number; /**< Partition number */ - udf_regid_t contents; - udf_Uint8_t contents_use[128]; - udf_Uint32_t access_type; - udf_Uint32_t start_loc; - udf_Uint32_t part_len; - udf_regid_t imp_id; - udf_Uint8_t imp_use[128]; - udf_Uint8_t reserved[156]; + udf_Uint32_t vol_desc_seq_num; + udf_Uint16_t flags; + udf_Uint16_t number; /**< Partition number */ + udf_regid_t contents; + udf_Uint8_t contents_use[128]; + udf_Uint32_t access_type; + udf_Uint32_t start_loc; + udf_Uint32_t part_len; + udf_regid_t imp_id; + udf_Uint8_t imp_use[128]; + udf_Uint8_t reserved[156]; } GNUC_PACKED; typedef struct partition_desc_s partition_desc_t; /** Partition Flags (ECMA 167r3 3/10.5.3) */ -#define PD_PARTITION_FLAGS_ALLOC 0x0001 +#define PD_PARTITION_FLAGS_ALLOC 0x0001 /** Partition Contents (ECMA 167r2 3/10.5.3) */ -#define PD_PARTITION_CONTENTS_NSR02 "+NSR02" +#define PD_PARTITION_CONTENTS_NSR02 "+NSR02" /** Partition Contents (ECMA 167r3 3/10.5.5) */ -#define PD_PARTITION_CONTENTS_FDC01 "+FDC01" -#define PD_PARTITION_CONTENTS_CD001 "+CD001" -#define PD_PARTITION_CONTENTS_CDW02 "+CDW02" -#define PD_PARTITION_CONTENTS_NSR03 "+NSR03" +#define PD_PARTITION_CONTENTS_FDC01 "+FDC01" +#define PD_PARTITION_CONTENTS_CD001 "+CD001" +#define PD_PARTITION_CONTENTS_CDW02 "+CDW02" +#define PD_PARTITION_CONTENTS_NSR03 "+NSR03" /** Access Type (ECMA 167r3 3/10.5.7) */ -#define PD_ACCESS_TYPE_NONE 0x00000000 -#define PD_ACCESS_TYPE_READ_ONLY 0x00000001 -#define PD_ACCESS_TYPE_WRITE_ONCE 0x00000002 -#define PD_ACCESS_TYPE_REWRITABLE 0x00000003 -#define PD_ACCESS_TYPE_OVERWRITABLE 0x00000004 +#define PD_ACCESS_TYPE_NONE 0x00000000 +#define PD_ACCESS_TYPE_READ_ONLY 0x00000001 +#define PD_ACCESS_TYPE_WRITE_ONCE 0x00000002 +#define PD_ACCESS_TYPE_REWRITABLE 0x00000003 +#define PD_ACCESS_TYPE_OVERWRITABLE 0x00000004 /** Recorded Address (ECMA 167r3 4/7.1) */ struct udf_lb_addr_s { - udf_Uint32_t lba; - udf_Uint16_t partitionReferenceNum; + udf_Uint32_t lba; + udf_Uint16_t partitionReferenceNum; } GNUC_PACKED; typedef struct udf_lb_addr_s udf_lb_addr_t; @@ -403,8 +403,8 @@ typedef struct udf_lb_addr_s udf_lb_addr_t; /** Short Allocation Descriptor (ECMA 167r3 4/14.14.1) */ struct udf_short_ad_s { - udf_Uint32_t len; - udf_Uint32_t pos; + udf_Uint32_t len; + udf_Uint32_t pos; } GNUC_PACKED; typedef struct udf_short_ad_s udf_short_ad_t; @@ -412,9 +412,9 @@ typedef struct udf_short_ad_s udf_short_ad_t; /** Long Allocation Descriptor (ECMA 167r3 4/14.14.2) */ struct udf_long_ad_s { - udf_Uint32_t len; - udf_lb_addr_t loc; - udf_Uint8_t imp_use[6]; + udf_Uint32_t len; + udf_lb_addr_t loc; + udf_Uint8_t imp_use[6]; } GNUC_PACKED; typedef struct udf_long_ad_s udf_long_ad_t; @@ -423,22 +423,22 @@ typedef struct udf_long_ad_s udf_long_ad_t; struct logical_vol_desc_s { udf_tag_t tag; - udf_Uint32_t seq_num; + udf_Uint32_t seq_num; udf_charspec_t desc_charset; - udf_dstring logvol_id[128]; - udf_Uint32_t logical_blocksize; - udf_regid_t domain_id; + udf_dstring logvol_id[128]; + udf_Uint32_t logical_blocksize; + udf_regid_t domain_id; union { udf_long_ad_t fsd_loc; - udf_Uint8_t logvol_content_use[16]; + udf_Uint8_t logvol_content_use[16]; } lvd_use; - udf_Uint8_t logvol_contents_use[16]; - udf_Uint32_t maptable_len; - udf_Uint32_t i_partition_maps; - udf_regid_t imp_id; - udf_Uint8_t imp_use[128]; + udf_Uint8_t logvol_contents_use[16]; + udf_Uint32_t maptable_len; + udf_Uint32_t i_partition_maps; + udf_regid_t imp_id; + udf_Uint8_t imp_use[128]; udf_extent_ad_t integrity_seq_ext; - udf_Uint8_t partition_maps[0]; + udf_Uint8_t partition_maps[0]; } GNUC_PACKED; typedef struct logical_vol_desc_s logical_vol_desc_t; @@ -446,39 +446,39 @@ typedef struct logical_vol_desc_s logical_vol_desc_t; /** Generic Partition Map (ECMA 167r3 3/10.7.1) */ struct generic_partition_map { - udf_Uint8_t partition_map_type; - udf_Uint8_t partition_map_length; - udf_Uint8_t partition_mapping[0]; + udf_Uint8_t partition_map_type; + udf_Uint8_t partition_map_length; + udf_Uint8_t partition_mapping[0]; } GNUC_PACKED; /** Partition Map Type (ECMA 167r3 3/10.7.1.1) */ -#define GP_PARTITION_MAP_TYPE_UNDEF 0x00 -#define GP_PARTIITON_MAP_TYPE_1 0x01 -#define GP_PARTITION_MAP_TYPE_2 0x02 +#define GP_PARTITION_MAP_TYPE_UNDEF 0x00 +#define GP_PARTIITON_MAP_TYPE_1 0x01 +#define GP_PARTITION_MAP_TYPE_2 0x02 /** Type 1 Partition Map (ECMA 167r3 3/10.7.2) */ struct generic_partition_map1 { - udf_Uint8_t partition_map_type; - udf_Uint8_t partition_map_length; - udf_Uint16_t vol_seq_num; - udf_Uint16_t i_partition; + udf_Uint8_t partition_map_type; + udf_Uint8_t partition_map_length; + udf_Uint16_t vol_seq_num; + udf_Uint16_t i_partition; } GNUC_PACKED; /** Type 2 Partition Map (ECMA 167r3 3/10.7.3) */ struct generic_partition_map2 { - udf_Uint8_t partition_map_type; - udf_Uint8_t partition_map_length; - udf_Uint8_t partition_id[62]; + udf_Uint8_t partition_map_type; + udf_Uint8_t partition_map_length; + udf_Uint8_t partition_id[62]; } GNUC_PACKED; /** Unallocated Space Descriptor (ECMA 167r3 3/10.8) */ struct unalloc_space_desc_s { udf_tag_t tag; - udf_Uint32_t vol_desc_seq_num; - udf_Uint32_t i_alloc_descs; + udf_Uint32_t vol_desc_seq_num; + udf_Uint32_t i_alloc_descs; udf_extent_ad_t allocDescs[0]; } GNUC_PACKED; @@ -486,7 +486,7 @@ struct unalloc_space_desc_s struct terminating_desc_s { udf_tag_t tag; - udf_Uint8_t reserved[496]; + udf_Uint8_t reserved[496]; } GNUC_PACKED; /** Logical Volume Integrity Descriptor (ECMA 167r3 3/10.10) */ @@ -516,16 +516,16 @@ struct logvol_integrity_desc_s } GNUC_PACKED; /** Integrity Type (ECMA 167r3 3/10.10.3) */ -#define LVID_INTEGRITY_TYPE_OPEN 0x00000000 -#define LVID_INTEGRITY_TYPE_CLOSE 0x00000001 +#define LVID_INTEGRITY_TYPE_OPEN 0x00000000 +#define LVID_INTEGRITY_TYPE_CLOSE 0x00000001 /** Extended Allocation Descriptor (ECMA 167r3 4/14.14.3) */ struct udf_ext_ad_s { - udf_Uint32_t len; - udf_Uint32_t recorded_len; - udf_Uint32_t information_len; - udf_lb_addr_t ext_loc; + udf_Uint32_t len; + udf_Uint32_t recorded_len; + udf_Uint32_t information_len; + udf_lb_addr_t ext_loc; } GNUC_PACKED; typedef struct udf_ext_ad_s udf_ext_ad_t; @@ -539,23 +539,23 @@ struct udf_fsd_s { udf_tag_t tag; udf_timestamp_t recording_time; - udf_Uint16_t interchange_lvl; - udf_Uint16_t maxInterchange_lvl; - udf_Uint32_t charset_list; - udf_Uint32_t max_charset_list; - udf_Uint32_t fileset_num; - udf_Uint32_t udf_fsd_num; + udf_Uint16_t interchange_lvl; + udf_Uint16_t maxInterchange_lvl; + udf_Uint32_t charset_list; + udf_Uint32_t max_charset_list; + udf_Uint32_t fileset_num; + udf_Uint32_t udf_fsd_num; udf_charspec_t logical_vol_id_charset; - udf_dstring logical_vol_id[128]; + udf_dstring logical_vol_id[128]; udf_charspec_t fileset_charset; - udf_dstring fileSet_id[32]; - udf_dstring copyright_file_id[32]; - udf_dstring abstract_file_id[32]; - udf_long_ad_t root_icb; - udf_regid_t domain_id; - udf_long_ad_t next_ext; - udf_long_ad_t stream_directory_ICB; - udf_Uint8_t reserved[32]; + udf_dstring fileSet_id[32]; + udf_dstring copyright_file_id[32]; + udf_dstring abstract_file_id[32]; + udf_long_ad_t root_icb; + udf_regid_t domain_id; + udf_long_ad_t next_ext; + udf_long_ad_t stream_directory_ICB; + udf_Uint8_t reserved[32]; } GNUC_PACKED; typedef struct udf_fsd_s udf_fsd_t; @@ -568,7 +568,7 @@ struct partition_header_desc_s udf_short_ad_t partition_integrity_table; udf_short_ad_t freed_space_table; udf_short_ad_t freed_space_bitmap; - udf_Uint8_t reserved[88]; + udf_Uint8_t reserved[88]; } GNUC_PACKED; typedef struct partition_header_desc_s partition_header_desc_t; @@ -577,28 +577,28 @@ typedef struct partition_header_desc_s partition_header_desc_t; struct udf_fileid_desc_s { udf_tag_t tag; - udf_Uint16_t file_version_num; - udf_Uint8_t file_characteristics; - udf_Uint8_t i_file_id; - udf_long_ad_t icb; + udf_Uint16_t file_version_num; + udf_Uint8_t file_characteristics; + udf_Uint8_t i_file_id; + udf_long_ad_t icb; /* MSVC workaround for multiple zero sized arrays Unlike what is the case with GNU, and against logic, an union of zero sized arrays in the Microsoft world is not zero bytes but one byte! Thus, for sizeof() to be consistent across platforms, we must use an ugly workaround that attaches the union to the last non-zero member. */ union { - udf_Uint16_t i_imp_use; + udf_Uint16_t i_imp_use; struct { - udf_Uint16_t unused; - udf_Uint8_t data[0]; + udf_Uint16_t unused; + udf_Uint8_t data[0]; } imp_use; struct { - udf_Uint16_t unused; - udf_Uint8_t data[0]; + udf_Uint16_t unused; + udf_Uint8_t data[0]; } file_id; struct { - udf_Uint16_t unused; - udf_Uint8_t data[0]; + udf_Uint16_t unused; + udf_Uint8_t data[0]; } padding; } u; } GNUC_PACKED; @@ -611,11 +611,11 @@ typedef struct udf_fileid_desc_s udf_fileid_desc_t; bitmask rather than distinct values of an enum. */ typedef enum { - UDF_FILE_HIDDEN = (1 << 0), - UDF_FILE_DIRECTORY = (1 << 1), - UDF_FILE_DELETED = (1 << 2), - UDF_FILE_PARENT = (1 << 3), - UDF_FILE_METADATA = (1 << 4) + UDF_FILE_HIDDEN = (1 << 0), + UDF_FILE_DIRECTORY = (1 << 1), + UDF_FILE_DELETED = (1 << 2), + UDF_FILE_PARENT = (1 << 3), + UDF_FILE_METADATA = (1 << 4) } file_characteristics_t; /** Allocation Ext Descriptor (ECMA 167r3 4/14.5) */ @@ -629,32 +629,32 @@ struct allocExtDesc /** ICB Tag (ECMA 167r3 4/14.6) */ struct udf_icbtag_s { - udf_Uint32_t prev_num_dirs; - udf_Uint16_t strat_type; - udf_Uint16_t strat_param; - udf_Uint16_t max_num_entries; - udf_Uint8_t reserved; - udf_Uint8_t file_type; - udf_lb_addr_t parent_ICB; - udf_Uint16_t flags; + udf_Uint32_t prev_num_dirs; + udf_Uint16_t strat_type; + udf_Uint16_t strat_param; + udf_Uint16_t max_num_entries; + udf_Uint8_t reserved; + udf_Uint8_t file_type; + udf_lb_addr_t parent_ICB; + udf_Uint16_t flags; } GNUC_PACKED; typedef struct udf_icbtag_s udf_icbtag_t; -#define UDF_ICB_TAG_FLAGS_SETUID 0x40 -#define UDF_ICB_TAG_FLAGS_SETGID 0x80 -#define UDF_ICB_TAG_FLAGS_STICKY 0x100 +#define UDF_ICB_TAG_FLAGS_SETUID 0x40 +#define UDF_ICB_TAG_FLAGS_SETGID 0x80 +#define UDF_ICB_TAG_FLAGS_STICKY 0x100 /** Strategy Type (ECMA 167r3 4/14.6.2) which helpfully points largely to 4/A.x */ #define ICBTAG_STRATEGY_TYPE_UNDEF 0x0000 -#define ICBTAG_STRATEGY_TYPE_1 0x0001 /**< 4/A.2 Direct entries Uint16 */ -#define ICBTAG_STRATEGY_TYPE_2 0x0002 /**< 4/A.3 List of ICB direct entries */ -#define ICBTAG_STRATEGY_TYPE_3 0x0003 /**< 4/A.4 */ -#define ICBTAG_STRATEGY_TYPE_4 0x0004 /**< 4/A.5 Hierarchy having one - single ICB with one direct entry. - This is what's most often used. - */ +#define ICBTAG_STRATEGY_TYPE_1 0x0001 /**< 4/A.2 Direct entries Uint16 */ +#define ICBTAG_STRATEGY_TYPE_2 0x0002 /**< 4/A.3 List of ICB direct entries */ +#define ICBTAG_STRATEGY_TYPE_3 0x0003 /**< 4/A.4 */ +#define ICBTAG_STRATEGY_TYPE_4 0x0004 /**< 4/A.5 Hierarchy having one + single ICB with one direct entry. + This is what's most often used. + */ /** File Type (ECMA 167r3 4/14.6.6) @@ -662,307 +662,307 @@ typedef struct udf_icbtag_s udf_icbtag_t; distinct values of an enum. */ typedef enum { - ICBTAG_FILE_TYPE_UNDEF = 0x00, - ICBTAG_FILE_TYPE_USE = 0x01, - ICBTAG_FILE_TYPE_PIE = 0x02, - ICBTAG_FILE_TYPE_IE = 0x03, - ICBTAG_FILE_TYPE_DIRECTORY = 0x04, - ICBTAG_FILE_TYPE_REGULAR = 0x05, - ICBTAG_FILE_TYPE_BLOCK = 0x06, - ICBTAG_FILE_TYPE_CHAR = 0x07, - ICBTAG_FILE_TYPE_EA = 0x08, - ICBTAG_FILE_TYPE_FIFO = 0x09, - ICBTAG_FILE_TYPE_SOCKET = 0x0A, - ICBTAG_FILE_TYPE_TE = 0x0B, - ICBTAG_FILE_TYPE_SYMLINK = 0x0C, - ICBTAG_FILE_TYPE_STREAMDIR = 0x0D + ICBTAG_FILE_TYPE_UNDEF = 0x00, + ICBTAG_FILE_TYPE_USE = 0x01, + ICBTAG_FILE_TYPE_PIE = 0x02, + ICBTAG_FILE_TYPE_IE = 0x03, + ICBTAG_FILE_TYPE_DIRECTORY = 0x04, + ICBTAG_FILE_TYPE_REGULAR = 0x05, + ICBTAG_FILE_TYPE_BLOCK = 0x06, + ICBTAG_FILE_TYPE_CHAR = 0x07, + ICBTAG_FILE_TYPE_EA = 0x08, + ICBTAG_FILE_TYPE_FIFO = 0x09, + ICBTAG_FILE_TYPE_SOCKET = 0x0A, + ICBTAG_FILE_TYPE_TE = 0x0B, + ICBTAG_FILE_TYPE_SYMLINK = 0x0C, + ICBTAG_FILE_TYPE_STREAMDIR = 0x0D } icbtag_file_type_enum_t; /** Flags (ECMA 167r3 4/14.6.8) */ typedef enum { - ICBTAG_FLAG_AD_MASK = 0x0007, /**< "&" this to get below address - flags */ - ICBTAG_FLAG_AD_SHORT = 0x0000, /**< The allocation descriptor - field is filled with - short_ad's. If the - offset is beyond the - current extent, look for - the next extent. */ - ICBTAG_FLAG_AD_LONG = 0x0001, /**< The allocation descriptor - field is filled with - long_ad's If the offset - is beyond the current - extent, look for the next - extent. */ - ICBTAG_FLAG_AD_EXTENDED = 0x0002, - ICBTAG_FLAG_AD_IN_ICB = 0x0003, /**< This type means that the - file *data* is stored in - the allocation descriptor - field of the file entry. */ - ICBTAG_FLAG_SORTED = 0x0008, - ICBTAG_FLAG_NONRELOCATABLE = 0x0010, - ICBTAG_FLAG_ARCHIVE = 0x0020, - ICBTAG_FLAG_SETUID = 0x0040, - ICBTAG_FLAG_SETGID = 0x0080, - ICBTAG_FLAG_STICKY = 0x0100, - ICBTAG_FLAG_CONTIGUOUS = 0x0200, - ICBTAG_FLAG_SYSTEM = 0x0400, - ICBTAG_FLAG_TRANSFORMED = 0x0800, - ICBTAG_FLAG_MULTIVERSIONS = 0x1000, - ICBTAG_FLAG_STREAM = 0x2000 + ICBTAG_FLAG_AD_MASK = 0x0007, /**< "&" this to get below address + flags */ + ICBTAG_FLAG_AD_SHORT = 0x0000, /**< The allocation descriptor + field is filled with + short_ad's. If the + offset is beyond the + current extent, look for + the next extent. */ + ICBTAG_FLAG_AD_LONG = 0x0001, /**< The allocation descriptor + field is filled with + long_ad's If the offset + is beyond the current + extent, look for the next + extent. */ + ICBTAG_FLAG_AD_EXTENDED = 0x0002, + ICBTAG_FLAG_AD_IN_ICB = 0x0003, /**< This type means that the + file *data* is stored in + the allocation descriptor + field of the file entry. */ + ICBTAG_FLAG_SORTED = 0x0008, + ICBTAG_FLAG_NONRELOCATABLE = 0x0010, + ICBTAG_FLAG_ARCHIVE = 0x0020, + ICBTAG_FLAG_SETUID = 0x0040, + ICBTAG_FLAG_SETGID = 0x0080, + ICBTAG_FLAG_STICKY = 0x0100, + ICBTAG_FLAG_CONTIGUOUS = 0x0200, + ICBTAG_FLAG_SYSTEM = 0x0400, + ICBTAG_FLAG_TRANSFORMED = 0x0800, + ICBTAG_FLAG_MULTIVERSIONS = 0x1000, + ICBTAG_FLAG_STREAM = 0x2000 } icbtag_flag_enum_t; /** Indirect Entry (ECMA 167r3 4/14.7) */ struct indirect_entry_s { udf_tag_t tag; - udf_icbtag_t icb_tag; - udf_long_ad_t indirect_ICB; + udf_icbtag_t icb_tag; + udf_long_ad_t indirect_ICB; } GNUC_PACKED; /** Terminal Entry (ECMA 167r3 4/14.8) */ struct terminal_entry_s { udf_tag_t tag; - udf_icbtag_t icb_tag; + udf_icbtag_t icb_tag; } GNUC_PACKED; /** File Entry (ECMA 167r3 4/14.9) */ struct udf_file_entry_s { udf_tag_t tag; - udf_icbtag_t icb_tag; /**< 4/14.9.2 */ - udf_Uint32_t uid; /**< 4/14.9.3 */ - udf_Uint32_t gid; /**< 4/14.9.4 */ - udf_Uint32_t permissions; /**< 4/14.9.5 */ - udf_Uint16_t link_count; /**< 4/14.9.6 */ - udf_Uint8_t rec_format; /**< 4/14.9.7 */ - udf_Uint8_t rec_disp_attr; /**< 4/14.9.8 */ - udf_Uint32_t rec_len; /**< 4/14.9.9 */ - udf_Uint64_t info_len; /**< 4/14.9.10 */ - udf_Uint64_t logblks_recorded; /**< 4/14.9.11 */ + udf_icbtag_t icb_tag; /**< 4/14.9.2 */ + udf_Uint32_t uid; /**< 4/14.9.3 */ + udf_Uint32_t gid; /**< 4/14.9.4 */ + udf_Uint32_t permissions; /**< 4/14.9.5 */ + udf_Uint16_t link_count; /**< 4/14.9.6 */ + udf_Uint8_t rec_format; /**< 4/14.9.7 */ + udf_Uint8_t rec_disp_attr; /**< 4/14.9.8 */ + udf_Uint32_t rec_len; /**< 4/14.9.9 */ + udf_Uint64_t info_len; /**< 4/14.9.10 */ + udf_Uint64_t logblks_recorded; /**< 4/14.9.11 */ udf_timestamp_t access_time; /**< 4/14.9.12 - last access to - any stream of file prior to - recording file entry */ + any stream of file prior to + recording file entry */ udf_timestamp_t modification_time; /**< 4/14.9.13 - last access to - modification to any stream of - file */ + modification to any stream of + file */ udf_timestamp_t attribute_time; - udf_Uint32_t checkpoint; - udf_long_ad_t ext_attr_ICB; - udf_regid_t imp_id; - udf_Uint64_t unique_ID; - udf_Uint32_t i_extended_attr; - udf_Uint32_t i_alloc_descs; + udf_Uint32_t checkpoint; + udf_long_ad_t ext_attr_ICB; + udf_regid_t imp_id; + udf_Uint64_t unique_ID; + udf_Uint32_t i_extended_attr; + udf_Uint32_t i_alloc_descs; /* The following union allows file entry reuse without worrying about overflows, by ensuring the struct is always the maximum possible size allowed by the specs: one UDF block. */ union { - udf_Uint8_t ext_attr[0]; - udf_Uint8_t alloc_descs[0]; - udf_Uint8_t pad_to_one_block[2048-176]; + udf_Uint8_t ext_attr[0]; + udf_Uint8_t alloc_descs[0]; + udf_Uint8_t pad_to_one_block[2048-176]; } u; } GNUC_PACKED; typedef struct udf_file_entry_s udf_file_entry_t; -#define UDF_FENTRY_SIZE 176 -#define UDF_FENTRY_PERM_USER_MASK 0x07 -#define UDF_FENTRY_PERM_GRP_MASK 0xE0 -#define UDF_FENTRY_PERM_OWNER_MASK 0x1C00 +#define UDF_FENTRY_SIZE 176 +#define UDF_FENTRY_PERM_USER_MASK 0x07 +#define UDF_FENTRY_PERM_GRP_MASK 0xE0 +#define UDF_FENTRY_PERM_OWNER_MASK 0x1C00 /** Permissions (ECMA 167r3 4/14.9.5) */ -#define FE_PERM_O_EXEC 0x00000001U -#define FE_PERM_O_WRITE 0x00000002U -#define FE_PERM_O_READ 0x00000004U -#define FE_PERM_O_CHATTR 0x00000008U -#define FE_PERM_O_DELETE 0x00000010U -#define FE_PERM_G_EXEC 0x00000020U -#define FE_PERM_G_WRITE 0x00000040U -#define FE_PERM_G_READ 0x00000080U -#define FE_PERM_G_CHATTR 0x00000100U -#define FE_PERM_G_DELETE 0x00000200U -#define FE_PERM_U_EXEC 0x00000400U -#define FE_PERM_U_WRITE 0x00000800U -#define FE_PERM_U_READ 0x00001000U -#define FE_PERM_U_CHATTR 0x00002000U -#define FE_PERM_U_DELETE 0x00004000U +#define FE_PERM_O_EXEC 0x00000001U +#define FE_PERM_O_WRITE 0x00000002U +#define FE_PERM_O_READ 0x00000004U +#define FE_PERM_O_CHATTR 0x00000008U +#define FE_PERM_O_DELETE 0x00000010U +#define FE_PERM_G_EXEC 0x00000020U +#define FE_PERM_G_WRITE 0x00000040U +#define FE_PERM_G_READ 0x00000080U +#define FE_PERM_G_CHATTR 0x00000100U +#define FE_PERM_G_DELETE 0x00000200U +#define FE_PERM_U_EXEC 0x00000400U +#define FE_PERM_U_WRITE 0x00000800U +#define FE_PERM_U_READ 0x00001000U +#define FE_PERM_U_CHATTR 0x00002000U +#define FE_PERM_U_DELETE 0x00004000U /** Record Format (ECMA 167r3 4/14.9.7) */ -#define FE_RECORD_FMT_UNDEF 0x00 -#define FE_RECORD_FMT_FIXED_PAD 0x01 -#define FE_RECORD_FMT_FIXED 0x02 -#define FE_RECORD_FMT_VARIABLE8 0x03 -#define FE_RECORD_FMT_VARIABLE16 0x04 -#define FE_RECORD_FMT_VARIABLE16_MSB 0x05 -#define FE_RECORD_FMT_VARIABLE32 0x06 -#define FE_RECORD_FMT_PRINT 0x07 -#define FE_RECORD_FMT_LF 0x08 -#define FE_RECORD_FMT_CR 0x09 -#define FE_RECORD_FMT_CRLF 0x0A -#define FE_RECORD_FMT_LFCR 0x0B +#define FE_RECORD_FMT_UNDEF 0x00 +#define FE_RECORD_FMT_FIXED_PAD 0x01 +#define FE_RECORD_FMT_FIXED 0x02 +#define FE_RECORD_FMT_VARIABLE8 0x03 +#define FE_RECORD_FMT_VARIABLE16 0x04 +#define FE_RECORD_FMT_VARIABLE16_MSB 0x05 +#define FE_RECORD_FMT_VARIABLE32 0x06 +#define FE_RECORD_FMT_PRINT 0x07 +#define FE_RECORD_FMT_LF 0x08 +#define FE_RECORD_FMT_CR 0x09 +#define FE_RECORD_FMT_CRLF 0x0A +#define FE_RECORD_FMT_LFCR 0x0B /** Record Display Attributes (ECMA 167r3 4/14.9.8) */ -#define FE_RECORD_DISPLAY_ATTR_UNDEF 0x00 -#define FE_RECORD_DISPLAY_ATTR_1 0x01 -#define FE_RECORD_DISPLAY_ATTR_2 0x02 -#define FE_RECORD_DISPLAY_ATTR_3 0x03 +#define FE_RECORD_DISPLAY_ATTR_UNDEF 0x00 +#define FE_RECORD_DISPLAY_ATTR_1 0x01 +#define FE_RECORD_DISPLAY_ATTR_2 0x02 +#define FE_RECORD_DISPLAY_ATTR_3 0x03 /** Extended Attribute Header Descriptor (ECMA 167r3 4/14.10.1) */ struct extended_attr_header_desc_s { udf_tag_t tag; - udf_Uint32_t imp_attr_location; - udf_Uint32_t app_attr_location; + udf_Uint32_t imp_attr_location; + udf_Uint32_t app_attr_location; } GNUC_PACKED; /** Generic Format (ECMA 167r3 4/14.10.2) */ struct generic_format_s { - udf_Uint32_t attr_type; - udf_Uint8_t attr_subtype; - udf_Uint8_t reserved[3]; - udf_Uint32_t attrLength; - udf_Uint8_t attrData[0]; + udf_Uint32_t attr_type; + udf_Uint8_t attr_subtype; + udf_Uint8_t reserved[3]; + udf_Uint32_t attrLength; + udf_Uint8_t attrData[0]; } GNUC_PACKED; /** Character Set Information (ECMA 167r3 4/14.10.3) */ struct charSet_info_s { - udf_Uint32_t attr_type; - udf_Uint8_t attr_subtype; - udf_Uint8_t reserved[3]; - udf_Uint32_t attrLength; - udf_Uint32_t escapeSeqLength; - udf_Uint8_t charSetType; - udf_Uint8_t escapeSeq[0]; + udf_Uint32_t attr_type; + udf_Uint8_t attr_subtype; + udf_Uint8_t reserved[3]; + udf_Uint32_t attrLength; + udf_Uint32_t escapeSeqLength; + udf_Uint8_t charSetType; + udf_Uint8_t escapeSeq[0]; } GNUC_PACKED; /* Alternate Permissions (ECMA 167r3 4/14.10.4) */ struct alt_perms_s { - udf_Uint32_t attr_type; - udf_Uint8_t attr_subtype; - udf_Uint8_t reserved[3]; - udf_Uint32_t attrLength; - udf_Uint16_t owner_id; - udf_Uint16_t group_id; - udf_Uint16_t permission; + udf_Uint32_t attr_type; + udf_Uint8_t attr_subtype; + udf_Uint8_t reserved[3]; + udf_Uint32_t attrLength; + udf_Uint16_t owner_id; + udf_Uint16_t group_id; + udf_Uint16_t permission; } GNUC_PACKED; /** File Times Extended Attribute (ECMA 167r3 4/14.10.5) */ struct filetimes_ext_attr_s { - udf_Uint32_t attr_type; - udf_Uint8_t attr_subtype; - udf_Uint8_t reserved[3]; - udf_Uint32_t attrLength; - udf_Uint32_t dataLength; - udf_Uint32_t fileTimeExistence; - udf_Uint8_t fileTimes; + udf_Uint32_t attr_type; + udf_Uint8_t attr_subtype; + udf_Uint8_t reserved[3]; + udf_Uint32_t attrLength; + udf_Uint32_t dataLength; + udf_Uint32_t fileTimeExistence; + udf_Uint8_t fileTimes; } GNUC_PACKED; /** FileTimeExistence (ECMA 167r3 4/14.10.5.6) */ -#define FTE_CREATION 0x00000001 -#define FTE_DELETION 0x00000004 -#define FTE_EFFECTIVE 0x00000008 -#define FTE_BACKUP 0x00000002 +#define FTE_CREATION 0x00000001 +#define FTE_DELETION 0x00000004 +#define FTE_EFFECTIVE 0x00000008 +#define FTE_BACKUP 0x00000002 /** Information Times Extended Attribute (ECMA 167r3 4/14.10.6) */ struct infoTimesExtAttr { - udf_Uint32_t attr_type; - udf_Uint8_t attr_subtype; - udf_Uint8_t reserved[3]; - udf_Uint32_t attrLength; - udf_Uint32_t dataLength; - udf_Uint32_t infoTimeExistence; - udf_Uint8_t infoTimes[0]; + udf_Uint32_t attr_type; + udf_Uint8_t attr_subtype; + udf_Uint8_t reserved[3]; + udf_Uint32_t attrLength; + udf_Uint32_t dataLength; + udf_Uint32_t infoTimeExistence; + udf_Uint8_t infoTimes[0]; } GNUC_PACKED; /** Device Specification (ECMA 167r3 4/14.10.7) */ struct deviceSpec { - udf_Uint32_t attr_type; - udf_Uint8_t attr_subtype; - udf_Uint8_t reserved[3]; - udf_Uint32_t attrLength; - udf_Uint32_t imp_useLength; - udf_Uint32_t majorDevice_id; - udf_Uint32_t minorDevice_id; - udf_Uint8_t imp_use[0]; + udf_Uint32_t attr_type; + udf_Uint8_t attr_subtype; + udf_Uint8_t reserved[3]; + udf_Uint32_t attrLength; + udf_Uint32_t imp_useLength; + udf_Uint32_t majorDevice_id; + udf_Uint32_t minorDevice_id; + udf_Uint8_t imp_use[0]; } GNUC_PACKED; /** Implementation Use Extended Attr (ECMA 167r3 4/14.10.8) */ struct impUseExtAttr { - udf_Uint32_t attr_type; - udf_Uint8_t attr_subtype; - udf_Uint8_t reserved[3]; - udf_Uint32_t attrLength; - udf_Uint32_t imp_useLength; - udf_regid_t imp_id; - udf_Uint8_t imp_use[0]; + udf_Uint32_t attr_type; + udf_Uint8_t attr_subtype; + udf_Uint8_t reserved[3]; + udf_Uint32_t attrLength; + udf_Uint32_t imp_useLength; + udf_regid_t imp_id; + udf_Uint8_t imp_use[0]; } GNUC_PACKED; /** Application Use Extended Attribute (ECMA 167r3 4/14.10.9) */ struct appUseExtAttr { - udf_Uint32_t attr_type; - udf_Uint8_t attr_subtype; - udf_Uint8_t reserved[3]; - udf_Uint32_t attrLength; - udf_Uint32_t appUseLength; - udf_regid_t app_id; - udf_Uint8_t appUse[0]; + udf_Uint32_t attr_type; + udf_Uint8_t attr_subtype; + udf_Uint8_t reserved[3]; + udf_Uint32_t attrLength; + udf_Uint32_t appUseLength; + udf_regid_t app_id; + udf_Uint8_t appUse[0]; } GNUC_PACKED; -#define EXTATTR_CHAR_SET 1 -#define EXTATTR_ALT_PERMS 3 -#define EXTATTR_FILE_TIMES 5 -#define EXTATTR_INFO_TIMES 6 -#define EXTATTR_DEV_SPEC 12 -#define EXTATTR_IMP_USE 2048 -#define EXTATTR_APP_USE 65536 +#define EXTATTR_CHAR_SET 1 +#define EXTATTR_ALT_PERMS 3 +#define EXTATTR_FILE_TIMES 5 +#define EXTATTR_INFO_TIMES 6 +#define EXTATTR_DEV_SPEC 12 +#define EXTATTR_IMP_USE 2048 +#define EXTATTR_APP_USE 65536 /** Unallocated Space Entry (ECMA 167r3 4/14.11) */ struct unallocSpaceEntry { udf_tag_t tag; - udf_icbtag_t icb_tag; - udf_Uint32_t lengthAllocDescs; - udf_Uint8_t allocDescs[0]; + udf_icbtag_t icb_tag; + udf_Uint32_t lengthAllocDescs; + udf_Uint8_t allocDescs[0]; } GNUC_PACKED; /** Space Bitmap Descriptor (ECMA 167r3 4/14.12) */ struct spaceBitmapDesc { udf_tag_t tag; - udf_Uint32_t i_bits; - udf_Uint32_t i_bytes; - udf_Uint8_t bitmap[0]; + udf_Uint32_t i_bits; + udf_Uint32_t i_bytes; + udf_Uint8_t bitmap[0]; } GNUC_PACKED; /** Partition Integrity Entry (ECMA 167r3 4/14.13) */ struct partitionIntegrityEntry { udf_tag_t tag; - udf_icbtag_t icb_tag; + udf_icbtag_t icb_tag; udf_timestamp_t recording_time; - udf_Uint8_t integrityType; - udf_Uint8_t reserved[175]; - udf_regid_t imp_id; - udf_Uint8_t imp_use[256]; + udf_Uint8_t integrityType; + udf_Uint8_t reserved[175]; + udf_regid_t imp_id; + udf_Uint8_t imp_use[256]; } GNUC_PACKED; /** Short Allocation Descriptor (ECMA 167r3 4/14.14.1) */ /** Extent Length (ECMA 167r3 4/14.14.1.1) */ -#define EXT_RECORDED_ALLOCATED 0x00000000 -#define EXT_NOT_RECORDED_ALLOCATED 0x40000000 -#define EXT_NOT_RECORDED_NOT_ALLOCATED 0x80000000 -#define EXT_NEXT_EXTENT_ALLOCDECS 0xC0000000 +#define EXT_RECORDED_ALLOCATED 0x00000000 +#define EXT_NOT_RECORDED_ALLOCATED 0x40000000 +#define EXT_NOT_RECORDED_NOT_ALLOCATED 0x80000000 +#define EXT_NEXT_EXTENT_ALLOCDECS 0xC0000000 /** Long Allocation Descriptor (ECMA 167r3 4/14.14.2) */ @@ -971,8 +971,8 @@ struct partitionIntegrityEntry /** Logical Volume Header Descriptor (ECMA 167r3 4/14.15) */ struct logical_vol_header_desc_s { - udf_Uint64_t uniqueID; - udf_Uint8_t reserved[24]; + udf_Uint64_t uniqueID; + udf_Uint8_t reserved[24]; } GNUC_PACKED; typedef struct logical_vol_header_desc_s logical_vol_header_desc_t; @@ -980,16 +980,16 @@ typedef struct logical_vol_header_desc_s logical_vol_header_desc_t; /** Path Component (ECMA 167r3 4/14.16.1) */ struct pathComponent { - udf_Uint8_t component_type; - udf_Uint8_t lengthComponent_id; - udf_Uint16_t componentFileVersionNum; - udf_dstring component_id[0]; + udf_Uint8_t component_type; + udf_Uint8_t lengthComponent_id; + udf_Uint16_t componentFileVersionNum; + udf_dstring component_id[0]; } GNUC_PACKED; /** File Entry (ECMA 167r3 4/14.17) */ struct extended_file_entry { - udf_tag_t tag; /**< 4/14.17.1 - id = 266 */ + udf_tag_t tag; /**< 4/14.17.1 - id = 266 */ udf_icbtag_t icb_tag; /**< 4/14.17.2 & 4/14.9.2 */ udf_Uint32_t uid; /**< 4/14.17.3 & 4/14.9.3 */ udf_Uint32_t gid; /**< 4/14.17.4 & 4/14.9.4 */ @@ -1002,14 +1002,14 @@ struct extended_file_entry udf_Uint64_t object_size; /**< 4/14.17.11 */ udf_Uint64_t logblks_recorded; /**< 4/14.17.12 & 4/14.9.11 */ udf_timestamp_t access_time; /**< 4/14.17.13 & 4/14.9.12 - last - access to any stream of file */ + access to any stream of file */ udf_timestamp_t modification_time; /**< 4/14.17.14 & 4/14.9.13 - last - modification to any stream of - file*/ + modification to any stream of + file*/ udf_timestamp_t create_time; /**< 4/14.17.15 */ udf_timestamp_t attribute_time; /**< 4/14.17.16 & 4/14.9.14 - - most recent create or modify - time */ + most recent create or modify + time */ udf_Uint32_t checkpoint; udf_Uint32_t reserved; /**< #00 bytes */ udf_long_ad_t ext_attr_ICB; @@ -1021,7 +1021,7 @@ struct extended_file_entry union { /* MSVC workaround for multiple zero sized arrays */ udf_Uint8_t ext_attr[0]; udf_Uint8_t alloc_descs[0]; - udf_Uint8_t pad_to_one_block[2048-216]; + udf_Uint8_t pad_to_one_block[2048-216]; } u; } GNUC_PACKED; @@ -1039,4 +1039,4 @@ extern icbtag_flag_enum_t debug_flag_enum; extern ecma_167_enum1_t debug_ecma_167_enum1; extern ecma_167_timezone_enum_t debug_ecma_167_timezone_enum; -#endif /* _ECMA_167_H */ +#endif /* CDIO_ECMA_167_H */ diff --git a/include/cdio/iso9660.h b/include/cdio/iso9660.h index 942c52d8..e52e8ebc 100644 --- a/include/cdio/iso9660.h +++ b/include/cdio/iso9660.h @@ -1,7 +1,5 @@ /* - $Id: iso9660.h,v 1.102 2008/07/16 00:28:54 rocky Exp $ - - Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 + Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2012 Rocky Bernstein Copyright (C) 2000 Herbert Valerio Riedel @@ -33,8 +31,8 @@ */ -#ifndef __CDIO_ISO9660_H__ -#define __CDIO_ISO9660_H__ +#ifndef CDIO_ISO9660_H_ +#define CDIO_ISO9660_H_ #include @@ -71,7 +69,7 @@ typedef char dchar_t; /*! See section 7.4.1 */ #undef ISODCL #endif /* This part borrowed from the bsd386 isofs */ -#define ISODCL(from, to) ((to) - (from) + 1) +#define ISODCL(from, to) ((to) - (from) + 1) #define MIN_TRACK_SIZE 4*75 #define MIN_ISO_SIZE MIN_TRACK_SIZE @@ -107,14 +105,14 @@ extern enum iso_enum1_s { /*! ISO 9660 directory flags. */ extern enum iso_flag_enum_s { - ISO_FILE = 0, /**< Not really a flag... */ - ISO_EXISTENCE = 1, /**< Do not make existence known (hidden) */ - ISO_DIRECTORY = 2, /**< This file is a directory */ - ISO_ASSOCIATED = 4, /**< This file is an associated file */ - ISO_RECORD = 8, /**< Record format in extended attr. != 0 */ + ISO_FILE = 0, /**< Not really a flag... */ + ISO_EXISTENCE = 1, /**< Do not make existence known (hidden) */ + ISO_DIRECTORY = 2, /**< This file is a directory */ + ISO_ASSOCIATED = 4, /**< This file is an associated file */ + ISO_RECORD = 8, /**< Record format in extended attr. != 0 */ ISO_PROTECTION = 16, /**< No read/execute perm. in ext. attr. */ - ISO_DRESERVED1 = 32, /**<, Reserved bit 5 */ - ISO_DRESERVED2 = 64, /**<, Reserved bit 6 */ + ISO_DRESERVED1 = 32, /**<, Reserved bit 5 */ + ISO_DRESERVED2 = 64, /**<, Reserved bit 6 */ ISO_MULTIEXTENT = 128, /**< Not final entry of a mult. ext. file */ } iso_flag_enums; @@ -124,7 +122,7 @@ extern enum iso_vd_enum_s { ISO_VD_PRIMARY = 1, /**< Is in any ISO-9660 */ ISO_VD_SUPPLEMENTARY = 2, /**< Used by Joliet, for example */ ISO_VD_PARITION = 3, /**< Indicates a partition of a CD */ - ISO_VD_END = 255 + ISO_VD_END = 255 } iso_vd_enums; @@ -136,12 +134,12 @@ extern enum iso_vd_enum_s { For ISO-9660 Level 1, the maximum needed string length is: @code - 30 chars (filename + ext) - + 2 chars ('.' + ';') - + 5 chars (strlen("32767")) - + 1 null byte + 30 chars (filename + ext) + + 2 chars ('.' + ';') + + 5 chars (strlen("32767")) + + 1 null byte ================================ - = 38 chars + = 38 chars @endcode */ @@ -183,15 +181,15 @@ PRAGMA_BEGIN_PACKED @see iso9660_dtime */ -struct iso9660_dtime_s { - iso711_t dt_year; /**< Number of years since 1900 */ - iso711_t dt_month; /**< Has value in range 1..12. Note starts +struct iso9660_dtime_s { + iso711_t dt_year; /**< Number of years since 1900 */ + iso711_t dt_month; /**< Has value in range 1..12. Note starts at 1, not 0 like a tm struct. */ - iso711_t dt_day; /**< Day of the month from 1 to 31 */ - iso711_t dt_hour; /**< Hour of the day from 0 to 23 */ - iso711_t dt_minute; /**< Minute of the hour from 0 to 59 */ - iso711_t dt_second; /**< Second of the minute from 0 to 59 */ - iso712_t dt_gmtoff; /**< GMT values -48 .. + 52 in 15 minute + iso711_t dt_day; /**< Day of the month from 1 to 31 */ + iso711_t dt_hour; /**< Hour of the day from 0 to 23 */ + iso711_t dt_minute; /**< Minute of the hour from 0 to 59 */ + iso711_t dt_second; /**< Second of the minute from 0 to 59 */ + iso712_t dt_gmtoff; /**< GMT values -48 .. + 52 in 15 minute intervals */ } GNUC_PACKED; @@ -206,19 +204,19 @@ typedef struct iso9660_dtime_s iso9660_dtime_t; @see iso9660_ltime */ -struct iso9660_ltime_s { - char lt_year [ISODCL( 1, 4)]; /**< Add 1900 to value +struct iso9660_ltime_s { + char lt_year [ISODCL( 1, 4)]; /**< Add 1900 to value for the Julian year */ - char lt_month [ISODCL( 5, 6)]; /**< Has value in range + char lt_month [ISODCL( 5, 6)]; /**< Has value in range 1..12. Note starts at 1, not 0 like a tm struct. */ - char lt_day [ISODCL( 7, 8)]; /**< Day of month: 1..31 */ - char lt_hour [ISODCL( 9, 10)]; /**< hour: 0..23 */ - char lt_minute [ISODCL( 11, 12)]; /**< minute: 0..59 */ - char lt_second [ISODCL( 13, 14)]; /**< second: 0..59 */ - char lt_hsecond [ISODCL( 15, 16)]; /**< The value is in + char lt_day [ISODCL( 7, 8)]; /**< Day of month: 1..31 */ + char lt_hour [ISODCL( 9, 10)]; /**< hour: 0..23 */ + char lt_minute [ISODCL( 11, 12)]; /**< minute: 0..59 */ + char lt_second [ISODCL( 13, 14)]; /**< second: 0..59 */ + char lt_hsecond [ISODCL( 15, 16)]; /**< The value is in units of 1/100's of a second */ iso712_t lt_gmtoff; /**< Offset from Greenwich Mean Time in number @@ -405,7 +403,7 @@ struct iso9660_svd_s { char id[5]; /**< ISO_STANDARD_ID "CD001" */ iso711_t version; /**< value 1 */ - char flags; /**< Section 8.5.3 */ + char flags; /**< Section 8.5.3 */ achar_t system_id[ISO_MAX_SYSTEM_ID]; /**< Section 8.5.4; each char is an achar */ dchar_t volume_id[ISO_MAX_VOLUME_ID]; /**< Section 8.5.5; each char @@ -1133,7 +1131,7 @@ lsn_t iso9660_get_dir_extent(const iso9660_dir_t *p_idr); #endif /* __cplusplus */ #undef ISODCL -#endif /* __CDIO_ISO9660_H__ */ +#endif /* CDIO_ISO9660_H_ */ /* * Local variables: diff --git a/include/cdio/logging.h b/include/cdio/logging.h index 988d11c5..46d88595 100644 --- a/include/cdio/logging.h +++ b/include/cdio/logging.h @@ -1,7 +1,5 @@ /* - $Id: logging.h,v 1.11 2008/03/25 15:59:09 karl Exp $ - - Copyright (C) 2003, 2004, 2008 Rocky Bernstein + Copyright (C) 2003, 2004, 2008, 2012 Rocky Bernstein Copyright (C) 2000 Herbert Valerio Riedel This program is free software: you can redistribute it and/or modify @@ -23,8 +21,8 @@ * */ -#ifndef __LOGGING_H__ -#define __LOGGING_H__ +#ifndef CDIO_LOGGING_H_ +#define CDIO_LOGGING_H_ #include @@ -124,7 +122,7 @@ void cdio_error (const char format[], ...) GNUC_PRINTF(1,2); } #endif -#endif /* __LOGGING_H__ */ +#endif /* CDIO_LOGGING_H_ */ /* diff --git a/include/cdio/mmc.h b/include/cdio/mmc.h index 3a6508e5..ee5421cb 100644 --- a/include/cdio/mmc.h +++ b/include/cdio/mmc.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Rocky Bernstein This program is free software: you can redistribute it and/or modify @@ -33,8 +33,8 @@ */ -#ifndef __CDIO_MMC_H__ -#define __CDIO_MMC_H__ +#ifndef CDIO_MMC_H_ +#define CDIO_MMC_H_ #include #include @@ -68,40 +68,40 @@ extern "C" { */ typedef struct cdio_mmc_request_sense { #if defined(__MMC_BIG_ENDIAN_BITFIELD) - uint8_t valid : 1; /**< valid bit is 1 if info is valid */ - uint8_t error_code : 7; + uint8_t valid : 1; /**< valid bit is 1 if info is valid */ + uint8_t error_code : 7; #else - uint8_t error_code : 7; - uint8_t valid : 1; /**< valid bit is 1 if info is valid */ + uint8_t error_code : 7; + uint8_t valid : 1; /**< valid bit is 1 if info is valid */ #endif - uint8_t segment_number; + uint8_t segment_number; #if defined(__MMC_BIG_ENDIAN_BITFIELD) - uint8_t filemark : 1; /**< manditory in sequential + uint8_t filemark : 1; /**< manditory in sequential * access devices */ - uint8_t eom : 1; /**< end of medium. manditory in + uint8_t eom : 1; /**< end of medium. manditory in * sequential access and * printer devices */ - uint8_t ili : 1; /**< incorrect length indicator */ - uint8_t reserved1 : 1; - uint8_t sense_key : 4; + uint8_t ili : 1; /**< incorrect length indicator */ + uint8_t reserved1 : 1; + uint8_t sense_key : 4; #else - uint8_t sense_key : 4; - uint8_t reserved1 : 1; - uint8_t ili : 1; /**< incorrect length indicator */ - uint8_t eom : 1; /**< end of medium. manditory in + uint8_t sense_key : 4; + uint8_t reserved1 : 1; + uint8_t ili : 1; /**< incorrect length indicator */ + uint8_t eom : 1; /**< end of medium. manditory in * sequential access and * printer devices */ - uint8_t filemark : 1; /**< manditory in sequential + uint8_t filemark : 1; /**< manditory in sequential * access devices */ #endif - uint8_t information[4]; - uint8_t additional_sense_len; /**< Additional sense length (n-7) */ - uint8_t command_info[4]; /**< Command-specific information */ - uint8_t asc; /**< Additional sense code */ - uint8_t ascq; /**< Additional sense code qualifier */ - uint8_t fruc; /**< Field replaceable unit code */ - uint8_t sks[3]; /**< Sense-key specific */ - uint8_t asb[46]; /**< Additional sense bytes */ + uint8_t information[4]; + uint8_t additional_sense_len; /**< Additional sense length (n-7) */ + uint8_t command_info[4]; /**< Command-specific information */ + uint8_t asc; /**< Additional sense code */ + uint8_t ascq; /**< Additional sense code qualifier */ + uint8_t fruc; /**< Field replaceable unit code */ + uint8_t sks[3]; /**< Sense-key specific */ + uint8_t asb[46]; /**< Additional sense bytes */ } cdio_mmc_request_sense_t; @@ -800,7 +800,7 @@ extern cdio_mmc_mode_page_t debug_cdio_mmc_mode_page; CDIO_MMC_GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL #endif /*DO_NOT_WANT_PARANOIA_COMPATIBILITY*/ -#endif /* __MMC_H__ */ +#endif /* CDIO_MMC_H_ */ /* * Local variables: diff --git a/include/cdio/mmc_cmds.h b/include/cdio/mmc_cmds.h index 2a4659de..06fca525 100644 --- a/include/cdio/mmc_cmds.h +++ b/include/cdio/mmc_cmds.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2010 Rocky Bernstein + Copyright (C) 2010, 2012 Rocky Bernstein 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 @@ -15,14 +15,14 @@ along with this program. If not, see . */ -#ifndef __CDIO_MMC_CMDS_H__ -#define __CDIO_MMC_CMDS_H__ +#ifndef CDIO_MMC_CMDS_H_ +#define CDIO_MMC_CMDS_H_ #include #include #include -#endif /* __CDIO_MMC_CMDS_H__ */ +#endif /* CDIO_MMC_CMDS_H_ */ /* * Local variables: diff --git a/include/cdio/mmc_hl_cmds.h b/include/cdio/mmc_hl_cmds.h index 48d23814..eb2410d9 100644 --- a/include/cdio/mmc_hl_cmds.h +++ b/include/cdio/mmc_hl_cmds.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2010 Rocky Bernstein + Copyright (C) 2010, 2012 Rocky Bernstein 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 @@ -22,8 +22,8 @@ MMC commands. */ -#ifndef __CDIO_MMC_HL_CMDS_H__ -#define __CDIO_MMC_HL_CMDS_H__ +#ifndef CDIO_MMC_HL_CMDS_H_ +#define CDIO_MMC_HL_CMDS_H_ #include @@ -94,7 +94,7 @@ extern "C" { @return DRIVER_OP_SUCCESS if we ran the command ok. */ driver_return_code_t mmc_mode_sense( CdIo_t *p_cdio, /*out*/ void *p_buf, - unsigned int i_size, int page); + unsigned int i_size, int page); /** Set the drive speed in CD-ROM speed units. @@ -121,7 +121,7 @@ extern "C" { } #endif /* __cplusplus */ -#endif /* __CDIO_MMC_HL_CMDS_H__ */ +#endif /* CDIO_MMC_HL_CMDS_H_ */ /* * Local variables: diff --git a/include/cdio/mmc_ll_cmds.h b/include/cdio/mmc_ll_cmds.h index 12114d32..6ead44c3 100644 --- a/include/cdio/mmc_ll_cmds.h +++ b/include/cdio/mmc_ll_cmds.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2010 Rocky Bernstein + Copyright (C) 2010, 2012 Rocky Bernstein 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 @@ -32,8 +32,8 @@ */ -#ifndef __CDIO_MMC_LL_CMDS_H__ -#define __CDIO_MMC_LL_CMDS_H__ +#ifndef CDIO_MMC_LL_CMDS_H_ +#define CDIO_MMC_LL_CMDS_H_ #include @@ -91,13 +91,13 @@ extern "C" { @param i_timeout_ms value in milliseconds to use on timeout. Setting to 0 uses the default time-out value stored in - mmc_timeout_ms. + mmc_timeout_ms. @return DRIVER_OP_SUCCESS if we ran the command ok. */ driver_return_code_t mmc_mode_select_10(CdIo_t *p_cdio, /*out*/ void *p_buf, - unsigned int i_size, int page, - unsigned int i_timeout_ms); + unsigned int i_size, int page, + unsigned int i_timeout_ms); /** Run a SCSI-MMC MODE SENSE command (10-byte version) and put the results in p_buf @@ -112,7 +112,7 @@ extern "C" { @return DRIVER_OP_SUCCESS if we ran the command ok. */ driver_return_code_t mmc_mode_sense_10( CdIo_t *p_cdio, /*out*/ void *p_buf, - unsigned int i_size, + unsigned int i_size, unsigned int i_page_code); /** @@ -125,7 +125,7 @@ extern "C" { @return DRIVER_OP_SUCCESS if we ran the command ok. */ driver_return_code_t mmc_mode_sense_6( CdIo_t *p_cdio, /*out*/ void *p_buf, - unsigned int i_size, int page); + unsigned int i_size, int page); /** Request preventing/allowing medium removal on a drive via @@ -137,15 +137,15 @@ extern "C" { @param i_timeout_ms value in milliseconds to use on timeout. Setting to 0 uses the default time-out value stored in - mmc_timeout_ms. + mmc_timeout_ms. @return DRIVER_OP_SUCCESS (0) if we got the status. return codes are the same as driver_return_code_t */ driver_return_code_t mmc_prevent_allow_medium_removal(const CdIo_t *p_cdio, - bool b_persistent, bool b_prevent, - unsigned int i_timeout_ms); + bool b_persistent, bool b_prevent, + unsigned int i_timeout_ms); /** Issue a MMC READ_CD command. @@ -296,7 +296,7 @@ extern "C" { @param i_timeout_ms value in milliseconds to use on timeout. Setting to 0 uses the default time-out value stored in - mmc_timeout_ms. + mmc_timeout_ms. @return the drive speed if greater than 0. -1 if we had an error. is -2 returned if this is not implemented for the current driver. @@ -324,8 +324,8 @@ extern "C" { @see mmc_eject_media or mmc_close_tray */ driver_return_code_t mmc_start_stop_unit(const CdIo_t *p_cdio, bool b_eject, - bool b_immediate, - uint8_t power_condition, + bool b_immediate, + uint8_t power_condition, unsigned int i_timeout_ms); /** @@ -335,12 +335,12 @@ extern "C" { @param i_timeout_ms value in milliseconds to use on timeout. Setting to 0 uses the default time-out value stored in - mmc_timeout_ms. + mmc_timeout_ms. @return DRIVER_OP_SUCCESS if we ran the command ok. */ driver_return_code_t mmc_test_unit_ready(const CdIo_t *p_cdio, - unsigned int i_timeout_ms); + unsigned int i_timeout_ms); #ifndef DO_NOT_WANT_OLD_MMC_COMPATIBILITY @@ -352,7 +352,7 @@ extern "C" { } #endif /* __cplusplus */ -#endif /* __CDIO_MMC_HL_CMDS_H__ */ +#endif /* CDIO_MMC_HL_CMDS_H_ */ /* * Local variables: diff --git a/include/cdio/mmc_util.h b/include/cdio/mmc_util.h index 1050a37e..980b4480 100644 --- a/include/cdio/mmc_util.h +++ b/include/cdio/mmc_util.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2010 Rocky Bernstein + Copyright (C) 2010, 2012 Rocky Bernstein 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 @@ -22,8 +22,8 @@ on anything other than headers. */ -#ifndef __CDIO_MMC_UTIL_H__ -#define __CDIO_MMC_UTIL_H__ +#ifndef CDIO_MMC_UTIL_H_ +#define CDIO_MMC_UTIL_H_ #include @@ -147,7 +147,7 @@ extern "C" { } #endif /* __cplusplus */ -#endif /* __MMC_UTIL_H__ */ +#endif /* CDIO_MMC_UTIL_H_ */ /* * Local variables: * c-file-style: "gnu" diff --git a/include/cdio/posix.h b/include/cdio/posix.h index 89e0ad37..54e503c2 100644 --- a/include/cdio/posix.h +++ b/include/cdio/posix.h @@ -1,7 +1,5 @@ /* - $Id: posix.h,v 1.2 2008/03/25 15:59:09 karl Exp $ - - Copyright (C) 2005, 2008 Rocky Bernstein + Copyright (C) 2005, 2008, 2012 Rocky Bernstein 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 @@ -22,8 +20,8 @@ * \brief various POSIX definitions. */ -#ifndef __CDIO_POSIX_H__ -#define __CDIO_POSIX_H__ +#ifndef CDIO_POSIX_H_ +#define CDIO_POSIX_H_ typedef uint32_t posix_mode_t; typedef uint32_t posix_nlink_t; @@ -31,7 +29,7 @@ typedef uint32_t posix_uid_t; typedef uint32_t posix_gid_t; typedef uint16_t unicode16_t; -#endif /* __CDIO_POSIX_H__ */ +#endif /* CDIO_POSIX_H_ */ /* diff --git a/include/cdio/read.h b/include/cdio/read.h index bc13b5f7..80731780 100644 --- a/include/cdio/read.h +++ b/include/cdio/read.h @@ -1,7 +1,5 @@ /* - $Id: read.h,v 1.15 2008/03/25 15:59:09 karl Exp $ - - Copyright (C) 2005, 2006, 2007, 2008 Rocky Bernstein + Copyright (C) 2005, 2006, 2007, 2008, 2012 Rocky Bernstein 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 @@ -23,8 +21,8 @@ * libcdio calls. */ -#ifndef __CDIO_READ_H__ -#define __CDIO_READ_H__ +#ifndef CDIO_READ_H_ +#define CDIO_READ_H_ #include @@ -74,11 +72,11 @@ extern "C" { @param p_cdio object to read from @param p_buf place to read data into. The caller should make sure this location can store at least CDIO_FRAMESIZE_RAW - bytes. + bytes. @param i_lsn sector to read */ driver_return_code_t cdio_read_audio_sector (const CdIo_t *p_cdio, - void *p_buf, lsn_t i_lsn); + void *p_buf, lsn_t i_lsn); /*! Reads audio sectors @@ -86,13 +84,13 @@ extern "C" { @param p_cdio object to read from @param p_buf place to read data into. The caller should make sure this location can store at least CDIO_FRAMESIZE_RAW - * i_blocks bytes. + * i_blocks bytes. @param i_lsn sector to read @param i_blocks number of sectors to read */ driver_return_code_t cdio_read_audio_sectors (const CdIo_t *p_cdio, - void *p_buf, lsn_t i_lsn, - uint32_t i_blocks); + void *p_buf, lsn_t i_lsn, + uint32_t i_blocks); /*! Read data sectors @@ -100,11 +98,11 @@ extern "C" { @param p_cdio object to read from @param p_buf place to read data into. The caller should make sure this location can store at least ISO_BLOCKSIZE, - M2RAW_SECTOR_SIZE, or M2F2_SECTOR_SIZE depending - on the kind of sector getting read. If you don't - know whether you have a Mode 1/2, Form 1/ Form 2/Formless - sector best to reserve space for the maximum, - M2RAW_SECTOR_SIZE. + M2RAW_SECTOR_SIZE, or M2F2_SECTOR_SIZE depending + on the kind of sector getting read. If you don't + know whether you have a Mode 1/2, Form 1/ Form 2/Formless + sector best to reserve space for the maximum, + M2RAW_SECTOR_SIZE. @param i_lsn sector to read @param i_blocksize size of block. Should be either CDIO_CD_FRAMESIZE, M2RAW_SECTOR_SIZE, or M2F2_SECTOR_SIZE. See comment above under p_buf. @@ -112,9 +110,9 @@ extern "C" { @param i_blocks number of blocks to read */ driver_return_code_t cdio_read_data_sectors ( const CdIo_t *p_cdio, - void *p_buf, lsn_t i_lsn, - uint16_t i_blocksize, - uint32_t i_blocks ); + void *p_buf, lsn_t i_lsn, + uint16_t i_blocksize, + uint32_t i_blocks ); /*! Reads a mode 1 sector @@ -125,8 +123,8 @@ extern "C" { mode 1 form 1 sectors. */ driver_return_code_t cdio_read_mode1_sector (const CdIo_t *p_cdio, - void *p_buf, lsn_t i_lsn, - bool b_form2); + void *p_buf, lsn_t i_lsn, + bool b_form2); /*! Reads mode 1 sectors @@ -138,17 +136,17 @@ extern "C" { @param i_blocks number of sectors to read */ driver_return_code_t cdio_read_mode1_sectors (const CdIo_t *p_cdio, - void *p_buf, lsn_t i_lsn, - bool b_form2, - uint32_t i_blocks); + void *p_buf, lsn_t i_lsn, + bool b_form2, + uint32_t i_blocks); /*! Reads a mode 2 sector @param p_cdio object to read from @param p_buf place to read data into. The caller should make sure this location can store at least - M2RAW_SECTOR_SIZE (for form 1) or CDIO_CD_FRAMESIZE (for - form 2) bytes. + M2RAW_SECTOR_SIZE (for form 1) or CDIO_CD_FRAMESIZE (for + form 2) bytes. @param i_lsn sector to read @param b_form2 true for reading mode 2 form 2 sectors or false for mode 2 form 1 sectors. @@ -156,23 +154,23 @@ extern "C" { @return 0 if no error, nonzero otherwise. */ driver_return_code_t cdio_read_mode2_sector (const CdIo_t *p_cdio, - void *p_buf, lsn_t i_lsn, - bool b_form2); + void *p_buf, lsn_t i_lsn, + bool b_form2); /** The special case of reading a single block is a common one so we provide a routine for that as a convenience. */ driver_return_code_t cdio_read_sector(const CdIo_t *p_cdio, void *p_buf, - lsn_t i_lsn, - cdio_read_mode_t read_mode); + lsn_t i_lsn, + cdio_read_mode_t read_mode); /*! Reads mode 2 sectors @param p_cdio object to read from @param p_buf place to read data into. The caller should make sure this location can store at least - M2RAW_SECTOR_SIZE (for form 1) or CDIO_CD_FRAMESIZE (for - form 2) * i_blocks bytes. + M2RAW_SECTOR_SIZE (for form 1) or CDIO_CD_FRAMESIZE (for + form 2) * i_blocks bytes. @param i_lsn sector to read @param b_form2 true for reading mode2 form 2 sectors or false for mode 2 form 1 sectors. @@ -181,9 +179,9 @@ extern "C" { @return 0 if no error, nonzero otherwise. */ driver_return_code_t cdio_read_mode2_sectors (const CdIo_t *p_cdio, - void *p_buf, lsn_t i_lsn, - bool b_form2, - uint32_t i_blocks); + void *p_buf, lsn_t i_lsn, + bool b_form2, + uint32_t i_blocks); /*! Reads a number of sectors (AKA blocks). @@ -215,12 +213,12 @@ extern "C" { */ driver_return_code_t cdio_read_sectors(const CdIo_t *p_cdio, void *p_buf, - lsn_t i_lsn, - cdio_read_mode_t read_mode, - uint32_t i_blocks); + lsn_t i_lsn, + cdio_read_mode_t read_mode, + uint32_t i_blocks); #ifdef __cplusplus } #endif /* __cplusplus */ -#endif /* __CDIO_TRACK_H__ */ +#endif /* CDIO_READ_H_ */ diff --git a/include/cdio/rock.h b/include/cdio/rock.h index 3a24f911..8ae66807 100644 --- a/include/cdio/rock.h +++ b/include/cdio/rock.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2005, 2006 2008 Rocky Bernstein + Copyright (C) 2005, 2006 2008, 2012 Rocky Bernstein See also rock.c by Eric Youngdale (1993) from GNU/Linux This is Copyright 1993 Yggdrasil Computing, Incorporated @@ -26,8 +26,8 @@ */ -#ifndef __CDIO_ROCK_H__ -#define __CDIO_ROCK_H__ +#ifndef CDIO_ROCK_H_ +#define CDIO_ROCK_H_ #include @@ -152,10 +152,10 @@ typedef enum { ISO_ROCK_SL_ROOT = 8 } iso_rock_sl_flag_t; -#define ISO_ROCK_SL_CONTINUE 1 -#define ISO_ROCK_SL_CURRENT 2 -#define ISO_ROCK_SL_PARENT 4 -#define ISO_ROCK_SL_ROOT 8 +#define ISO_ROCK_SL_CONTINUE 1 +#define ISO_ROCK_SL_CURRENT 2 +#define ISO_ROCK_SL_PARENT 4 +#define ISO_ROCK_SL_ROOT 8 typedef struct iso_rock_sl_part_s { uint8_t flags; @@ -178,9 +178,9 @@ typedef enum { ISO_ROCK_NM_PARENT = 4, } iso_rock_nm_flag_t; -#define ISO_ROCK_NM_CONTINUE 1 -#define ISO_ROCK_NM_CURRENT 2 -#define ISO_ROCK_NM_PARENT 4 +#define ISO_ROCK_NM_CONTINUE 1 +#define ISO_ROCK_NM_CURRENT 2 +#define ISO_ROCK_NM_PARENT 4 typedef struct iso_rock_nm_s { @@ -373,7 +373,7 @@ extern iso_rock_tf_flag_t iso_rock_tf_flag; } #endif /* __cplusplus */ -#endif /* __ISO_ROCK_H__ */ +#endif /* CDIO_ROCK_H_ */ /* * Local variables: diff --git a/include/cdio/sector.h b/include/cdio/sector.h index 6e308338..c3644209 100644 --- a/include/cdio/sector.h +++ b/include/cdio/sector.h @@ -1,7 +1,6 @@ /* - $Id: sector.h,v 1.38 2008/03/25 15:59:09 karl Exp $ - - Copyright (C) 2003, 2004, 2005, 2006, 2008 Rocky Bernstein + Copyright (C) 2003, 2004, 2005, 2006, 2008, 2012 + Rocky Bernstein Copyright (C) 2000 Herbert Valerio Riedel This program is free software: you can redistribute it and/or modify @@ -57,8 +56,8 @@ */ -#ifndef _CDIO_SECTOR_H_ -#define _CDIO_SECTOR_H_ +#ifndef CDIO_SECTOR_H_ +#define CDIO_SECTOR_H_ #ifdef __cplusplus extern "C" { @@ -69,21 +68,21 @@ /*! Information that can be obtained through a Read Subchannel command. */ -#define CDIO_SUBCHANNEL_SUBQ_DATA 0 -#define CDIO_SUBCHANNEL_CURRENT_POSITION 1 -#define CDIO_SUBCHANNEL_MEDIA_CATALOG 2 -#define CDIO_SUBCHANNEL_TRACK_ISRC 3 +#define CDIO_SUBCHANNEL_SUBQ_DATA 0 +#define CDIO_SUBCHANNEL_CURRENT_POSITION 1 +#define CDIO_SUBCHANNEL_MEDIA_CATALOG 2 +#define CDIO_SUBCHANNEL_TRACK_ISRC 3 /*! track flags * Q Sub-channel Control Field (4.2.3.3) */ typedef enum { - NONE = 0x00, /* no flags set */ - PRE_EMPHASIS = 0x01, /* audio track recorded with pre-emphasis */ - COPY_PERMITTED = 0x02, /* digital copy permitted */ - DATA = 0x04, /* data track */ - FOUR_CHANNEL_AUDIO = 0x08, /* 4 audio channels */ - SCMS = 0x10 /* SCMS (5.29.2.7) */ + NONE = 0x00, /* no flags set */ + PRE_EMPHASIS = 0x01, /* audio track recorded with pre-emphasis */ + COPY_PERMITTED = 0x02, /* digital copy permitted */ + DATA = 0x04, /* data track */ + FOUR_CHANNEL_AUDIO = 0x08, /* 4 audio channels */ + SCMS = 0x10 /* SCMS (5.29.2.7) */ } flag_t; #define CDIO_PREGAP_SECTORS 150 @@ -274,7 +273,7 @@ #define CD_FRAMESIZE_RAW CDIO_CD_FRAMESIZE_RAW #endif /*DO_NOT_WANT_PARANOIA_COMPATIBILITY*/ -#endif /* _CDIO_SECTOR_H_ */ +#endif /* CDIO_SECTOR_H_ */ /* diff --git a/include/cdio/track.h b/include/cdio/track.h index 3fd1f585..e5b9461a 100644 --- a/include/cdio/track.h +++ b/include/cdio/track.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2005, 2006, 2008 Rocky Bernstein + Copyright (C) 2005, 2006, 2008, 2012 Rocky Bernstein 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 @@ -18,8 +18,8 @@ /** \file track.h * \brief The top-level header for track-related libcdio calls. */ -#ifndef __CDIO_TRACK_H__ -#define __CDIO_TRACK_H__ +#ifndef CDIO_TRACK_H_ +#define CDIO_TRACK_H_ #ifdef __cplusplus extern "C" { @@ -34,8 +34,8 @@ extern "C" { 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. - */ + * of user data. + */ TRACK_FORMAT_ERROR /**< Dunno what is, or some other error. */ } track_format_t; @@ -51,8 +51,8 @@ extern "C" { track_flag_t preemphasis; /**< Linear preemphasis on an audio track */ track_flag_t copy_permit; /**< Whether copying is permitted */ int channels; /**< Number of audio channels, 2, 4. -2 if not - implemented or -1 for error. - */ + implemented or -1 for error. + */ } track_flags_t; /*! The leadout track is always 0xAA, regardless of # of tracks on @@ -70,7 +70,7 @@ extern "C" { extern enum cdio_track_enums { CDIO_CDROM_LBA = 0x01, /**< "logical block": first frame is #0 */ CDIO_CDROM_MSF = 0x02, /**< "minute-second-frame": binary, not - BCD here! */ + BCD here! */ CDIO_CDROM_DATA_TRACK = 0x04, CDIO_CDROM_CDI_TRACK = 0x10, CDIO_CDROM_XA_TRACK = 0x20, @@ -86,14 +86,14 @@ extern "C" { reference: MMC-3 draft revsion - 10g */ typedef enum { - AUDIO, /**< 2352 byte block length */ - MODE1, /**< 2048 byte block length */ - MODE1_RAW, /**< 2352 byte block length */ - MODE2, /**< 2336 byte block length */ - MODE2_FORM1, /**< 2048 byte block length */ - MODE2_FORM2, /**< 2324 byte block length */ - MODE2_FORM_MIX, /**< 2336 byte block length */ - MODE2_RAW /**< 2352 byte block length */ + AUDIO, /**< 2352 byte block length */ + MODE1, /**< 2048 byte block length */ + MODE1_RAW, /**< 2352 byte block length */ + MODE2, /**< 2336 byte block length */ + MODE2_FORM1, /**< 2048 byte block length */ + MODE2_FORM2, /**< 2324 byte block length */ + MODE2_FORM_MIX, /**< 2336 byte block length */ + MODE2_RAW /**< 2352 byte block length */ } trackmode_t; /*! @@ -130,7 +130,7 @@ extern "C" { if not an audio track? */ track_flag_t cdio_get_track_copy_permit(const CdIo_t *p_cdio, - track_t i_track); + track_t i_track); /*! Get the format (audio, mode2, mode1) of track. @@ -228,13 +228,13 @@ extern "C" { @return true if things worked or false if there is no track entry. */ bool cdio_get_track_msf(const CdIo_t *p_cdio, track_t i_track, - /*out*/ msf_t *msf); + /*out*/ msf_t *msf); /*! Get linear preemphasis status on an audio track This is not meaningful if not an audio track? */ track_flag_t cdio_get_track_preemphasis(const CdIo_t *p_cdio, - track_t i_track); + track_t i_track); /*! Get the number of sectors between this track an the next. This @@ -250,5 +250,4 @@ extern "C" { } #endif /* __cplusplus */ -#endif /* __CDIO_TRACK_H__ */ - +#endif /* CDIO_TRACK_H_ */ diff --git a/include/cdio/types.h b/include/cdio/types.h index 919d3cbe..7499884e 100644 --- a/include/cdio/types.h +++ b/include/cdio/types.h @@ -22,8 +22,8 @@ */ -#ifndef __CDIO_TYPES_H__ -#define __CDIO_TYPES_H__ +#ifndef CDIO_TYPES_H_ +#define CDIO_TYPES_H_ #ifdef __cplusplus extern "C" { @@ -265,10 +265,10 @@ typedef uint8_t ubyte; typedef int32_t lsn_t; /* Address in either MSF or logical format */ - union cdio_cdrom_addr + union cdio_cdrom_addr { - msf_t msf; - lba_t lba; + msf_t msf; + lba_t lba; }; /*! The type of a track number 0..99. */ @@ -325,20 +325,20 @@ typedef uint8_t ubyte; Q Sub-channel Control Field (4.2.3.3) */ typedef enum { - CDIO_TRACK_FLAG_NONE = 0x00, /**< no flags set */ - CDIO_TRACK_FLAG_PRE_EMPHASIS = 0x01, /**< audio track recorded with + CDIO_TRACK_FLAG_NONE = 0x00, /**< no flags set */ + CDIO_TRACK_FLAG_PRE_EMPHASIS = 0x01, /**< audio track recorded with pre-emphasis */ - CDIO_TRACK_FLAG_COPY_PERMITTED = 0x02, /**< digital copy permitted */ - CDIO_TRACK_FLAG_DATA = 0x04, /**< data track */ + CDIO_TRACK_FLAG_COPY_PERMITTED = 0x02, /**< digital copy permitted */ + CDIO_TRACK_FLAG_DATA = 0x04, /**< data track */ CDIO_TRACK_FLAG_FOUR_CHANNEL_AUDIO = 0x08, /**< 4 audio channels */ - CDIO_TRACK_FLAG_SCMS = 0x10 /**< SCMS (5.29.2.7) */ + CDIO_TRACK_FLAG_SCMS = 0x10 /**< SCMS (5.29.2.7) */ } cdio_track_flag; #ifdef __cplusplus } #endif /* __cplusplus */ -#endif /* __CDIO_TYPES_H__ */ +#endif /* CDIO_TYPES_H_ */ /* diff --git a/include/cdio/util.h b/include/cdio/util.h index 654a7684..4ac8f9b9 100644 --- a/include/cdio/util.h +++ b/include/cdio/util.h @@ -17,8 +17,8 @@ along with this program. If not, see . */ -#ifndef __CDIO_UTIL_H__ -#define __CDIO_UTIL_H__ +#ifndef CDIO_UTIL_H_ +#define CDIO_UTIL_H_ /*! \file util.h @@ -129,7 +129,7 @@ char *cdio_realpath (const char *psz_src, char *psz_dst); } #endif -#endif /* __CDIO_UTIL_H__ */ +#endif /* CDIO_UTIL_H_ */ /* diff --git a/include/cdio/xa.h b/include/cdio/xa.h index 13b21c8f..7dc95d88 100644 --- a/include/cdio/xa.h +++ b/include/cdio/xa.h @@ -1,7 +1,6 @@ /* - $Id: xa.h,v 1.19 2008/03/25 15:59:10 karl Exp $ - - Copyright (C) 2003, 2004, 2005, 2006, 2008 Rocky Bernstein + Copyright (C) 2003, 2004, 2005, 2006, 2008, 2012 + Rocky Bernstein Copyright (C) 2000 Herbert Valerio Riedel See also iso9660.h by Eric Youngdale (1993) and in cdrtools. These are @@ -31,8 +30,8 @@ */ -#ifndef __CDIO_XA_H__ -#define __CDIO_XA_H__ +#ifndef CDIO_XA_H_ +#define CDIO_XA_H_ #ifdef __cplusplus extern "C" { @@ -153,7 +152,7 @@ iso9660_get_xa_attr_str (uint16_t xa_attr); */ iso9660_xa_t * iso9660_xa_init (iso9660_xa_t *_xa, uint16_t uid, uint16_t gid, uint16_t attr, - uint8_t filenum); + uint8_t filenum); #ifdef __cplusplus } @@ -168,7 +167,7 @@ extern xa_misc_enum_t debugger_xa_misc_enum; #endif /* __cplusplus */ -#endif /* __CDIO_XA_H__ */ +#endif /* CDIO_XA_H_ */ /* * Local variables: diff --git a/lib/driver/_cdio_stdio.h b/lib/driver/_cdio_stdio.h index a2cd4c02..d3f805f1 100644 --- a/lib/driver/_cdio_stdio.h +++ b/lib/driver/_cdio_stdio.h @@ -1,7 +1,5 @@ /* - $Id: _cdio_stdio.h,v 1.3 2008/04/22 15:29:11 karl Exp $ - - Copyright (C) 2003, 2008 Rocky Bernstein + Copyright (C) 2003, 2008, 2012 Rocky Bernstein Copyright (C) 2000 Herbert Valerio Riedel This program is free software: you can redistribute it and/or modify @@ -19,8 +17,8 @@ */ -#ifndef __CDIO_STDIO_H__ -#define __CDIO_STDIO_H__ +#ifndef CDIO_STDIO_H_ +#define CDIO_STDIO_H_ #include "_cdio_stream.h" @@ -39,7 +37,7 @@ CdioDataSource_t * cdio_stdio_new(const char psz_path[]); void cdio_stdio_destroy(CdioDataSource_t *p_obj); -#endif /* __CDIO_STREAM_STDIO_H__ */ +#endif /* CDIO_STDIO_H_ */ /* diff --git a/lib/driver/_cdio_stream.h b/lib/driver/_cdio_stream.h index 313bc31f..defe1f2c 100644 --- a/lib/driver/_cdio_stream.h +++ b/lib/driver/_cdio_stream.h @@ -18,8 +18,8 @@ */ -#ifndef __CDIO_STREAM_H__ -#define __CDIO_STREAM_H__ +#ifndef CDIO_STREAM_H_ +#define CDIO_STREAM_H_ #include #include "cdio_private.h" @@ -126,7 +126,7 @@ extern "C" { } #endif /* __cplusplus */ -#endif /* __CDIO_STREAM_H__ */ +#endif /* CDIO_STREAM_H_ */ /* diff --git a/lib/driver/cdio_assert.h b/lib/driver/cdio_assert.h index 8967e27d..644a047f 100644 --- a/lib/driver/cdio_assert.h +++ b/lib/driver/cdio_assert.h @@ -16,8 +16,8 @@ along with this program. If not, see . */ -#ifndef __CDIO_ASSERT_H__ -#define __CDIO_ASSERT_H__ +#ifndef CDIO_ASSERT_H_ +#define CDIO_ASSERT_H_ #if defined(__GNUC__) && !defined(__MINGW32__) @@ -55,4 +55,4 @@ #endif -#endif /* __CDIO_ASSERT_H__ */ +#endif /* CDIO_ASSERT_H_ */ diff --git a/lib/driver/cdio_private.h b/lib/driver/cdio_private.h index e526c448..d0ae3f80 100644 --- a/lib/driver/cdio_private.h +++ b/lib/driver/cdio_private.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2003, 2004, 2005, 2008, 2009, 2011 + Copyright (C) 2003, 2004, 2005, 2008, 2009, 2011, 2012 Rocky Bernstein This program is free software: you can redistribute it and/or modify @@ -19,8 +19,8 @@ /* Internal routines for CD I/O drivers. */ -#ifndef __CDIO_PRIVATE_H__ -#define __CDIO_PRIVATE_H__ +#ifndef CDIO_DRIVER_PRIVATE_H_ +#define CDIO_DRIVER_PRIVATE_H_ #if defined(HAVE_CONFIG_H) && !defined(LIBCDIO_CONFIG_H) # include "config.h" @@ -62,7 +62,7 @@ extern "C" { */ driver_return_code_t (*audio_get_volume) - (void *p_env, /*out*/ cdio_audio_volume_t *p_volume); + (void *p_env, /*out*/ cdio_audio_volume_t *p_volume); /*! Pause playing CD through analog output @@ -77,8 +77,8 @@ extern "C" { @param p_env the CD object to be acted upon. */ driver_return_code_t (*audio_play_msf) ( void *p_env, - msf_t *p_start_msf, - msf_t *p_end_msf ); + msf_t *p_start_msf, + msf_t *p_end_msf ); /*! Playing CD through analog output @@ -86,7 +86,7 @@ extern "C" { @param p_env the CD object to be acted upon. */ driver_return_code_t (*audio_play_track_index) - ( void *p_env, cdio_track_index_t *p_track_index ); + ( void *p_env, cdio_track_index_t *p_track_index ); /*! Get subchannel information. @@ -94,7 +94,7 @@ extern "C" { @param p_env the CD object to be acted upon. */ driver_return_code_t (*audio_read_subchannel) - ( void *p_env, cdio_subchannel_t *subchannel ); + ( void *p_env, cdio_subchannel_t *subchannel ); /*! Resume playing an audio CD. @@ -111,7 +111,7 @@ extern "C" { */ driver_return_code_t (*audio_set_volume) - ( void *p_env, cdio_audio_volume_t *p_volume ); + ( void *p_env, cdio_audio_volume_t *p_volume ); /*! Stop playing an audio CD. @@ -204,9 +204,9 @@ extern "C" { See cd_types.h for a list of bitmasks for the drive type; */ void (*get_drive_cap) (const void *p_env, - cdio_drive_read_cap_t *p_read_cap, - cdio_drive_write_cap_t *p_write_cap, - cdio_drive_misc_cap_t *p_misc_cap); + cdio_drive_read_cap_t *p_read_cap, + cdio_drive_write_cap_t *p_write_cap, + cdio_drive_misc_cap_t *p_misc_cap); /*! Return the number of of the first track. CDIO_INVALID_TRACK is returned on error. @@ -218,16 +218,16 @@ extern "C" { False is returned if we had an error getting the information. */ bool (*get_hwinfo) - ( const CdIo_t *p_cdio, /* out*/ cdio_hwinfo_t *p_hw_info ); + ( const CdIo_t *p_cdio, /* out*/ cdio_hwinfo_t *p_hw_info ); /*! Get the LSN of the first track of the last session of on the CD. - + @param p_cdio the CD object to be acted upon. @param i_last_session pointer to the session number to be returned. */ driver_return_code_t (*get_last_session) - ( void *p_env, /*out*/ lsn_t *i_last_session ); + ( void *p_env, /*out*/ lsn_t *i_last_session ); /*! Find out if media has changed since the last call. @@ -315,7 +315,7 @@ extern "C" { audio track? */ track_flag_t (*get_track_preemphasis) - ( const void *p_env, track_t i_track ); + ( const void *p_env, track_t i_track ); /*! lseek - reposition read/write file offset @@ -336,7 +336,7 @@ extern "C" { from lsn. Returns 0 if no error. */ int (*read_audio_sectors) ( void *p_env, void *p_buf, lsn_t i_lsn, - unsigned int i_blocks ); + unsigned int i_blocks ); /*! Read a data sector @@ -356,15 +356,15 @@ extern "C" { M2RAW_SECTOR_SIZE, or M2F2_SECTOR_SIZE. See comment above under p_buf. */ driver_return_code_t (*read_data_sectors) - ( void *p_env, void *p_buf, lsn_t i_lsn, uint16_t i_blocksize, - uint32_t i_blocks ); + ( void *p_env, void *p_buf, lsn_t i_lsn, uint16_t i_blocksize, + uint32_t i_blocks ); /*! Reads a single mode2 sector from cd device into buf starting from lsn. Returns 0 if no error. */ int (*read_mode2_sector) - ( void *p_env, void *p_buf, lsn_t i_lsn, bool b_mode2_form2 ); + ( void *p_env, void *p_buf, lsn_t i_lsn, bool b_mode2_form2 ); /*! Reads i_blocks of mode2 sectors from cd device into data starting @@ -372,15 +372,15 @@ extern "C" { Returns 0 if no error. */ int (*read_mode2_sectors) - ( void *p_env, void *p_buf, lsn_t i_lsn, bool b_mode2_form2, - unsigned int i_blocks ); + ( void *p_env, void *p_buf, lsn_t i_lsn, bool b_mode2_form2, + unsigned int i_blocks ); /*! Reads a single mode1 sector from cd device into buf starting from lsn. Returns 0 if no error. */ int (*read_mode1_sector) - ( void *p_env, void *p_buf, lsn_t i_lsn, bool mode1_form2 ); + ( void *p_env, void *p_buf, lsn_t i_lsn, bool mode1_form2 ); /*! Reads i_blocks of mode1 sectors from cd device into data starting @@ -388,24 +388,24 @@ extern "C" { Returns 0 if no error. */ int (*read_mode1_sectors) - ( void *p_env, void *p_buf, lsn_t i_lsn, bool mode1_form2, - unsigned int i_blocks ); + ( void *p_env, void *p_buf, lsn_t i_lsn, bool mode1_form2, + unsigned int i_blocks ); bool (*read_toc) ( void *p_env ) ; /*! Run a SCSI MMC command. - cdio CD structure set by cdio_open(). + cdio CD structure set by cdio_open(). i_timeout_ms time in milliseconds we will wait for the command to complete. cdb_len number of bytes in cdb (6, 10, or 12). - cdb CDB bytes. All values that are needed should be set on + cdb CDB bytes. All values that are needed should be set on input. - b_return_data TRUE if the command expects data to be returned in + b_return_data TRUE if the command expects data to be returned in the buffer - len Size of buffer - buf Buffer for data, both sending and receiving + len Size of buffer + buf Buffer for data, both sending and receiving Returns 0 if command completed successfully. */ @@ -420,7 +420,7 @@ extern "C" { Set the blocksize for subsequent reads. */ driver_return_code_t (*set_blocksize) ( void *p_env, - uint16_t i_blocksize ); + uint16_t i_blocksize ); /*! Set the drive speed. @@ -437,7 +437,7 @@ extern "C" { struct _CdIo { driver_id_t driver_id; /**< Particular driver opened. */ cdio_funcs_t op; /**< driver-specific routines handling - implementation*/ + implementation*/ void *env; /**< environment. Passed to routine above. */ }; @@ -464,7 +464,7 @@ extern "C" { bool (*have_driver) (void); CdIo_t *(*driver_open) (const char *psz_source_name); CdIo_t *(*driver_open_am) (const char *psz_source_name, - const char *psz_access_mode); + const char *psz_access_mode); char *(*get_default_device) (void); bool (*is_device) (const char *psz_source_name); char **(*get_devices) (void); @@ -489,7 +489,7 @@ extern "C" { Use cdio_free_device_list() to free this device_list. */ void cdio_add_device_list(char **device_list[], const char *psz_drive, - unsigned int *i_drives); + unsigned int *i_drives); driver_return_code_t close_tray_bsdi (const char *psz_drive); driver_return_code_t close_tray_freebsd (const char *psz_drive); @@ -512,7 +512,7 @@ extern "C" { @see cdio_open_cd, cdio_open */ CdIo_t * cdio_open_am_netbsd (const char *psz_source, - const char *psz_access_mode); + const char *psz_access_mode); /*! DEPRICATED: use cdio_have_driver(). True if AIX driver is available. */ @@ -559,4 +559,4 @@ extern "C" { } #endif /* __cplusplus */ -#endif /* __CDIO_PRIVATE_H__ */ +#endif /* CDIO_DRIVER_PRIVATE_H_ */ diff --git a/lib/driver/cdtext_private.h b/lib/driver/cdtext_private.h index 518a3cf9..38cca509 100644 --- a/lib/driver/cdtext_private.h +++ b/lib/driver/cdtext_private.h @@ -1,5 +1,6 @@ /* - Copyright (C) 2004, 2005, 2008, 2011 Rocky Bernstein + Copyright (C) 2004, 2005, 2008, 2011, 2012 + Rocky Bernstein 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 @@ -15,8 +16,8 @@ along with this program. If not, see . */ -#ifndef __CDIO_CDTEXT_PRIVATE_H__ -#define __CDIO_CDTEXT_PRIVATE_H__ +#ifndef CDIO_DRIVER_CDTEXT_PRIVATE_H_ +#define CDIO_DRIVER_CDTEXT_PRIVATE_H_ #include @@ -136,7 +137,7 @@ cdtext_field_t cdtext_is_field (const char *field); cdtext_lang_t cdtext_is_language (const char *lang); -#endif /* __CDIO_CDTEXT_PRIVATE_H__ */ +#endif /* CDIO_DRIVER_CDTEXT_PRIVATE_H_ */ /* * Local variables: diff --git a/lib/driver/filemode.h b/lib/driver/filemode.h index 7ca25ba7..a06f72c9 100644 --- a/lib/driver/filemode.h +++ b/lib/driver/filemode.h @@ -1,7 +1,7 @@ /* filemode.h -- file modes common definitions - Copyright (C) 2005, 2008, 2011 Rocky Bernstein + Copyright (C) 2005, 2008, 2011, 2012 Rocky Bernstein Copyright (C) 1985, 1990, 1993, 1998-2000 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -18,8 +18,8 @@ along with this program. If not, see . */ -#ifndef __FILEMODE_H__ -#define __FILEMODE_H__ +#ifndef CDIO_DRIVER_FILEMODE_H_ +#define CDIO_DRIVER_FILEMODE_H_ #ifdef HAVE_SYS_STAT_H #include @@ -131,4 +131,4 @@ # define S_ISCTG(m) (((m) & S_IFMT) == S_IFCTG) #endif -#endif /* __FILEMODE_H__ */ +#endif /* CDIO_DRIVER_FILEMODE_H_ */ diff --git a/lib/driver/generic.h b/lib/driver/generic.h index e0dd2618..1f435d61 100644 --- a/lib/driver/generic.h +++ b/lib/driver/generic.h @@ -1,5 +1,6 @@ /* - Copyright (C) 2004, 2005, 2006, 2008, 2009 Rocky Bernstein + Copyright (C) 2004, 2005, 2006, 2008, 2009, 2012 + Rocky Bernstein 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 @@ -18,8 +19,8 @@ /* Internal routines for CD I/O drivers. */ -#ifndef __CDIO_GENERIC_H__ -#define __CDIO_GENERIC_H__ +#ifndef CDIO_DRIVER_GENERIC_H_ +#define CDIO_DRIVER_GENERIC_H_ #if defined(HAVE_CONFIG_H) && !defined(LIBCDIO_CONFIG_H) # include "config.h" @@ -57,7 +58,7 @@ extern "C" { track_t i_tracks; /**< The number of tracks. */ uint8_t i_joliet_level; /**< 0 = no Joliet extensions. - 1-3: Joliet level. */ + 1-3: Joliet level. */ iso9660_pvd_t pvd; iso9660_svd_t svd; CdIo_t *cdio; /**< a way to call general cdio routines. */ @@ -208,7 +209,7 @@ extern "C" { Is this meaningful if not an audio track? */ track_flag_t get_track_copy_permit_generic(void *p_user_data, - track_t i_track); + track_t i_track); /*! Return 1 if track has pre-emphasis, 0 if not, or -1 for error. Is this meaningful if not an audio track? @@ -216,7 +217,7 @@ extern "C" { pre-emphasis is a non linear frequency response. */ track_flag_t get_track_preemphasis_generic(const void *p_user_data, - track_t i_track); + track_t i_track); /*! Read cdtext information for a CdIo object . @@ -230,14 +231,14 @@ extern "C" { /*! Read mode 1 or mode2 sectors (using cooked mode). */ driver_return_code_t read_data_sectors_generic (void *p_user_data, - void *p_buf, lsn_t i_lsn, - uint16_t i_blocksize, - uint32_t i_blocks); + void *p_buf, lsn_t i_lsn, + uint16_t i_blocksize, + uint32_t i_blocks); #ifdef __cplusplus } #endif /* __cplusplus */ -#endif /* __CDIO_GENERIC_H__ */ +#endif /* CDIO_DRIVER_GENERIC_H_ */ /* diff --git a/lib/driver/image.h b/lib/driver/image.h index 9f80777b..1db3a99f 100644 --- a/lib/driver/image.h +++ b/lib/driver/image.h @@ -1,5 +1,6 @@ /* - Copyright (C) 2004, 2005, 2008, 2011 Rocky Bernstein + Copyright (C) 2004, 2005, 2008, 2011, 2012 + Rocky Bernstein 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 @@ -21,8 +22,8 @@ defined before it is included. */ -#ifndef __CDIO_IMAGE_H__ -#define __CDIO_IMAGE_H__ +#ifndef CDIO_DRIVER_IMAGE_H_ +#define CDIO_DRIVER_IMAGE_H_ #if defined(HAVE_CONFIG_H) && !defined(__CDIO_CONFIG_H__) # include "config.h" @@ -46,34 +47,34 @@ typedef struct { msf_t start_msf; lba_t start_lba; int start_index; - lba_t pregap; /**< pre-gap */ - lba_t silence; /**< pre-gap with zero audio data */ + lba_t pregap; /**< pre-gap */ + lba_t silence; /**< pre-gap with zero audio data */ int sec_count; /**< Number of sectors in this track. Does not - include pregap */ + include pregap */ int num_indices; flag_t flags; /**< "[NO] COPY", "4CH", "[NO] PREMPAHSIS" */ - char *isrc; /**< IRSC Code (5.22.4) exactly 12 bytes */ + char *isrc; /**< IRSC Code (5.22.4) exactly 12 bytes */ char *filename; CdioDataSource_t *data_source; off_t offset; /**< byte offset into data_start of track - beginning. In cdrdao for example, one - filename may cover many tracks and - each track would then have a different - offset. - */ + beginning. In cdrdao for example, one + filename may cover many tracks and + each track would then have a different + offset. + */ track_format_t track_format; bool track_green; trackmode_t mode; uint16_t datasize; /**< How much is in the portion we return - back? */ + back? */ uint16_t datastart; /**< Offset from begining of frame - that data starts */ + that data starts */ uint16_t endsize; /**< How much stuff at the end to skip over. - This stuff may have error correction - (EDC, or ECC).*/ + This stuff may have error correction + (EDC, or ECC).*/ uint16_t blocksize; /**< total block size = start + size + end */ } track_info_t; -#endif /* __CDIO_IMAGE_H__ */ +#endif /* CDIO_DRIVER_IMAGE_H_ */ diff --git a/lib/driver/image_common.h b/lib/driver/image_common.h index 8362bc6c..3177b3f6 100644 --- a/lib/driver/image_common.h +++ b/lib/driver/image_common.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2004, 2005, 2008 Rocky Bernstein + Copyright (C) 2004, 2005, 2008, 2012 Rocky Bernstein 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 @@ -24,8 +24,8 @@ image.h */ -#ifndef __CDIO_IMAGE_COMMON_H__ -#define __CDIO_IMAGE_COMMON_H__ +#ifndef CDIO_DRIVER_IMAGE_COMMON_H_ +#define CDIO_DRIVER_IMAGE_COMMON_H_ typedef struct { /* Things common to all drivers like this. @@ -35,20 +35,20 @@ typedef struct { char *psz_cue_name; char *psz_access_mode; /* Just the name of the driver. - We add this for regularity with other - real CD drivers which has an access mode. - */ + We add this for regularity with other + real CD drivers which has an access mode. + */ char *psz_mcn; /* Media Catalog Number (5.22.3) - exactly 13 bytes */ + exactly 13 bytes */ track_info_t tocent[CDIO_CD_MAX_TRACKS+1]; /* entry info for each track - add 1 for leadout. */ + add 1 for leadout. */ discmode_t disc_mode; #ifdef NEED_NERO_STRUCT /* Nero Specific stuff. Note: for the image_free to work, this *must* be last. */ bool is_dao; /* True if some of disk at once. False - if some sort of track at once. */ + if some sort of track at once. */ uint32_t mtyp; /* Value of MTYP (media type?) tag */ uint8_t dtyp; /* Value of DAOX media type tag */ @@ -91,9 +91,9 @@ discmode_t _get_discmode_image (void *p_user_data); */ void _get_drive_cap_image (const void *user_data, - cdio_drive_read_cap_t *p_read_cap, - cdio_drive_write_cap_t *p_write_cap, - cdio_drive_misc_cap_t *p_misc_cap); + cdio_drive_read_cap_t *p_read_cap, + cdio_drive_write_cap_t *p_write_cap, + cdio_drive_misc_cap_t *p_misc_cap); /*! Return the number of of the first track. @@ -151,7 +151,7 @@ track_flag_t get_track_copy_permit_image(void *p_user_data, track_t i_track); pre-emphasis is a non linear frequency response. */ track_flag_t get_track_preemphasis_image(const void *p_user_data, - track_t i_track); + track_t i_track); /*! Return the starting LBA for the pregap for track number i_track. Track numbers start at 1. @@ -190,8 +190,8 @@ char *get_track_isrc_image(const void *p_user_data, track_t i_track); */ driver_return_code_t read_data_sectors_image ( void *p_user_data, void *p_buf, - lsn_t i_lsn, uint16_t i_blocksize, - uint32_t i_blocks ); + lsn_t i_lsn, uint16_t i_blocksize, + uint32_t i_blocks ); /*! Set the arg "key" with "value" in the source device. @@ -202,4 +202,4 @@ read_data_sectors_image ( void *p_user_data, void *p_buf, */ int _set_arg_image (void *user_data, const char key[], const char value[]); -#endif /* __CDIO_IMAGE_COMMON_H__ */ +#endif /* CDIO_DRIVER_IMAGE_COMMON_H_ */ diff --git a/lib/driver/mmc/mmc_cmd_helper.h b/lib/driver/mmc/mmc_cmd_helper.h index 56a3f143..f77f8c34 100644 --- a/lib/driver/mmc/mmc_cmd_helper.h +++ b/lib/driver/mmc/mmc_cmd_helper.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2010 Rocky Bernstein + Copyright (C) 2010, 2012 Rocky Bernstein 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 @@ -15,8 +15,8 @@ along with this program. If not, see . */ -#ifndef __CDIO_MMC_CMD_HELPER_H__ -#define __CDIO_MMC_CMD_HELPER_H__ +#ifndef CDIO_DRIVER_MMC_CMD_HELPER_H_ +#define CDIO_DRIVER_MMC_CMD_HELPER_H_ /* Boilerplate initialization code to setup running MMC command. We assume variables 'p_cdio', 'p_buf', and 'i_size' are previously @@ -27,22 +27,22 @@ 3. zeros the buffer (p_buf) using i_size. 4. Sets up the command field of cdb to passed in value mmc_cmd. */ -#define MMC_CMD_SETUP(mmc_cmd) \ - mmc_cdb_t cdb = {{0, }}; \ - \ - if ( ! p_cdio ) return DRIVER_OP_UNINIT; \ - if ( ! p_cdio->op.run_mmc_cmd ) return DRIVER_OP_UNSUPPORTED; \ - \ - CDIO_MMC_SET_COMMAND(cdb.field, mmc_cmd) +#define MMC_CMD_SETUP(mmc_cmd) \ + mmc_cdb_t cdb = {{0, }}; \ + \ + if ( ! p_cdio ) return DRIVER_OP_UNINIT; \ + if ( ! p_cdio->op.run_mmc_cmd ) return DRIVER_OP_UNSUPPORTED; \ + \ + CDIO_MMC_SET_COMMAND(cdb.field, mmc_cmd) /* Boilerplate initialization code to setup running MMC read command needs to set the cdb 16-bit length field. See above comment for MMC_CMD_SETUP. */ -#define MMC_CMD_SETUP_READ16(mmc_cmd) \ - MMC_CMD_SETUP(mmc_cmd); \ - \ - /* Setup to read header, to get length of data */ \ +#define MMC_CMD_SETUP_READ16(mmc_cmd) \ + MMC_CMD_SETUP(mmc_cmd); \ + \ + /* Setup to read header, to get length of data */ \ CDIO_MMC_SET_READ_LENGTH16(cdb.field, i_size) /* Boilerplate code to run a MMC command. @@ -53,11 +53,11 @@ 'direction' is the SCSI direction (read, write, none) of the command. */ -#define MMC_RUN_CMD(direction, i_timeout) \ - p_cdio->op.run_mmc_cmd(p_cdio->env, \ - i_timeout, \ - mmc_get_cmd_len(cdb.field[0]), \ - &cdb, \ - direction, i_size, p_buf) +#define MMC_RUN_CMD(direction, i_timeout) \ + p_cdio->op.run_mmc_cmd(p_cdio->env, \ + i_timeout, \ + mmc_get_cmd_len(cdb.field[0]), \ + &cdb, \ + direction, i_size, p_buf) -#endif /* __CDIO_MMC_CMD_HELPER_H__ */ +#endif /* CDIO_DRIVER_MMC_CMD_HELPER_H_ */ diff --git a/lib/driver/portable.h b/lib/driver/portable.h index 0c005fe9..8b0ad7ba 100644 --- a/lib/driver/portable.h +++ b/lib/driver/portable.h @@ -21,8 +21,8 @@ included other routines can be more portable. */ -#ifndef __CDIO_PORTABLE_H__ -#define __CDIO_PORTABLE_H__ +#ifndef CDIO_DRIVER_PORTABLE_H_ +#define CDIO_DRIVER_PORTABLE_H_ #if defined(HAVE_CONFIG_H) && !defined(__CDIO_CONFIG_H__) # include "config.h" @@ -51,4 +51,4 @@ # define drand48() (rand() / (double)RAND_MAX) #endif -#endif /* __CDIO_PORTABLE_H__ */ +#endif /* CDIO_DRIVER_PORTABLE_H_ */ diff --git a/lib/iso9660/iso9660_private.h b/lib/iso9660/iso9660_private.h index 20ea2b4e..e798ec75 100644 --- a/lib/iso9660/iso9660_private.h +++ b/lib/iso9660/iso9660_private.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2003, 2004, 2005, 2008, 2011 + Copyright (C) 2003, 2004, 2005, 2008, 2011, 2012 Rocky Bernstein Copyright (C) 2000 Herbert Valerio Riedel @@ -22,8 +22,8 @@ along with this program. If not, see . */ -#ifndef __CDIO_ISO9660_PRIVATE_H__ -#define __CDIO_ISO9660_PRIVATE_H__ +#ifndef CDIO_ISO9660_ISO9660_PRIVATE_H_ +#define CDIO_ISO9660_ISO9660_PRIVATE_H_ #if defined(HAVE_CONFIG_H) && !defined(__CDIO_CONFIG_H__) # include "config.h" @@ -71,7 +71,7 @@ typedef struct iso_path_table_s { PRAGMA_END_PACKED -#endif /* __CDIO_ISO9660_PRIVATE_H__ */ +#endif /* CDIO_ISO0660_ISO9660_PRIVATE_H_ */ /* diff --git a/lib/udf/udf_fs.h b/lib/udf/udf_fs.h index 80e99554..913953b8 100644 --- a/lib/udf/udf_fs.h +++ b/lib/udf/udf_fs.h @@ -1,7 +1,5 @@ /* - $Id: udf_fs.h,v 1.3 2008/04/18 16:02:10 karl Exp $ - - Copyright (C) 2006, 2008 Rocky Bernstein + Copyright (C) 2006, 2008, 2012 Rocky Bernstein 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 @@ -17,8 +15,8 @@ along with this program. If not, see . */ -#ifndef __CDIO_UDF_FS_H__ -#define __CDIO_UDF_FS_H__ +#ifndef CDIO_UDF_UDF_FS_H_ +#define CDIO_UDF_UDF_FS_H_ #include /** @@ -27,7 +25,7 @@ */ int udf_checktag(const udf_tag_t *p_tag, udf_Uint16_t tag_id); -#endif /* __CDIO_UDF_FS_H__ */ +#endif /* CDIO_UDF_UDF_FS_H_ */ /* diff --git a/lib/udf/udf_private.h b/lib/udf/udf_private.h index 559b1d48..d61cc911 100644 --- a/lib/udf/udf_private.h +++ b/lib/udf/udf_private.h @@ -15,8 +15,8 @@ along with this program. If not, see . */ -#ifndef __CDIO_UDF_PRIVATE_H__ -#define __CDIO_UDF_PRIVATE_H__ +#ifndef CDIO_UDF_UDF_PRIVATE_H_ +#define CDIO_UDF_UDF_PRIVATE_H_ #if defined(HAVE_CONFIG_H) && !defined(LIBCDIO_CONFIG_H) && !defined(__CDIO_CONFIG_H__) # include "config.h" @@ -43,7 +43,7 @@ struct udf_s { uint32_t fsd_offset; /* lba of fileset descriptor */ }; -#endif /* __CDIO_UDF_PRIVATE_H__ */ +#endif /* CDIO_UDF_UDF_PRIVATE_H_ */ /* diff --git a/src/getopt.h b/src/getopt.h index c40f6543..e4ebccbf 100644 --- a/src/getopt.h +++ b/src/getopt.h @@ -19,10 +19,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef _GETOPT_H -#define _GETOPT_H 1 +#ifndef CDIO_SRC_GETOPT_H +#define CDIO_SRC_GETOPT_H 1 -#ifdef __cplusplus +#ifdef __cplusplus extern "C" { #endif @@ -63,9 +63,9 @@ extern int optopt; zero. The field `has_arg' is: - no_argument (or 0) if the option does not take an argument, - required_argument (or 1) if the option requires an argument, - optional_argument (or 2) if the option takes an optional argument. + no_argument (or 0) if the option does not take an argument, + required_argument (or 1) if the option requires an argument, + optional_argument (or 2) if the option takes an optional argument. If the field `flag' is not NULL, it points to a variable that is set to the value given in the field `val' when the option is found, but @@ -94,9 +94,9 @@ struct option /* Names for the values of the `has_arg' field of `struct option'. */ -#define no_argument 0 -#define required_argument 1 -#define optional_argument 2 +#define no_argument 0 +#define required_argument 1 +#define optional_argument 2 #if defined (__STDC__) && __STDC__ #if defined (__GNU_LIBRARY__) || defined (__MINGW32__) @@ -108,26 +108,26 @@ extern int getopt (int argc, char *const *argv, const char *shortopts); extern int getopt (); #endif /* __GNU_LIBRARY__ */ extern int getopt_long (int argc, char *const *argv, const char *shortopts, - const struct option *longopts, int *longind); + const struct option *longopts, int *longind); extern int getopt_long_only (int argc, char *const *argv, - const char *shortopts, - const struct option *longopts, int *longind); + const char *shortopts, + const struct option *longopts, int *longind); /* Internal only. Users should not call this directly. */ extern int _getopt_internal (int argc, char *const *argv, - const char *shortopts, - const struct option *longopts, int *longind, - int long_only); + const char *shortopts, + const struct option *longopts, int *longind, + int long_only); #else /* not __STDC__ */ -extern int getopt (); -extern int getopt_long (); -extern int getopt_long_only (); +extern int getopt(); +extern int getopt_long(); +extern int getopt_long_only(); -extern int _getopt_internal (); +extern int _getopt_internal(); #endif /* __STDC__ */ -#ifdef __cplusplus +#ifdef __cplusplus } #endif -#endif /* getopt.h */ +#endif /* CDIO_SRC_GETOPT_H */ From a834f98bc843a161e884b9f1a19c3d80abf3df1b Mon Sep 17 00:00:00 2001 From: "R. Bernstein" Date: Sun, 18 Mar 2012 13:27:12 -0400 Subject: [PATCH 07/18] Recent header work by Pete Batard eliminates the need to set __CDIO_H__ here. --- example/audio.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/example/audio.c b/example/audio.c index 6951bd51..b92412ed 100644 --- a/example/audio.c +++ b/example/audio.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2005, 2008, 2009 Rocky Bernstein + Copyright (C) 2005, 2008, 2009, 2012 Rocky Bernstein Adapted from Gerd Knorr's player.c program Copyright (C) 1997, 1998 @@ -24,7 +24,6 @@ */ #ifdef HAVE_CONFIG_H #include "config.h" -#define __CDIO_CONFIG_H__ 1 #endif #ifdef HAVE_STDIO_H From 70a56315ac97c82f688cb2bc35696dc744651973 Mon Sep 17 00:00:00 2001 From: "R. Bernstein" Date: Sun, 18 Mar 2012 13:34:21 -0400 Subject: [PATCH 08/18] Replace a few collections of preprocessor #define's with enum's. Savannah bug #35746 https://savannah.gnu.org/bugs/?35746 . Patch from Markus Elfring. --- include/cdio/dvd.h | 39 ++++++++++++++++++++++----------------- include/cdio/sector.h | 23 ++++++++++++++--------- 2 files changed, 36 insertions(+), 26 deletions(-) diff --git a/include/cdio/dvd.h b/include/cdio/dvd.h index bc337944..9d3f3389 100644 --- a/include/cdio/dvd.h +++ b/include/cdio/dvd.h @@ -35,27 +35,32 @@ /** Values used in a READ DVD STRUCTURE */ - -#define CDIO_DVD_STRUCT_PHYSICAL 0x00 -#define CDIO_DVD_STRUCT_COPYRIGHT 0x01 -#define CDIO_DVD_STRUCT_DISCKEY 0x02 -#define CDIO_DVD_STRUCT_BCA 0x03 -#define CDIO_DVD_STRUCT_MANUFACT 0x04 +typedef enum cdio_dvd_structure +{ + CDIO_DVD_STRUCT_PHYSICAL = 0x00, + CDIO_DVD_STRUCT_COPYRIGHT = 0x01, + CDIO_DVD_STRUCT_DISCKEY = 0x02, + CDIO_DVD_STRUCT_BCA = 0x03, + CDIO_DVD_STRUCT_MANUFACT = 0x04 +} cdio_dvd_structure; /** Media definitions for "DVD Book" from MMC-5 Table 400, page 419. */ -#define CDIO_DVD_BOOK_DVD_ROM 0x0 /**< DVD-ROM */ -#define CDIO_DVD_BOOK_DVD_RAM 0x1 /**< DVD-RAM */ -#define CDIO_DVD_BOOK_DVD_R 0x2 /**< DVD-R */ -#define CDIO_DVD_BOOK_DVD_RW 0x3 /**< DVD-RW */ -#define CDIO_DVD_BOOK_HD_DVD_ROM 0x4 /**< HD DVD-ROM */ -#define CDIO_DVD_BOOK_HD_DVD_RAM 0x5 /**< HD DVD-RAM */ -#define CDIO_DVD_BOOK_HD_DVD_R 0x6 /**< HD DVD-R */ -#define CDIO_DVD_BOOK_DVD_PRW 0x9 /**< DVD+RW */ -#define CDIO_DVD_BOOK_DVD_PR 0xa /**< DVD+R */ -#define CDIO_DVD_BOOK_DVD_PRW_DL 0xd /**< DVD+RW DL */ -#define CDIO_DVD_BOOK_DVD_PR_DL 0xe /**< DVD+R DL */ +typedef enum cdio_dvd_book +{ + CDIO_DVD_BOOK_DVD_ROM = 0x0, /**< DVD-ROM */ + CDIO_DVD_BOOK_DVD_RAM = 0x1, /**< DVD-RAM */ + CDIO_DVD_BOOK_DVD_R = 0x2, /**< DVD-R */ + CDIO_DVD_BOOK_DVD_RW = 0x3, /**< DVD-RW */ + CDIO_DVD_BOOK_HD_DVD_ROM = 0x4, /**< HD DVD-ROM */ + CDIO_DVD_BOOK_HD_DVD_RAM = 0x5, /**< HD DVD-RAM */ + CDIO_DVD_BOOK_HD_DVD_R = 0x6, /**< HD DVD-R */ + CDIO_DVD_BOOK_DVD_PRW = 0x9, /**< DVD+RW */ + CDIO_DVD_BOOK_DVD_PR = 0xa, /**< DVD+R */ + CDIO_DVD_BOOK_DVD_PRW_DL = 0xd, /**< DVD+RW DL */ + CDIO_DVD_BOOK_DVD_PR_DL = 0xe /**< DVD+R DL */ +} cdio_dvd_book; typedef struct cdio_dvd_layer { unsigned int book_version : 4; diff --git a/include/cdio/sector.h b/include/cdio/sector.h index c3644209..86857159 100644 --- a/include/cdio/sector.h +++ b/include/cdio/sector.h @@ -68,10 +68,13 @@ /*! Information that can be obtained through a Read Subchannel command. */ -#define CDIO_SUBCHANNEL_SUBQ_DATA 0 -#define CDIO_SUBCHANNEL_CURRENT_POSITION 1 -#define CDIO_SUBCHANNEL_MEDIA_CATALOG 2 -#define CDIO_SUBCHANNEL_TRACK_ISRC 3 + typedef enum cdio_subchannel + { + CDIO_SUBCHANNEL_SUBQ_DATA = 0, + CDIO_SUBCHANNEL_CURRENT_POSITION = 1, + CDIO_SUBCHANNEL_MEDIA_CATALOG = 2, + CDIO_SUBCHANNEL_TRACK_ISRC = 3 + } cdio_subchannel; /*! track flags * Q Sub-channel Control Field (4.2.3.3) @@ -198,12 +201,14 @@ #define CDIO_CD_FRAMES_PER_MIN \ (CDIO_CD_FRAMES_PER_SEC*CDIO_CD_SECS_PER_MIN) -#define CDIO_CD_74MIN_SECTORS (UINT32_C(74)*CDIO_CD_FRAMES_PER_MIN) -#define CDIO_CD_80MIN_SECTORS (UINT32_C(80)*CDIO_CD_FRAMES_PER_MIN) -#define CDIO_CD_90MIN_SECTORS (UINT32_C(90)*CDIO_CD_FRAMES_PER_MIN) +typedef enum cdio_cd_minutes_sectors +{ + CDIO_CD_74MIN_SECTORS = UINT32_C(74) * CDIO_CD_FRAMES_PER_MIN, + CDIO_CD_80MIN_SECTORS = UINT32_C(80) * CDIO_CD_FRAMES_PER_MIN, + CDIO_CD_90MIN_SECTORS = UINT32_C(90) * CDIO_CD_FRAMES_PER_MIN, -#define CDIO_CD_MAX_SECTORS \ - (UINT32_C(100)*CDIO_CD_FRAMES_PER_MIN-CDIO_PREGAP_SECTORS) + CDIO_CD_MAX_SECTORS = UINT32_C(100) * CDIO_CD_FRAMES_PER_MIN - CDIO_PREGAP_SECTORS +} cdio_cd_minutes_sectors; #define msf_t_SIZEOF 3 From 4684fb002ac22ae917c2199ca00e957ec942fd60 Mon Sep 17 00:00:00 2001 From: "R. Bernstein" Date: Sun, 18 Mar 2012 22:45:08 -0400 Subject: [PATCH 09/18] Small changes. --- include/cdio/Makefile.am | 3 +- include/cdio/cdda.h | 411 --------------------------------------- test/check_cue.sh.in | 6 +- 3 files changed, 5 insertions(+), 415 deletions(-) delete mode 100644 include/cdio/cdda.h diff --git a/include/cdio/Makefile.am b/include/cdio/Makefile.am index 7280a726..da4c4f42 100644 --- a/include/cdio/Makefile.am +++ b/include/cdio/Makefile.am @@ -1,4 +1,5 @@ -# Copyright (C) 2003, 2004, 2006, 2008, 2011 Rocky Bernstein +# Copyright (C) 2003, 2004, 2006, 2008, 2011, 2012 +# Rocky Bernstein # # 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 diff --git a/include/cdio/cdda.h b/include/cdio/cdda.h deleted file mode 100644 index c30e129d..00000000 --- a/include/cdio/cdda.h +++ /dev/null @@ -1,411 +0,0 @@ -/* - $Id: cdda.h,v 1.30 2008/03/25 15:59:08 karl Exp $ - - Copyright (C) 2004, 2005, 2006, 2008 Rocky Bernstein - Copyright (C) 2001 Xiph.org and Heiko Eissfeldt heiko@escape.colossus.de - - 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 3 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, see . -*/ - -/** \file cdda.h - * - * \brief The top-level interface header for libcdio_cdda. - * Applications include this for paranoia access. - * - ******************************************************************/ - -#ifndef _CDDA_INTERFACE_H_ -#define _CDDA_INTERFACE_H_ - -#include - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - /** cdrom_paranoia is an opaque structure which is used in all of the - library operations. - */ - typedef struct cdrom_paranoia_s cdrom_paranoia_t; - typedef struct cdrom_drive_s cdrom_drive_t; - - /** For compatibility. cdrom_drive_t is deprecated, use cdrom_drive_t - instead. */ - - /** - Flags for simulating jitter used in testing. - - The enumeration type one probably wouldn't really use in a program. - It is here instead of defines to give symbolic names that can be - helpful in debuggers where wants just to say refer to - CDDA_TEST_JITTER_SMALL and get the correct value. - */ - typedef enum { - CDDA_MESSAGE_FORGETIT = 0, - CDDA_MESSAGE_PRINTIT = 1, - CDDA_MESSAGE_LOGIT = 2, - CD_FRAMESAMPLES = CDIO_CD_FRAMESIZE_RAW / 4, - MAXTRK = (CDIO_CD_MAX_TRACKS+1) - } paranoia_cdda_enums_t; - - -#include - -/** We keep MAXTRK since this header is exposed publicly and other - programs may have used this. -*/ -#define MAXTRK (CDIO_CD_MAX_TRACKS+1) - -/** \brief Structure for cdparanoia's CD Table of Contents */ -typedef struct TOC_s { - unsigned char bTrack; - int32_t dwStartSector; -} TOC_t; - -/** For compatibility. TOC is deprecated, use TOC_t instead. */ -#define TOC TOC_t - -/** \brief Structure for cdparanoia's CD-ROM access */ -struct cdrom_drive_s { - - CdIo_t *p_cdio; - int opened; /**< This struct may just represent a candidate for opening */ - - char *cdda_device_name; - - char *drive_model; - int drive_type; - int bigendianp; /**< Whether data returned on the CDDA is bigendian or - not. 1 if big endian, 0 if little endian and -1 if - we don't know. - */ - int nsectors; /**< Number of sectors use in reading. Multiply by - CDIO_CD_FRAMESIZE_RAW to get number of bytes used in - the read buffer. */ - - int cd_extra; /**< -1 if we can't get multisession info, 0 if - there is one session only or the multi-session - LBA is less than or 100 (don't ask me why -- I - don't know), and 1 if the multi-session lba is - greater than 100. */ - - bool b_swap_bytes; /**< Swap bytes if Endian-ness of drive - mismatches the endian-ness of the - computer? */ - track_t tracks; - TOC_t disc_toc[MAXTRK]; /**< info here starts origin 0 rather than the - first track number (usually 1). So to take - a track number and use it here, subtract - off cdio_get_first_track_num() beforehand. - */ - lsn_t audio_first_sector; - lsn_t audio_last_sector; - - int errordest; - int messagedest; - char *errorbuf; - char *messagebuf; - - /* functions specific to particular drives/interfaces */ - - int (*enable_cdda) (cdrom_drive_t *d, int onoff); - int (*read_toc) (cdrom_drive_t *d); - long (*read_audio) (cdrom_drive_t *d, void *p, lsn_t begin, - long sectors); - int (*set_speed) (cdrom_drive_t *d, int speed); - int error_retry; - int report_all; - - int is_atapi; - int is_mmc; - - int i_test_flags; /**< Normally set 0. But if we are testing - paranoia operation this can be set to one of - the flag masks to simulate a particular kind of - failure. */ - -}; - - - /** - Flags for simulating jitter used in testing. - - The enumeration type one probably wouldn't really use in a program. - It is here instead of defines to give symbolic names that can be - helpful in debuggers where wants just to say refer to - CDDA_TEST_JITTER_SMALL and get the correct value. - */ - typedef enum { - CDDA_TEST_JITTER_SMALL = 1, - CDDA_TEST_JITTER_LARGE = 2, - CDDA_TEST_JITTER_MASSIVE = 3, - CDDA_TEST_FRAG_SMALL = (1<<3), - CDDA_TEST_FRAG_LARGE = (2<<3), - CDDA_TEST_FRAG_MASSIVE = (3<<3), - CDDA_TEST_UNDERRUN = 64 - } paranoia_jitter_t; - -/** jitter testing. The first two bits are set to determine the - byte-distance we will jitter the data; 0 is no shifting. - */ - -/**< jitter testing. Set the below bit to always cause jittering on reads. - The below bit only has any effect if the first two (above) bits are - nonzero. If the above bits are set, but the below bit isn't we'll - jitter 90% of the time. - */ -#define CDDA_TEST_ALWAYS_JITTER 4 - -/** fragment testing */ -#define CDDA_TEST_FRAG_SMALL (1<<3) -#define CDDA_TEST_FRAG_LARGE (2<<3) -#define CDDA_TEST_FRAG_MASSIVE (3<<3) - -/**< under-run testing. The below bit is set for testing. */ -#define CDDA_TEST_UNDERRUN 64 - -#if TESTING_IS_FINISHED - - /** scratch testing */ -#define CDDA_TEST_SCRATCH 128 -#undef CDDA_TEST_BOGUS_BYTES 256 -#undef CDDA_TEST_DROPDUPE_BYTES 512 -#endif /* TESTING_IS_FINISHED */ - -/** autosense functions */ - -/** Get a CD-ROM drive with a CD-DA in it. - If mesagedest is 1, then any messages in the process will be stored - in message. -*/ -extern cdrom_drive_t *cdio_cddap_find_a_cdrom(int messagedest, - char **ppsz_message); - -/** Returns a paranoia CD-ROM drive object with a CD-DA in it or NULL - if there was an error. - @see cdio_cddap_identify_cdio - */ -extern cdrom_drive_t *cdio_cddap_identify(const char *psz_device, - int messagedest, - char **ppsz_message); - -/** Returns a paranoia CD-ROM drive object with a CD-DA in it or NULL - if there was an error. In contrast to cdio_cddap_identify, we - start out with an initialized p_cdio object. For example you may - have used that for other purposes such as to get CDDB/CD-Text - information. @see cdio_cddap_identify - */ -cdrom_drive_t *cdio_cddap_identify_cdio(CdIo_t *p_cdio, - int messagedest, char **ppsz_messages); - -/** drive-oriented functions */ - -extern int cdio_cddap_speed_set(cdrom_drive_t *d, int speed); -extern void cdio_cddap_verbose_set(cdrom_drive_t *d, int err_action, - int mes_action); -extern char *cdio_cddap_messages(cdrom_drive_t *d); -extern char *cdio_cddap_errors(cdrom_drive_t *d); - -/*! - Closes d and releases all storage associated with it except - the internal p_cdio pointer. - - @param d cdrom_drive_t object to be closed. - @return 0 if passed a null pointer and 1 if not in which case - some work was probably done. - - @see cdio_cddap_close -*/ -bool cdio_cddap_close_no_free_cdio(cdrom_drive_t *d); - -/*! - Closes d and releases all storage associated with it. - Doubles as "cdrom_drive_free()". - - @param d cdrom_drive_t object to be closed. - @return 0 if passed a null pointer and 1 if not in which case - some work was probably done. - - @see cdio_cddap_close_no_free_cdio -*/ -extern int cdio_cddap_close(cdrom_drive_t *d); - -extern int cdio_cddap_open(cdrom_drive_t *d); - -extern long cdio_cddap_read(cdrom_drive_t *d, void *p_buffer, - lsn_t beginsector, long sectors); - -/*! Return the lsn for the start of track i_track */ -extern lsn_t cdio_cddap_track_firstsector(cdrom_drive_t *d, - track_t i_track); - -/*! Get last lsn of the track. This generally one less than the start - of the next track. -1 is returned on error. */ -extern lsn_t cdio_cddap_track_lastsector(cdrom_drive_t *d, track_t i_track); - -/*! Return the number of tracks on the CD. */ -extern track_t cdio_cddap_tracks(cdrom_drive_t *d); - -/*! Return the track containing the given LSN. If the LSN is before - the first track (in the pregap), 0 is returned. If there was an - error or the LSN after the LEADOUT (beyond the end of the CD), then - CDIO_INVALID_TRACK is returned. - */ -extern int cdio_cddap_sector_gettrack(cdrom_drive_t *d, lsn_t lsn); - -/*! Return the number of channels in track: 2 or 4; -2 if not - implemented or -1 for error. - Not meaningful if track is not an audio track. -*/ -extern int cdio_cddap_track_channels(cdrom_drive_t *d, track_t i_track); - -/*! Return 1 is track is an audio track, 0 otherwise. */ -extern int cdio_cddap_track_audiop(cdrom_drive_t *d, track_t i_track); - -/*! Return 1 is track has copy permit set, 0 otherwise. */ -extern int cdio_cddap_track_copyp(cdrom_drive_t *d, track_t i_track); - -/*! Return 1 is audio track has linear preemphasis set, 0 otherwise. - Only makes sense for audio tracks. - */ -extern int cdio_cddap_track_preemp(cdrom_drive_t *d, track_t i_track); - -/*! Get first lsn of the first audio track. -1 is returned on error. */ -extern lsn_t cdio_cddap_disc_firstsector(cdrom_drive_t *d); - -/*! Get last lsn of the last audio track. The last lsn is generally one - less than the start of the next track after the audio track. -1 is - returned on error. */ -extern lsn_t cdio_cddap_disc_lastsector(cdrom_drive_t *d); - -/*! Determine Endian-ness of the CD-drive based on reading data from - it. Some drives return audio data Big Endian while some (most) - return data Little Endian. Drives known to return data bigendian are - SCSI drives from Kodak, Ricoh, HP, Philips, Plasmon, Grundig - CDR100IPW, and Mitsumi CD-R. ATAPI and MMC drives are little endian. - - rocky: As someone who didn't write the code, I have to say this is - nothing less than brilliant. An FFT is done both ways and the the - transform is looked at to see which has data in the FFT (or audible) - portion. (Or so that's how I understand it.) - - @return 1 if big-endian, 0 if little-endian, -1 if we couldn't - figure things out or some error. - */ -extern int data_bigendianp(cdrom_drive_t *d); - -/** transport errors: */ - -typedef enum { - TR_OK = 0, - TR_EWRITE = 1 /**< Error writing packet command (transport) */, - TR_EREAD = 2 /**< Error reading packet data (transport) */, - TR_UNDERRUN = 3 /**< Read underrun */, - TR_OVERRUN = 4 /**< Read overrun */, - TR_ILLEGAL = 5 /**< Illegal/rejected request */, - TR_MEDIUM = 6 /**< Medium error */, - TR_BUSY = 7 /**< Device busy */, - TR_NOTREADY = 8 /**< Device not ready */, - TR_FAULT = 9 /**< Device failure */, - TR_UNKNOWN = 10 /**< Unspecified error */, - TR_STREAMING = 11 /**< loss of streaming */, -} transport_error_t; - - -#ifdef NEED_STRERROR_TR -const char *strerror_tr[]={ - "Success", - "Error writing packet command to device", - "Error reading command from device", - "SCSI packet data underrun (too little data)", - "SCSI packet data overrun (too much data)", - "Illegal SCSI request (rejected by target)", - "Medium reading data from medium", - "Device busy", - "Device not ready", - "Target hardware fault", - "Unspecified error", - "Drive lost streaming" -}; -#endif /*NEED_STERROR_TR*/ - -/** Errors returned by lib: - -\verbatim -001: Unable to set CDROM to read audio mode -002: Unable to read table of contents lead-out -003: CDROM reporting illegal number of tracks -004: Unable to read table of contents header -005: Unable to read table of contents entry -006: Could not read any data from drive -007: Unknown, unrecoverable error reading data -008: Unable to identify CDROM model -009: CDROM reporting illegal table of contents -010: Unaddressable sector - -100: Interface not supported -101: Drive is neither a CDROM nor a WORM device -102: Permision denied on cdrom (ioctl) device -103: Permision denied on cdrom (data) device - -300: Kernel memory error - -400: Device not open -401: Invalid track number -402: Track not audio data -403: No audio tracks on disc -\endverbatim - -*/ - -#ifndef DO_NOT_WANT_PARANOIA_COMPATIBILITY -/** For compatibility with good ol' paranoia */ -#define cdda_find_a_cdrom cdio_cddap_find_a_cdrom -#define cdda_identify cdio_cddap_identify -#define cdda_speed_set cdio_cddap_speed_set -#define cdda_verbose_set cdio_cddap_verbose_set -#define cdda_messages cdio_cddap_messages -#define cdda_errors cdio_cddap_errors -#define cdda_close cdio_cddap_close -#define cdda_open cdio_cddap_open -#define cdda_read cdio_cddap_read -#define cdda_track_firstsector cdio_cddap_track_firstsector -#define cdda_track_lastsector cdio_cddap_track_lastsector -#define cdda_tracks cdio_cddap_tracks -#define cdda_sector_gettrack cdio_cddap_sector_gettrack -#define cdda_track_channels cdio_cddap_track_channels -#define cdda_track_audiop cdio_cddap_track_audiop -#define cdda_track_copyp cdio_cddap_track_copyp -#define cdda_track_preemp cdio_cddap_track_preemp -#define cdda_disc_firstsector cdio_cddap_disc_firstsector -#define cdda_disc_lastsector cdio_cddap_disc_lastsector -#define cdrom_drive cdrom_drive_t - -#endif /*DO_NOT_WANT_PARANOIA_COMPATIBILITY*/ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/** The below variables are trickery to force the above enum symbol - values to be recorded in debug symbol tables. They are used to - allow one to refer to the enumeration value names in the typedefs - above in a debugger and debugger expressions -*/ - -extern paranoia_jitter_t debug_paranoia_jitter; -extern paranoia_cdda_enums_t debug_paranoia_cdda_enums; - -#endif /*_CDDA_INTERFACE_H_*/ - diff --git a/test/check_cue.sh.in b/test/check_cue.sh.in index d52b6661..890d2e42 100644 --- a/test/check_cue.sh.in +++ b/test/check_cue.sh.in @@ -2,15 +2,15 @@ # Tests to see that BIN/CUE and cdrdao TOC file iamge reading is correct # (via cd-info). -if test "@VCDINFO_LIBS@X" != "X" ; then +if test ! -d "@VCDINFO_LIBS@" ; then vcd_opt='--no-vcd' fi -if test "X$abs_top_srcdir" = "X" ; then +if test ! -d "$abs_top_srcdir" ; then abs_top_srcdir=@abs_top_srcdir@ fi -if test "X$top_builddir" = "X" ; then +if test ! -d "$top_builddir" ; then top_builddir=@abs_top_builddir@ fi From 0fd3a2bf20894489490b94132d649d34b3245465 Mon Sep 17 00:00:00 2001 From: rocky Date: Mon, 19 Mar 2012 21:43:16 -0400 Subject: [PATCH 10/18] MinGW seems to need for FILE in utf8.h now --- include/cdio/utf8.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/cdio/utf8.h b/include/cdio/utf8.h index df420f10..863b158c 100644 --- a/include/cdio/utf8.h +++ b/include/cdio/utf8.h @@ -99,6 +99,7 @@ bool cdio_charset_to_utf8(const char *src, size_t src_len, cdio_utf8_t **dst, */ wchar_t* cdio_utf8_to_wchar(const char* str); +#include /* for FILE */ /** \brief Provides an UTF-8 compliant version of fopen for Windows * The parameters and return value are the same as fopen(). */ From be738cbb2f2f5a9fa6b5086d02c6307342029749 Mon Sep 17 00:00:00 2001 From: "R. Bernstein" Date: Sun, 25 Mar 2012 01:47:26 -0400 Subject: [PATCH 11/18] Expand driver test framework a little and the tests we do. --- test/driver/gnu_linux.c | 12 +++++-- test/driver/helper.c | 74 +++++++++++++++++++++++++++++++++++++++-- test/driver/helper.h | 17 +++++++++- 3 files changed, 97 insertions(+), 6 deletions(-) diff --git a/test/driver/gnu_linux.c b/test/driver/gnu_linux.c index fdf998e5..f4571b3e 100644 --- a/test/driver/gnu_linux.c +++ b/test/driver/gnu_linux.c @@ -36,8 +36,6 @@ #include #endif -#include -#include #include "helper.h" int @@ -46,6 +44,7 @@ main(int argc, const char *argv[]) CdIo_t *p_cdio; char **ppsz_drives=NULL; + cdio_log_set_handler(log_handler); cdio_loglevel_default = (argc > 1) ? CDIO_LOG_DEBUG : CDIO_LOG_INFO; /* snprintf(psz_nrgfile, sizeof(psz_nrgfile)-1, "%s/%s", TEST_DIR, cue_file[i]); @@ -60,7 +59,14 @@ main(int argc, const char *argv[]) p_cdio = cdio_open_linux(ppsz_drives[0]); if (p_cdio) { const char *psz_source = NULL, *psz_scsi_tuple; - + lsn_t lsn; + + reset_counts(); + lsn = cdio_get_track_lsn(p_cdio, CDIO_CD_MAX_TRACKS+1); + assert_equal_int(CDIO_INVALID_LSN, lsn, + "cdio_get_track_lsn with too large of a track number"); + reset_counts(); + check_get_arg_source(p_cdio, ppsz_drives[0]); check_mmc_supported(p_cdio, 3); diff --git a/test/driver/helper.c b/test/driver/helper.c index b000de40..37aecfb4 100644 --- a/test/driver/helper.c +++ b/test/driver/helper.c @@ -16,7 +16,6 @@ */ #ifdef HAVE_CONFIG_H #include "config.h" -#define __CDIO_CONFIG_H__ 1 #endif #ifdef HAVE_STDIO_H @@ -29,9 +28,51 @@ #include #endif -#include #include "helper.h" +unsigned int info_msg_count=0; +unsigned int debug_msg_count=0; +unsigned int warn_msg_count=0; +unsigned int error_msg_count=0; +const char *info_messages[6] = {NULL, NULL, NULL, NULL, NULL, NULL}; +const char *debug_messages[6] = {NULL, NULL, NULL, NULL, NULL, NULL}; +const char *warn_messages[6] = {NULL, NULL, NULL, NULL, NULL, NULL}; +const char *error_messages[6] = {NULL, NULL, NULL, NULL, NULL, NULL}; + +void +assert_equal_int(int expect, int got, const char *msg) +{ + if (expect != got) { + fprintf(stderr, "ERROR: Expected %d, got %d\n", expect, got); + if (NULL != msg) fprintf(stderr, "%s\n", msg); + exit(1); + } +} + +void +assert_no_warn(const char *msg) +{ + if (warn_msg_count != 0) { + unsigned int i; + fprintf(stderr, "ERROR: got unexpected warnings:\n"); + for (i=0; i + Copyright (C) 2010, 2012 Rocky Bernstein 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 @@ -14,8 +14,23 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ + +#include + void check_access_mode(CdIo_t *p_cdio, const char *psz_expected_access_mode); void check_get_arg_source(CdIo_t *p_cdio, const char *psz_expected_source); void check_mmc_supported(CdIo_t *p_cdio, int i_expected); +#include +void log_handler(cdio_log_level_t level, const char message[]); +extern unsigned int info_msg_count; +extern unsigned int debug_msg_count; +extern unsigned int warn_msg_count; +extern const char *info_messages[6]; +extern const char *debug_messages[6]; +extern const char *warn_messages[6]; +extern void assert_equal_int(int expect, int got, const char *msg); +extern void reset_counts(void); +extern void assert_warn(const char *msg); +extern void assert_no_warn(const char *msg); From 8fca6497bc80912bc3b4d7a1822ed5decf9eddce Mon Sep 17 00:00:00 2001 From: "R. Bernstein" Date: Sun, 25 Mar 2012 03:57:16 -0400 Subject: [PATCH 12/18] Typo in C preprocessor symbol Comment #3 Savannah #35818 --- include/cdio/sector.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/cdio/sector.h b/include/cdio/sector.h index 86857159..c26fbd10 100644 --- a/include/cdio/sector.h +++ b/include/cdio/sector.h @@ -153,7 +153,7 @@ #define CDIO_CD_FRAMESIZE_RAW 2352 /**< bytes per frame, "raw" mode */ #define CDIO_CD_FRAMESIZE_RAWER 2646 /**< The maximum possible returned bytes */ -#define CDIO_CD_FRAMESIZE_RAW1 (CDIO_CD_CD_FRAMESIZE_RAW-CDIO_CD_SYNC_SIZE) /*2340*/ +#define CDIO_CD_FRAMESIZE_RAW1 (CDIO_CD_FRAMESIZE_RAW-CDIO_CD_SYNC_SIZE) /*2340*/ #define CDIO_CD_FRAMESIZE_RAW0 (CDIO_CD_FRAMESIZE_RAW-CDIO_CD_SYNC_SIZE-CDIO_CD_HEADER_SIZE) /*2336*/ /*! "before data" part of raw XA (green, mode2) frame */ From 79255a6cb8c0d8d3617cac8cd4d55527bea0b8a4 Mon Sep 17 00:00:00 2001 From: "R. Bernstein" Date: Sun, 25 Mar 2012 10:39:20 -0400 Subject: [PATCH 13/18] track.c, gnu_linux.c: Test for exceding max track limit but allow specifying the leadout track in some cases. Makefile.am: need to build extract unconditionally since that is used in testing --- example/Makefile.am | 13 ++++++--- lib/driver/gnu_linux.c | 13 +++++++-- lib/driver/track.c | 60 +++++++++++++++++++++++++++++++++++------- 3 files changed, 71 insertions(+), 15 deletions(-) diff --git a/example/Makefile.am b/example/Makefile.am index 3afa284c..50d8a649 100644 --- a/example/Makefile.am +++ b/example/Makefile.am @@ -21,13 +21,18 @@ if ENABLE_CPP SUBDIRS = C++ endif + if BUILD_EXAMPLES -noinst_PROGRAMS = audio cdchange cdio-eject cdtext device discid drives eject \ - extract isofile isofile2 isofuzzy isolist isolsn \ - mmc1 mmc2 mmc2a mmc3 \ - sample3 sample4 tracks udf1 udffile + audio cdchange cdio-eject cdtext device \ + discid drives eject \ + extract isofile isofile2 isofuzzy isolist isolsn \ + mmc1 mmc2 mmc2a mmc3 \ + sample3 sample4 tracks udf1 udffile endif +# extract is used in tests so that has to be built regardless +noinst_PROGRAMS = extract $(noinst_programs) + INCLUDES = -I$(top_srcdir) $(LIBCDIO_CFLAGS) audio_DEPENDENCIES = $(LIBCDIO_DEPS) diff --git a/lib/driver/gnu_linux.c b/lib/driver/gnu_linux.c index d8b88533..6e4b050a 100644 --- a/lib/driver/gnu_linux.c +++ b/lib/driver/gnu_linux.c @@ -1,7 +1,7 @@ /* Copyright (C) 2001 Herbert Valerio Riedel Copyright (C) 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2011 - Rocky Bernstein + 2012 Rocky Bernstein 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 @@ -601,7 +601,9 @@ get_track_msf_linux(void *p_user_data, track_t i_track, msf_t *msf) { _img_private_t *p_env = p_user_data; - if (NULL == msf) return false; + if (NULL == msf || + (i_track > CDIO_CD_MAX_TRACKS && i_track != CDIO_CDROM_LEADOUT_TRACK)) + return false; if (!p_env->gen.toc_init) read_toc_linux (p_user_data) ; @@ -1179,6 +1181,13 @@ read_toc_linux (void *p_user_data) p_env->gen.i_first_track = p_env->tochdr.cdth_trk0; p_env->gen.i_tracks = p_env->tochdr.cdth_trk1; + if (p_env->gen.i_tracks > CDIO_CD_MAX_TRACKS) { + cdio_log(CDIO_LOG_WARN, "Number of tracks exceeds maximum (%d vs. %d)\n", + p_env->gen.i_tracks, CDIO_CD_MAX_TRACKS); + p_env->gen.i_tracks = CDIO_CD_MAX_TRACKS; + } + + /* read individual tracks */ for (i= p_env->gen.i_first_track; i<=p_env->gen.i_tracks; i++) { struct cdrom_tocentry *p_toc = diff --git a/lib/driver/track.c b/lib/driver/track.c index 31fd423f..da03d93f 100644 --- a/lib/driver/track.c +++ b/lib/driver/track.c @@ -1,5 +1,6 @@ /* - Copyright (C) 2003, 2004, 2005, 2008, 2011 Rocky Bernstein + Copyright (C) 2003, 2004, 2005, 2008, 2011, 2012 + Rocky Bernstein Copyright (C) 2001 Herbert Valerio Riedel This program is free software: you can redistribute it and/or modify @@ -20,10 +21,10 @@ #ifdef HAVE_CONFIG_H # include "config.h" -# define __CDIO_CONFIG_H__ 1 #endif #include +#include #include "cdio_private.h" const char *track_format2str[6] = @@ -39,9 +40,13 @@ enum cdio_track_enums; CDIO_INVALID_TRACK is returned on error. */ track_t -cdio_get_first_track_num (const CdIo_t *p_cdio) +cdio_get_first_track_num(const CdIo_t *p_cdio) { - if (NULL == p_cdio) return CDIO_INVALID_TRACK; + if (NULL == p_cdio) { + cdio_info("Null CdIo object passed\n"); + return CDIO_INVALID_TRACK; + } + if (p_cdio->op.get_first_track_num) { return p_cdio->op.get_first_track_num (p_cdio->env); @@ -57,7 +62,11 @@ cdio_get_first_track_num (const CdIo_t *p_cdio) track_t cdio_get_last_track_num (const CdIo_t *p_cdio) { - if (NULL == p_cdio) return CDIO_INVALID_TRACK; + if (NULL == p_cdio) { + cdio_info("Null CdIo object passed\n"); + return CDIO_INVALID_TRACK; + } + { const track_t i_first_track = cdio_get_first_track_num(p_cdio); if ( CDIO_INVALID_TRACK != i_first_track ) { @@ -76,6 +85,15 @@ cdio_get_last_track_num (const CdIo_t *p_cdio) int cdio_get_track_channels(const CdIo_t *p_cdio, track_t i_track) { + if (NULL == p_cdio) { + cdio_info("Null CdIo object passed\n"); + return -1; + } + if (i_track > CDIO_CD_MAX_TRACKS) { + cdio_log(CDIO_LOG_WARN, "Number of tracks exceeds maximum (%d vs. %d)\n", + i_track, CDIO_CD_MAX_TRACKS); + return -1; + } if (p_cdio->op.get_track_channels) { return p_cdio->op.get_track_channels (p_cdio->env, i_track); } else { @@ -209,7 +227,10 @@ cdio_get_track_green(const CdIo_t *p_cdio, track_t i_track) lba_t cdio_get_track_lba(const CdIo_t *p_cdio, track_t i_track) { - if (!p_cdio) return CDIO_INVALID_LBA; + if (NULL == p_cdio) { + cdio_info("Null CdIo object passed\n"); + return CDIO_INVALID_LBA; + } if (p_cdio->op.get_track_lba) { return p_cdio->op.get_track_lba (p_cdio->env, i_track); @@ -232,7 +253,16 @@ cdio_get_track_lba(const CdIo_t *p_cdio, track_t i_track) lsn_t cdio_get_track_lsn(const CdIo_t *p_cdio, track_t i_track) { - if (p_cdio == NULL) return CDIO_INVALID_LSN; + if (NULL == p_cdio) { + cdio_info("Null CdIo object passed\n"); + return CDIO_INVALID_LSN; + } + if (i_track > CDIO_CD_MAX_TRACKS && i_track != CDIO_CDROM_LEADOUT_TRACK) { + cdio_log(CDIO_LOG_WARN, "Number of tracks exceeds maximum (%d vs. %d)\n", + i_track, CDIO_CD_MAX_TRACKS); + return CDIO_INVALID_LSN; + } + if (p_cdio->op.get_track_lba) { return cdio_lba_to_lsn(p_cdio->op.get_track_lba (p_cdio->env, i_track)); @@ -254,7 +284,16 @@ cdio_get_track_lsn(const CdIo_t *p_cdio, track_t i_track) char * cdio_get_track_isrc (const CdIo_t *p_cdio, track_t i_track) { - if (p_cdio == NULL) return NULL; + if (NULL == p_cdio) { + cdio_info("Null CdIo object passed\n"); + return NULL; + } + + if (i_track > CDIO_CD_MAX_TRACKS) { + cdio_log(CDIO_LOG_WARN, "Number of tracks exceeds maximum (%d vs. %d)\n", + i_track, CDIO_CD_MAX_TRACKS); + return NULL; + } if (p_cdio->op.get_track_isrc) { return p_cdio->op.get_track_isrc (p_cdio->env, i_track); @@ -271,7 +310,10 @@ cdio_get_track_isrc (const CdIo_t *p_cdio, track_t i_track) lba_t cdio_get_track_pregap_lba(const CdIo_t *p_cdio, track_t i_track) { - if (p_cdio == NULL) return CDIO_INVALID_LBA; + if (NULL == p_cdio) { + cdio_info("Null CdIo object passed\n"); + return CDIO_INVALID_LBA; + } if (p_cdio->op.get_track_pregap_lba) { return p_cdio->op.get_track_pregap_lba (p_cdio->env, i_track); From 023fcab57ff9b780080e39e716c5a0fa002183ac Mon Sep 17 00:00:00 2001 From: "R. Bernstein" Date: Sun, 25 Mar 2012 13:10:21 -0400 Subject: [PATCH 14/18] Add catalog number to ISO 9660 cue file. --- src/util.c | 4 +++- test/check_opts0.right | 2 +- test/check_opts1.right | 2 +- test/check_opts2.right | 2 +- test/check_opts3.right | 2 +- test/check_opts4.right | 2 +- test/check_opts5.right | 2 +- test/check_opts6.right | 2 +- test/check_opts7.right | 2 +- test/data/isofs-m1.cue | 1 + 10 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/util.c b/src/util.c index 32896138..6285990a 100644 --- a/src/util.c +++ b/src/util.c @@ -56,7 +56,9 @@ print_version (char *program_name, const char *version, if (no_header == 0) { report( stdout, - "%s version %s\nCopyright (c) 2003, 2004, 2005, 2007, 2008, 2011 R. Bernstein\n", + "%s version %s\n" + "Copyright (c) 2003, 2004, 2005, 2007, 2008, 2011, 2012 " + "R. Bernstein\n", program_name, version); report( stdout, _("This is free software; see the source for copying conditions.\n\ diff --git a/test/check_opts0.right b/test/check_opts0.right index f5e163fc..5b6d6873 100644 --- a/test/check_opts0.right +++ b/test/check_opts0.right @@ -1,7 +1,7 @@ __________________________________ Disc mode is listed as: CD-DATA (Mode 1) -Media Catalog Number (MCN): not available +Media Catalog Number (MCN): 0000012101954 Last CD Session LSN: not supported by drive/driver __________________________________ CD Analysis Report diff --git a/test/check_opts1.right b/test/check_opts1.right index f5e163fc..5b6d6873 100644 --- a/test/check_opts1.right +++ b/test/check_opts1.right @@ -1,7 +1,7 @@ __________________________________ Disc mode is listed as: CD-DATA (Mode 1) -Media Catalog Number (MCN): not available +Media Catalog Number (MCN): 0000012101954 Last CD Session LSN: not supported by drive/driver __________________________________ CD Analysis Report diff --git a/test/check_opts2.right b/test/check_opts2.right index c4712945..6477819f 100644 --- a/test/check_opts2.right +++ b/test/check_opts2.right @@ -5,5 +5,5 @@ CD-ROM Track List (1 - 1) #: MSF LSN Type Green? Copy? 1: 00:02:00 000000 data false no 170: 00:06:02 000302 leadout (693 KB raw, 604 KB formatted) -Media Catalog Number (MCN): not available +Media Catalog Number (MCN): 0000012101954 Last CD Session LSN: not supported by drive/driver diff --git a/test/check_opts3.right b/test/check_opts3.right index c4712945..6477819f 100644 --- a/test/check_opts3.right +++ b/test/check_opts3.right @@ -5,5 +5,5 @@ CD-ROM Track List (1 - 1) #: MSF LSN Type Green? Copy? 1: 00:02:00 000000 data false no 170: 00:06:02 000302 leadout (693 KB raw, 604 KB formatted) -Media Catalog Number (MCN): not available +Media Catalog Number (MCN): 0000012101954 Last CD Session LSN: not supported by drive/driver diff --git a/test/check_opts4.right b/test/check_opts4.right index e4977f34..aed4e947 100644 --- a/test/check_opts4.right +++ b/test/check_opts4.right @@ -5,7 +5,7 @@ CD-ROM Track List (1 - 1) #: MSF LSN Type Green? Copy? 1: 00:02:00 000000 data false no 170: 00:06:02 000302 leadout (693 KB raw, 604 KB formatted) -Media Catalog Number (MCN): not available +Media Catalog Number (MCN): 0000012101954 Last CD Session LSN: not supported by drive/driver __________________________________ CD Analysis Report diff --git a/test/check_opts5.right b/test/check_opts5.right index e4977f34..aed4e947 100644 --- a/test/check_opts5.right +++ b/test/check_opts5.right @@ -5,7 +5,7 @@ CD-ROM Track List (1 - 1) #: MSF LSN Type Green? Copy? 1: 00:02:00 000000 data false no 170: 00:06:02 000302 leadout (693 KB raw, 604 KB formatted) -Media Catalog Number (MCN): not available +Media Catalog Number (MCN): 0000012101954 Last CD Session LSN: not supported by drive/driver __________________________________ CD Analysis Report diff --git a/test/check_opts6.right b/test/check_opts6.right index e4977f34..aed4e947 100644 --- a/test/check_opts6.right +++ b/test/check_opts6.right @@ -5,7 +5,7 @@ CD-ROM Track List (1 - 1) #: MSF LSN Type Green? Copy? 1: 00:02:00 000000 data false no 170: 00:06:02 000302 leadout (693 KB raw, 604 KB formatted) -Media Catalog Number (MCN): not available +Media Catalog Number (MCN): 0000012101954 Last CD Session LSN: not supported by drive/driver __________________________________ CD Analysis Report diff --git a/test/check_opts7.right b/test/check_opts7.right index e4977f34..aed4e947 100644 --- a/test/check_opts7.right +++ b/test/check_opts7.right @@ -5,7 +5,7 @@ CD-ROM Track List (1 - 1) #: MSF LSN Type Green? Copy? 1: 00:02:00 000000 data false no 170: 00:06:02 000302 leadout (693 KB raw, 604 KB formatted) -Media Catalog Number (MCN): not available +Media Catalog Number (MCN): 0000012101954 Last CD Session LSN: not supported by drive/driver __________________________________ CD Analysis Report diff --git a/test/data/isofs-m1.cue b/test/data/isofs-m1.cue index 677a803f..bead774e 100644 --- a/test/data/isofs-m1.cue +++ b/test/data/isofs-m1.cue @@ -1,3 +1,4 @@ +CATALOG 0000012101954 FILE "ISOFS-M1.BIN" BINARY TRACK 01 MODE1/2352 INDEX 01 00:00:00 From 8a3f964baa48e95abf50a75490a013f785c7702a Mon Sep 17 00:00:00 2001 From: rocky Date: Sun, 25 Mar 2012 17:16:55 -0400 Subject: [PATCH 15/18] Getting back to where we were before we created cdtext --- lib/Makefile.am | 2 +- lib/cdtext/.gitignore | 9 - lib/cdtext/Makefile.am | 139 ------- lib/cdtext/cdtext.c | 741 ------------------------------------ lib/cdtext/cdtext_private.h | 148 ------- lib/cdtext/libcdtext.sym | 13 - 6 files changed, 1 insertion(+), 1051 deletions(-) delete mode 100644 lib/cdtext/.gitignore delete mode 100644 lib/cdtext/Makefile.am delete mode 100644 lib/cdtext/cdtext.c delete mode 100644 lib/cdtext/cdtext_private.h delete mode 100644 lib/cdtext/libcdtext.sym diff --git a/lib/Makefile.am b/lib/Makefile.am index efee1c9d..4be685e3 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -21,4 +21,4 @@ if ENABLE_CXX_BINDINGS cxxdirs = cdio++ endif -SUBDIRS = driver cdtext iso9660 udf $(cxxdirs) +SUBDIRS = driver iso9660 udf $(cxxdirs) diff --git a/lib/cdtext/.gitignore b/lib/cdtext/.gitignore deleted file mode 100644 index ad9ee005..00000000 --- a/lib/cdtext/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -/*.lo -/*.o -/*~ -/.deps -/.libs -/Makefile -/Makefile.in -/libcdtext.la -/libcdtext.la.ver diff --git a/lib/cdtext/Makefile.am b/lib/cdtext/Makefile.am deleted file mode 100644 index 58294963..00000000 --- a/lib/cdtext/Makefile.am +++ /dev/null @@ -1,139 +0,0 @@ -# Copyright (C) 2012 -# Rocky Bernstein -# -# 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 3 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, see . - -######################################################## -# Things to make the libcdtext library -######################################################## -# -# From libtool documentation amended with guidance from N. Boullis: -# -# 1. Start with version information of `0:0:0' for each libtool library. -# -# 2. It is probably not a good idea to update the version information -# several times between public releases, but rather once per public -# release. (This seems to be more an aesthetic consideration than -# a hard technical one.) -# -# 3. If the library source code has changed at all since the last -# update, then increment REVISION (`C:R:A' becomes `C:R+1:A'). -# -# 4. If any interfaces have been added, removed, or changed since the -# last update, increment CURRENT, and set REVISION to 0. -# -# 5. If any interfaces have been added since the last public release, -# then increment AGE. -# -# 6. If any interfaces have been removed or changed since the last -# public release, then set AGE to 0. A changed interface means an -# incompatibility with previous versions. - -libcdtext_la_CURRENT = 1 -libcdtext_la_REVISION = 0 -libcdtext_la_AGE = 0 - -EXTRA_DIST = cdtext.sym - -noinst_HEADERS = cdtext_private.h - -lib_LTLIBRARIES = libcdtext.la - -libcdtext_la_SOURCES = \ - cdtext.c \ - iso9660_private.h - -libcdtext_la_LIBADD = @LIBCDIO_LIBS@ -libcdtext_la_ldflags = -version-info $(libcdtext_la_CURRENT):$(libcdtext_la_REVISION):$(libcdtext_la_AGE) @LT_NO_UNDEFINED@ -libcdtext_la_dependencies = $(top_builddir)/lib/driver/libcdio.la - -INCLUDES = $(LIBCDIO_CFLAGS) - -######################################################## -# Things to version the symbols in the libraries -######################################################## - -# An explanation of the versioning problem from Nicolas Boullis and -# the versioned symbol solution he uses below... -# -# Currently, libvcdinfo uses the cdio_open function from libcdio. -# Let's imagine a program foobar that uses both the vcdinfo_open -# function from libvcdinfo and the cdio_open function from libcdio. - -# Currently, libcdio has SONAME libcdio.so.0, libvcdinfo has SONAME -# libvcdinfo.so.0 and requires libcdio.so.0, and foobar requires both -# libvcdinfo.so.0 and libcdio.so.0. Everything looks fine. -# -# Now, for some reason, you decide to change the cdio_open function. -# That's your right, but you have to bump the CURRENT version and (if I -# understand it correctly, athough this is not that clear in libtool's -# documentation) set the AGE to 0. Anyway, this bumps the SONAME, which is -# sane since the interface changes incompatibly. - -# Now, you have a new libcdio with SONAME libcdio.so.1. But libvcdinfo and -# foobar still require libcdio.so.0. Everything is still fine. - -# Now, after some minor changes, the author of foobar recompiles foobar. -# Then, foobar now requires libvcdinfo.so.0 and libcdio.so.1. And foobar -# now segfaults... - -# What is happening? When you run foobar, if brings both libvcdinfo.so.0 -# and libcdio.so.1, but libvcdinfo.so.0 also brings libcdio.so.0. So you -# have both libcdio.so.0 and libcdio.so.1 that bring their symbols to the -# global namespace. Hence, you have to incompatible versions of the -# cdio_open function in the name space. When foobar calls cdio_open, it -# may choose the wrong function, and segfaults... - -# With versioned symbols, the cdio_open function from libcdio.so.0 may be -# known as (something that looks like) cdio_open@@CDIO_0. An the cdio_open -# function from libcdio.so.1 as cdio_open@@CDIO_1. Both versions of -# libcdio would still be brought in by the most recent foobar, but foobar -# (and libvcdinfo) know which versioned function to use and then use the -# good one. - - -# This is some simple versioning where every symbol is versioned with -# something that looks like the SONAME of the library. More complex (and -# better) versioning is possible; it is for example what is used by glibc. -# But good complex versioning is something that requires much more -# work... - - -# The below is a impliments symbol versioning. First of all, I -# compute MAJOR as CURENT - AGE; that is what is used within libtool -# (at least on GNU/Linux systems) for the number in the SONAME. The -# nm command gives the list of symbols known in each of the object -# files that will be part of the shared library. And the sed command -# extracts from this list those symbols that will be shared. (This sed -# command comes from libtool.) - -libcdtext_la_MAJOR = $(shell expr $(libcdtext_la_CURRENT) - $(libcdtext_la_AGE)) -if BUILD_VERSIONED_LIBS -libcdtext_la_LDFLAGS = $(libcdtext_la_ldflags) -Wl,--version-script=libcdtext.la.ver -libcdtext_la_DEPENDENCIES = $(libcdio9660_la_dependencies) libcdtext.la.ver - -libcdtext.la.ver: $(libcdtext_la_OBJECTS) $(srcdir)/libcdtext.sym - @echo 'CDTEXT_$(libcdtext_la_MAJOR) {' > $@ - @objs=`for obj in $(libcdtext_la_OBJECTS); do sed -ne "s/^pic_object='\(.*\)'$$/\1/p" $$obj; done`; \ - if test -n "$$objs" ; then \ - nm $${objs} | sed -n -e 's/^.*[ ][ABCDGIRSTW][ABCDGIRSTW]*[ ][ ]*\([_A-Za-z][_A-Za-z0-9]*\)$$/\1/p' | sort -u | { first=true; while read symbol; do if grep -q "^$${symbol}\$$" $(srcdir)/libcdtext.sym; then if test $$first = true; then echo " global:"; first=false; fi; echo " $${symbol};"; fi; done; } >> $@; \ - nm $${objs} | sed -n -e 's/^.*[ ][ABCDGIRSTW][ABCDGIRSTW]*[ ][ ]*\([_A-Za-z][_A-Za-z0-9]*\)$$/\1/p' | sort -u | { first=true; while read symbol; do if grep -q "^$${symbol}\$$" $(srcdir)/libcdtext.sym; then :; else if test $$first = true; then echo " local:"; first=false; fi; echo " $${symbol};"; fi; done; } >> $@; \ - fi - @echo '};' >> $@ - -MOSTLYCLEANFILES = libcdtext.la.ver -else -libcdtext_la_LDFLAGS = $(libcdtext_la_ldflags) -libcdtext_la_DEPENDENCIES = $(libcdio9660_la_dependencies) -endif diff --git a/lib/cdtext/cdtext.c b/lib/cdtext/cdtext.c deleted file mode 100644 index 45e5bf84..00000000 --- a/lib/cdtext/cdtext.c +++ /dev/null @@ -1,741 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2008, 2011, 2012 - Rocky Bernstein - - toc reading routine adapted from cuetools - Copyright (C) 2003 Svend Sanjay Sorensen - - 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 3 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, see . -*/ - -#ifdef HAVE_CONFIG_H -# include "config.h" -# define __CDIO_CONFIG_H__ 1 -#endif - -#include -#include -#include "cdtext_private.h" -#include - -#ifdef HAVE_STDLIB_H -#include -#endif - -#ifdef HAVE_STRING_H -#include -#endif - -#define _CDTEXT_DBCC -#define MAX_CDTEXT_GENRE_CODE 28 -#define MAX_CDTEXT_LANGUAGE_CODE 127 - -#ifndef CDIO_CD_MAX_TRACKS -# define CDIO_CD_MAX_TRACKS 99 /* Largest CD track number */ -#endif - -const char *cdtext_field[MAX_CDTEXT_FIELDS] = -{ - "TITLE", - "PERFORMER", - "SONGWRITER", - "COMPOSER", - "MESSAGE", - "ARRANGER", - "ISRC", - "UPC_EAN", - "GENRE", - "DISC_ID", -}; - -const char *cdtext_genre[MAX_CDTEXT_GENRE_CODE] = -{ - "Not Used", - "Not Defined", - "Adult Contemporary", - "Alternative Rock", - "Childrens Music", - "Classical", - "Contemporary Christian", - "Country", - "Dance", - "Easy Listening", - "Erotic", - "Folk", - "Gospel", - "Hip Hop", - "Jazz", - "Latin", - "Musical", - "New Age", - "Opera", - "Operetta", - "Pop Music", - "Rap", - "Reggae", - "Rock Music", - "Rhythm & Blues", - "Sound Effects", - "Spoken Word", - "World Music" -}; - -const char *cdtext_language[MAX_CDTEXT_LANGUAGE_CODE] = -{ - "Unknown", - "Albanian", - "Breton", - "Catalan", - "Croatian", - "Welsh", - "Czech", - "Danish", - "German", - "English", - "Spanish", - "Esperanto", - "Estonian", - "Basque", - "Faroese", - "French", - "Frisian", - "Irish", - "Gaelic", - "Galician", - "Icelandic", - "Italian", - "Lappish", - "Latin", - "Latvian", - "Luxembourgian", - "Lithuanian", - "Hungarian", - "Maltese", - "Dutch", - "Norwegian", - "Occitan", - "Polish", - "Portuguese", - "Romanian", - "Romansh", - "Serbian", - "Slovak", - "Slovenian", - "Finnish", - "Swedish", - "Turkish", - "Flemish", - "Wallon", - "Zulu", - "Vietnamese", - "Uzbek", - "Urdu", - "Ukrainian", - "Thai", - "Telugu", - "Tatar", - "Tamil", - "Tadzhik", - "Swahili", - "SrananTongo", - "Somali", - "Sinhalese", - "Shona", - "Serbo-croat", - "Ruthenian", - "Russian", - "Russian", - "Quechua", - "Pushtu", - "Punjabi", - "Persian", - "Papamiento", - "Oriya", - "Nepali", - "Ndebele", - "Marathi", - "Moldavian", - "Malaysian", - "Malagasay", - "Macedonian", - "Laotian", - "Korean", - "Khmer", - "Kazakh", - "Kannada", - "Japanese", - "Indonesian", - "Hindi", - "Hebrew", - "Hausa", - "Gurani", - "Gujurati", - "Greek", - "Georgian", - "Fulani", - "Dari", - "Churash", - "Chinese", - "Burmese", - "Bulgarian", - "Bengali", - "Bielorussian", - "Bambora", - "Azerbaijani", - "Assamese", - "Armenian", - "Arabic", - "Amharic" -}; - -/*! - Return string representation of given field type. -*/ -const char * -cdtext_field2str(cdtext_field_t i) -{ - if (i >= MAX_CDTEXT_FIELDS) - return "INVALID"; - else - return cdtext_field[i]; -} - -/*! - Return string representation of the given genre code. -*/ -const char * -cdtext_genre2str(cdtext_genre_t i) -{ - if (i >= MAX_CDTEXT_GENRE_CODE) - return "INVALID"; - else - return cdtext_genre[i]; -} - -/*! - Return string representation of the given language code. -*/ -const char * -cdtext_lang2str(cdtext_lang_t i) -{ - if (i >= MAX_CDTEXT_LANGUAGE_CODE) - return "INVALID"; - else - return cdtext_language[i]; -} - -/*! - Free memory associated with the given cdtext_t object. - - @param p_cdtext the CD-TEXT object -*/ -void -cdtext_destroy(cdtext_t *p_cdtext) -{ - cdtext_field_t k; - track_t j; - int i; - - if (!p_cdtext) return; - for (i=0; iblock[i].track[j].field[k]) { - free(p_cdtext->block[i].track[j].field[k]); - p_cdtext->block[i].track[j].field[k] = NULL; - } - } - } - } -} - -/*! - Returns a copy of the return value of cdtext_get_const or NULL. - - Should be freed when done. - @see cdtext_get_const -*/ -char * -cdtext_get(const cdtext_t *p_cdtext, cdtext_field_t field, track_t track) -{ - const char *ret = cdtext_get_const(p_cdtext, field, track); - if (NULL == ret) - return NULL; - else - return strdup(ret); -} - -/*! - Returns value of the given field. - - NULL is returned if key is CDTEXT_INVALID or the field is not set. - Strings are encoded in UTF-8. - - @param p_cdtext the CD-TEXT object - @param field type of the field to return - @param track specifies the track, 0 stands for disc -*/ -const char * -cdtext_get_const(const cdtext_t *p_cdtext, cdtext_field_t field, track_t track) -{ - if (CDTEXT_FIELD_INVALID == field - || NULL == p_cdtext - || 0 > track - || CDIO_CD_MAX_TRACKS < track) - return NULL; - - return p_cdtext->block[p_cdtext->block_i].track[track].field[field]; -} - - -/*! - Returns the currently active language. - - @param p_cdtext the CD-TEXT object -*/ -cdtext_lang_t -cdtext_get_language(const cdtext_t *p_cdtext) -{ - if (NULL == p_cdtext) - return CDTEXT_LANGUAGE_UNKNOWN; - return p_cdtext->block[p_cdtext->block_i].language_code; -} - -/* - Returns a list of available languages or NULL. - - Internally the list is stored in a static array. - - @param p_cdtext the CD-TEXT object -*/ -cdtext_lang_t -*cdtext_list_languages(const cdtext_t *p_cdtext) -{ - static cdtext_lang_t avail[CDTEXT_NUM_BLOCKS_MAX]; - int i, j=0; - - if (NULL == p_cdtext) - return NULL; - - for (i=0; iblock[i].language_code) - avail[j++] = p_cdtext->block[i].language_code; - } - - return avail; -} - -/*! - Try to select the given language. - Select default language if specified is not available or invalid and - return false. - - @param p_cdtext the CD-TEXT object - @param language string representation of the language - - @return true on success, false if language is not available -*/ -bool -cdtext_select_language(cdtext_t *p_cdtext, const char *language) -{ - cdtext_lang_t lang_id; - lang_id = cdtext_is_language(language); - - if(NULL == p_cdtext) - return false; - - if (CDTEXT_LANGUAGE_UNKNOWN != lang_id) - { - int i; - for (i=0; iblock[i].language_code) { - p_cdtext->block_i = i; - return true; - } - } - } else { - p_cdtext->block_i = 0; - } - return false; -} - -/*! - Initialize a new cdtext structure. - - When the structure is no longer needed, release the - resources using cdtext_delete. - -*/ -cdtext_t -*cdtext_init(void) -{ - cdtext_field_t k; - track_t j; - int i; - cdtext_t *p_cdtext; - - p_cdtext = (cdtext_t *) malloc(sizeof(struct cdtext_s)); - - for (i=0; iblock[i].track[j].field[k] = NULL; - } - } - p_cdtext->block[i].genre_code = CDTEXT_GENRE_UNUSED; - p_cdtext->block[i].language_code = CDTEXT_LANGUAGE_UNKNOWN; - } - - p_cdtext->block_i = 0; - - return p_cdtext; -} - -/*! - Returns associated cdtext_field_t if field is a CD-TEXT keyword. - - Internal function. - - @param key key to test - - @return CDTEXT_INVALID if the given keyword is invalid -*/ -cdtext_field_t -cdtext_is_field (const char *key) -{ - unsigned int i; - - for (i = 0; i < MAX_CDTEXT_FIELDS ; i++) - if (0 == strcmp(cdtext_field[i], key)) { - return i; - } - return CDTEXT_FIELD_INVALID; -} - -/*! - Returns associated cdtext_lang_t if argument is a supported language. - - Internal function. - - @param lang language to test - - @return CDTEXT_LANGUAGE_UNKNOWN if language is not supported -*/ -cdtext_lang_t -cdtext_is_language(const char *lang) -{ - unsigned int i; - - for (i = 0; i < MAX_CDTEXT_LANGUAGE_CODE; i++) - if (0 == strcmp(cdtext_language[i], lang)) { - return i; - } - return CDTEXT_LANGUAGE_UNKNOWN; -} - -/*! - Sets the given field at the given track to the given value. - - Recodes to UTF-8 if charset is not NULL. - - @param p_cdtext the CD-TEXT object - @param key field to set - @param value value to set - @param track track to work on - @param charset charset to convert from - */ -void -cdtext_set(cdtext_t *p_cdtext, cdtext_field_t key, const uint8_t *value, - track_t track, const char *charset) -{ - if (NULL == value || key == CDTEXT_FIELD_INVALID || 0 > track - || CDIO_CD_MAX_TRACKS < track) - return; - - /* free old memory */ - if (p_cdtext->block[p_cdtext->block_i].track[track].field[key]) - free(p_cdtext->block[p_cdtext->block_i].track[track].field[key]); - - /* recode to UTF-8 */ - if (NULL != charset) { - cdio_utf8_t *utf8_str = NULL; - cdio_charset_to_utf8((const char*) value, strlen((const char*)value), - &utf8_str, charset); - p_cdtext->block[p_cdtext->block_i].track[track].field[key] = (char *)utf8_str; - } else - p_cdtext->block[p_cdtext->block_i].track[track].field[key] = strdup((const char *)value); -} - -/*! - Read a binary CD-TEXT and fill a cdtext struct. - - @param p_cdtext the CD-TEXT object - @param wdata the data - @param i_data size of wdata - - @returns 0 on success, non-zero on failure -*/ -int -cdtext_data_init(cdtext_t *p_cdtext, uint8_t *wdata, size_t i_data) -{ - uint8_t *p_data; - int j; - uint8_t buffer[256]; - int i_buf = 0; - int i_block; - int i_seq = 0; - int i; - cdtext_blocksize_t blocksize; - char *charset = NULL; - - memset( buffer, 0, sizeof(buffer) ); - - p_data = wdata; - if (i_data < CDTEXT_LEN_PACK || 0 != i_data % CDTEXT_LEN_PACK) { - cdio_warn("CD-Text size is not multiple of pack size"); - return -1; - } - -#if 0 - for(i=0; i < i_data; i++) - printf("%0x%c", wdata[i], ((i+1) % 18 == 0 ? '\n' : ' ')); -#endif - - - /* Iterate over blocks */ - i_block = -1; - while(i_data > 0) { - cdtext_pack_t pack; - cdtext_read_pack(&pack, p_data); - - if (i_block != pack.block || i_seq != pack.seq) { - cdtext_pack_t tpack; - i_block = pack.block; - if (i_block >= CDTEXT_NUM_BLOCKS_MAX) { - cdio_warn("CD-TEXT: Invalid blocknumber %d.\n", i_block); - return -1; - } - p_cdtext->block_i = i_block; - i_seq = 0; - memset( &blocksize, 0, CDTEXT_LEN_BLOCKSIZE); - - /* first read block size information for sanity checks and encoding */ - for(i=0; i <= i_data-CDTEXT_LEN_PACK; i+=CDTEXT_LEN_PACK) { - - if (p_data[i+0] == CDTEXT_PACK_BLOCKSIZE) { - cdtext_read_pack(&tpack, p_data+i); - switch (tpack.i_track) { - case 0: - blocksize.charcode = tpack.text[0]; - blocksize.i_first_track = tpack.text[1]; - blocksize.i_last_track = tpack.text[2]; - blocksize.copyright = tpack.text[3]; - blocksize.i_packs[0] = tpack.text[4]; - blocksize.i_packs[1] = tpack.text[5]; - blocksize.i_packs[2] = tpack.text[6]; - blocksize.i_packs[3] = tpack.text[7]; - blocksize.i_packs[4] = tpack.text[8]; - blocksize.i_packs[5] = tpack.text[9]; - blocksize.i_packs[6] = tpack.text[10]; - blocksize.i_packs[7] = tpack.text[11]; - break; - case 1: - blocksize.i_packs[8] = tpack.text[0]; - blocksize.i_packs[9] = tpack.text[1]; - blocksize.i_packs[10] = tpack.text[2]; - blocksize.i_packs[11] = tpack.text[3]; - blocksize.i_packs[12] = tpack.text[4]; - blocksize.i_packs[13] = tpack.text[5]; - blocksize.i_packs[14] = tpack.text[6]; - blocksize.i_packs[15] = tpack.text[7]; - blocksize.lastseq[0] = tpack.text[8]; - blocksize.lastseq[1] = tpack.text[9]; - blocksize.lastseq[2] = tpack.text[10]; - blocksize.lastseq[3] = tpack.text[11]; - break; - case 2: - blocksize.lastseq[4] = tpack.text[0]; - blocksize.lastseq[5] = tpack.text[1]; - blocksize.lastseq[6] = tpack.text[2]; - blocksize.lastseq[7] = tpack.text[3]; - blocksize.langcode[0] = tpack.text[4]; - blocksize.langcode[1] = tpack.text[5]; - blocksize.langcode[2] = tpack.text[6]; - blocksize.langcode[3] = tpack.text[7]; - blocksize.langcode[4] = tpack.text[8]; - blocksize.langcode[5] = tpack.text[9]; - blocksize.langcode[6] = tpack.text[10]; - blocksize.langcode[7] = tpack.text[11]; - break; - } - } - } - - if(blocksize.i_packs[15] == 3) { - /* if there were 3 BLOCKSIZE packs */ - /* set copyright */ - p_cdtext->block[i_block].copyright = (0x03 == (blocksize.copyright & 0x03)); - - /* set Language */ - if(blocksize.langcode[i_block] <= 0x7f) - p_cdtext->block[i_block].language_code = blocksize.langcode[i_block]; - - /* determine encoding */ - switch (blocksize.charcode){ - case CDTEXT_CHARCODE_ISO_8859_1: - /* default */ - charset = (char *) "ISO-8859-1"; - break; - case CDTEXT_CHARCODE_ASCII: - charset = (char *) "ASCII"; - break; - case CDTEXT_CHARCODE_SHIFT_JIS: - charset = (char *) "SHIFT_JIS"; - break; - } - } else { - cdio_warn("CD-TEXT: No blocksize information available for block %d.\n", i_block); - return -1; - } - - } - - cdtext_read_pack(&pack, p_data); - -#ifndef _CDTEXT_DBCC - if ( pack.db_chars ) { - cdio_warn("CD-TEXT: Double-byte characters not supported"); - return -1; - } -#endif - - /* read text packs first */ - j = 0; - switch (pack.type) { - case CDTEXT_PACK_GENRE: - /* If pack.text starts with an unprintable character, it is likely to be the genre_code. - * While the specification requires the first GENRE pack to start with the 2 byte genre code, - * it is not specific about the following ones. */ - if (pack.text[0] <= 31) { - j = 2; - if (CDTEXT_GENRE_UNUSED == p_cdtext->block[i_block].genre_code) - p_cdtext->block[i_block].genre_code = CDTEXT_GET_LEN16(pack.text); - } - case CDTEXT_PACK_TITLE: - case CDTEXT_PACK_PERFORMER: - case CDTEXT_PACK_SONGWRITER: - case CDTEXT_PACK_COMPOSER: - case CDTEXT_PACK_ARRANGER: - case CDTEXT_PACK_MESSAGE: - case CDTEXT_PACK_DISCID: - case CDTEXT_PACK_UPC: - while (j < CDTEXT_LEN_TEXTDATA) { - /* not terminated */ - if (pack.text[j] != 0 || (pack.db_chars && pack.text[j+1] != 0)) { - buffer[i_buf++] = pack.text[j]; - if(pack.db_chars) - buffer[i_buf++] = pack.text[j+1]; - } else if(i_buf > 1) { - buffer[i_buf++] = 0; - if(pack.db_chars) - buffer[i_buf++] = 0; - - switch (pack.type) { - case CDTEXT_PACK_TITLE: - cdtext_set(p_cdtext, CDTEXT_FIELD_TITLE, buffer, pack.i_track, charset); - break; - case CDTEXT_PACK_PERFORMER: - cdtext_set(p_cdtext, CDTEXT_FIELD_PERFORMER, buffer, pack.i_track, charset); - break; - case CDTEXT_PACK_SONGWRITER: - cdtext_set(p_cdtext, CDTEXT_FIELD_SONGWRITER, buffer, pack.i_track, charset); - break; - case CDTEXT_PACK_COMPOSER: - cdtext_set(p_cdtext, CDTEXT_FIELD_COMPOSER, buffer, pack.i_track, charset); - break; - case CDTEXT_PACK_ARRANGER: - cdtext_set(p_cdtext, CDTEXT_FIELD_ARRANGER, buffer, pack.i_track, charset); - break; - case CDTEXT_PACK_MESSAGE: - cdtext_set(p_cdtext, CDTEXT_FIELD_MESSAGE, buffer, pack.i_track, charset); - break; - case CDTEXT_PACK_DISCID: - if (pack.i_track == 0) - cdtext_set(p_cdtext, CDTEXT_FIELD_DISCID, buffer, pack.i_track, NULL); - break; - case CDTEXT_PACK_GENRE: - cdtext_set(p_cdtext, CDTEXT_FIELD_GENRE, buffer, pack.i_track, "ASCII"); - break; - case CDTEXT_PACK_UPC: - if (pack.i_track == 0) - cdtext_set(p_cdtext, CDTEXT_FIELD_UPC_EAN, buffer, pack.i_track, "ASCII"); - else - cdtext_set(p_cdtext, CDTEXT_FIELD_ISRC, buffer, pack.i_track, "ISO-8859-1"); - break; - } - i_buf = 0; - - } - if (pack.db_chars) - j+=2; - else - j+=1; - } - break; - } - /* This would be the right place to parse TOC and TOC2 fields. */ - - i_seq++; - i_data-=CDTEXT_LEN_PACK; - p_data+=CDTEXT_LEN_PACK; - } /* end of while loop */ - - p_cdtext->block_i = 0; - return 0; -} - - -/*! - Fills cdtext_pack_t with information read from p_data - - @param p_pack out - @param p_data in -*/ -int -cdtext_read_pack(cdtext_pack_t *p_pack, const uint8_t *p_data) { - p_pack->type = p_data[0]; - p_pack->i_track = p_data[1]; - p_pack->seq = p_data[2]; - p_pack->char_pos = p_data[3] & 0x0F; - p_pack->block = (p_data[3] >> 4) & 0x07; - p_pack->db_chars = (p_data[3] >> 7) & 0x01; - p_pack->text[0] = p_data[4]; - p_pack->text[1] = p_data[5]; - p_pack->text[2] = p_data[6]; - p_pack->text[3] = p_data[7]; - p_pack->text[4] = p_data[8]; - p_pack->text[5] = p_data[9]; - p_pack->text[6] = p_data[10]; - p_pack->text[7] = p_data[11]; - p_pack->text[8] = p_data[12]; - p_pack->text[9] = p_data[13]; - p_pack->text[10] = p_data[14]; - p_pack->text[11] = p_data[15]; - p_pack->crc[0] = p_data[16]; - p_pack->crc[1] = p_data[17]; - - return 0; -} diff --git a/lib/cdtext/cdtext_private.h b/lib/cdtext/cdtext_private.h deleted file mode 100644 index 2f17a289..00000000 --- a/lib/cdtext/cdtext_private.h +++ /dev/null @@ -1,148 +0,0 @@ -/* - Copyright (C) 2004, 2005, 2008, 2011, 2012 - Rocky Bernstein - - 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 3 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, see . -*/ - -#ifndef __CDIO_CDTEXT_PRIVATE_H__ -#define __CDIO_CDTEXT_PRIVATE_H__ - -#include - -#define CDTEXT_GET_LEN16(p) (p[0]<<8) + p[1] - - -enum { - CDTEXT_LEN_BINARY_MAX = 9216, - CDTEXT_LEN_TEXTDATA = 12, - CDTEXT_LEN_PACK = 18, - CDTEXT_LEN_BLOCKSIZE = 36, - CDTEXT_NUM_BLOCKS_MAX = 8, - CDTEXT_NUM_TRACKS_MAX = 100, - CDTEXT_NUM_BLOCKPACKS_MAX = 255 -} cdtext_format_enum; - -/** - * From table J.2 - Pack Type Indicator Definitions from - * Working Draft NCITS XXX T10/1364-D Revision 10G. November 12, 2001. - */ -enum { - CDTEXT_PACK_TITLE = 0x80, - CDTEXT_PACK_PERFORMER = 0x81, - CDTEXT_PACK_SONGWRITER = 0x82, - CDTEXT_PACK_COMPOSER = 0x83, - CDTEXT_PACK_ARRANGER = 0x84, - CDTEXT_PACK_MESSAGE = 0x85, - CDTEXT_PACK_DISCID = 0x86, - CDTEXT_PACK_GENRE = 0x87, - CDTEXT_PACK_TOC = 0x88, - CDTEXT_PACK_TOC2 = 0x89, - CDTEXT_PACK_UPC = 0x8E, - CDTEXT_PACK_BLOCKSIZE = 0x8F -} cdtext_packtype_enum; - - -/** CD-Text character encodings */ -enum cdtext_charcode_enum_s { - CDTEXT_CHARCODE_ISO_8859_1 = 0x00, /**< ISO-8859-1 (8 bit), Latin-1 */ - CDTEXT_CHARCODE_ASCII = 0x01, /**< ASCII (7 bit) */ - CDTEXT_CHARCODE_SHIFT_JIS = 0x80 /**< Shift_JIS (double byte), JIS X 0208 Appendix 1 */ -///* The following were proposed but never implemented anywhere. -// * They are mentioned for completeness here -// * CDTEXT_CHARCODE_KOREAN = 0x81, /**< Korean */ -// * CDTEXT_CHARCODE_CHINESE = 0x82, /**< Mandarin Chinese */ -// * CDTEXT_CHARCODE_UNDEFINED = 0xFF, /**< everything else */ -// */ -} cdtext_charcode_enum; - -/** Structure of CD-TEXT data Packs */ -struct cdtext_pack_s -{ - uint8_t type; - uint8_t i_track; - uint8_t seq; - uint8_t char_pos; /* character position */ - uint8_t block; /* block number 0..7 */ - uint8_t db_chars; /* double byte character */ - uint8_t text[CDTEXT_LEN_TEXTDATA]; - uint8_t crc[2]; -}; - - -/** Structure of of block size information packs */ -struct cdtext_blocksize_s -{ - uint8_t charcode; /* character code */ - uint8_t i_first_track; /* first track number */ - uint8_t i_last_track; /* last track number */ - uint8_t copyright; /* 3 CD-TEXT is copyrighted, 0 no copyright on CD-TEXT */ - uint8_t i_packs[16]; /* number of packs of each type - * 0 TITLE; 1 PERFORMER; 2 SONGWRITER; 3 COMPOSER; - * 4 ARRANGER; 5 MESSAGE; 6 DISCID; 7 GENRE; - * 8 TOC; 9 TOC2; 10-12 RESERVED; 13 CLOSED; - * 14 UPC_ISRC; 15 BLOCKSIZE */ - uint8_t lastseq[8]; /* last sequence for block 0..7 */ - uint8_t langcode[8]; /* language code for block 0..7 */ -}; - -typedef struct cdtext_pack_s cdtext_pack_t; -typedef struct cdtext_blocksize_s cdtext_blocksize_t; - -/*! Structure for CD-TEXT of a track. */ -struct cdtext_track_s { - char *field[MAX_CDTEXT_FIELDS]; -}; - -/*! Structure for CD-TEXT of a block. */ -struct cdtext_block_s { - struct cdtext_track_s track[CDTEXT_NUM_TRACKS_MAX]; /**< 0: disc; 1..99: tracks */ - cdtext_genre_t genre_code; /**< genre code of the disc */ - cdtext_lang_t language_code; /**< language of this block */ - bool copyright; /**< CD-TEXT copyright */ -}; - -/*! Structure for CD-TEXT of a disc. - - @see cdtext_init, cdtext_destroy, cdtext_get, and cdtext_set. - */ -struct cdtext_s { - struct cdtext_block_s block[CDTEXT_NUM_BLOCKS_MAX]; /**< CD-TEXT for block 0..7 */ - uint8_t block_i; /**< index of active block */ -}; - -int cdtext_read_pack (cdtext_pack_t *pack, const uint8_t *data); - -/*! - returns enum of field if key is a CD-Text keyword, - returns CDTEXT_FIELD_INVALID otherwise. -*/ -cdtext_field_t cdtext_is_field (const char *field); - -/*! - returns enum of language if lang is a valid language, - returns CDTEXT_LANGUAGE_UNKNOWN otherwise. -*/ -cdtext_lang_t cdtext_is_language (const char *lang); - - -#endif /* __CDIO_CDTEXT_PRIVATE_H__ */ - -/* - * Local variables: - * c-file-style: "gnu" - * tab-width: 8 - * indent-tabs-mode: nil - * End: - */ diff --git a/lib/cdtext/libcdtext.sym b/lib/cdtext/libcdtext.sym deleted file mode 100644 index 7cf7a01d..00000000 --- a/lib/cdtext/libcdtext.sym +++ /dev/null @@ -1,13 +0,0 @@ -cdio_get_cdtext -cdio_get_cdtext_raw -cdtext_destroy -cdtext_field2str -cdtext_genre2str -cdtext_lang2str -cdtext_get -cdtext_get_const -cdtext_get_language -cdtext_init -cdtext_list_languages -cdtext_set -cdtext_select_language From eb990be1a612ede70058ae15e0c0150e8acbf5fb Mon Sep 17 00:00:00 2001 From: rocky Date: Sun, 25 Mar 2012 17:21:12 -0400 Subject: [PATCH 16/18] Getting back to before cdtext library --- configure.ac | 1 - libcdtext.pc.in | 12 ------------ 2 files changed, 13 deletions(-) delete mode 100644 libcdtext.pc.in diff --git a/configure.ac b/configure.ac index 7b1b2cf2..8f26d324 100644 --- a/configure.ac +++ b/configure.ac @@ -643,7 +643,6 @@ AC_CONFIG_FILES([ doc/Makefile \ lib/Makefile \ lib/cdio++/Makefile \ - lib/cdtext/Makefile \ lib/driver/Makefile \ lib/iso9660/Makefile \ lib/udf/Makefile \ diff --git a/libcdtext.pc.in b/libcdtext.pc.in deleted file mode 100644 index ff168b47..00000000 --- a/libcdtext.pc.in +++ /dev/null @@ -1,12 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ -libiconv=@LTLIBICONV@ - -Name: libcdtext -Description: CD-Text library of libcdio -Version: @PACKAGE_VERSION@ -Requires: libcdio -Libs: -L${libdir} -lcdtext @LTLIBICONV@ -lcdio -Cflags: -I${includedir} From aa0c1cb2a3d32dfea07bd4b9bd6a664066cb3f65 Mon Sep 17 00:00:00 2001 From: rocky Date: Sun, 25 Mar 2012 20:11:11 -0400 Subject: [PATCH 17/18] test/Makefile.am: test example files, some of which are used in tests, is no longer optional other Makefile.am: remove some cruft. --- Makefile.am | 3 +-- configure.ac | 1 - example/Makefile.am | 46 +++++++++++++++++++++++++++-------------- test/Makefile.am | 2 +- test/driver/Makefile.am | 4 ++-- 5 files changed, 34 insertions(+), 22 deletions(-) diff --git a/Makefile.am b/Makefile.am index 0f00df16..4df3808f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -# Copyright (C) 2003, 2004, 2006, 2008, 2011 +# Copyright (C) 2003, 2004, 2006, 2008, 2011, 2012 # Rocky Bernstein # # This program is free software: you can redistribute it and/or modify @@ -116,7 +116,6 @@ check_iso.sh: $(top_builddir)/config.status check_iso.sh.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ chmod +x config_iso.sh -# cvs2cl MAINTAINERCLEANFILES = ChangeLog *.rej *.orig if MAINTAINER_MODE diff --git a/configure.ac b/configure.ac index 8f26d324..d3e86fb6 100644 --- a/configure.ac +++ b/configure.ac @@ -648,7 +648,6 @@ AC_CONFIG_FILES([ lib/udf/Makefile \ libcdio.pc \ libcdio++.pc \ - libcdtext.pc \ libiso9660.pc \ libiso9660++.pc \ libudf.pc \ diff --git a/example/Makefile.am b/example/Makefile.am index 50d8a649..2782dfa4 100644 --- a/example/Makefile.am +++ b/example/Makefile.am @@ -22,18 +22,35 @@ if ENABLE_CPP SUBDIRS = C++ endif -if BUILD_EXAMPLES - audio cdchange cdio-eject cdtext device \ - discid drives eject \ - extract isofile isofile2 isofuzzy isolist isolsn \ - mmc1 mmc2 mmc2a mmc3 \ - sample3 sample4 tracks udf1 udffile -endif +noinst_PROGRAMS = \ + audio \ + cdchange \ + cdio-eject \ + cdtext \ + device \ + discid \ + drives \ + eject \ + extract \ + isofile \ + isofile2 \ + isofuzzy \ + isolist \ + isolsn \ + mmc1 \ + mmc2 \ + mmc2a \ + mmc3 \ + sample3 \ + sample4 \ + tracks \ + udf1 \ + udffile -# extract is used in tests so that has to be built regardless -noinst_PROGRAMS = extract $(noinst_programs) +check_PROGRAMS = cdtext device drives \ + mmc1 mmc2 mmc2a mmc3 sample4 -INCLUDES = -I$(top_srcdir) $(LIBCDIO_CFLAGS) +INCLUDES = $(LIBCDIO_CFLAGS) audio_DEPENDENCIES = $(LIBCDIO_DEPS) audio_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV) @@ -41,6 +58,9 @@ audio_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV) cdchange_DEPENDENCIES = $(LIBCDIO_DEPS) cdchange_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV) +cdio_eject_DEPENDENCIES = $(LIBCDIO_DEPS) +cdio_eject_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV) + cdtext_DEPENDENCIES = $(LIBCDIO_DEPS) cdtext_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV) @@ -59,9 +79,6 @@ eject_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV) extract_DEPENDENCIES = $(LIBISO9660_LIBS) $(LIBUDF_LIBS) $(LIBCDIO_DEPS) extract_LDADD = $(LIBISO9660_LIBS) $(LIBUDF_LIBS) $(LIBCDIO_LIBS) $(LTLIBICONV) -cdio_eject_DEPENDENCIES = $(LIBCDIO_DEPS) -cdio_eject_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV) - isofile_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS) $(LTLIBICONV) isofile2_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS) $(LTLIBICONV) isofuzzy_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS) $(LTLIBICONV) @@ -94,9 +111,6 @@ udf1_LDADD = $(LIBUDF_LIBS) $(LIBCDIO_LIBS) $(LTLIBICONV) udffile_DEPENDENCIES = $(LIBUDF_LIBS) $(LIBCDIO_DEPS) udffile_LDADD = $(LIBUDF_LIBS) $(LIBCDIO_LIBS) $(LTLIBICONV) -check_PROGRAMS = cdtext device drives \ - mmc1 mmc2 mmc2a mmc3 sample4 - TESTS = $(check_PROGRAMS) # iso programs create file "copying" diff --git a/test/Makefile.am b/test/Makefile.am index 5c6d267a..6a7eef1d 100755 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -31,7 +31,7 @@ hack = check_sizeof testassert testgetdevices testischar \ EXTRA_PROGRAMS = testdefault DATA_DIR = @abs_top_srcdir@/test/data -INCLUDES = -I$(top_srcdir) $(LIBCDIO_CFLAGS) $(LIBISO9660_CFLAGS) +INCLUDES = $(LIBCDIO_CFLAGS) $(LIBISO9660_CFLAGS) check_sizeof_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS) $(LTLIBICONV) testassert_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV) diff --git a/test/driver/Makefile.am b/test/driver/Makefile.am index f8f4f9e4..6f8b12c0 100644 --- a/test/driver/Makefile.am +++ b/test/driver/Makefile.am @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010 Rocky Bernstein +# Copyright (C) 2009, 2010, 2012 Rocky Bernstein # # 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 @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -INCLUDES = -I$(top_srcdir) $(LIBCDIO_CFLAGS) $(LIBISO9660_CFLAGS) +INCLUDES = $(LIBCDIO_CFLAGS) $(LIBISO9660_CFLAGS) DATA_DIR = $(abs_top_srcdir)/test/data abs_path_SOURCES = abs_path.c From b052c43389f8e028211595d6f352200f7c30149a Mon Sep 17 00:00:00 2001 From: "R. Bernstein" Date: Mon, 26 Mar 2012 07:40:10 -0400 Subject: [PATCH 18/18] Update some README's to reflect the current situation. --- README | 8 +++++--- README.libcdio | 18 +++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/README b/README index a3d27324..b5ee7004 100644 --- a/README +++ b/README @@ -9,9 +9,11 @@ A library for working with ISO-9660 filesystems libiso9660 is included. A generic interface for issuing MMC (multimedia commands) is also part of the libcdio library. -Also included is a library for working with ISO-9660 filesystems as is -also the CD-DA error/jitter correction library from cdparanoia -(http://www.xiph.org/paranoia). +Also included is a library for working with ISO-9660 filesystems. + +The CD-DA error/jitter correction library from cdparanoia +(http://www.xiph.org/paranoia) is included as a separate library +licenced under GPL v2. Some support for disk image types like CDRWin's BIN/CUE format, cdrdao's TOC format, and Nero's NRG format are available. Therefore, diff --git a/README.libcdio b/README.libcdio index b69cc461..7d718a3f 100644 --- a/README.libcdio +++ b/README.libcdio @@ -62,16 +62,16 @@ an optional dependency on libcdio). Microsoft Windows ------- -The building under Microsoft Windows the thing to do is to install -cygwin (http://www.cygwin.com). It has been reported that MinGW -(http://www.mingw.org/) also works, but it is possible you may -encounter more problems there. +Building under Microsoft Windows is supported for cygwin +(http://www.cygwin.com). MinGW (http://www.mingw.org/) may also work, +but it is possible you may encounter problems there. -Folks may have used Microsoft compilers (e.g. Visual C), but you may -find you need to make your own "project" files. Don't undertake this -unless you are willing to spend time hacking. xboxmediacenter team -folks I believe go this route, so you may be able to use their project -files as a starting point. +Support for Microsoft compilers (e.g. Visual C) is not officially +supported. You need to make your own "project" files. Don't +undertake this unless you are willing to spend time hacking. In the +past xboxmediacenter team folks I believe have gone this route, as has +Pete Batard in his rufus project. You may be able to use their project +files as a starting point. XBOX -------