diff options
Diffstat (limited to 'src/input/vcd/libcdio/cdio')
-rw-r--r-- | src/input/vcd/libcdio/cdio/cd_types.h | 127 | ||||
-rw-r--r-- | src/input/vcd/libcdio/cdio/cdio.h | 299 | ||||
-rw-r--r-- | src/input/vcd/libcdio/cdio/iso9660.h | 395 | ||||
-rw-r--r-- | src/input/vcd/libcdio/cdio/logging.h | 105 | ||||
-rw-r--r-- | src/input/vcd/libcdio/cdio/sector.h | 152 | ||||
-rw-r--r-- | src/input/vcd/libcdio/cdio/types.h | 39 | ||||
-rw-r--r-- | src/input/vcd/libcdio/cdio/util.h | 8 | ||||
-rw-r--r-- | src/input/vcd/libcdio/cdio/version.h | 11 | ||||
-rw-r--r-- | src/input/vcd/libcdio/cdio/xa.h | 72 |
9 files changed, 811 insertions, 397 deletions
diff --git a/src/input/vcd/libcdio/cdio/cd_types.h b/src/input/vcd/libcdio/cdio/cd_types.h index 91b36453c..1117171ae 100644 --- a/src/input/vcd/libcdio/cdio/cd_types.h +++ b/src/input/vcd/libcdio/cdio/cd_types.h @@ -1,5 +1,5 @@ /* - $Id: cd_types.h,v 1.1 2003/10/13 11:47:12 f1rmb Exp $ + $Id: cd_types.h,v 1.2 2004/04/11 12:20:31 miguelfreitas Exp $ Copyright (C) 2003 Rocky Bernstein <rocky@panix.com> Copyright (C) 1996,1997,1998 Gerd Knorr <kraxel@bytesex.org> @@ -20,10 +20,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* - Filesystem types we understand. The highest-numbered fs type should - be less than CDIO_FS_MASK defined below. -*/ +/** \file cd_types.h + * \brief Header for routines which automatically determine the Compact Disc + * format and possibly filesystem on the CD. + * + */ #ifndef __CDIO_CD_TYPES_H__ #define __CDIO_CD_TYPES_H__ @@ -32,72 +33,100 @@ extern "C" { #endif /* __cplusplus */ -#define CDIO_FS_AUDIO 1 /* audio only - not really a fs */ -#define CDIO_FS_HIGH_SIERRA 2 -#define CDIO_FS_ISO_9660 3 +/** + * Filesystem types we understand. The highest-numbered fs type should + * be less than CDIO_FS_MASK defined below. + */ +#define CDIO_FS_AUDIO 1 /**< audio only - not really a + filesystem */ +#define CDIO_FS_HIGH_SIERRA 2 +#define CDIO_FS_ISO_9660 3 /**< ISO 9660 filesystem */ #define CDIO_FS_INTERACTIVE 4 -#define CDIO_FS_HFS 5 -#define CDIO_FS_UFS 6 - -/* EXT2 was the GNU/Linux native filesystem for early kernels. Newer - GNU/Linux OS's may use EXT3 which EXT2 with a journal. */ +#define CDIO_FS_HFS 5 /**< file system used on the Macintosh + system in MacOS 6 through MacOS 9 + and depricated in OSX. */ +#define CDIO_FS_UFS 6 /**< Generic Unix file system derived + from the Berkeley fast file + system. */ + +/** + * EXT2 was the GNU/Linux native filesystem for early kernels. Newer + * GNU/Linux OS's may use EXT3 which EXT2 with a journal. + */ #define CDIO_FS_EXT2 7 -#define CDIO_FS_ISO_HFS 8 /* both hfs & isofs filesystem */ -#define CDIO_FS_ISO_9660_INTERACTIVE 9 /* both CD-RTOS and isofs filesystem */ +#define CDIO_FS_ISO_HFS 8 /**< both HFS & ISO-9660 filesystem */ +#define CDIO_FS_ISO_9660_INTERACTIVE 9 /**< both CD-RTOS and ISO filesystem */ -/* The 3DO is, technically, a set of specifications created by the 3DO -company. These specs are for making a 3DO Interactive Multiplayer -which uses a CD-player. Panasonic in the early 90's was the first -company to manufacture and market a 3DO player. */ +/** + * The 3DO is, technically, a set of specifications created by the 3DO + * company. These specs are for making a 3DO Interactive Multiplayer + * which uses a CD-player. Panasonic in the early 90's was the first + * company to manufacture and market a 3DO player. + */ #define CDIO_FS_3DO 10 -#define CDIO_FS_MASK 15 /* Should be 2*n-1 and > above */ +#define CDIO_FS_MASK 15 /**< Note: this should be 2**n-1 and + and greater than the highest + CDIO_FS number above */ #define CDIO_FS_UNKNOWN CDIO_FS_MASK -/* Macro to extract just the FS type portion defined above */ +/** + * Macro to extract just the FS type portion defined above +*/ #define CDIO_FSTYPE(fs) (fs & CDIO_FS_MASK) -/* - Bit masks for the classes of CD-images. These are generally - higher-level than the fs-type information above and may be determined - based of the fs type information. +/** + * Bit masks for the classes of CD-images. These are generally + * higher-level than the fs-type information above and may be determined + * based of the fs type information. */ -#define CDIO_FS_ANAL_XA 16 -#define CDIO_FS_ANAL_MULTISESSION 32 -#define CDIO_FS_ANAL_PHOTO_CD 64 -#define CDIO_FS_ANAL_HIDDEN_TRACK 128 +#define CDIO_FS_ANAL_XA 16 /**< eXtended Architecture format */ +#define CDIO_FS_ANAL_MULTISESSION 32 /**< CD has multisesion */ +#define CDIO_FS_ANAL_PHOTO_CD 64 /**< Is a Kodak Photo CD */ +#define CDIO_FS_ANAL_HIDDEN_TRACK 128 /**< Hidden track at the + beginning of the CD */ #define CDIO_FS_ANAL_CDTV 256 -#define CDIO_FS_ANAL_BOOTABLE 512 -#define CDIO_FS_ANAL_VIDEOCD 1024 /* VCD 1.1 */ -#define CDIO_FS_ANAL_ROCKRIDGE 2048 -#define CDIO_FS_ANAL_JOLIET 4096 -#define CDIO_FS_ANAL_SVCD 8192 /* Super VCD or Choiji Video CD */ -#define CDIO_FS_ANAL_CVD 16384 /* Choiji Video CD */ - -/* Pattern which can be used by cdio_get_devices to specify matching - any sort of CD. -*/ +#define CDIO_FS_ANAL_BOOTABLE 512 /**< CD is bootable */ +#define CDIO_FS_ANAL_VIDEOCD 1024 /**< VCD 1.1 */ +#define CDIO_FS_ANAL_ROCKRIDGE 2048 /**< Has Rock Ridge Extensions to + ISO 9660 */ +#define CDIO_FS_ANAL_JOLIET 4096 /**< Microsoft Joliet extensions + to ISO 9660 */ +#define CDIO_FS_ANAL_SVCD 8192 /**< Super VCD or Choiji Video CD */ +#define CDIO_FS_ANAL_CVD 16384 /**< Choiji Video CD */ + +/** + * Pattern which can be used by cdio_get_devices to specify matching + * any sort of CD. + */ #define CDIO_FS_MATCH_ALL (cdio_fs_anal_t) (~CDIO_FS_MASK) +/*! + \brief The type used to return analysis information from + cdio_guess_cd_type. + + These fields make sense only for when an ISO-9660 filesystem is used. + */ typedef struct { - unsigned int joliet_level; - char iso_label[33]; /* 32 + 1 for null byte at the end in - formatting the string */ + 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 */ unsigned int isofs_size; -} cdio_analysis_t; +} cdio_iso_analysis_t; -/* - Try to determine what kind of CD-image and/or filesystem we - have at track track_num. Return information about the CD image - is returned in cdio_analysis and the return value. -*/ +/** + * Try to determine what kind of CD-image and/or filesystem we + * have at track track_num. Return information about the CD image + * is returned in iso_analysis and the return value. + */ cdio_fs_anal_t cdio_guess_cd_type(const CdIo *cdio, int start_session, track_t track_num, - /*out*/ cdio_analysis_t *cdio_analysis); + /*out*/ cdio_iso_analysis_t *iso_analysis); #ifdef __cplusplus } diff --git a/src/input/vcd/libcdio/cdio/cdio.h b/src/input/vcd/libcdio/cdio/cdio.h index d0b304b38..a9fa4b02e 100644 --- a/src/input/vcd/libcdio/cdio/cdio.h +++ b/src/input/vcd/libcdio/cdio/cdio.h @@ -1,8 +1,8 @@ /* -*- c -*- - $Id: cdio.h,v 1.1 2003/10/13 11:47:12 f1rmb Exp $ + $Id: cdio.h,v 1.2 2004/04/11 12:20:31 miguelfreitas Exp $ Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org> - Copyright (C) 2003 Rocky Bernstein <rocky@panix.com> + Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,14 +19,16 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Public CD Input and Control Interface . */ +/** \file cdio.h + * \brief The top-level header for libcdio: the CD Input and Control library. + */ #ifndef __CDIO_H__ #define __CDIO_H__ -/* Application Interface or Protocol version number. If the public - interface changes, we increase this number. +/** Application Interface or Protocol version number. If the public + * interface changes, we increase this number. */ #define CDIO_API_VERSION 1 @@ -43,64 +45,68 @@ #include <cdio/sector.h> /* Flags specifying the category of device to open or is opened. */ -#define CDIO_SRC_IS_DISK_IMAGE_MASK 0x0001 -#define CDIO_SRC_IS_DEVICE_MASK 0x0002 -#define CDIO_SRC_IS_SCSI_MASK 0x0004 + +#define CDIO_SRC_IS_DISK_IMAGE_MASK 0x0001 /**< Read source is a CD image. */ +#define CDIO_SRC_IS_DEVICE_MASK 0x0002 /**< Read source is a CD device. */ +#define CDIO_SRC_IS_SCSI_MASK 0x0004 #define CDIO_SRC_IS_NATIVE_MASK 0x0008 #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ - /* opaque structure */ + /** This is an opaque structure. */ typedef struct _CdIo CdIo; - /* The below enumerations may be used to tag a specific driver - that is opened or is desired to be opened. Note that this is - different than what is available on a given host. - - Order is a little significant since the order is used in scans. - We have to start with UNKNOWN and devices should come before - disk-image readers. By putting something towards the top (a lower - enumeration number), in an iterative scan we prefer that to something - with a higher enumeration number. - - NOTE: IF YOU MODIFY ENUM MAKE SURE INITIALIZATION IN CDIO.C AGREES. - - */ + /** The driver_id_t enumerations may be used to tag a specific driver + * that is opened or is desired to be opened. Note that this is + * different than what is available on a given host. + * + * Order is a little significant since the order is used in scans. + * We have to start with UNKNOWN and devices should come before + * disk-image readers. By putting something towards the top (a lower + * enumeration number), in an iterative scan we prefer that to + * something with a higher enumeration number. + * + * NOTE: IF YOU MODIFY ENUM MAKE SURE INITIALIZATION IN CDIO.C AGREES. + * + */ typedef enum { DRIVER_UNKNOWN, - DRIVER_BSDI, - DRIVER_FREEBSD, - DRIVER_LINUX, - DRIVER_SOLARIS, - DRIVER_OSX, - DRIVER_WIN32, - DRIVER_BINCUE, /* Prefer bincue over nrg when both exist */ - DRIVER_NRG, - DRIVER_DEVICE /* Is really a set of the above; should come last */ + DRIVER_BSDI, /**< BSDI driver */ + DRIVER_FREEBSD, /**< FreeBSD driver */ + DRIVER_LINUX, /**< GNU/Linux Driver */ + DRIVER_SOLARIS, /**< Sun Solaris Driver */ + DRIVER_OSX, /**< Apple OSX Driver */ + DRIVER_WIN32, /**< Microsoft Windows Driver */ + DRIVER_BINCUE, /**< BIN/CUE format CD image. This is listed before NRG, + to make the code prefer BINCUE 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; - /* Make sure what's listed below is the last one above. Since we have - a bogus (but useful) 0th entry above we don't have to add one below. - */ +/** Make sure what's listed for CDIO_MIN_DRIVER is the last + enumeration in driver_id_t. Since we have a bogus (but useful) 0th + entry above we don't have to add one. +*/ #define CDIO_MIN_DRIVER DRIVER_BSDI #define CDIO_MIN_DEVICE_DRIVER CDIO_MIN_DRIVER #define CDIO_MAX_DRIVER DRIVER_NRG #define CDIO_MAX_DEVICE_DRIVER DRIVER_WIN32 typedef enum { - TRACK_FORMAT_AUDIO, /* Audio track, e.g. CD-DA */ - TRACK_FORMAT_CDI, /* CD-i. How this is different from DATA below? */ - TRACK_FORMAT_XA, /* Mode2 of some sort */ - TRACK_FORMAT_DATA, /* Mode1 of some sort */ - TRACK_FORMAT_PSX, /* Playstation CD. Like audio but only 2336 bytes - of user data. + TRACK_FORMAT_AUDIO, /**< Audio track, e.g. CD-DA */ + TRACK_FORMAT_CDI, /**< CD-i. How this is different from DATA below? */ + TRACK_FORMAT_XA, /**< Mode2 of some sort */ + TRACK_FORMAT_DATA, /**< Mode1 of some sort */ + TRACK_FORMAT_PSX, /**< Playstation CD. Like audio but only 2336 bytes + * of user data. */ - TRACK_FORMAT_ERROR /* Dunno what is or some other error. */ + TRACK_FORMAT_ERROR /**< Dunno what is, or some other error. */ } track_format_t; - /* Printable tags for above enumeration. */ + /*! Printable tags for track_format_t enumeration. */ extern const char *track_format2str[6]; /*! @@ -140,12 +146,14 @@ extern "C" { To find a CD-drive of any type, use the mask CDIO_FS_MATCH_ALL. NULL is returned if we couldn't get a default device. + It is also possible to return a non NULL but after dereferencing the + the value is NULL. This also means nothing was found. */ char ** cdio_get_devices_with_cap (char* search_devices[], cdio_fs_anal_t capabilities, bool any); - /*!Return an array of device names. If you want a specific - devices, dor a driver give that device, if you want hardware + /*! Return an array of device names. If you want a specific + devices for a driver, give that device. If you want hardware devices, give DRIVER_DEVICE and if you want all possible devices, image drivers and hardware drivers give DRIVER_UNKNOWN. @@ -190,7 +198,7 @@ extern "C" { track_t cdio_get_num_tracks (const CdIo *obj); /*! - Get format of track. + Get the format (audio, mode2, mode1) of track. */ track_format_t cdio_get_track_format(const CdIo *obj, track_t track_num); @@ -255,46 +263,46 @@ extern "C" { ssize_t cdio_read(const CdIo *obj, void *buf, size_t size); /*! - Reads a audio sector from cd device into data starting - from lsn. Returns 0 if no error. - */ + Reads a audio sector from cd device into data starting + from lsn. Returns 0 if no error. + */ int cdio_read_audio_sector (const CdIo *obj, void *buf, lsn_t lsn); /*! - Reads a audio sector from cd device into data starting - from lsn. Returns 0 if no error. - */ + Reads a audio sector from cd device into data starting + from lsn. Returns 0 if no error. + */ int cdio_read_audio_sectors (const CdIo *obj, void *buf, lsn_t lsn, unsigned int nblocks); /*! Reads a single mode1 sector from cd device into data starting from lsn. Returns 0 if no error. - */ + */ int cdio_read_mode1_sector (const CdIo *obj, void *buf, lsn_t lsn, - bool is_form2); - + bool b_form2); + /*! - Reads nblocks of mode1 sectors from cd device into data starting - from lsn. Returns 0 if no error. - */ + Reads nblocks of mode1 sectors from cd device into data starting + from lsn. Returns 0 if no error. + */ int cdio_read_mode1_sectors (const CdIo *obj, void *buf, lsn_t lsn, - bool is_form2, unsigned int num_sectors); - + bool b_form2, unsigned int num_sectors); + /*! - Reads a single mode2 sector from cd device into data starting - from lsn. Returns 0 if no error. - */ + Reads a single mode2 sector from cd device into data starting + from lsn. Returns 0 if no error. + */ int cdio_read_mode2_sector (const CdIo *obj, void *buf, lsn_t lsn, - bool is_form2); - + bool b_form2); + /*! Reads nblocks of mode2 sectors from cd device into data starting from lsn. Returns 0 if no error. */ int cdio_read_mode2_sectors (const CdIo *obj, void *buf, lsn_t lsn, - bool is_form2, unsigned int num_sectors); + bool b_form2, unsigned int num_sectors); /*! Set the arg "key" with "value" in the source device. @@ -306,49 +314,73 @@ extern "C" { Return the size of the CD in logical block address (LBA) units. */ uint32_t cdio_stat_size (const CdIo *obj); - + /*! Initialize CD Reading and control routines. Should be called first. - */ + */ bool cdio_init(void); - + /* True if xxx driver is available. where xxx=linux, solaris, nrg, ... */ + + /*! True if BSDI driver is available. */ bool cdio_have_bsdi (void); + + /*! True if FreeBSD driver is available. */ bool cdio_have_freebsd (void); + + /*! True if GNU/Linux driver is available. */ bool cdio_have_linux (void); + + /*! True if Sun Solaris driver is available. */ bool cdio_have_solaris (void); + + /*! True if Apple OSX driver is available. */ bool cdio_have_osx (void); + + /*! True if Microsoft Windows driver is available. */ bool cdio_have_win32 (void); + + /*! True if Nero driver is available. */ bool cdio_have_nrg (void); + + /*! True if BIN/CUE driver is available. */ bool cdio_have_bincue (void); - /* Like above but uses the enumeration instead. */ + /*! Like cdio_have_xxx but uses an enumeration instead. */ bool cdio_have_driver (driver_id_t driver_id); - /* Return a string decribing driver_id. */ + /*! Return a string decribing driver_id. */ const char *cdio_driver_describe (driver_id_t driver_id); /*! Sets up to read from place specified by source_name and driver_id This should be called before using any other routine, except cdio_init. This will call cdio_init, if that hasn't been - done previously. to call one of the specific routines below. + done previously. to call one of the specific cdio_open_xxx + routines. NULL is returned on error. */ CdIo * cdio_open (const char *source_name, driver_id_t driver_id); - /*! cdrao BIN/CUE CD disk-image routines. Source is the .bin file + /*! Set up BIN/CUE CD disk-image for reading. Source is the .bin or + .cue file NULL is returned on error. */ CdIo * cdio_open_bincue (const char *bin_name); + /*! Return a string containing the default CUE file that would + be used when none is specified. + + NULL is returned on error or there is no device. + */ char * cdio_get_default_device_bincue(void); char **cdio_get_devices_bincue(void); - /*! CD routines. Source is the some sort of device. + /*! Set up CD-ROM for reading. The device_name is + the some sort of device name. NULL is returned on error. */ @@ -360,65 +392,154 @@ extern "C" { */ CdIo * cdio_open_cue (const char *cue_name); - /*! BSDI CD-reading routines. - NULL is returned on error. - */ + /*! Set up CD-ROM for reading using the BSDI driver. The device_name is + the some sort of device name. + + NULL is returned on error or there is no BSDI driver. + + @see cdio_open + */ CdIo * cdio_open_bsdi (const char *source_name); + /*! Return a string containing the default device name that the + BSDI driver would use when none is specified. + + NULL is returned on error or there is no CD-ROM device. + + @see cdio_open_cd + @see cdio_open + */ char * cdio_get_default_device_bsdi(void); + /*! Return a list of all of the CD-ROM devices that the BSDI driver + can find. + */ char **cdio_get_devices_bsdi(void); - /*! BSDI CD-reading routines. - NULL is returned on error. - */ + /*! Set up CD-ROM for reading using the FreeBSD driver. The device_name is + the some sort of device name. + + NULL is returned on error or there is no FreeBSD driver. + + @see cdio_open_cd + @see cdio_open + */ CdIo * cdio_open_freebsd (const char *source_name); + /*! Return a string containing the default device name that the + FreeBSD driver would use when none is specified. + + NULL is returned on error or there is no CD-ROM device. + */ char * cdio_get_default_device_freebsd(void); + /*! Return a list of all of the CD-ROM devices that the FreeBSD driver + can find. + */ char **cdio_get_devices_freebsd(void); - /*! Linux CD-reading routines. - NULL is returned on error. + /*! Set up CD-ROM for reading using the GNU/Linux driver. The device_name is + the some sort of device name. + + NULL is returned on error or there is no GNU/Linux driver. */ CdIo * cdio_open_linux (const char *source_name); + /*! Return a string containing the default device name that the + GNU/Linux driver would use when none is specified. A scan is made + for CD-ROM drives with CDs in them. + + NULL is returned on error or there is no CD-ROM device. + + @see cdio_open_cd + @see cdio_open + */ char * cdio_get_default_device_linux(void); + /*! Return a list of all of the CD-ROM devices that the GNU/Linux driver + can find. + */ char **cdio_get_devices_linux(void); - /*! Solaris CD-reading routines. - NULL is returned on error. + /*! Set up CD-ROM for reading using the Sun Solaris driver. The + device_name is the some sort of device name. + + NULL is returned on error or there is no Solaris driver. */ CdIo * cdio_open_solaris (const char *source_name); + /*! Return a string containing the default device name that the + Solaris driver would use when none is specified. A scan is made + for CD-ROM drives with CDs in them. + + NULL is returned on error or there is no CD-ROM device. + + @see cdio_open_cd + @see cdio_open + */ char * cdio_get_default_device_solaris(void); + /*! Return a list of all of the CD-ROM devices that the Solaris driver + can find. + */ char **cdio_get_devices_solaris(void); - /*! Darwin OS X CD-reading routines. - NULL is returned on error. + /*! Set up CD-ROM for reading using the Apple OSX driver. The + device_name is the some sort of device name. + + NULL is returned on error or there is no OSX driver. + + @see cdio_open_cd + @see cdio_open */ CdIo * cdio_open_osx (const char *source_name); + /*! Return a string containing the default device name that the + OSX driver would use when none is specified. A scan is made + for CD-ROM drives with CDs in them. + + NULL is returned on error or there is no CD-ROM device + */ char * cdio_get_default_device_osx(void); + /*! Return a list of all of the CD-ROM devices that the OSX driver + can find. + */ char **cdio_get_devices_osx(void); - /*! Win32 CD-reading routines. - NULL is returned on error. + /*! Set up CD-ROM for reading using the Microsoft Windows driver. The + device_name is the some sort of device name. + + NULL is returned on error or there is no Microsof Windows driver. */ CdIo * cdio_open_win32 (const char *source_name); + /*! Return a string containing the default device name that the + Win32 driver would use when none is specified. A scan is made + for CD-ROM drives with CDs in them. + + NULL is returned on error or there is no CD-ROM device. + + @see cdio_open_cd + @see cdio_open + */ char * cdio_get_default_device_win32(void); char **cdio_get_devices_win32(void); - /*! Nero CD disk-image routines. - NULL is returned on error. + /*! Set up CD-ROM for reading using the Nero driver. The + device_name is the some sort of device name. + + NULL is returned on error or there is no Nero driver. */ CdIo * cdio_open_nrg (const char *source_name); + /*! Return a string containing the default device name that the + NRG driver would use when none is specified. A scan is made + for NRG disk images in the current directory.. + + NULL is returned on error or there is no CD-ROM device. + */ char * cdio_get_default_device_nrg(void); char **cdio_get_devices_nrg(void); diff --git a/src/input/vcd/libcdio/cdio/iso9660.h b/src/input/vcd/libcdio/cdio/iso9660.h index c2cabe5fc..78f78ef81 100644 --- a/src/input/vcd/libcdio/cdio/iso9660.h +++ b/src/input/vcd/libcdio/cdio/iso9660.h @@ -1,8 +1,8 @@ /* - $Id: iso9660.h,v 1.1 2003/10/13 11:47:12 f1rmb Exp $ + $Id: iso9660.h,v 1.2 2004/04/11 12:20:31 miguelfreitas Exp $ Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> - Copyright (C) 2003 Rocky Bernstein <rocky@panix.com> + Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> See also iso9660.h by Eric Youngdale (1993). @@ -23,9 +23,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* - * Header file iso9660.h - assorted structure definitions and typecasts. - specific to iso9660 filesystem. +/*! + * \file iso9660.h + * \brief Header for libiso9660: the ISO-9660 filesystem library. */ @@ -42,16 +42,19 @@ #define MIN_TRACK_SIZE 4*75 #define MIN_ISO_SIZE MIN_TRACK_SIZE -/* - A ISO filename is: "abcde.eee;1" -> <filename> '.' <ext> ';' <version #> - - The maximum needed string length is: +/*! + An ISO filename is: "abcde.eee;1" -> <filename> '.' <ext> ';' <version #> + + For ISO-9660 Level 1, the maximum needed string length is: + +\verbatim 30 chars (filename + ext) + 2 chars ('.' + ';') - + strlen("32767") - + null byte + + 5 chars (strlen("32767")) + + 1 null byte ================================ - = 38 chars + = 38 chars +\endverbatim */ #define LEN_ISONAME 31 #define MAX_ISONAME 37 @@ -61,26 +64,28 @@ /* * ISO 9660 directory flags. */ -#define ISO_FILE 0 /* Not really a flag... */ -#define ISO_EXISTENCE 1 /* Do not make existence known (hidden) */ -#define ISO_DIRECTORY 2 /* This file is a directory */ -#define ISO_ASSOCIATED 4 /* This file is an assiciated file */ -#define ISO_RECORD 8 /* Record format in extended attr. != 0 */ -#define ISO_PROTECTION 16 /* No read/execute perm. in ext. attr. */ -#define ISO_DRESERVED1 32 /* Reserved bit 5 */ -#define ISO_DRESERVED2 64 /* Reserved bit 6 */ -#define ISO_MULTIEXTENT 128 /* Not final entry of a mult. ext. file */ +#define ISO_FILE 0 /**< Not really a flag... */ +#define ISO_EXISTENCE 1 /**< Do not make existence known (hidden) */ +#define ISO_DIRECTORY 2 /**< This file is a directory */ +#define ISO_ASSOCIATED 4 /**< This file is an associated file */ +#define ISO_RECORD 8 /**< Record format in extended attr. != 0 */ +#define ISO_PROTECTION 16 /**< No read/execute perm. in ext. attr. */ +#define ISO_DRESERVED1 32 /**< Reserved bit 5 */ +#define ISO_DRESERVED2 64 /**< Reserved bit 6 */ +#define ISO_MULTIEXTENT 128 /**< Not final entry of a mult. ext. file */ /* Volume descriptor types */ #define ISO_VD_PRIMARY 1 -#define ISO_VD_SUPPLEMENTARY 2 /* Used by Joliet */ +#define ISO_VD_SUPPLEMENTARY 2 /**< Used by Joliet */ #define ISO_VD_END 255 -#define ISO_PVD_SECTOR 16 -#define ISO_EVD_SECTOR 17 +#define ISO_PVD_SECTOR 16 /**< Sector of Primary Volume Descriptor */ +#define ISO_EVD_SECTOR 17 /**< Sector of End Volume Descriptor */ -#define ISO_STANDARD_ID "CD001" -#define ISO_BLOCKSIZE 2048 +#define ISO_STANDARD_ID "CD001" /**< String inside track identifying an + ISO 9660 filesystem. */ +#define ISO_BLOCKSIZE 2048 /**< Number of bytes in an ISO + 9660 block */ #ifdef __cplusplus extern "C" { @@ -95,64 +100,95 @@ enum strncpy_pad_check { PRAGMA_BEGIN_PACKED +/*! + \brief ISO-9660 shorter-format time structure. + + @see iso9660_dtime + */ struct iso9660_dtime { uint8_t dt_year; - uint8_t dt_month; /* 1..12. Note 1 origin not 0, like a tm struct. */ + uint8_t dt_month; /**< Has value in range 1..12. Note starts + at 1, not 0 like a tm struct. */ uint8_t dt_day; uint8_t dt_hour; uint8_t dt_minute; uint8_t dt_second; - int8_t dt_gmtoff; /* GMT values -48 .. + 52 in 15 min intervals */ + int8_t dt_gmtoff; /**< GMT values -48 .. + 52 in 15 minute + intervals */ } GNUC_PACKED; typedef struct iso9660_dtime iso9660_dtime_t; +/*! + \brief ISO-9660 longer-format time structure. + + @see iso9660_ltime + */ struct iso9660_ltime { - char lt_year [_delta( 1, 4)]; /* Add 1900 for Julian year */ - char lt_month [_delta( 5, 6)]; /* 1..12. Note starts at 1. */ + char lt_year [_delta( 1, 4)]; /**< Add 1900 to value + for the Julian + year */ + char lt_month [_delta( 5, 6)]; /**< Has value in range + 1..12. Note starts + at 1, not 0 like a + tm struct. */ char lt_day [_delta( 7, 8)]; char lt_hour [_delta( 9, 10)]; char lt_minute [_delta( 11, 12)]; char lt_second [_delta( 13, 14)]; - char lt_hsecond [_delta( 15, 16)]; /* 1/100's of a second */ + char lt_hsecond [_delta( 15, 16)]; /**<! The value is in + units of 1/100's of + a second */ int8_t lt_gmtoff [_delta( 17, 17)]; } GNUC_PACKED; typedef struct iso9660_ltime iso9660_ltime_t; -/* ISO-9660 Primary Volume Descriptor. +/*! + \brief ISO-9660 Primary Volume Descriptor. */ struct iso9660_pvd { - uint8_t type; /* 711 */ + uint8_t type; /**< 711 encoded */ char id[5]; - uint8_t version; /* 711 */ + uint8_t version; /**< 711 encoded */ char unused1[1]; - char system_id[32]; /* achars */ - char volume_id[32]; /* dchars */ + char system_id[32]; /**< each char is an achar */ + char volume_id[32]; /**< each char is a dchar */ char unused2[8]; - uint64_t volume_space_size; /* 733 */ + uint64_t volume_space_size; /**< 733 encoded */ char escape_sequences[32]; - uint32_t volume_set_size; /* 723 */ - uint32_t volume_sequence_number; /* 723 */ - uint32_t logical_block_size; /* 723 */ - uint64_t path_table_size; /* 733 */ - uint32_t type_l_path_table; /* 731 */ - uint32_t opt_type_l_path_table; /* 731 */ - uint32_t type_m_path_table; /* 732 */ - uint32_t opt_type_m_path_table; /* 732 */ - char root_directory_record[34]; /* 9.1 */ - char volume_set_id[128]; /* dchars */ - char publisher_id[128]; /* achars */ - char preparer_id[128]; /* achars */ - char application_id[128]; /* achars */ - char copyright_file_id[37]; /* 7.5 dchars */ - char abstract_file_id[37]; /* 7.5 dchars */ - char bibliographic_file_id[37]; /* 7.5 dchars */ - iso9660_ltime_t creation_date; /* 8.4.26.1 */ - iso9660_ltime_t modification_date; /* 8.4.26.1 */ - iso9660_ltime_t expiration_date; /* 8.4.26.1 */ - iso9660_ltime_t effective_date; /* 8.4.26.1 */ - uint8_t file_structure_version; /* 711 */ + uint32_t volume_set_size; /**< 723 encoded */ + uint32_t volume_sequence_number; /**< 723 encoded */ + uint32_t logical_block_size; /**< 723 encoded */ + uint64_t path_table_size; /**< 733 encoded */ + uint32_t type_l_path_table; /**< 731 encoded */ + uint32_t opt_type_l_path_table; /**< 731 encoded */ + uint32_t type_m_path_table; /**< 732 encoded */ + uint32_t opt_type_m_path_table; /**< 732 encoded */ + char root_directory_record[34]; /**< See section 9.1 of + ISO 9660 spec. */ + char volume_set_id[128]; /**< dchars */ + char publisher_id[128]; /**< achars */ + char preparer_id[128]; /**< achars */ + char application_id[128]; /**< achars */ + char copyright_file_id[37]; /**< See section 7.5 of + ISO 9660 spec. Each char is + a dchar */ + char abstract_file_id[37]; /**< See section 7.5 of + ISO 9660 spec. Each char is + a dchar */ + char bibliographic_file_id[37]; /**< See section 7.5 of + ISO 9660 spec. Each char is + a dchar. */ + iso9660_ltime_t creation_date; /**< See section 8.4.26.1 of + ISO 9660 spec. */ + iso9660_ltime_t modification_date; /**< See section 8.4.26.1 of + ISO 9660 spec. */ + iso9660_ltime_t expiration_date; /**< See section 8.4.26.1 of + ISO 9660 spec. */ + iso9660_ltime_t effective_date; /**< See section 8.4.26.1 of + ISO 9660 spec. */ + uint8_t file_structure_version; /**< 711 encoded */ char unused4[1]; char application_data[512]; char unused5[653]; @@ -166,49 +202,110 @@ typedef struct iso9660_stat iso9660_stat_t; #define EMPTY_ARRAY_SIZE 0 #endif -/* - * XXX JS: The next structure may have an odd length! - * Some compilers (e.g. on Sun3/mc68020) padd the structures to even length. - * For this reason, we cannot use sizeof (struct iso_path_table) or - * sizeof (struct iso_directory_record) to compute on disk sizes. - * Instead, we use offsetof(..., name) and add the name size. - * See mkisofs.h - */ -/* Format of an ISO-9660 directory record */ +/*! \brief Format of an ISO-9660 directory record + + This structure may have an odd length depending on how many + characters there are in the filename! Some compilers (e.g. on + Sun3/mc68020) pad the structures to an even length. For this reason, + we cannot use sizeof (struct iso_path_table) or sizeof (struct + iso_directory_record) to compute on disk sizes. Instead, we use + offsetof(..., name) and add the name size. See mkisofs.h of the + cdrtools package. + + @see iso9660_stat +*/ struct iso9660_dir { - uint8_t length; /* 711 */ - uint8_t xa_length; /* 711 */ - uint64_t extent; /* 733 */ - uint64_t size; /* 733 */ - iso9660_dtime_t recording_time; /* 7 by 711 */ + uint8_t length; /*! 711 encoded */ + uint8_t xa_length; /*! 711 encoded */ + uint64_t extent; /*! 733 encoded */ + uint64_t size; /*! 733 encoded */ + iso9660_dtime_t recording_time; /*! 7 711-encoded units */ uint8_t file_flags; - uint8_t file_unit_size; /* 711 */ - uint8_t interleave_gap; /* 711 */ - uint32_t volume_sequence_number; /* 723 */ - uint8_t filename_len; /* 711 */ + uint8_t file_unit_size; /*! 711 encoded */ + uint8_t interleave_gap; /*! 711 encoded */ + uint32_t volume_sequence_number; /*! 723 encoded */ + uint8_t filename_len; /*! 711 encoded */ char filename[EMPTY_ARRAY_SIZE]; } GNUC_PACKED; -/* The following structure is not part of ISO 9660. We just use it - for our own purposes for communicating info back that's pulled out. +PRAGMA_END_PACKED + +/*! \brief Unix stat-like version of iso9660_dir + + The iso9660_stat structure is not part of the ISO-9660 + specification. We use it for our to communicate information + in a C-library friendly way, e.g struct tm time structures and + a C-style filename string. + + @see iso9660_dir */ struct iso9660_stat { /* big endian!! */ + struct tm tm; /**< time on entry */ + lsn_t lsn; /**< start logical sector number */ + uint32_t size; /**< total size in bytes */ + uint32_t secsize; /**< number of sectors allocated */ + iso9660_xa_t xa; /**< XA attributes */ enum { _STAT_FILE = 1, _STAT_DIR = 2 } type; - lsn_t lsn; /* start logical sector number */ - uint32_t size; /* total size in bytes */ - uint32_t secsize; /* number of sectors allocated */ - iso9660_xa_t xa; /* XA attributes */ - struct tm tm; /* time on entry */ -} ; + char filename[EMPTY_ARRAY_SIZE]; /**< filename */ +}; -PRAGMA_END_PACKED -/*==================================== - Character file/dirname's -=====================================*/ +/** This is an opaque structure. */ +typedef struct _iso9660 iso9660_t; + +/*! + Open an ISO 9660 image for reading. Maybe in the future we will have + flags and mode. NULL is returned on error. +*/ + iso9660_t *iso9660_open (const char *pathname /*flags, mode */); + +/*! + Close previously opened ISO 9660 image. + True is unconditionally returned. If there was an error false would + be returned. +*/ + bool iso9660_close (iso9660_t * iso); + + +/*! + Seek to a position and then read n bytes. Size read is returned. +*/ + long int iso9660_iso_seek_read (iso9660_t *iso, void *ptr, lsn_t start, + long int size); + +/*==================================================== + Time conversion + ====================================================*/ +/*! + Set time in format used in ISO 9660 directory index record + from a Unix time structure. */ + void iso9660_set_dtime (const struct tm *tm, + /*out*/ iso9660_dtime_t *idr_date); + + +/*! + Set "long" time in format used in ISO 9660 primary volume descriptor + from a Unix time structure. */ + void iso9660_set_ltime (const struct tm *_tm, + /*out*/ iso9660_ltime_t *pvd_date); + +/*! + Get Unix time structure from format use in an ISO 9660 directory index + record. Even though tm_wday and tm_yday fields are not explicitly in + idr_date, they are calculated from the other fields. + + If tm is to reflect the localtime, set "use_localtime" true, otherwise + tm will reported in GMT. +*/ + void iso9660_get_dtime (const iso9660_dtime_t *idr_date, bool use_localtime, + /*out*/ struct tm *tm); + +/*==================================================== + Characters used in file and directory and manipulation + ====================================================*/ /*! Return true if c is a DCHAR - a character that can appear in an an ISO-9600 level 1 directory name. These are the ASCII capital @@ -247,31 +344,6 @@ int iso9660_name_translate(const char *old, char *new); char *iso9660_strncpy_pad(char dst[], const char src[], size_t len, enum strncpy_pad_check _check); -/*! - Set time in format used in ISO 9660 directory index record - from a Unix time structure. */ - void iso9660_set_dtime (const struct tm *tm, - /*out*/ iso9660_dtime_t *idr_date); - - -/*! - Set "long" time in format used in ISO 9660 primary volume descriptor - from a Unix time structure. */ - void iso9660_set_ltime (const struct tm *_tm, - /*out*/ iso9660_ltime_t *pvd_date); - -/*! - Get Unix time structure from format use in an ISO 9660 directory index - record. Even though tm_wday and tm_yday fields are not explicitly in - idr_date, they are calculated from the other fields. - - If tm is to reflect the localtime, set "use_localtime" true, otherwise - tm will reported in GMT. -*/ - void iso9660_get_dtime (const iso9660_dtime_t *idr_date, bool use_localtime, - /*out*/ struct tm *tm); - - /*===================================================================== file/dirname's ======================================================================*/ @@ -291,7 +363,7 @@ bool iso9660_dirname_valid_p (const char pathname[]); /*! Take pathname and a version number and turn that into a ISO-9660 pathname. (That's just the pathname followd by ";" and the version - number. For example, mydir/file.ext -> mydir/file.ext;1 for version + number. For example, mydir/file.ext -> MYDIR/FILE.EXT;1 for version 1. The resulting ISO-9660 pathname is returned. */ char *iso9660_pathname_isofy (const char pathname[], uint16_t version); @@ -336,45 +408,88 @@ iso9660_dir_calc_record_size (unsigned int namelen, unsigned int su_len); /*! Given a directory pointer, find the filesystem entry that contains - lsn and return information about it in stat. + lsn and return information about it. - Returns true if we found an entry with the lsn and false if not. + Returns stat_t of entry if we found lsn, or NULL otherwise. */ -bool iso9660_find_fs_lsn(const CdIo *cdio, lsn_t lsn, - /*out*/ iso9660_stat_t *stat); +iso9660_stat_t *iso9660_find_fs_lsn(const CdIo *cdio, lsn_t lsn); + /*! - Get file status for pathname into stat. As with libc's stat, 0 is returned - if no error and -1 on error. + Given a directory pointer, find the filesystem entry that contains + lsn and return information about it. + + Returns stat_t of entry if we found lsn, or NULL otherwise. + */ +iso9660_stat_t *iso9660_find_ifs_lsn(const iso9660_t *iso, lsn_t lsn); + + +/*! + Get file status for pathname into stat. NULL is returned on error. + */ +iso9660_stat_t *iso9660_fs_stat (const CdIo *obj, const char pathname[], + bool is_mode2); + +/*! + Get file status for pathname into stat. NULL is returned on error. + pathname version numbers in the ISO 9660 + name are dropped, i.e. ;1 is removed and if level 1 ISO-9660 names + are lowercased. */ -int iso9660_fs_stat (const CdIo *obj, const char pathname[], - /*out*/ iso9660_stat_t *stat, bool is_mode2); +iso9660_stat_t *iso9660_fs_stat_translate (const CdIo *obj, + const char pathname[], + bool is_mode2); -void * /* list of char* -- caller must free it */ -iso9660_fs_readdir (const CdIo *obj, const char pathname[], bool mode2); +/*! + Get file status for pathname into stat. NULL is returned on error. + */ +void *iso9660_ifs_stat (iso9660_t *iso, const char pathname[]); -uint8_t -iso9660_get_dir_len(const iso9660_dir_t *idr); + +/*! + Get file status for pathname into stat. NULL is returned on error. + pathname version numbers in the ISO 9660 + name are dropped, i.e. ;1 is removed and if level 1 ISO-9660 names + are lowercased. + */ +void *iso9660_ifs_stat_translate (iso9660_t *iso, const char pathname[]); + + + +/*! + Read pathname (a directory) and return a list of iso9660_stat_t + of the files inside that. The caller must free the returned result. +*/ +void * iso9660_fs_readdir (const CdIo *obj, const char pathname[], bool mode2); + +/*! + Read pathname (a directory) and return a list of iso9660_stat_t + of the files inside that. The caller must free the returned result. +*/ +void * iso9660_ifs_readdir (iso9660_t *iso, const char pathname[]); + +uint8_t iso9660_get_dir_len(const iso9660_dir_t *idr); #if FIXME -uint8_t -iso9660_get_dir_size(const iso9660_dir_t *idr); +uint8_t iso9660_get_dir_size(const iso9660_dir_t *idr); -lsn_t -iso9660_get_dir_extent(const iso9660_dir_t *idr); +lsn_t iso9660_get_dir_extent(const iso9660_dir_t *idr); #endif -uint8_t -iso9660_get_pvd_type(const iso9660_pvd_t *pvd); +/*! + Return the directory name stored in the iso9660_dir_t + + A string is allocated: the caller must deallocate. +*/ +char * iso9660_dir_to_name (const iso9660_dir_t *iso9660_dir); + +uint8_t iso9660_get_pvd_type(const iso9660_pvd_t *pvd); -const char * -iso9660_get_pvd_id(const iso9660_pvd_t *pvd); +const char * iso9660_get_pvd_id(const iso9660_pvd_t *pvd); -int -iso9660_get_pvd_space_size(const iso9660_pvd_t *pvd); +int iso9660_get_pvd_space_size(const iso9660_pvd_t *pvd); -int -iso9660_get_pvd_block_size(const iso9660_pvd_t *pvd) ; +int iso9660_get_pvd_block_size(const iso9660_pvd_t *pvd) ; /*! Return the primary volume id version number (of pvd). If there is an error 0 is returned. @@ -401,7 +516,9 @@ uint16_t iso9660_pathtable_m_add_entry (void *pt, const char name[], uint32_t extent, uint16_t parent); -/* volume descriptors */ +/*===================================================================== + Volume Descriptors +======================================================================*/ void iso9660_set_pvd (void *pd, const char volume_id[], const char application_id[], diff --git a/src/input/vcd/libcdio/cdio/logging.h b/src/input/vcd/libcdio/cdio/logging.h index 9a600b437..aec981ad4 100644 --- a/src/input/vcd/libcdio/cdio/logging.h +++ b/src/input/vcd/libcdio/cdio/logging.h @@ -1,7 +1,8 @@ /* - $Id: logging.h,v 1.1 2003/10/13 11:47:12 f1rmb Exp $ + $Id: logging.h,v 1.2 2004/04/11 12:20:31 miguelfreitas Exp $ - Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> + Copyright (C) 2000, Herbert Valerio Riedel <hvr@gnu.org> + Copyright (C) 2003, Rocky Bernstein <rocky@panix.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,42 +18,104 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/** \file logging.h + * \brief Header to control logging and level of detail of output. + * + */ #ifndef __LOGGING_H__ #define __LOGGING_H__ #include <cdio/types.h> +/** + * The different log levels supported. + */ typedef enum { - CDIO_LOG_DEBUG = 1, - CDIO_LOG_INFO, - CDIO_LOG_WARN, - CDIO_LOG_ERROR, - CDIO_LOG_ASSERT + CDIO_LOG_DEBUG = 1, /**< Debug-level messages - helps debug what's up. */ + CDIO_LOG_INFO, /**< Informational - indicates perhaps something of + interest. */ + CDIO_LOG_WARN, /**< Warning conditions - something that looks funny. */ + CDIO_LOG_ERROR, /**< Error conditions - may terminate program. */ + CDIO_LOG_ASSERT /**< Critical conditions - may abort program. */ } cdio_log_level_t; -extern int cdio_loglevel_default; +/** + * The place to save the preference concerning how much verbosity + * is desired. This is used by the internal default log handler, but + * it could be use by applications which provide their own log handler. + */ +extern cdio_log_level_t cdio_loglevel_default; -void -cdio_log (cdio_log_level_t level, const char format[], ...) GNUC_PRINTF(2, 3); - +/** + * This type defines the signature of a log handler. For every + * message being logged, the handler will receive the log level and + * the message string. + * + * @see cdio_log_set_handler + * @see cdio_log_level_t + * + * @param level The log level. + * @param message The log message. + */ typedef void (*cdio_log_handler_t) (cdio_log_level_t level, const char message[]); -cdio_log_handler_t -cdio_log_set_handler (cdio_log_handler_t new_handler); +/** + * Set a custom log handler for libcdio. The return value is the log + * handler being replaced. If the provided parameter is NULL, then + * the handler will be reset to the default handler. + * + * @see cdio_log_handler_t + * + * @param new_handler The new log handler. + * @return The previous log handler. + */ +cdio_log_handler_t cdio_log_set_handler (cdio_log_handler_t new_handler); + +/** + * Handle an message with the given log level + * + * @see cdio_debug + * @see cdio_info + * @see cdio_warn + * @see cdio_error -void -cdio_debug (const char format[], ...) GNUC_PRINTF(1,2); + * @param level The log level. + * @param format printf-style format string + * @param ... remaining arguments needed by format string + */ +void cdio_log (cdio_log_level_t level, + const char format[], ...) GNUC_PRINTF(2, 3); + +/** + * Handle a debugging message. + * + * @see cdio_log for a more generic routine + */ +void cdio_debug (const char format[], ...) GNUC_PRINTF(1,2); -void -cdio_info (const char format[], ...) GNUC_PRINTF(1,2); +/** + * Handle an informative message. + * + * @see cdio_log for a more generic routine + */ +void cdio_info (const char format[], ...) GNUC_PRINTF(1,2); -void -cdio_warn (const char format[], ...) GNUC_PRINTF(1,2); +/** + * Handle a warning message. + * + * @see cdio_log for a more generic routine + */ +void cdio_warn (const char format[], ...) GNUC_PRINTF(1,2); -void -cdio_error (const char format[], ...) GNUC_PRINTF(1,2); +/** + * Handle an error message. + * + * @see cdio_log for a more generic routine. + */ +void cdio_error (const char format[], ...) GNUC_PRINTF(1,2); #endif /* __LOGGING_H__ */ diff --git a/src/input/vcd/libcdio/cdio/sector.h b/src/input/vcd/libcdio/cdio/sector.h index 39dd0fefb..939515543 100644 --- a/src/input/vcd/libcdio/cdio/sector.h +++ b/src/input/vcd/libcdio/cdio/sector.h @@ -1,5 +1,5 @@ /* - $Id: sector.h,v 1.1 2003/10/13 11:47:12 f1rmb Exp $ + $Id: sector.h,v 1.2 2004/04/11 12:20:31 miguelfreitas Exp $ Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2003 Rocky Bernstein <rocky@panix.com> @@ -18,8 +18,44 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* - Things related to CDROM layout. Sector sizes, MSFs, LBAs, +/*! + \file sector.h + \brief Things related to CD-ROM layout: tracks, sector sizes, MSFs, LBAs. + + A CD-ROM physical sector size is 2048, 2052, 2056, 2324, 2332, 2336, + 2340, or 2352 bytes long. + + Sector types of the standard CD-ROM data formats: + +\verbatim + format sector type user data size (bytes) + ----------------------------------------------------------------------------- + 1 (Red Book) CD-DA 2352 (CDIO_CD_FRAMESIZE_RAW) + 2 (Yellow Book) Mode1 Form1 2048 (CDIO_CD_FRAMESIZE) + 3 (Yellow Book) Mode1 Form2 2336 (M2RAW_SECTOR_SIZE) + 4 (Green Book) Mode2 Form1 2048 (CDIO_CD_FRAMESIZE) + 5 (Green Book) Mode2 Form2 2328 (2324+4 spare bytes) + + + The layout of the standard CD-ROM data formats: + ----------------------------------------------------------------------------- + - audio (red): | audio_sample_bytes | + | 2352 | + + - data (yellow, mode1): | sync - head - data - EDC - zero - ECC | + | 12 - 4 - 2048 - 4 - 8 - 276 | + + - data (yellow, mode2): | sync - head - data | + | 12 - 4 - 2336 | + + - XA data (green, mode2 form1): | sync - head - sub - data - EDC - ECC | + | 12 - 4 - 8 - 2048 - 4 - 276 | + + - XA data (green, mode2 form2): | sync - head - sub - data - Spare | + | 12 - 4 - 8 - 2324 - 4 | +\endverbatim + + */ #ifndef _CDIO_SECTOR_H_ @@ -34,80 +70,50 @@ #define CDIO_PREGAP_SECTORS 150 #define CDIO_POSTGAP_SECTORS 150 -/* - * A CD-ROM physical sector size is 2048, 2052, 2056, 2324, 2332, 2336, - * 2340, or 2352 bytes long. - -* Sector types of the standard CD-ROM data formats: - * - * format sector type user data size (bytes) - * ----------------------------------------------------------------------------- - * 1 (Red Book) CD-DA 2352 (CDIO_CD_FRAMESIZE_RAW) - * 2 (Yellow Book) Mode1 Form1 2048 (CDIO_CD_FRAMESIZE) - * 3 (Yellow Book) Mode1 Form2 2336 (M2RAW_SECTOR_SIZE) - * 4 (Green Book) Mode2 Form1 2048 (CDIO_CD_FRAMESIZE) - * 5 (Green Book) Mode2 Form2 2328 (2324+4 spare bytes) - * - * - * The layout of the standard CD-ROM data formats: - * ----------------------------------------------------------------------------- - * - audio (red): | audio_sample_bytes | - * | 2352 | - * - * - data (yellow, mode1): | sync - head - data - EDC - zero - ECC | - * | 12 - 4 - 2048 - 4 - 8 - 276 | - * - * - data (yellow, mode2): | sync - head - data | - * | 12 - 4 - 2336 | - * - * - XA data (green, mode2 form1): | sync - head - sub - data - EDC - ECC | - * | 12 - 4 - 8 - 2048 - 4 - 276 | - * - * - XA data (green, mode2 form2): | sync - head - sub - data - Spare | - * | 12 - 4 - 8 - 2324 - 4 | - * - */ - /* Some generally useful CD-ROM information -- mostly based on the above. This is from linux.h - not to slight other OS's. This was the first place I came across such useful stuff. */ -#define CDIO_CD_MINS 74 /* max. minutes per CD, not really a limit */ -#define CDIO_CD_SECS_PER_MIN 60 /* seconds per minute */ -#define CDIO_CD_FRAMES_PER_SEC 75 /* frames per second */ -#define CDIO_CD_SYNC_SIZE 12 /* 12 sync bytes per raw data frame */ -#define CDIO_CD_CHUNK_SIZE 24 /* lowest-level "data bytes piece" */ -#define CDIO_CD_NUM_OF_CHUNKS 98 /* chunks per frame */ -#define CDIO_CD_FRAMESIZE_SUB 96 /* subchannel data "frame" size */ -#define CDIO_CD_HEADER_SIZE 4 /* header (address) bytes per raw data - frame */ -#define CDIO_CD_SUBHEADER_SIZE 8 /* subheader bytes per raw XA data frame */ -#define CDIO_CD_EDC_SIZE 4 /* bytes EDC per most raw data frame types */ -#define CDIO_CD_M1F1_ZERO_SIZE 8 /* bytes zero per yellow book mode 1 frame */ -#define CDIO_CD_ECC_SIZE 276 /* bytes ECC per most raw data frame types */ -#define CDIO_CD_FRAMESIZE 2048 /* bytes per frame, "cooked" mode */ -#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 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE) /*2340*/ -#define CDIO_CD_FRAMESIZE_RAW0 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE-CD_HEAD_SIZE) /*2336*/ - -/* "before data" part of raw XA (green, mode2) frame */ +#define CDIO_CD_MINS 74 /**< max. minutes per CD, not really + a limit */ +#define CDIO_CD_SECS_PER_MIN 60 /**< seconds per minute */ +#define CDIO_CD_FRAMES_PER_SEC 75 /**< frames per second */ +#define CDIO_CD_SYNC_SIZE 12 /**< 12 sync bytes per raw data frame */ +#define CDIO_CD_CHUNK_SIZE 24 /**< lowest-level "data bytes piece" */ +#define CDIO_CD_NUM_OF_CHUNKS 98 /**< chunks per frame */ +#define CDIO_CD_FRAMESIZE_SUB 96 /**< subchannel data "frame" size */ +#define CDIO_CD_HEADER_SIZE 4 /**< header (address) bytes per raw + data frame */ +#define CDIO_CD_SUBHEADER_SIZE 8 /**< subheader bytes per raw XA data frame */ +#define CDIO_CD_EDC_SIZE 4 /**< bytes EDC per most raw data + frame types */ +#define CDIO_CD_M1F1_ZERO_SIZE 8 /**< bytes zero per yellow book mode + 1 frame */ +#define CDIO_CD_ECC_SIZE 276 /**< bytes ECC per most raw data frame types */ +#define CDIO_CD_FRAMESIZE 2048 /**< bytes per frame, "cooked" mode */ +#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_RAW0 (CDIO_CD_FRAMESIZE_RAW-CDIO_CD_SYNC_SIZE-CDIO_CD__HEAD_SIZE) /*2336*/ + +/*! "before data" part of raw XA (green, mode2) frame */ #define CDIO_CD_XA_HEADER (CDIO_CD_HEADER_SIZE+CDIO_CD_SUBHEADER_SIZE) -/* "after data" part of raw XA (green, mode2 form1) frame */ +/*! "after data" part of raw XA (green, mode2 form1) frame */ #define CDIO_CD_XA_TAIL (CDIO_CD_EDC_SIZE+CDIO_CD_ECC_SIZE) -/* "before data" sync bytes + header of XA (green, mode2) frame */ +/*! "before data" sync bytes + header of XA (green, mode2) frame */ #define CDIO_CD_XA_SYNC_HEADER (CDIO_CD_SYNC_SIZE+CDIO_CD_XA_HEADER) /* CD-ROM address types (Linux cdrom_tocentry.cdte_format) */ -#define CDIO_CDROM_LBA 0x01 /* "logical block": first frame is #0 */ -#define CDIO_CDROM_MSF 0x02 /* "minute-second-frame": binary, not bcd here! */ +#define CDIO_CDROM_LBA 0x01 /**< "logical block": first frame is #0 */ +#define CDIO_CDROM_MSF 0x02 /**< "minute-second-frame": binary, not + BCD here! */ #define CDIO_CDROM_DATA_TRACK 0x04 -/* The leadout track is always 0xAA, regardless of # of tracks on disc */ +/*! The leadout track is always 0xAA, regardless of # of tracks on disc */ #define CDIO_CDROM_LEADOUT_TRACK 0xAA #define M2F2_SECTOR_SIZE 2324 @@ -129,20 +135,40 @@ #define msf_t_SIZEOF 3 -/* warning, returns new allocated string */ +/*! + Convert an LBA into a string representation of the MSF. + \warning cdio_lba_to_msf_str returns new allocated string */ char *cdio_lba_to_msf_str (lba_t lba); +/*! + Convert an LBA into the corresponding LSN. +*/ lba_t cdio_lba_to_lsn (lba_t lba); +/*! + Convert an LBA into the corresponding MSF. +*/ void cdio_lba_to_msf(lba_t lba, msf_t *msf); +/*! + Convert an LSN into the corresponding LBA. +*/ lba_t cdio_lsn_to_lba (lsn_t lsn); +/*! + Convert an LSN into the corresponding MSF. +*/ void cdio_lsn_to_msf (lsn_t lsn, msf_t *msf); +/*! + Convert a MSF into the corresponding LBA. +*/ lba_t cdio_msf_to_lba (const msf_t *msf); +/*! + Convert a MSF into the corresponding LSN. +*/ lsn_t cdio_msf_to_lsn (const msf_t *msf); diff --git a/src/input/vcd/libcdio/cdio/types.h b/src/input/vcd/libcdio/cdio/types.h index e3c3ff3e5..c4b0b0934 100644 --- a/src/input/vcd/libcdio/cdio/types.h +++ b/src/input/vcd/libcdio/cdio/types.h @@ -1,8 +1,8 @@ /* - $Id: types.h,v 1.1 2003/10/13 11:47:12 f1rmb Exp $ + $Id: types.h,v 1.2 2004/04/11 12:20:31 miguelfreitas Exp $ Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> - Copyright (C) 2002,2003 Rocky Bernstein <rocky@panix.com> + Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,6 +18,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/** \file types.h + * \brief Common type definitions used pervasively in libcdio. + */ + #ifndef __CDIO_TYPES_H__ #define __CDIO_TYPES_H__ @@ -54,10 +59,6 @@ extern "C" { # undef INT64_C #endif -#if defined (MINGW32) - typedef int ssize_t; -#endif - /* if it's still not defined, take a good guess... should work for most 32bit and 64bit archs */ @@ -172,14 +173,23 @@ extern "C" { /* our own offsetof()-like macro */ #define __cd_offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) - /* In many structures on the disk a sector address is stored as a - BCD-encoded mmssff in three bytes. */ + /*! + \brief MSF (minute/second/frame) structure + + One CD-ROMs addressing scheme especially used in audio formats + (Red Book) is an address by minute, sector and frame which + BCD-encoded in three bytes. An alternative format is an lba_t. + + @see lba_t + */ PRAGMA_BEGIN_PACKED - typedef struct { + struct msf_rec { uint8_t m, s, f; - } GNUC_PACKED msf_t; + } GNUC_PACKED; PRAGMA_END_PACKED + typedef struct msf_rec msf_t; + #define msf_t_SIZEOF 3 /* type used for bit-fields in structs (1 <= bits <= 8) */ @@ -194,13 +204,16 @@ extern "C" { typedef uint8_t bitfield_t; #endif - /* The type of a Logical Block Address. */ + /*! The type of a Logical Block Address. + + @see msf_t + */ typedef uint32_t lba_t; - /* The type of an Logical Sector Number. */ + /*! The type of an Logical Sector Number. */ typedef uint32_t lsn_t; - /* The type of an track number 0..99. */ + /*! The type of an track number 0..99. */ typedef uint8_t track_t; /*! diff --git a/src/input/vcd/libcdio/cdio/util.h b/src/input/vcd/libcdio/cdio/util.h index 147a32365..5142653ad 100644 --- a/src/input/vcd/libcdio/cdio/util.h +++ b/src/input/vcd/libcdio/cdio/util.h @@ -1,5 +1,5 @@ /* - $Id: util.h,v 1.1 2003/10/13 11:47:12 f1rmb Exp $ + $Id: util.h,v 1.2 2004/04/11 12:20:31 miguelfreitas Exp $ Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> @@ -21,6 +21,12 @@ #ifndef __CDIO_UTIL_H__ #define __CDIO_UTIL_H__ +/*! + \file util.h + \brief Miscellaneous utility functions. + + Warning: this will probably get removed/replaced by using glib.h +*/ #include <stdlib.h> #undef MAX diff --git a/src/input/vcd/libcdio/cdio/version.h b/src/input/vcd/libcdio/cdio/version.h index c8bbce698..345924cab 100644 --- a/src/input/vcd/libcdio/cdio/version.h +++ b/src/input/vcd/libcdio/cdio/version.h @@ -1 +1,10 @@ -#define CDIO_VERSION "0.64-cvs" +/* $Id: version.h,v 1.2 2004/04/11 12:20:31 miguelfreitas Exp $ */ +/** \file version.h + * \brief A file simply containing the library version number. + */ + +/*! CDIO_VERSION can as a string in programs to show what version is used. */ +#define CDIO_VERSION "0.68" + +/*! LIBCDIO_VERSION_NUM can be used for testing in the C preprocessor */ +#define LIBCDIO_VERSION_NUM 68 diff --git a/src/input/vcd/libcdio/cdio/xa.h b/src/input/vcd/libcdio/cdio/xa.h index 06e5df250..5ff7addd4 100644 --- a/src/input/vcd/libcdio/cdio/xa.h +++ b/src/input/vcd/libcdio/cdio/xa.h @@ -1,8 +1,8 @@ /* - $Id: xa.h,v 1.1 2003/10/13 11:47:12 f1rmb Exp $ + $Id: xa.h,v 1.2 2004/04/11 12:20:31 miguelfreitas Exp $ Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> - Copyright (C) 2003 Rocky Bernstein <rocky@panix.com> + Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> See also iso9660.h by Eric Youngdale (1993) and in cdrtools. These are @@ -24,6 +24,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +/*! + \file xa.h + \brief Things related to the ISO-9660 XA (Extended Attributes) format +*/ + #ifndef __CDIO_XA_H__ #define __CDIO_XA_H__ @@ -34,17 +39,17 @@ #define ISO_XA_MARKER_OFFSET 1024 /* XA attribute definitions */ -#define XA_PERM_RSYS 0x0001 /* System Group Read */ -#define XA_PERM_XSYS 0x0004 /* System Group Execute */ +#define XA_PERM_RSYS 0x0001 /**< System Group Read */ +#define XA_PERM_XSYS 0x0004 /**< System Group Execute */ -#define XA_PERM_RUSR 0x0010 /* User (owner) Read */ -#define XA_PERM_XUSR 0x0040 /* User (owner) Execute */ +#define XA_PERM_RUSR 0x0010 /**< User (owner) Read */ +#define XA_PERM_XUSR 0x0040 /**< User (owner) Execute */ -#define XA_PERM_RGRP 0x0100 /* Group Read */ -#define XA_PERM_XGRP 0x0400 /* Group Execute */ +#define XA_PERM_RGRP 0x0100 /**< Group Read */ +#define XA_PERM_XGRP 0x0400 /**< Group Execute */ -#define XA_PERM_ROTH 0x1000 /* Other (world) Read */ -#define XA_PERM_XOTH 0x4000 /* Other (world) Execute */ +#define XA_PERM_ROTH 0x1000 /**< Other (world) Read */ +#define XA_PERM_XOTH 0x4000 /**< Other (world) Execute */ #define XA_ATTR_MODE2FORM1 (1 << 11) #define XA_ATTR_MODE2FORM2 (1 << 12) @@ -61,18 +66,37 @@ #define XA_FORM1_FILE (XA_ATTR_MODE2FORM1 | XA_PERM_ALL_ALL) #define XA_FORM2_FILE (XA_ATTR_MODE2FORM2 | XA_PERM_ALL_ALL) -/* - * Extended Attributes record according to Yellow Book. - */ -typedef struct iso9660_xa /* big endian!! */ +/*! \brief "Extended Architecture according t the Philips Yellow Book. + +CD-ROM EXtended Architecture is a modification to the CD-ROM +specification that defines two new types of sectors. CD-ROM XA was +developed jointly by Sony, Philips, and Microsoft, and announced in +August 1988. Its specifications were published in an extension to the +Yellow Book. CD-i, Photo CD, Video CD and CD-EXTRA have all +subsequently been based on CD-ROM XA. + +CD-XA defines another way of formatting sectors on a CD-ROM, including +headers in the sectors that describe the type (audio, video, data) and +some additional info (markers, resolution in case of a video or audio +sector, file numbers, etc). + +The data written on a CD-XA is consistent with and can be in ISO-9660 +file system format and therefore be readable by ISO-9660 file system +translators. But also a CD-I player can also read CD-XA discs even if +its own `Green Book' file system only resembles ISO 9660 and isn't +fully compatible. + + Note structure is big-endian. +*/ +typedef struct iso9660_xa { - uint16_t group_id; /* 0 */ - uint16_t user_id; /* 0 */ - uint16_t attributes; /* XA_ATTR_ */ - uint8_t signature[2]; /* { 'X', 'A' } */ - uint8_t filenum; /* file number, see also XA subheader */ - uint8_t reserved[5]; /* zero */ -} iso9660_xa_t GNUC_PACKED; + uint16_t group_id; /**< 0 */ + uint16_t user_id; /**< 0 */ + uint16_t attributes; /**< XA_ATTR_ */ + uint8_t signature[2]; /**< { 'X', 'A' } */ + uint8_t filenum; /**< file number, see also XA subheader */ + uint8_t reserved[5]; /**< zero */ +} GNUC_PACKED iso9660_xa_t; /*! @@ -106,6 +130,12 @@ typedef struct iso9660_xa /* big endian!! */ const char * iso9660_get_xa_attr_str (uint16_t xa_attr); +/*! + Allocates and initalizes a new iso9600_xa_t variable and returns + it. The caller should free the returned result. + + @see iso9660_xa +*/ iso9660_xa_t * iso9660_xa_init (iso9660_xa_t *_xa, uint16_t uid, uint16_t gid, uint16_t attr, uint8_t filenum); |