diff options
| author | Rocky Bernstein <rockyb@users.sourceforge.net> | 2005-01-01 02:43:56 +0000 |
|---|---|---|
| committer | Rocky Bernstein <rockyb@users.sourceforge.net> | 2005-01-01 02:43:56 +0000 |
| commit | 01d976496634a07467382bfb7c621f95792946b7 (patch) | |
| tree | 39bf1a66b7f7517e27f2da388ed99a20d5b1f450 /src/input/vcd/libcdio/cdio | |
| parent | 5c8aac6caa78d6ea1a635ba6a0162d2c41b20a74 (diff) | |
| download | xine-lib-01d976496634a07467382bfb7c621f95792946b7.tar.gz xine-lib-01d976496634a07467382bfb7c621f95792946b7.tar.bz2 | |
Update internal (and messy) copies to libcdio 0.71 and
vcdimager 0.7.21.
CVS patchset: 7313
CVS date: 2005/01/01 02:43:56
Diffstat (limited to 'src/input/vcd/libcdio/cdio')
| -rw-r--r-- | src/input/vcd/libcdio/cdio/Makefile.am | 18 | ||||
| -rw-r--r-- | src/input/vcd/libcdio/cdio/cd_types.h | 36 | ||||
| -rw-r--r-- | src/input/vcd/libcdio/cdio/cdio.h | 701 | ||||
| -rw-r--r-- | src/input/vcd/libcdio/cdio/cdtext.h | 108 | ||||
| -rw-r--r-- | src/input/vcd/libcdio/cdio/ds.h | 73 | ||||
| -rw-r--r-- | src/input/vcd/libcdio/cdio/dvd.h | 113 | ||||
| -rw-r--r-- | src/input/vcd/libcdio/cdio/iso9660.h | 427 | ||||
| -rw-r--r-- | src/input/vcd/libcdio/cdio/logging.h | 16 | ||||
| -rw-r--r-- | src/input/vcd/libcdio/cdio/scsi_mmc.h | 415 | ||||
| -rw-r--r-- | src/input/vcd/libcdio/cdio/sector.h | 200 | ||||
| -rw-r--r-- | src/input/vcd/libcdio/cdio/types.h | 156 | ||||
| -rw-r--r-- | src/input/vcd/libcdio/cdio/util.h | 39 | ||||
| -rw-r--r-- | src/input/vcd/libcdio/cdio/xa.h | 4 |
13 files changed, 1995 insertions, 311 deletions
diff --git a/src/input/vcd/libcdio/cdio/Makefile.am b/src/input/vcd/libcdio/cdio/Makefile.am index 8381d9c31..0910d60e5 100644 --- a/src/input/vcd/libcdio/cdio/Makefile.am +++ b/src/input/vcd/libcdio/cdio/Makefile.am @@ -1,3 +1,19 @@ include $(top_srcdir)/misc/Makefile.common -noinst_HEADERS = cdio.h cd_types.h iso9660.h logging.h sector.h types.h util.h version.h xa.h +noinst_HEADERS = \ + bytesex.h \ + bytesex_asm.h \ + cdio.h \ + cdtext.h \ + cdtext.h \ + cd_types.h \ + ds.h \ + dvd.h \ + iso9660.h \ + logging.h \ + sector.h \ + scsi_mmc.h \ + types.h \ + util.h \ + version.h \ + xa.h diff --git a/src/input/vcd/libcdio/cdio/cd_types.h b/src/input/vcd/libcdio/cdio/cd_types.h index 1117171ae..b03cc9f72 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.2 2004/04/11 12:20:31 miguelfreitas Exp $ + $Id: cd_types.h,v 1.3 2005/01/01 02:43:58 rockyb Exp $ Copyright (C) 2003 Rocky Bernstein <rocky@panix.com> Copyright (C) 1996,1997,1998 Gerd Knorr <kraxel@bytesex.org> @@ -67,6 +67,15 @@ extern "C" { */ #define CDIO_FS_3DO 10 +/** + Microsoft X-BOX CD. + */ +#define CDIO_FS_XISO 11 +#define CDIO_FS_UDFX 12 +#define CDIO_FS_UDF 13 +#define CDIO_FS_ISO_UDF 14 + + #define CDIO_FS_MASK 15 /**< Note: this should be 2**n-1 and and greater than the highest CDIO_FS number above */ @@ -82,20 +91,21 @@ extern "C" { * higher-level than the fs-type information above and may be determined * based of the fs type information. */ -#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 +#define CDIO_FS_ANAL_XA 0x0010 /**< eXtended Architecture format */ +#define CDIO_FS_ANAL_MULTISESSION 0x0020 /**< CD has multisesion */ +#define CDIO_FS_ANAL_PHOTO_CD 0x0040 /**< Is a Kodak Photo CD */ +#define CDIO_FS_ANAL_HIDDEN_TRACK 0x0080 /**< Hidden track at the beginning of the CD */ -#define CDIO_FS_ANAL_CDTV 256 -#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 +#define CDIO_FS_ANAL_CDTV 0x0100 +#define CDIO_FS_ANAL_BOOTABLE 0x0200 /**< CD is bootable */ +#define CDIO_FS_ANAL_VIDEOCD 0x0400 /**< VCD 1.1 */ +#define CDIO_FS_ANAL_ROCKRIDGE 0x0800 /**< Has Rock Ridge Extensions to ISO 9660 */ -#define CDIO_FS_ANAL_JOLIET 4096 /**< Microsoft Joliet extensions +#define CDIO_FS_ANAL_JOLIET 0x1000 /**< 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 */ +#define CDIO_FS_ANAL_SVCD 0x2000 /**< Super VCD or Choiji Video CD */ +#define CDIO_FS_ANAL_CVD 0x4000 /**< Choiji Video CD */ +#define CDIO_FS_ANAL_XISO 0x8000 /**< XBOX CD */ /** * Pattern which can be used by cdio_get_devices to specify matching @@ -117,6 +127,8 @@ typedef struct char iso_label[33]; /**< This is 32 + 1 for null byte at the end in formatting the string */ unsigned int isofs_size; + uint8_t UDFVerMinor; /**< For UDF filesystems only */ + uint8_t UDFVerMajor; /**< For UDF filesystems only */ } cdio_iso_analysis_t; /** diff --git a/src/input/vcd/libcdio/cdio/cdio.h b/src/input/vcd/libcdio/cdio/cdio.h index a9fa4b02e..e0d8ae311 100644 --- a/src/input/vcd/libcdio/cdio/cdio.h +++ b/src/input/vcd/libcdio/cdio/cdio.h @@ -1,5 +1,5 @@ /* -*- c -*- - $Id: cdio.h,v 1.2 2004/04/11 12:20:31 miguelfreitas Exp $ + $Id: cdio.h,v 1.3 2005/01/01 02:43:58 rockyb Exp $ Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> @@ -30,7 +30,7 @@ /** Application Interface or Protocol version number. If the public * interface changes, we increase this number. */ -#define CDIO_API_VERSION 1 +#define CDIO_API_VERSION 2 #include <cdio/version.h> @@ -44,26 +44,43 @@ #include <cdio/types.h> #include <cdio/sector.h> -/* Flags specifying the category of device to open or is opened. */ +/**! Flags specifying the category of device to open or is opened. */ #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_SCSI_MASK 0x0004 /**< Read source SCSI device. */ #define CDIO_SRC_IS_NATIVE_MASK 0x0008 #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ - /** This is an opaque structure. */ +/*! Size of fields returned by an INQUIRY command */ +#define CDIO_MMC_HW_VENDOR_LEN 8 /**< length of vendor field */ +#define CDIO_MMC_HW_MODEL_LEN 16 /**< length of model field */ +#define CDIO_MMC_HW_REVISION_LEN 4 /**< length of revision field */ + + /*! \brief Structure to return CD vendor, model, and revision-level + strings obtained via the INQUIRY command */ + typedef struct cdio_hwinfo + { + char psz_vendor [CDIO_MMC_HW_VENDOR_LEN+1]; + char psz_model [CDIO_MMC_HW_MODEL_LEN+1]; + char psz_revision[CDIO_MMC_HW_REVISION_LEN+1]; + } cdio_hwinfo_t; + + /** This is an opaque structure for the CD object. */ typedef struct _CdIo CdIo; + /** This is an opaque structure for the CD-Text object. */ + typedef struct cdtext cdtext_t; + /** 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 + * We have to start with DRIVER_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. @@ -72,20 +89,33 @@ extern "C" { * */ typedef enum { - DRIVER_UNKNOWN, + DRIVER_UNKNOWN, /**< Used as input when we don't care what kind + of driver to use. */ DRIVER_BSDI, /**< BSDI driver */ - DRIVER_FREEBSD, /**< FreeBSD driver */ + DRIVER_FREEBSD, /**< FreeBSD driver - includes CAM and ioctl access */ 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_WIN32, /**< Microsoft Windows Driver. Includes ASPI and + ioctl acces. */ + DRIVER_CDRDAO, /**< cdrdao format CD image. This is listed + 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. */ DRIVER_NRG, /**< Nero NRG format CD image. */ DRIVER_DEVICE /**< Is really a set of the above; should come last */ } driver_id_t; + /** There will generally be only one hardware for a given + build/platform from the list above. You can use the variable + below to determine which you've got. If the build doesn't make an + hardware driver, then the value will be DRIVER_UNKNOWN. + */ + extern const driver_id_t cdio_os_driver; + + /** 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. @@ -106,51 +136,77 @@ extern "C" { TRACK_FORMAT_ERROR /**< Dunno what is, or some other error. */ } track_format_t; + extern const char *discmode2str[]; + /*! Printable tags for track_format_t enumeration. */ extern const char *track_format2str[6]; /*! Eject media in CD drive if there is a routine to do so. - Return 0 if success and 1 for failure, and 2 if no routine. - If the CD is ejected *obj is freed and obj set to NULL. + + @param p_cdio the CD object to be acted upon. + @return 0 if success and 1 for failure, and 2 if no routine. + If the CD is ejected *p_cdio is freed and p_cdio set to NULL. */ - int cdio_eject_media (CdIo **obj); + int cdio_eject_media (CdIo **p_cdio); /*! - Free any resources associated with obj. + Free any resources associated with p_cdio. Call this when done using p_cdio + and using CD reading/control operations. + + @param p_cdio the CD object to eliminated. */ - void cdio_destroy (CdIo *obj); + void cdio_destroy (CdIo *p_cdio); /*! Free device list returned by cdio_get_devices or cdio_get_devices_with_cap. + + @param device_list list returned by cdio_get_devices or + cdio_get_devices_with_cap + + @see cdio_get_devices, cdio_get_devices_with_cap + */ void cdio_free_device_list (char * device_list[]); /*! - Return the value associatied with key. NULL is returned if obj is NULL + Get the value associatied with key. + + @param p_cdio the CD object queried + @param key the key to retrieve + @return the value associatd with "key" or NULL if p_cdio is NULL or "key" does not exist. */ - const char * cdio_get_arg (const CdIo *obj, const char key[]); + const char * cdio_get_arg (const CdIo *p_cdio, const char key[]); + + /*! + Get CD-Text information for a CdIo object. + + @param p_cdio the CD object that may contain CD-Text information. + @param i_track track for which we are requesting CD-Text information. + @return the CD-Text object or NULL if obj is NULL + or CD-Text information does not exist. + + If i_track is 0 or CDIO_CDROM_LEADOUT_TRACK the track returned + is the information assocated with the CD. + */ + const cdtext_t *cdio_get_cdtext (CdIo *p_cdio, track_t i_track); /*! - Return an array of device names in search_devices that have at - least the capabilities listed by cap. If search_devices is NULL, - then we'll search all possible CD drives. + Get the default CD device. + if p_cdio is NULL (we haven't initialized a specific device driver), + then find a suitable one and return the default device for that. - If "any" is set false then every capability listed in the extended - portion of capabilities (i.e. not the basic filesystem) must be - satisified. If "any" is set true, then if any of the capabilities - matches, we call that a success. + @param p_cdio the CD object queried + @return a string containing the default CD device or NULL is + if we couldn't get a default device. - 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. + In some situations of drivers or OS's we can't find a CD device if + there is no media in it and it is possible for this routine to return + NULL even though there may be a hardware CD-ROM. */ - char ** cdio_get_devices_with_cap (char* search_devices[], - cdio_fs_anal_t capabilities, bool any); + char * cdio_get_default_device (const CdIo *p_cdio); /*! Return an array of device names. If you want a specific devices for a driver, give that device. If you want hardware @@ -158,49 +214,153 @@ extern "C" { image drivers and hardware drivers give DRIVER_UNKNOWN. NULL is returned if we couldn't return a list of devices. + + In some situations of drivers or OS's we can't find a CD device if + there is no media in it and it is possible for this routine to return + NULL even though there may be a hardware CD-ROM. */ - char ** cdio_get_devices (driver_id_t driver); + char ** cdio_get_devices (driver_id_t driver_id); /*! - Return a string containing the default CD device. - if obj is NULL (we haven't initialized a specific device driver), - then find a suitable one and return the default device for that. + Get an array of device names in search_devices that have at least + the capabilities listed by the capabities parameter. If + search_devices is NULL, then we'll search all possible CD drives. - NULL is returned if we couldn't get a default device. + If "b_any" is set false then every capability listed in the + extended portion of capabilities (i.e. not the basic filesystem) + must be satisified. If "any" is set true, then if any of the + capabilities matches, we call that a success. + + To find a CD-drive of any type, use the mask CDIO_FS_MATCH_ALL. + + @return the array of device names or NULL 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_default_device (const CdIo *obj); + char ** cdio_get_devices_with_cap (char* ppsz_search_devices[], + cdio_fs_anal_t capabilities, bool b_any); /*! - Return the media catalog number (MCN) from the CD or NULL if there - is none or we don't have the ability to get it. + Like cdio_get_devices_with_cap but we return the driver we found + as well. This is because often one wants to search for kind of drive + and then *open* it afterwards. Giving the driver back facilitates this, + and speeds things up for libcdio as well. + */ + char ** cdio_get_devices_with_cap_ret (/*out*/ char* ppsz_search_devices[], + 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 + were given DRIVER_DEVICE or DRIVER_UNKNOWN. This is because + often one wants to get a drive name and then *open* it + afterwards. Giving the driver back facilitates this, and speeds + things up for libcdio as well. + */ + + char ** cdio_get_devices_ret (/*in/out*/ driver_id_t *p_driver_id); - Note: string is malloc'd so caller has to free() the returned - string when done with it. + /*! + Get disc mode - the kind of CD (CD-DA, CD-ROM mode 1, CD-MIXED, etc. + that we've got. The notion of "CD" is extended a little to include + DVD's. + */ + discmode_t cdio_get_discmode (CdIo *p_cdio); + + /*! + Get the what kind of device we've got. + + @param p_cdio the CD object queried + @param p_read_cap pointer to return read capabilities + @param p_write_cap pointer to return write capabilities + @param p_misc_cap pointer to return miscellaneous other capabilities + + In some situations of drivers or OS's we can't find a CD device if + there is no media in it and it is possible for this routine to return + NULL even though there may be a hardware CD-ROM. + */ + void cdio_get_drive_cap (const CdIo *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); + + /*! + Get the drive capabilities for a specified device. + + @return a list of device capabilities. + + In some situations of drivers or OS's we can't find a CD device if + there is no media in it and it is possible for this routine to return + NULL even though there may be a hardware CD-ROM. */ - char *cdio_get_mcn (const CdIo *obj); + 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); /*! - Return a string containing the name of the driver in use. + Get a string containing the name of the driver in use. + + @return a string with driver name or NULL if CdIo is NULL (we + haven't initialized a specific device. + */ + const char * cdio_get_driver_name (const CdIo *p_cdio); + + /*! + Get the driver id. if CdIo is NULL (we haven't initialized a specific device driver), - then return NULL. + then return DRIVER_UNKNOWN. + + @return the driver id.. */ - const char * cdio_get_driver_name (const CdIo *obj); + driver_id_t cdio_get_driver_id (const CdIo *p_cdio); /*! - Return the number of the first track. - CDIO_INVALID_TRACK is returned on error. + Get the number of the first track. + + @return the track number or CDIO_INVALID_TRACK + on error. */ - track_t cdio_get_first_track_num(const CdIo *obj); + track_t cdio_get_first_track_num(const CdIo *p_cdio); + /*! + Get the CD-ROM hardware info via a SCSI MMC INQUIRY command. + False is returned if we had an error getting the information. + */ + bool cdio_get_hwinfo ( const CdIo *p_cdio, + /* out*/ cdio_hwinfo_t *p_hw_info ); + + + /*! + Return the Joliet level recognized for p_cdio. + */ + uint8_t cdio_get_joliet_level(const CdIo *p_cdio); + /*! - Return a string containing the default CD device if none is specified. + Get the media catalog number (MCN) from the CD. + + @return the media catalog number r NULL if there is none or we + don't have the ability to get it. + + Note: string is malloc'd so caller has to free() the returned + string when done with it. + */ - track_t cdio_get_num_tracks (const CdIo *obj); + char * cdio_get_mcn (const CdIo *p_cdio); + + /*! + Get the number of tracks on the CD. + + @return the number of tracks, or CDIO_INVALID_TRACK if there is + an error. + */ + track_t cdio_get_num_tracks (const CdIo *p_cdio); /*! Get the format (audio, mode2, mode1) of track. */ - track_format_t cdio_get_track_format(const CdIo *obj, track_t track_num); + track_format_t cdio_get_track_format(const CdIo *p_cdio, track_t i_track); /*! Return true if we have XA data (green, mode2 form1) or @@ -210,110 +370,178 @@ extern "C" { FIXME: there's gotta be a better design for this and get_track_format? */ - bool cdio_get_track_green(const CdIo *obj, track_t track_num); + bool cdio_get_track_green(const CdIo *p_cdio, track_t i_track); /*! - Return the starting LBA for track number - track_num in obj. Tracks numbers start at 1. + Get the starting LBA for track number + i_track in p_cdio. Track numbers usually start at something + greater than 0, usually 1. + The "leadout" track is specified either by - using track_num LEADOUT_TRACK or the total tracks+1. - CDIO_INVALID_LBA is returned on error. + using i_track CDIO_CDROM_LEADOUT_TRACK or the total tracks+1. + + @param p_cdio object to get information from + @param i_track the track number we want the LSN for + @return the starting LBA or CDIO_INVALID_LBA on error. */ - lba_t cdio_get_track_lba(const CdIo *obj, track_t track_num); + lba_t cdio_get_track_lba(const CdIo *p_cdio, track_t i_track); /*! - Return the starting LSN for track number - track_num in obj. Tracks numbers start at 1. + Return the starting MSF (minutes/secs/frames) for track number + i_track in p_cdio. Track numbers usually start at something + greater than 0, usually 1. + The "leadout" track is specified either by - using track_num LEADOUT_TRACK or the total tracks+1. - CDIO_INVALID_LBA is returned on error. + using i_track CDIO_CDROM_LEADOUT_TRACK or the total tracks+1. + + @param p_cdio object to get information from + @param i_track the track number we want the LSN for + @return the starting LSN or CDIO_INVALID_LSN on error. */ - lsn_t cdio_get_track_lsn(const CdIo *obj, track_t track_num); + lsn_t cdio_get_track_lsn(const CdIo *p_cdio, track_t i_track); /*! Return the starting MSF (minutes/secs/frames) for track number - track_num in obj. Track numbers start at 1. + i_track in p_cdio. Track numbers usually start at something + greater than 0, usually 1. + The "leadout" track is specified either by - using track_num LEADOUT_TRACK or the total tracks+1. - False is returned if there is no track entry. + using i_track CDIO_CDROM_LEADOUT_TRACK or the total tracks+1. + + @return true if things worked or false if there is no track entry. */ - bool cdio_get_track_msf(const CdIo *obj, track_t track_num, + bool cdio_get_track_msf(const CdIo *p_cdio, track_t i_track, /*out*/ msf_t *msf); /*! - Return the number of sectors between this track an the next. This + Get the number of sectors between this track an the next. This includes any pregap sectors before the start of the next track. - Tracks start at 1. - 0 is returned if there is an error. + Track numbers usually start at something + greater than 0, usually 1. + + @return the number of sectors or 0 if there is an error. */ - unsigned int cdio_get_track_sec_count(const CdIo *obj, track_t track_num); + unsigned int cdio_get_track_sec_count(const CdIo *p_cdio, track_t i_track); /*! - lseek - reposition read/write file offset - Returns (off_t) -1 on error. + Reposition read offset Similar to (if not the same as) libc's lseek() + + @param p_cdio object to get information from + @param offset amount to seek + @param whence like corresponding parameter in libc's lseek, e.g. + SEEK_SET or SEEK_END. + @return (off_t) -1 on error. */ - off_t cdio_lseek(const CdIo *obj, off_t offset, int whence); + off_t cdio_lseek(const CdIo *p_cdio, off_t offset, int whence); /*! Reads into buf the next size bytes. - Returns -1 on error. Similar to (if not the same as) libc's read() + + @return (ssize_t) -1 on error. */ - ssize_t cdio_read(const CdIo *obj, void *buf, size_t size); + ssize_t cdio_read(const CdIo *p_cdio, void *buf, size_t size); /*! - Reads a audio sector from cd device into data starting - from lsn. Returns 0 if no error. + Read an audio sector + + @param p_cdio object to read from + @param buf place to read data into + @param lsn sector to read + + @return 0 if no error, nonzero otherwise. */ - int cdio_read_audio_sector (const CdIo *obj, void *buf, lsn_t lsn); + int cdio_read_audio_sector (const CdIo *p_cdio, void *buf, lsn_t lsn); /*! - Reads a audio sector from cd device into data starting - from lsn. Returns 0 if no error. + Reads audio sectors + + @param p_cdio object to read from + @param buf place to read data into + @param lsn sector to read + @param i_sectors number of sectors to read + + @return 0 if no error, nonzero otherwise. */ - int cdio_read_audio_sectors (const CdIo *obj, void *buf, lsn_t lsn, - unsigned int nblocks); + int cdio_read_audio_sectors (const CdIo *p_cdio, void *buf, lsn_t lsn, + unsigned int i_sectors); /*! - Reads a single mode1 sector from cd device into data starting - from lsn. Returns 0 if no error. + Reads a mode1 sector + + @param p_cdio object to read from + @param buf place to read data into + @param lsn sector to read + @param b_form2 true for reading mode1 form2 sectors or false for + mode1 form1 sectors. + + @return 0 if no error, nonzero otherwise. */ - int cdio_read_mode1_sector (const CdIo *obj, void *buf, lsn_t lsn, + int cdio_read_mode1_sector (const CdIo *p_cdio, void *buf, lsn_t lsn, bool b_form2); /*! - Reads nblocks of mode1 sectors from cd device into data starting - from lsn. Returns 0 if no error. + Reads mode1 sectors + + @param p_cdio object to read from + @param buf place to read data into + @param lsn sector to read + @param b_form2 true for reading mode1 form2 sectors or false for + mode1 form1 sectors. + @param i_sectors number of sectors to read + + @return 0 if no error, nonzero otherwise. */ - int cdio_read_mode1_sectors (const CdIo *obj, void *buf, lsn_t lsn, - bool b_form2, unsigned int num_sectors); + int cdio_read_mode1_sectors (const CdIo *p_cdio, void *buf, lsn_t lsn, + bool b_form2, unsigned int i_sectors); /*! - Reads a single mode2 sector from cd device into data starting - from lsn. Returns 0 if no error. + Reads a mode1 sector + + @param p_cdio object to read from + @param buf place to read data into + @param lsn sector to read + @param b_form2 true for reading mode1 form2 sectors or false for + mode1 form1 sectors. + + @return 0 if no error, nonzero otherwise. */ - int cdio_read_mode2_sector (const CdIo *obj, void *buf, lsn_t lsn, + int cdio_read_mode2_sector (const CdIo *p_cdio, void *buf, lsn_t lsn, bool b_form2); /*! - Reads nblocks of mode2 sectors from cd device into data starting - from lsn. - Returns 0 if no error. + Reads mode2 sectors + + @param p_cdio object to read from + @param buf place to read data into + @param lsn sector to read + @param b_form2 true for reading mode1 form2 sectors or false for + mode1 form1 sectors. + @param i_sectors number of sectors to read + + @return 0 if no error, nonzero otherwise. */ - int cdio_read_mode2_sectors (const CdIo *obj, void *buf, lsn_t lsn, - bool b_form2, unsigned int num_sectors); + int cdio_read_mode2_sectors (const CdIo *p_cdio, void *buf, lsn_t lsn, + bool b_form2, unsigned int i_sectors); /*! - Set the arg "key" with "value" in the source device. - 0 is returned if no error was found, and nonzero if there as an error. + Set the arg "key" with "value" in "obj". + + @param p_cdio the CD object to set + @param key the key to set + @param value the value to assocaiate with key + @return 0 if no error was found, and nonzero otherwise. */ - int cdio_set_arg (CdIo *obj, const char key[], const char value[]); + int cdio_set_arg (CdIo *p_cdio, const char key[], const char value[]); /*! - Return the size of the CD in logical block address (LBA) units. + Get the size of the CD in logical block address (LBA) units. + + @param p_cdio the CD object queried + @return the size */ - uint32_t cdio_stat_size (const CdIo *obj); + uint32_t cdio_stat_size (const CdIo *p_cdio); /*! Initialize CD Reading and control routines. Should be called first. @@ -347,72 +575,148 @@ extern "C" { /*! True if BIN/CUE driver is available. */ bool cdio_have_bincue (void); + /*! True if cdrdao CDRDAO driver is available. */ + bool cdio_have_cdrdao (void); + /*! Like cdio_have_xxx but uses an enumeration instead. */ bool cdio_have_driver (driver_id_t driver_id); - /*! Return a string decribing driver_id. */ + /*! + Get a string decribing driver_id. + + @param driver_id the driver you want the description for + @return a sring of driver description + */ 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 cdio_open_xxx - routines. + driver_id. This or cdio_open_* 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 + cdio_open_xxx routines. - NULL is returned on error. + @return the cdio object or NULL on error or no device. */ CdIo * cdio_open (const char *source_name, driver_id_t driver_id); + /*! Sets up to read from place specified by source_name, driver_id + and access mode. This or cdio_open 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 + cdio_open_xxx routines. + + @return the cdio object or NULL on error or no device. + */ + CdIo * cdio_open_am (const char *psz_source_name, + driver_id_t driver_id, const char *psz_access_mode); + + /*! Set up BIN/CUE CD disk-image for reading. Source is the .bin or + .cue file + + @return the cdio object or NULL on error or no device. + */ + CdIo * cdio_open_bincue (const char *psz_cue_name); + /*! Set up BIN/CUE CD disk-image for reading. Source is the .bin or .cue file - NULL is returned on error. + @return the cdio object or NULL on error or no device.. + */ + CdIo * cdio_open_am_bincue (const char *psz_cue_name, + const char *psz_access_mode); + + /*! Set up cdrdao CD disk-image for reading. Source is the .toc file + + @return the cdio object or NULL on error or no device. + */ + CdIo * cdio_open_cdrdao (const char *psz_toc_name); + + /*! Set up cdrdao CD disk-image for reading. Source is the .toc file + + @return the cdio object or NULL on error or no device.. */ - CdIo * cdio_open_bincue (const char *bin_name); + CdIo * cdio_open_am_cdrdao (const char *psz_toc_name, + const char *psz_access_mode); /*! 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. + @return the cdio object or NULL on error or no device. */ char * cdio_get_default_device_bincue(void); char **cdio_get_devices_bincue(void); + /*! 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_cdrdao(void); + + char **cdio_get_devices_cdrdao(void); + /*! Set up CD-ROM for reading. The device_name is the some sort of device name. - NULL is returned on error. + @return the cdio object for subsequent operations. + NULL on error or there is no driver for a some sort of hardware CD-ROM. */ CdIo * cdio_open_cd (const char *device_name); - /*! cdrao BIN/CUE CD disk-image routines. Source is the .cue file + /*! Set up CD-ROM for reading. The device_name is + the some sort of device name. + + @return the cdio object for subsequent operations. + NULL on error or there is no driver for a some sort of hardware CD-ROM. + */ + CdIo * cdio_open_am_cd (const char *psz_device, + const char *psz_access_mode); + + /*! CDRWIN BIN/CUE CD disc-image routines. Source is the .cue file - NULL is returned on error. + @return the cdio object for subsequent operations. + NULL on error. */ CdIo * cdio_open_cue (const char *cue_name); /*! 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. + @return the cdio object for subsequent operations. + NULL on error or there is no BSDI driver. @see cdio_open */ - CdIo * cdio_open_bsdi (const char *source_name); + CdIo * cdio_open_bsdi (const char *psz_source_name); + + /*! Set up CD-ROM for reading using the BSDI driver. The device_name is + the some sort of device name. + + @return the cdio object for subsequent operations. + NULL on error or there is no BSDI driver. + + @see cdio_open + */ + CdIo * cdio_open_am_bsdi (const char *psz_source_name, + const char *psz_access_mode); /*! 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. + @return the cdio object for subsequent operations. + NULL on error or there is no BSDI driver. - @see cdio_open_cd - @see cdio_open + @see cdio_open_cd, 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. + + In some situations of drivers or OS's we can't find a CD device if + there is no media in it and it is possible for this routine to return + NULL even though there may be a hardware CD-ROM. */ char **cdio_get_devices_bsdi(void); @@ -421,10 +725,19 @@ extern "C" { NULL is returned on error or there is no FreeBSD driver. - @see cdio_open_cd - @see cdio_open + @see cdio_open_cd, cdio_open */ - CdIo * cdio_open_freebsd (const char *source_name); + CdIo * cdio_open_freebsd (const char *paz_source_name); + + /*! 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, cdio_open + */ + CdIo * cdio_open_am_freebsd (const char *psz_source_name, + const char *psz_access_mode); /*! Return a string containing the default device name that the FreeBSD driver would use when none is specified. @@ -441,18 +754,35 @@ extern "C" { /*! 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. + @return the cdio object for subsequent operations. + NULL on error or there is no GNU/Linux driver. + + In some situations of drivers or OS's we can't find a CD device if + there is no media in it and it is possible for this routine to return + NULL even though there may be a hardware CD-ROM. */ CdIo * cdio_open_linux (const char *source_name); + /*! Set up CD-ROM for reading using the GNU/Linux driver. The + device_name is the some sort of device name. + + @return the cdio object for subsequent operations. + NULL on error or there is no GNU/Linux driver. + */ + CdIo * cdio_open_am_linux (const char *source_name, + const char *access_mode); + /*! 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 + In some situations of drivers or OS's we can't find a CD device if + there is no media in it and it is possible for this routine to return + NULL even though there may be a hardware CD-ROM. + + @see cdio_open_cd, cdio_open */ char * cdio_get_default_device_linux(void); @@ -464,18 +794,31 @@ extern "C" { /*! 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. + @return the cdio object for subsequent operations. + NULL on error or there is no Solaris driver. */ CdIo * cdio_open_solaris (const char *source_name); + /*! Set up CD-ROM for reading using the Sun Solaris driver. The + device_name is the some sort of device name. + + @return the cdio object for subsequent operations. + NULL on error or there is no Solaris driver. + */ + CdIo * cdio_open_am_solaris (const char *psz_source_name, + const char *psz_access_mode); + /*! 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 + In some situations of drivers or OS's we can't find a CD device if + there is no media in it and it is possible for this routine to return + NULL even though there may be a hardware CD-ROM. + + @see cdio_open_cd, cdio_open */ char * cdio_get_default_device_solaris(void); @@ -489,16 +832,31 @@ extern "C" { NULL is returned on error or there is no OSX driver. - @see cdio_open_cd - @see cdio_open + In some situations of drivers or OS's we can't find a CD device if + there is no media in it and it is possible for this routine to return + NULL even though there may be a hardware CD-ROM. + + @see cdio_open_cd, cdio_open */ - CdIo * cdio_open_osx (const char *source_name); + CdIo * cdio_open_osx (const char *psz_source_name); + + /*! 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, cdio_open + */ + CdIo * cdio_open_am_osx (const char *psz_source_name, + const char *psz_access_mode); /*! 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 + In some situations of drivers or OS's we can't find a CD device if + there is no media in it and it is possible for this routine to return + NULL even though there may be a hardware CD-ROM. */ char * cdio_get_default_device_osx(void); @@ -510,18 +868,29 @@ extern "C" { /*! 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. + In some situations of drivers or OS's we can't find a CD device if + there is no media in it and it is possible for this routine to return + NULL even though there may be a hardware CD-ROM. */ CdIo * cdio_open_win32 (const char *source_name); + /*! 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_am_win32 (const char *psz_source_name, + const char *psz_access_mode); + /*! 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. + In some situations of drivers or OS's we can't find a CD device if + there is no media in it and it is possible for this routine to return + NULL even though there may be a hardware CD-ROM. - @see cdio_open_cd - @see cdio_open + @see cdio_open_cd, cdio_open */ char * cdio_get_default_device_win32(void); @@ -530,10 +899,18 @@ extern "C" { /*! 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. + @return true on success; NULL on error or there is no Nero driver. */ CdIo * cdio_open_nrg (const char *source_name); + /*! Set up CD-ROM for reading using the Nero driver. The + device_name is the some sort of device name. + + @return true on success; NULL on error or there is no Nero driver. + */ + CdIo * cdio_open_am_nrg (const char *psz_source_name, + const char *psz_access_mode); + /*! 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.. @@ -544,18 +921,50 @@ extern "C" { char **cdio_get_devices_nrg(void); - /*! Return corresponding BIN file if cue_name is a cue file or NULL - if not a CUE file. + /*! + + Determine if bin_name is the bin file part of a CDRWIN CD disk image. + + @param bin_name location of presumed CDRWIN bin image file. + @return the corresponding CUE file if bin_name is a BIN file or + NULL if not a BIN file. + */ + char *cdio_is_binfile(const char *bin_name); + + /*! + Determine if cue_name is the cue sheet for a CDRWIN CD disk image. + + @return corresponding BIN file if cue_name is a CDRWIN cue file or + NULL if not a CUE file. */ char *cdio_is_cuefile(const char *cue_name); - /*! Return corresponding CUE file if bin_name is a fin file or NULL - if not a BIN file. NOTE: when we handle TOC something will have to - change here.... + /*! + Determine if psg_nrg is a Nero CD disk image. + + @param psz_nrg location of presumed NRG image file. + @return true if psz_nrg is a Nero NRG image or false + if not a NRG image. */ - char *cdio_is_binfile(const char *bin_name); + bool cdio_is_nrg(const char *psz_nrg); - /*! Return true if source name is a device. + /*! + Determine if psg_toc is a TOC file for a cdrdao CD disk image. + + @param psz_toc location of presumed TOC image file. + @return true if toc_name is a cdrdao TOC file or false + if not a TOC file. + */ + bool cdio_is_tocfile(const char *psz_toc); + + /*! + Determine if source_name refers to a real hardware CD-ROM. + + @param source_name location name of object + @param driver_id driver for reading object. Use DRIVER_UNKNOWN if you + don't know what driver to use. + @return true if source_name is a device; If false is returned we + could have a CD disk image. */ bool cdio_is_device(const char *source_name, driver_id_t driver_id); diff --git a/src/input/vcd/libcdio/cdio/cdtext.h b/src/input/vcd/libcdio/cdio/cdtext.h new file mode 100644 index 000000000..4b397a3ff --- /dev/null +++ b/src/input/vcd/libcdio/cdio/cdtext.h @@ -0,0 +1,108 @@ +/* + $Id: cdtext.h,v 1.1 2005/01/01 02:43:58 rockyb Exp $ + + Copyright (C) 2004 Rocky Bernstein <rocky@panix.com> + adapted from cuetools + Copyright (C) 2003 Svend Sanjay Sorensen <ssorensen@fastmail.fm> + + 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 2 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +/*! + * \file cdtext.h + * \brief Header CD-Text information +*/ + + +#ifndef __CDIO_CDTEXT_H__ +#define __CDIO_CDTEXT_H__ + +#include <cdio/cdio.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define MAX_CDTEXT_FIELDS 13 + + /*! \brief structure for holding CD-Text information + + @see cdtext_init, cdtext_destroy, cdtext_get, and cdtext_set. + */ + struct cdtext { + char *field[MAX_CDTEXT_FIELDS]; + }; + + /*! \brief A list of all of the CD-Text fields */ + typedef enum { + CDTEXT_ARRANGER = 0, /**< name(s) of the arranger(s) */ + CDTEXT_COMPOSER = 1, /**< name(s) of the composer(s) */ + CDTEXT_DISCID = 2, /**< disc identification information */ + CDTEXT_GENRE = 3, /**< genre identification and genre information */ + CDTEXT_MESSAGE = 4, /**< ISRC code of each track */ + CDTEXT_ISRC = 5, /**< message(s) from the content provider or artist */ + CDTEXT_PERFORMER = 6, /**< name(s) of the performer(s) */ + CDTEXT_SIZE_INFO = 7, /**< size information of the block */ + CDTEXT_SONGWRITER = 8, /**< name(s) of the songwriter(s) */ + CDTEXT_TITLE = 9, /**< title of album name or track titles */ + CDTEXT_TOC_INFO = 10, /**< table of contents information */ + CDTEXT_TOC_INFO2 = 11, /**< second table of contents information */ + CDTEXT_UPC_EAN = 12, + CDTEXT_INVALID = MAX_CDTEXT_FIELDS + } cdtext_field_t; + + /*! Return string representation of the enum values above */ + const char *cdtext_field2str (cdtext_field_t i); + + /*! Initialize a new cdtext structure. + When the structure is no longer needed, release the + resources using cdtext_delete. + */ + void cdtext_init (cdtext_t *cdtext); + + /*! Free memory assocated with cdtext*/ + void cdtext_destroy (cdtext_t *cdtext); + + /*! returns the string associated with the given field. NULL is + returned if key is CDTEXT_INVALID or the field is not set. + + @see cdio_get_cdtext to retrieve the cdtext structure used as + input here. + */ + const char *cdtext_get (cdtext_field_t key, const cdtext_t *cdtext); + + /*! + returns enum of keyword if key is a CD-Text keyword, + returns MAX_CDTEXT_FIELDS non-zero otherwise. + */ + cdtext_field_t cdtext_is_keyword (const char *key); + + /*! + sets cdtext's keyword entry to field + */ + void cdtext_set (cdtext_field_t key, const char *value, cdtext_t *cdtext); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __CDIO_CDTEXT_H__ */ + +/* + * Local variables: + * c-file-style: "gnu" + * tab-width: 8 + * indent-tabs-mode: nil + * End: + */ diff --git a/src/input/vcd/libcdio/cdio/ds.h b/src/input/vcd/libcdio/cdio/ds.h new file mode 100644 index 000000000..c811cadd4 --- /dev/null +++ b/src/input/vcd/libcdio/cdio/ds.h @@ -0,0 +1,73 @@ +/* + $Id: ds.h,v 1.1 2005/01/01 02:43:58 rockyb Exp $ + + Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> + + 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 2 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef __CDIO_DS_H__ +#define __CDIO_DS_H__ + +#include <cdio/types.h> + +/* opaque... */ +typedef struct _CdioList CdioList; +typedef struct _CdioListNode CdioListNode; + +typedef int (*_cdio_list_cmp_func) (void *data1, void *data2); + +typedef int (*_cdio_list_iterfunc) (void *data, void *user_data); + +/* methods */ +CdioList *_cdio_list_new (void); + +void _cdio_list_free (CdioList *list, int free_data); + +unsigned _cdio_list_length (const CdioList *list); + +void _cdio_list_prepend (CdioList *list, void *data); + +void _cdio_list_append (CdioList *list, void *data); + +void _cdio_list_foreach (CdioList *list, _cdio_list_iterfunc func, void *user_data); + +CdioListNode *_cdio_list_find (CdioList *list, _cdio_list_iterfunc cmp_func, void *user_data); + +#define _CDIO_LIST_FOREACH(node, list) \ + for (node = _cdio_list_begin (list); node; node = _cdio_list_node_next (node)) + +/* node ops */ + +CdioListNode *_cdio_list_begin (const CdioList *list); + +CdioListNode *_cdio_list_end (CdioList *list); + +CdioListNode *_cdio_list_node_next (CdioListNode *node); + +void _cdio_list_node_free (CdioListNode *node, int free_data); + +void *_cdio_list_node_data (CdioListNode *node); + +#endif /* __CDIO_DS_H__ */ + +/* + * Local variables: + * c-file-style: "gnu" + * tab-width: 8 + * indent-tabs-mode: nil + * End: + */ + diff --git a/src/input/vcd/libcdio/cdio/dvd.h b/src/input/vcd/libcdio/cdio/dvd.h new file mode 100644 index 000000000..df58c4322 --- /dev/null +++ b/src/input/vcd/libcdio/cdio/dvd.h @@ -0,0 +1,113 @@ +/* + $Id: dvd.h,v 1.1 2005/01/01 02:43:58 rockyb Exp $ + + Copyright (C) 2004 Rocky Bernstein <rocky@panix.com> + Modeled after GNU/Linux definitions in linux/cdrom.h + + 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 2 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +/*! + \file dvd.h + \brief Definitions for DVD access. +*/ + +#ifndef __CDIO_DVD_H__ +#define __CDIO_DVD_H__ + +#include <cdio/types.h> + +/*! 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 + +/*! Media definitions for "Book Type" */ +#define CDIO_DVD_BOOK_DVD_ROM 0 +#define CDIO_DVD_BOOK_DVD_RAM 1 +#define CDIO_DVD_BOOK_DVD_R 2 /**< DVD-R */ +#define CDIO_DVD_BOOK_DVD_RW 3 /**< DVD-RW */ +#define CDIO_DVD_BOOK_DVD_PR 8 /**< DVD+R */ +#define CDIO_DVD_BOOK_DVD_PRW 9 /**< DVD+RW */ + +typedef struct cdio_dvd_layer { + uint8_t book_version : 4; + uint8_t book_type : 4; + uint8_t min_rate : 4; + uint8_t disc_size : 4; + uint8_t layer_type : 4; + uint8_t track_path : 1; + uint8_t nlayers : 2; + uint8_t track_density : 4; + uint8_t linear_density: 4; + uint8_t bca : 1; + uint32_t start_sector; + uint32_t end_sector; + uint32_t end_sector_l0; +} cdio_dvd_layer_t; + +/*! Maximum number of layers in a DVD. */ +#define CDIO_DVD_MAX_LAYERS 4 + +typedef struct cdio_dvd_physical { + uint8_t type; + uint8_t layer_num; + cdio_dvd_layer_t layer[CDIO_DVD_MAX_LAYERS]; +} cdio_dvd_physical_t; + +typedef struct cdio_dvd_copyright { + uint8_t type; + + uint8_t layer_num; + uint8_t cpst; + uint8_t rmi; +} cdio_dvd_copyright_t; + +typedef struct cdio_dvd_disckey { + uint8_t type; + + unsigned agid : 2; + uint8_t value[2048]; +} cdio_dvd_disckey_t; + +typedef struct cdio_dvd_bca { + uint8_t type; + + int len; + uint8_t value[188]; +} cdio_dvd_bca_t; + +typedef struct cdio_dvd_manufact { + uint8_t type; + + uint8_t layer_num; + int len; + uint8_t value[2048]; +} cdio_dvd_manufact_t; + +typedef union { + uint8_t type; + + cdio_dvd_physical_t physical; + cdio_dvd_copyright_t copyright; + cdio_dvd_disckey_t disckey; + cdio_dvd_bca_t bca; + cdio_dvd_manufact_t manufact; +} cdio_dvd_struct_t; + +#endif /* __SCSI_MMC_H__ */ diff --git a/src/input/vcd/libcdio/cdio/iso9660.h b/src/input/vcd/libcdio/cdio/iso9660.h index 78f78ef81..104b6ba62 100644 --- a/src/input/vcd/libcdio/cdio/iso9660.h +++ b/src/input/vcd/libcdio/cdio/iso9660.h @@ -1,5 +1,5 @@ /* - $Id: iso9660.h,v 1.2 2004/04/11 12:20:31 miguelfreitas Exp $ + $Id: iso9660.h,v 1.3 2005/01/01 02:43:58 rockyb Exp $ Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> @@ -33,6 +33,7 @@ #define __CDIO_ISO9660_H__ #include <cdio/cdio.h> +#include <cdio/ds.h> #include <cdio/xa.h> #include <time.h> @@ -56,14 +57,35 @@ = 38 chars \endverbatim */ -#define LEN_ISONAME 31 -#define MAX_ISONAME 37 +/*! size in bytes of the filename portion + null byte */ +#define LEN_ISONAME 31 + +/*! Max # characters in the entire ISO 9660 filename. */ +#define MAX_ISONAME 37 + +/*! Max # characters in the entire ISO 9660 filename. */ #define MAX_ISOPATHNAME 255 -/* - * ISO 9660 directory flags. - */ +/*! Max # characters in an perparer id. */ +#define ISO_MAX_PREPARER_ID 128 + +/*! Max # characters in an publisher id. */ +#define ISO_MAX_PUBLISHER_ID 128 + +/*! Max # characters in an application id. */ +#define ISO_MAX_APPLICATION_ID 128 + +/*! Max # characters in an system id. */ +#define ISO_MAX_SYSTEM_ID 32 + +/*! Max # characters in an volume id. */ +#define ISO_MAX_VOLUME_ID 32 + +/*! Max # characters in an volume-set id. */ +#define ISO_MAX_VOLUMESET_ID 128 + +/**! 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 */ @@ -74,18 +96,23 @@ #define ISO_DRESERVED2 64 /**< Reserved bit 6 */ #define ISO_MULTIEXTENT 128 /**< Not final entry of a mult. ext. file */ -/* Volume descriptor types */ +/**! Volume descriptor types */ #define ISO_VD_PRIMARY 1 #define ISO_VD_SUPPLEMENTARY 2 /**< Used by Joliet */ #define ISO_VD_END 255 -#define ISO_PVD_SECTOR 16 /**< Sector of Primary Volume Descriptor */ -#define ISO_EVD_SECTOR 17 /**< Sector of End Volume Descriptor */ +/*! Sector of Primary Volume Descriptor */ +#define ISO_PVD_SECTOR 16 + +/*! Sector of End Volume Descriptor */ +#define ISO_EVD_SECTOR 17 -#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 */ +/*! String inside track identifying an ISO 9660 filesystem. */ +#define ISO_STANDARD_ID "CD001" + + +/*! Number of bytes in an ISO 9660 block */ +#define ISO_BLOCKSIZE 2048 #ifdef __cplusplus extern "C" { @@ -98,6 +125,10 @@ enum strncpy_pad_check { ISO9660_DCHARS }; +#ifndef EMPTY_ARRAY_SIZE +#define EMPTY_ARRAY_SIZE 0 +#endif + PRAGMA_BEGIN_PACKED /*! @@ -144,33 +175,62 @@ struct iso9660_ltime { typedef struct iso9660_ltime iso9660_ltime_t; +/*! \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 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 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; + +typedef struct iso9660_dir iso9660_dir_t; + /*! \brief ISO-9660 Primary Volume Descriptor. */ struct iso9660_pvd { - uint8_t type; /**< 711 encoded */ + uint8_t type; /**< 711 encoded */ char id[5]; - uint8_t version; /**< 711 encoded */ + uint8_t version; /**< 711 encoded */ char unused1[1]; - char system_id[32]; /**< each char is an achar */ - char volume_id[32]; /**< each char is a dchar */ + char system_id[ISO_MAX_SYSTEM_ID]; /**< each char is an achar */ + char volume_id[ISO_MAX_VOLUME_ID]; /**< each char is a dchar */ char unused2[8]; - uint64_t volume_space_size; /**< 733 encoded */ - char escape_sequences[32]; - 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 */ + uint64_t volume_space_size; /**< 733 encoded */ + char unused3[32]; + 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 */ + iso9660_dir_t root_directory_record; /**< See section 9.1 of + ISO 9660 spec. */ + char root_directory_filename; /**< Is \0 */ + char volume_set_id[ISO_MAX_VOLUMESET_ID]; /**< dchars */ + char publisher_id[ISO_MAX_PUBLISHER_ID]; /**< achars */ + char preparer_id[ISO_MAX_PREPARER_ID]; /**< achars */ + char application_id[ISO_MAX_APPLICATION_ID]; /**< achars */ char copyright_file_id[37]; /**< See section 7.5 of ISO 9660 spec. Each char is a dchar */ @@ -194,41 +254,63 @@ struct iso9660_pvd { char unused5[653]; } GNUC_PACKED; -typedef struct iso9660_dir iso9660_dir_t; typedef struct iso9660_pvd iso9660_pvd_t; -typedef struct iso9660_stat iso9660_stat_t; - -#ifndef EMPTY_ARRAY_SIZE -#define EMPTY_ARRAY_SIZE 0 -#endif - - -/*! \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. +/*! + \brief ISO-9660 Supplementary Volume Descriptor. - @see iso9660_stat + This is used for Joliet Extentions and is almost the same as the + the primary descriptor but two unused fields, "unused1" and "unused3 + become "flags and "escape_sequences" respectively. */ -struct iso9660_dir { - 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 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]; +struct iso9660_svd { + uint8_t type; /**< 711 encoded */ + char id[5]; + uint8_t version; /**< 711 encoded */ + char flags; /**< 853 */ + char system_id[ISO_MAX_SYSTEM_ID]; /**< each char is an achar */ + char volume_id[ISO_MAX_VOLUME_ID]; /**< each char is a dchar */ + char unused2[8]; + uint64_t volume_space_size; /**< 733 encoded */ + char escape_sequences[32]; /**< 856 */ + 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 */ + iso9660_dir_t root_directory_record; /**< See section 9.1 of + ISO 9660 spec. */ + char volume_set_id[ISO_MAX_VOLUMESET_ID]; /**< dchars */ + char publisher_id[ISO_MAX_PUBLISHER_ID]; /**< achars */ + char preparer_id[ISO_MAX_PREPARER_ID]; /**< achars */ + char application_id[ISO_MAX_APPLICATION_ID]; /**< 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]; } GNUC_PACKED; +typedef struct iso9660_svd iso9660_svd_t; PRAGMA_END_PACKED @@ -251,29 +333,88 @@ struct iso9660_stat { /* big endian!! */ char filename[EMPTY_ARRAY_SIZE]; /**< filename */ }; +typedef struct iso9660_stat iso9660_stat_t; + + +/** A mask used in iso9660_ifs_read_vd which allows what kinds + of extensions we allow, eg. Joliet, Rock Ridge, etc. */ +typedef uint8_t iso_extension_mask_t; + +#define ISO_EXTENSION_JOLIET_LEVEL1 0x01 +#define ISO_EXTENSION_JOLIET_LEVEL2 0x02 +#define ISO_EXTENSION_JOLIET_LEVEL3 0x04 +#define ISO_EXTENSION_ROCK_RIDGE 0x08 +#define ISO_EXTENSION_HIGH_SIERRA 0x10 + +#define ISO_EXTENSION_ALL 0xFF +#define ISO_EXTENSION_NONE 0x00 +#define ISO_EXTENSION_JOLIET \ + (ISO_EXTENSION_JOLIET_LEVEL1 | \ + ISO_EXTENSION_JOLIET_LEVEL2 | \ + ISO_EXTENSION_JOLIET_LEVEL3 ) + /** 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. + a mode. NULL is returned on error. */ - iso9660_t *iso9660_open (const char *pathname /*flags, mode */); + iso9660_t *iso9660_open (const char *psz_pathname /*flags, mode */); + +/*! + Open an ISO 9660 image for reading allowing various ISO 9660 + extensions. Maybe in the future we will have a mode. NULL is + returned on error. +*/ + iso9660_t *iso9660_open_ext (const char *psz_pathname, + iso_extension_mask_t iso_extension_mask); /*! 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); + bool iso9660_close (iso9660_t * p_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); + long int iso9660_iso_seek_read (const iso9660_t *p_iso, void *ptr, + lsn_t start, long int i_size); + +/*! + Read the Primary Volume Descriptor for a CD. + True is returned if read, and false if there was an error. +*/ + bool iso9660_fs_read_pvd ( const CdIo *p_cdio, + /*out*/ iso9660_pvd_t *p_pvd ); + +/*! + Read the Primary Volume Descriptor for an ISO 9660 image. + True is returned if read, and false if there was an error. +*/ + bool iso9660_ifs_read_pvd (const iso9660_t *p_iso, + /*out*/ iso9660_pvd_t *p_pvd); + +/*! + Read the Super block of an ISO 9660 image. This is the + Primary Volume Descriptor (PVD) and perhaps a Supplemental Volume + Descriptor if (Joliet) extensions are acceptable. +*/ + bool iso9660_fs_read_superblock (CdIo *p_cdio, + iso_extension_mask_t iso_extension_mask); + +/*! + Read the Supper block of an ISO 9660 image. This is the + Primary Volume Descriptor (PVD) and perhaps a Supplemental Volume + Descriptor if (Joliet) extensions are acceptable. +*/ + bool iso9660_ifs_read_superblock (iso9660_t *p_iso, + iso_extension_mask_t iso_extension_mask); + /*==================================================== Time conversion @@ -289,7 +430,7 @@ typedef struct _iso9660 iso9660_t; 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); + /*out*/ iso9660_ltime_t *p_pvd_date); /*! Get Unix time structure from format use in an ISO 9660 directory index @@ -323,13 +464,24 @@ bool iso9660_isachar (int c); /*! Convert ISO-9660 file name that stored in a directory entry into what's usually listed as the file name in a listing. - Lowercase name, and drop deal with trailing ;1's or .;1's or - ; version numbers. + Lowercase name, and remove trailing ;1's or .;1's and + turn the other ;'s into version numbers. The length of the translated string is returned. */ -int iso9660_name_translate(const char *old, char *new); +int iso9660_name_translate(const char *psz_oldname, char *psz_newname); + +/*! + Convert ISO-9660 file name that stored in a directory entry into + what's usually listed as the file name in a listing. Lowercase + name if not using Joliet extension. Remove trailing ;1's or .;1's and + turn the other ;'s into version numbers. + The length of the translated string is returned. +*/ +int iso9660_name_translate_ext(const char *old, char *new, + uint8_t i_joliet_level); + /*! Pad string src with spaces to size len and copy this to dst. If len is less than the length of src, dst will be truncated to the @@ -366,7 +518,7 @@ bool iso9660_dirname_valid_p (const char pathname[]); 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); +char *iso9660_pathname_isofy (const char pathname[], uint16_t i_version); /*! Check that pathname is a valid ISO-9660 pathname. @@ -412,7 +564,7 @@ iso9660_dir_calc_record_size (unsigned int namelen, unsigned int su_len); Returns stat_t of entry if we found lsn, or NULL otherwise. */ -iso9660_stat_t *iso9660_find_fs_lsn(const CdIo *cdio, lsn_t lsn); +iso9660_stat_t *iso9660_find_fs_lsn(CdIo *p_cdio, lsn_t i_lsn); /*! @@ -421,14 +573,14 @@ iso9660_stat_t *iso9660_find_fs_lsn(const CdIo *cdio, lsn_t lsn); 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); +iso9660_stat_t *iso9660_find_ifs_lsn(const iso9660_t *p_iso, lsn_t i_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); +iso9660_stat_t *iso9660_fs_stat (CdIo *p_cdio, const char pathname[]); + /*! Get file status for pathname into stat. NULL is returned on error. @@ -436,14 +588,14 @@ iso9660_stat_t *iso9660_fs_stat (const CdIo *obj, const char pathname[], name are dropped, i.e. ;1 is removed and if level 1 ISO-9660 names are lowercased. */ -iso9660_stat_t *iso9660_fs_stat_translate (const CdIo *obj, +iso9660_stat_t *iso9660_fs_stat_translate (CdIo *p_cdio, const char pathname[], - bool is_mode2); + bool b_mode2); /*! Get file status for pathname into stat. NULL is returned on error. */ -void *iso9660_ifs_stat (iso9660_t *iso, const char pathname[]); +iso9660_stat_t *iso9660_ifs_stat (iso9660_t *p_iso, const char pathname[]); /*! @@ -452,28 +604,46 @@ void *iso9660_ifs_stat (iso9660_t *iso, const char pathname[]); 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[]); - - +iso9660_stat_t *iso9660_ifs_stat_translate (iso9660_t *p_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); +CdioList * iso9660_fs_readdir (CdIo *p_cdio, const char pathname[], + bool b_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[]); +CdioList * iso9660_ifs_readdir (iso9660_t *p_iso, const char pathname[]); + +/*! + Return the PVD's application ID. + NULL is returned if there is some problem in getting this. +*/ +char * iso9660_get_application_id(iso9660_pvd_t *p_pvd); + +/*! + Get the application ID. psz_app_id is set to NULL if there + is some problem in getting this and false is returned. +*/ +bool iso9660_ifs_get_application_id(iso9660_t *p_iso, + /*out*/ char **p_psz_app_id); -uint8_t iso9660_get_dir_len(const iso9660_dir_t *idr); +/*! + Return the Joliet level recognized for p_iso. +*/ +uint8_t iso9660_ifs_get_joliet_level(iso9660_t *p_iso); + +uint8_t iso9660_get_dir_len(const iso9660_dir_t *p_idr); #if FIXME -uint8_t iso9660_get_dir_size(const iso9660_dir_t *idr); +uint8_t iso9660_get_dir_size(const iso9660_dir_t *p_idr); -lsn_t iso9660_get_dir_extent(const iso9660_dir_t *idr); +lsn_t iso9660_get_dir_extent(const iso9660_dir_t *p_idr); #endif /*! @@ -481,25 +651,90 @@ lsn_t iso9660_get_dir_extent(const iso9660_dir_t *idr); A string is allocated: the caller must deallocate. */ -char * iso9660_dir_to_name (const iso9660_dir_t *iso9660_dir); +char * iso9660_dir_to_name (const iso9660_dir_t *p_iso9660_dir); + +/*! + Return a string containing the preparer id with trailing + blanks removed. +*/ +char *iso9660_get_preparer_id(const iso9660_pvd_t *p_pvd); -uint8_t iso9660_get_pvd_type(const iso9660_pvd_t *pvd); +/*! + Get the preparer ID. psz_preparer_id is set to NULL if there + is some problem in getting this and false is returned. +*/ +bool iso9660_ifs_get_preparer_id(iso9660_t *p_iso, + /*out*/ char **p_psz_preparer_id); + +/*! + Return a string containing the PVD's publisher id with trailing + blanks removed. +*/ +char *iso9660_get_publisher_id(const iso9660_pvd_t *p_pvd); -const char * iso9660_get_pvd_id(const iso9660_pvd_t *pvd); +/*! + Get the publisher ID. psz_publisher_id is set to NULL if there + is some problem in getting this and false is returned. +*/ +bool iso9660_ifs_get_publisher_id(iso9660_t *p_iso, + /*out*/ char **p_psz_publisher_id); + +uint8_t iso9660_get_pvd_type(const iso9660_pvd_t *p_pvd); + +const char * iso9660_get_pvd_id(const iso9660_pvd_t *p_pvd); -int iso9660_get_pvd_space_size(const iso9660_pvd_t *pvd); +int iso9660_get_pvd_space_size(const iso9660_pvd_t *p_pvd); -int iso9660_get_pvd_block_size(const iso9660_pvd_t *pvd) ; +int iso9660_get_pvd_block_size(const iso9660_pvd_t *p_pvd) ; /*! Return the primary volume id version number (of pvd). If there is an error 0 is returned. */ int iso9660_get_pvd_version(const iso9660_pvd_t *pvd) ; +/*! + Return a string containing the PVD's system id with trailing + blanks removed. +*/ +char *iso9660_get_system_id(const iso9660_pvd_t *p_pvd); + +/*! + Get the system ID. psz_system_id is set to NULL if there + is some problem in getting this and false is returned. +*/ +bool iso9660_ifs_get_system_id(iso9660_t *p_iso, + /*out*/ char **p_psz_system_id); + + /*! Return the LSN of the root directory for pvd. If there is an error CDIO_INVALID_LSN is returned. */ -lsn_t iso9660_get_root_lsn(const iso9660_pvd_t *pvd); +lsn_t iso9660_get_root_lsn(const iso9660_pvd_t *p_pvd); + +/*! + Return the PVD's volume ID. +*/ +char *iso9660_get_volume_id(const iso9660_pvd_t *p_pvd); + +/*! + Get the system ID. psz_system_id is set to NULL if there + is some problem in getting this and false is returned. +*/ +bool iso9660_ifs_get_volume_id(iso9660_t *p_iso, + /*out*/ char **p_psz_volume_id); + +/*! + Return the PVD's volumeset ID. + NULL is returned if there is some problem in getting this. +*/ +char *iso9660_get_volumeset_id(const iso9660_pvd_t *p_pvd); + +/*! + Get the systemset ID. psz_systemset_id is set to NULL if there + is some problem in getting this and false is returned. +*/ +bool iso9660_ifs_get_volumeset_id(iso9660_t *p_iso, + /*out*/ char **p_psz_volumeset_id); /* pathtable */ @@ -530,6 +765,12 @@ iso9660_set_pvd (void *pd, const char volume_id[], const char application_id[], void iso9660_set_evd (void *pd); +/*! + Return true if ISO 9660 image has extended attrributes (XA). +*/ +bool iso9660_ifs_is_xa (const iso9660_t * p_iso); + + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/src/input/vcd/libcdio/cdio/logging.h b/src/input/vcd/libcdio/cdio/logging.h index aec981ad4..8c78259ea 100644 --- a/src/input/vcd/libcdio/cdio/logging.h +++ b/src/input/vcd/libcdio/cdio/logging.h @@ -1,8 +1,8 @@ /* - $Id: logging.h,v 1.2 2004/04/11 12:20:31 miguelfreitas Exp $ + $Id: logging.h,v 1.3 2005/01/01 02:43:58 rockyb 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> 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 @@ -29,6 +29,10 @@ #include <cdio/types.h> +#ifdef __cplusplus +extern "C" { +#endif + /** * The different log levels supported. */ @@ -75,7 +79,7 @@ typedef void (*cdio_log_handler_t) (cdio_log_level_t level, cdio_log_handler_t cdio_log_set_handler (cdio_log_handler_t new_handler); /** - * Handle an message with the given log level + * Handle an message with the given log level. * * @see cdio_debug * @see cdio_info @@ -111,12 +115,16 @@ void cdio_info (const char format[], ...) GNUC_PRINTF(1,2); void cdio_warn (const char format[], ...) GNUC_PRINTF(1,2); /** - * Handle an error message. + * Handle an error message. Execution is terminated. * * @see cdio_log for a more generic routine. */ void cdio_error (const char format[], ...) GNUC_PRINTF(1,2); +#ifdef __cplusplus +} +#endif + #endif /* __LOGGING_H__ */ diff --git a/src/input/vcd/libcdio/cdio/scsi_mmc.h b/src/input/vcd/libcdio/cdio/scsi_mmc.h new file mode 100644 index 000000000..12860247e --- /dev/null +++ b/src/input/vcd/libcdio/cdio/scsi_mmc.h @@ -0,0 +1,415 @@ +/* + $Id: scsi_mmc.h,v 1.1 2005/01/01 02:43:58 rockyb Exp $ + + 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 + the Free Software Foundation; either version 2 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +/*! + \file scsi_mmc.h + \brief Common definitions for SCSI MMC (Multi-Media Commands). +*/ + +#ifndef __SCSI_MMC_H__ +#define __SCSI_MMC_H__ + +#include <cdio/cdio.h> +#include <cdio/types.h> +#include <cdio/dvd.h> + +/*! The generic packet command opcodes for CD/DVD Logical Units. */ + +#define CDIO_MMC_GPCMD_INQUIRY 0x12 +#define CDIO_MMC_GPCMD_MODE_SELECT_6 0x15 +#define CDIO_MMC_GPCMD_MODE_SENSE 0x1a +#define CDIO_MMC_GPCMD_START_STOP 0x1b +#define CDIO_MMC_GPCMD_ALLOW_MEDIUM_REMOVAL 0x1e +#define CDIO_MMC_GPCMD_READ_10 0x28 + +/*! + Group 2 Commands + */ +#define CDIO_MMC_GPCMD_READ_SUBCHANNEL 0x42 +#define CDIO_MMC_GPCMD_READ_TOC 0x43 +#define CDIO_MMC_GPCMD_READ_HEADER 0x44 +#define CDIO_MMC_GPCMD_PLAY_AUDIO_10 0x45 +#define CDIO_MMC_GPCMD_GET_CONFIGURATION 0x46 +#define CDIO_MMC_GPCMD_PLAY_AUDIO_MSF 0x47 +#define CDIO_MMC_GPCMD_PLAY_AUDIO_TI 0x48 +#define CDIO_MMC_GPCMD_PLAY_TRACK_REL_10 0x49 +#define CDIO_MMC_GPCMD_PAUSE_RESUME 0x4b + +#define CDIO_MMC_GPCMD_READ_DISC_INFO 0x51 +#define CDIO_MMC_GPCMD_MODE_SELECT 0x55 +#define CDIO_MMC_GPCMD_MODE_SENSE_10 0x5a + +/*! + Group 5 Commands + */ +#define CDIO_MMC_GPCMD_PLAY_AUDIO_12 0xa5 +#define CDIO_MMC_GPCMD_READ_12 0xa8 +#define CDIO_MMC_GPCMD_PLAY_TRACK_REL_12 0xa9 +#define CDIO_MMC_GPCMD_READ_DVD_STRUCTURE 0xad +#define CDIO_MMC_GPCMD_READ_CD 0xbe +#define CDIO_MMC_GPCMD_READ_MSF 0xb9 + +/*! + Group 6 Commands + */ + +#define CDIO_MMC_GPCMD_CD_PLAYBACK_STATUS 0xc4 /**< SONY unique command */ +#define CDIO_MMC_GPCMD_PLAYBACK_CONTROL 0xc9 /**< SONY unique command */ +#define CDIO_MMC_GPCMD_READ_CDDA 0xd8 /**< Vendor unique command */ +#define CDIO_MMC_GPCMD_READ_CDXA 0xdb /**< Vendor unique command */ +#define CDIO_MMC_GPCMD_READ_ALL_SUBCODES 0xdf /**< Vendor unique command */ + + + +/*! Level values that can go into READ_CD */ +#define CDIO_MMC_READ_TYPE_ANY 0 /**< All types */ +#define CDIO_MMC_READ_TYPE_CDDA 1 /**< Only CD-DA sectors */ +#define CDIO_MMC_READ_TYPE_MODE1 2 /**< mode1 sectors (user data = 2048) */ +#define CDIO_MMC_READ_TYPE_MODE2 3 /**< mode2 sectors form1 or form2 */ +#define CDIO_MMC_READ_TYPE_M2F1 4 /**< mode2 sectors form1 */ +#define CDIO_MMC_READ_TYPE_M2F2 5 /**< mode2 sectors form2 */ + +/*! Format values for READ_TOC */ +#define CDIO_MMC_READTOC_FMT_TOC 0 +#define CDIO_MMC_READTOC_FMT_SESSION 1 +#define CDIO_MMC_READTOC_FMT_FULTOC 2 +#define CDIO_MMC_READTOC_FMT_PMA 3 /**< Q subcode data */ +#define CDIO_MMC_READTOC_FMT_ATIP 4 /**< includes media type */ +#define CDIO_MMC_READTOC_FMT_CDTEXT 5 /**< CD-TEXT info */ + +/*! Page codes for MODE SENSE and MODE SET. */ +#define CDIO_MMC_R_W_ERROR_PAGE 0x01 +#define CDIO_MMC_WRITE_PARMS_PAGE 0x05 +#define CDIO_MMC_AUDIO_CTL_PAGE 0x0e +#define CDIO_MMC_CDR_PARMS_PAGE 0x0d +#define CDIO_MMC_POWER_PAGE 0x1a +#define CDIO_MMC_FAULT_FAIL_PAGE 0x1c +#define CDIO_MMC_TO_PROTECT_PAGE 0x1d +#define CDIO_MMC_CAPABILITIES_PAGE 0x2a +#define CDIO_MMC_ALL_PAGES 0x3f + +/*! Return type codes for GET_CONFIGURATION. */ +#define CDIO_MMC_GET_CONF_ALL_FEATURES 0 /**< all features without regard + to currency. */ +#define CDIO_MMC_GET_CONF_CURRENT_FEATURES 1 /**< features which are currently + in effect (e.g. based on + medium inserted). */ +#define CDIO_MMC_GET_CONF_NAMED_FEATURE 2 /**< just the feature named in + the GET_CONFIGURATION + cdb. */ + +/*! FEATURE codes used in GET CONFIGURATION. */ + +#define CDIO_MMC_FEATURE_PROFILE_LIST 0x000 /**< Profile List Feature */ +#define CDIO_MMC_FEATURE_CORE 0x001 +#define CDIO_MMC_FEATURE_REMOVABLE_MEDIUM 0x002 /**< Removable Medium + Feature */ +#define CDIO_MMC_FEATURE_WRITE_PROTECT 0x003 /**< Write Protect + Feature */ +#define CDIO_MMC_FEATURE_RANDOM_READABLE 0x010 /**< Random Readable + Feature */ +#define CDIO_MMC_FEATURE_MULTI_READ 0x01D /**< Multi-Read + Feature */ +#define CDIO_MMC_FEATURE_CD_READ 0x01E /**< CD Read + Feature */ +#define CDIO_MMC_FEATURE_DVD_READ 0x01F /**< DVD Read + Feature */ +#define CDIO_MMC_FEATURE_RANDOM_WRITABLE 0x020 /**< Random Writable + Feature */ +#define CDIO_MMC_FEATURE_INCR_WRITE 0x021 /**< Incremental + Streaming Writable + Feature */ +#define CDIO_MMC_FEATURE_SECTOR_ERASE 0x022 /**< Sector Erasable + Feature */ +#define CDIO_MMC_FEATURE_FORMATABLE 0x023 /**< Formattable + Feature */ +#define CDIO_MMC_FEATURE_DEFECT_MGMT 0x024 /**< Management + Ability of the + Logical Unit/media + system to provide + an apparently + defect-free + space.*/ +#define CDIO_MMC_FEATURE_WRITE_ONCE 0x025 /**< Write Once + Feature */ +#define CDIO_MMC_FEATURE_RESTRICT_OVERW 0x026 /**< Restricted + Overwrite + Feature */ +#define CDIO_MMC_FEATURE_CD_RW_CAV 0x027 /**< CD-RW CAV Write + Feature */ +#define CDIO_MMC_FEATURE_MRW 0x028 /**< MRW Feature */ +#define CDIO_MMC_FEATURE_DVD_PRW 0x02A /**< DVD+RW Feature */ +#define CDIO_MMC_FEATURE_DVD_PR 0x02B /**< DVD+R Feature */ +#define CDIO_MMC_FEATURE_CD_TAO 0x02D +#define CDIO_MMC_FEATURE_CD_SAO 0x02E +#define CDIO_MMC_FEATURE_POWER_MGMT 0x100 /**< Initiator and + device directed + power management */ +#define CDIO_MMC_FEATURE_CDDA_EXT_PLAY 0x103 /**< Ability to play + audio CDs via the + Logical Unit s own + analog output */ +#define CDIO_MMC_FEATURE_MCODE_UPGRADE 0x104 /* Ability for the + device to accept + new microcode via + the interface */ +#define CDIO_MMC_FEATURE_TIME_OUT 0x105 /**< Ability to + respond to all + commands within a + specific time */ +#define CDIO_MMC_FEATURE_DVD_CSS 0x106 /**< Ability to + perform DVD + CSS/CPPM + authentication and + RPC */ +#define CDIO_MMC_FEATURE_RT_STREAMING 0x107 /**< Ability to read + and write using + Initiator requested + performance + parameters + */ +#define CDIO_MMC_FEATURE_LU_SN 0x108 /**< The Logical Unit + has a unique + identifier. */ +#define CDIO_MMC_FEATURE_FIRMWARE_DATE 0x1FF /**< Firmware creation + date report */ + +/*! Profile codes used in GET_CONFIGURATION - PROFILE LIST. */ +#define CDIO_MMC_FEATURE_PROF_NON_REMOVABLE 0x0001 /**< Re-writable + disk, capable of + changing + behavior */ +#define CDIO_MMC_FEATURE_PROF_REMOVABLE 0x0002 /**< disk + Re-writable; + with removable + media */ +#define CDIO_MMC_FEATURE_PROF_MO_ERASABLE 0x0003 /**< Erasable + Magneto-Optical + disk with sector + erase + capability */ +#define CDIO_MMC_FEATURE_PROF_MO_WRITE_ONCE 0x0004 /**< Write Once + Magneto-Optical + write once */ +#define CDIO_MMC_FEATURE_PROF_AS_MO 0x0005 /**< Advance + Storage + Magneto-Optical */ +#define CDIO_MMC_FEATURE_PROF_CD_ROM 0x0008 /**< Read only + Compact Disc + capable */ +#define CDIO_MMC_FEATURE_PROF_CD_R 0x0009 /**< Write once + Compact Disc + capable */ +#define CDIO_MMC_FEATURE_PROF_CD_RW 0x000A /**< CD-RW + Re-writable + Compact Disc + capable */ +#define CDIO_MMC_FEATURE_PROF_DVD_ROM 0x0010 /**< Read only + DVD */ +#define CDIO_MMC_FEATURE_PROF_DVD_R_SEQ 0x0011 /**< Re-recordable + DVD using + Sequential + recording */ +#define CDIO_MMC_FEATURE_PROF_DVD_RAM 0x0012 /**< Re-writable + DVD */ +#define CDIO_MMC_FEATURE_PROF_DVD_RW_RO 0x0013 /**< Re-recordable + DVD using + Restricted + Overwrite */ +#define CDIO_MMC_FEATURE_PROF_DVD_RW_SEQ 0x0014 /**< Re-recordable + DVD using + Sequential + recording */ +#define CDIO_MMC_FEATURE_PROF_DVD_PRW 0x001A /**< DVD+RW - DVD + ReWritable */ +#define CDIO_MMC_FEATURE_PROF_DVD_PR 0x001B /**< DVD+R - DVD + Recordable */ +#define CDIO_MMC_FEATURE_PROF_DDCD_ROM 0x0020 /**< Read only + DDCD */ +#define CDIO_MMC_FEATURE_PROF_DDCD_R 0x0021 /**< DDCD-R Write + only DDCD */ +#define CDIO_MMC_FEATURE_PROF_DDCD_RW 0x0022 /**< Re-Write only + DDCD */ +#define CDIO_MMC_FEATURE_PROF_NON_CONFORM 0xFFFF /**< The Logical + Unit does not + conform to any + Profile. */ + +/*! This is listed as optional in ATAPI 2.6, but is (curiously) + missing from Mt. Fuji, Table 57. It _is_ mentioned in Mt. Fuji + Table 377 as an MMC command for SCSi devices though... Most ATAPI + drives support it. */ +#define CDIO_MMC_GPCMD_SET_SPEED 0xbb + + +/*! The largest Command Descriptor Buffer (CDB) size. + The possible sizes are 6, 10, and 12 bytes. + */ +#define MAX_CDB_LEN 12 + +/*! \brief A Command Descriptor Buffer (CDB) used in sending SCSI MMC + commands. + */ +typedef struct scsi_mmc_cdb { + uint8_t field[MAX_CDB_LEN]; +} scsi_mmc_cdb_t; + +/*! \brief Format of header block in data returned from a SCSI-MMC + GET_CONFIGURATION command. + */ +typedef struct scsi_mmc_feature_list_header { + unsigned char length_msb; + unsigned char length_1sb; + unsigned char length_2sb; + unsigned char length_lsb; + unsigned char reserved1; + unsigned char reserved2; + unsigned char profile_msb; + unsigned char profile_lsb; +} scs_mmc_feature_list_header_t; + +/*! An enumeration indicating whether a SCSI MMC command is sending + data or getting data. + */ +typedef enum scsi_mmc_direction { + SCSI_MMC_DATA_READ, + SCSI_MMC_DATA_WRITE +} scsi_mmc_direction_t; + +#define CDIO_MMC_SET_COMMAND(cdb, command) \ + cdb[0] = command + +#define CDIO_MMC_SET_READ_TYPE(cdb, sector_type) \ + cdb[1] = (sector_type << 2) + +#define CDIO_MMC_GET_LEN16(p) \ + (p[0]<<8) + p[1] + +#define CDIO_MMC_GET_LEN32(p) \ + (p[0] << 24) + (p[1] << 16) + (p[2] << 8) + p[3]; + +#define CDIO_MMC_SET_LEN16(cdb, pos, len) \ + cdb[pos ] = (len >> 8) & 0xff; \ + cdb[pos+1] = (len ) & 0xff + +#define CDIO_MMC_SET_READ_LBA(cdb, lba) \ + cdb[2] = (lba >> 24) & 0xff; \ + cdb[3] = (lba >> 16) & 0xff; \ + cdb[4] = (lba >> 8) & 0xff; \ + cdb[5] = (lba ) & 0xff + +#define CDIO_MMC_SET_START_TRACK(cdb, command) \ + cdb[6] = command + +#define CDIO_MMC_SET_READ_LENGTH24(cdb, len) \ + cdb[6] = (len >> 16) & 0xff; \ + cdb[7] = (len >> 8) & 0xff; \ + cdb[8] = (len ) & 0xff + +#define CDIO_MMC_SET_READ_LENGTH16(cdb, len) \ + CDIO_MMC_SET_LEN16(cdb, 7, len) + +#define CDIO_MMC_SET_READ_LENGTH8(cdb, len) \ + cdb[8] = (len ) & 0xff + +#define CDIO_MMC_MCSB_ALL_HEADERS 0x78 + +#define CDIO_MMC_SET_MAIN_CHANNEL_SELECTION_BITS(cdb, val) \ + cdb[9] = val; + +/*! + Return the number of length in bytes of the Command Descriptor + buffer (CDB) for a given SCSI MMC command. The length will be + either 6, 10, or 12. +*/ +uint8_t scsi_mmc_get_cmd_len(uint8_t scsi_cmd); + + +/*! + Run a SCSI MMC command. + + cdio CD structure set by cdio_open(). + i_timeout_ms time in milliseconds we will wait for the command + to complete. + p_cdb CDB bytes. All values that are needed should be set on + input. We'll figure out what the right CDB length should be. + e_direction direction the transfer is to go. + i_buf Size of buffer + p_buf Buffer for data, both sending and receiving. + + Returns 0 if command completed successfully. + */ +int scsi_mmc_run_cmd( const CdIo *p_cdio, unsigned int i_timeout_ms, + const scsi_mmc_cdb_t *p_cdb, + scsi_mmc_direction_t e_direction, unsigned int i_buf, + /*in/out*/ void *p_buf ); + +/*! + * Eject using SCSI MMC commands. Return 0 if successful. + */ +int scsi_mmc_eject_media( const CdIo *p_cdio); + +/*! Packet driver to read mode2 sectors. + Can read only up to 25 blocks. +*/ +int scsi_mmc_read_sectors ( const CdIo *p_cdio, void *p_buf, lba_t lba, + int sector_type, unsigned int nblocks); + +/*! + Set the block size for subsequest read requests, via a SCSI MMC + MODE_SELECT 6 command. + */ +int scsi_mmc_set_blocksize ( const CdIo *p_cdio, unsigned int bsize); + +/*! + Return the the kind of drive capabilities of device. + */ +void scsi_mmc_get_drive_cap (const CdIo *p_cdio, + /*out*/ cdio_drive_read_cap_t *p_read_cap, + /*out*/ cdio_drive_write_cap_t *p_write_cap, + /*out*/ cdio_drive_misc_cap_t *p_misc_cap); + +/*! + Get the DVD type associated with cd object. +*/ +discmode_t scsi_mmc_get_dvd_struct_physical ( const CdIo *p_cdio, + cdio_dvd_struct_t *s); + +/*! + Get the CD-ROM hardware info via a SCSI MMC INQUIRY command. + False is returned if we had an error getting the information. +*/ +bool scsi_mmc_get_hwinfo ( const CdIo *p_cdio, + /* out*/ cdio_hwinfo_t *p_hw_info ); + + +/*! + Get the media catalog number (MCN) from the CD via MMC. + + @return the media catalog number r NULL if there is none or we + don't have the ability to get it. + + Note: string is malloc'd so caller has to free() the returned + string when done with it. + +*/ +char *scsi_mmc_get_mcn ( const CdIo *p_cdio ); + +#endif /* __SCSI_MMC_H__ */ diff --git a/src/input/vcd/libcdio/cdio/sector.h b/src/input/vcd/libcdio/cdio/sector.h index 939515543..826883aea 100644 --- a/src/input/vcd/libcdio/cdio/sector.h +++ b/src/input/vcd/libcdio/cdio/sector.h @@ -1,8 +1,8 @@ /* - $Id: sector.h,v 1.2 2004/04/11 12:20:31 miguelfreitas Exp $ + $Id: sector.h,v 1.3 2005/01/01 02:43:58 rockyb 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> 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 @@ -67,7 +67,60 @@ #include <cdio/types.h> -#define CDIO_PREGAP_SECTORS 150 +/*! track modes (Table 350) + 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 */ +} trackmode_t; + +/*! disc modes. The first combined from MMC-3 5.29.2.8 (Send CUESHEET) + and 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_DVD_ROM, /**< DVD ROM (e.g. movies) */ + CDIO_DISC_MODE_DVD_RAM, /**< DVD-RAM */ + CDIO_DISC_MODE_DVD_R, /**< DVD-R */ + CDIO_DISC_MODE_DVD_RW, /**< DVD-RW */ + CDIO_DISC_MODE_DVD_PR, /**< DVD+R */ + CDIO_DISC_MODE_DVD_PRW, /**< DVD+RW */ + CDIO_DISC_MODE_DVD_OTHER, /**< Unknown/unclassified DVD type */ + CDIO_DISC_MODE_NO_INFO, + CDIO_DISC_MODE_ERROR +} discmode_t; + +/*! 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 + +/*! 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) */ +} flag_t; + +#define CDIO_PREGAP_SECTORS 150 #define CDIO_POSTGAP_SECTORS 150 /* @@ -75,25 +128,28 @@ 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_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*/ @@ -106,22 +162,43 @@ /*! "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) */ +/*! CD-ROM address types (GNU/Linux e.g. 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! */ +/*! CD-ROM track format types (GNU/Linux cdte_ctrl) */ #define CDIO_CDROM_DATA_TRACK 0x04 - -/*! The leadout track is always 0xAA, regardless of # of tracks on disc */ +#define CDIO_CDROM_CDI_TRACK 0x10 +#define CDIO_CDROM_XA_TRACK 0x20 + +/*! The leadout track is always 0xAA, regardless of # of tracks on + disc, or what value may be used internally. For example although + OS X uses a different value for the lead-out track internally than + given below, programmers should use CDIO_CDROM_LEADOUT_TRACK and + not worry about this. + */ #define CDIO_CDROM_LEADOUT_TRACK 0xAA #define M2F2_SECTOR_SIZE 2324 #define M2SUB_SECTOR_SIZE 2332 #define M2RAW_SECTOR_SIZE 2336 -#define CDIO_CD_MAX_TRACKS 99 -#define CDIO_CD_MIN_TRACK_NO 1 +/*! Largest CD track number */ +#define CDIO_CD_MAX_TRACKS 99 +/*! Smallest CD track number */ +#define CDIO_CD_MIN_TRACK_NO 1 + +/*! Largest CD session number */ +#define CDIO_CD_MAX_SESSIONS 99 +/*! Smallest CD session number */ +#define CDIO_CD_MIN_SESSION_NO 1 + +/*! Largest LSN in a CD */ +#define CDIO_CD_MAX_LSN 450150 +/*! Smallest LSN in a CD */ +#define CDIO_CD_MIN_LSN -450150 + #define CDIO_CD_FRAMES_PER_MIN \ (CDIO_CD_FRAMES_PER_SEC*CDIO_CD_SECS_PER_MIN) @@ -141,6 +218,11 @@ char *cdio_lba_to_msf_str (lba_t lba); /*! + Convert an MSF into a string representation of the MSF. + \warning cdio_msf_to_msf_str returns new allocated string */ +char *cdio_msf_to_str (const msf_t *msf); + +/*! Convert an LBA into the corresponding LSN. */ lba_t cdio_lba_to_lsn (lba_t lba); @@ -152,6 +234,7 @@ void cdio_lba_to_msf(lba_t lba, msf_t *msf); /*! Convert an LSN into the corresponding LBA. + CDIO_INVALID_LBA is returned if there is an error. */ lba_t cdio_lsn_to_lba (lsn_t lsn); @@ -162,20 +245,75 @@ void cdio_lsn_to_msf (lsn_t lsn, msf_t *msf); /*! Convert a MSF into the corresponding LBA. + CDIO_INVALID_LBA is returned if there is an error. */ -lba_t -cdio_msf_to_lba (const msf_t *msf); +lba_t cdio_msf_to_lba (const msf_t *msf); /*! Convert a MSF into the corresponding LSN. + CDIO_INVALID_LSN is returned if there is an error. */ -lsn_t -cdio_msf_to_lsn (const msf_t *msf); +lsn_t cdio_msf_to_lsn (const msf_t *msf); + +/*! + Convert a MSF - broken out as 3 integer components into the + corresponding LBA. + CDIO_INVALID_LBA is returned if there is an error. +*/ +lba_t cdio_msf3_to_lba (unsigned int minutes, unsigned int seconds, + unsigned int frames); + +/*! + Convert a string of the form MM:SS:FF into the corresponding LBA. + CDIO_INVALID_LBA is returned if there is an error. +*/ +lba_t cdio_mmssff_to_lba (const char *psz_mmssff); + +/*! + Return true if discmode is some sort of CD. +*/ +bool cdio_is_discmode_cdrom (discmode_t discmode); + +/*! + Return true if discmode is some sort of DVD. +*/ +bool cdio_is_discmode_dvd (discmode_t discmode); + #ifdef __cplusplus } #endif +static inline bool discmode_is_cd(discmode_t discmode) +{ + switch (discmode) { + case CDIO_DISC_MODE_CD_DA: + case CDIO_DISC_MODE_CD_DATA: + case CDIO_DISC_MODE_CD_XA: + case CDIO_DISC_MODE_CD_MIXED: + return true; + default: + return false; + } +} + +static inline bool discmode_is_dvd(discmode_t discmode) +{ + switch (discmode) { + case CDIO_DISC_MODE_DVD_ROM: + case CDIO_DISC_MODE_DVD_RAM: + case CDIO_DISC_MODE_DVD_R: + case CDIO_DISC_MODE_DVD_RW: + case CDIO_DISC_MODE_DVD_PR: + case CDIO_DISC_MODE_DVD_PRW: + case CDIO_DISC_MODE_DVD_OTHER: + return true; + default: + return false; + } +} + + #endif /* _CDIO_SECTOR_H_ */ diff --git a/src/input/vcd/libcdio/cdio/types.h b/src/input/vcd/libcdio/cdio/types.h index c4b0b0934..ec84a142b 100644 --- a/src/input/vcd/libcdio/cdio/types.h +++ b/src/input/vcd/libcdio/cdio/types.h @@ -1,5 +1,5 @@ /* - $Id: types.h,v 1.2 2004/04/11 12:20:31 miguelfreitas Exp $ + $Id: types.h,v 1.3 2005/01/01 02:43:58 rockyb Exp $ Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com> @@ -106,11 +106,11 @@ extern "C" { { false = 0, true = 1 - } _Bool; + } _cdio_Bool; # define false false # define true true -# define bool _Bool +# define bool _cdio_Bool # endif #endif @@ -204,16 +204,21 @@ extern "C" { typedef uint8_t bitfield_t; #endif - /*! The type of a Logical Block Address. + /*! The type of a Logical Block Address. We allow for an lba to be + negative to be consistent with an lba, although I'm not sure this + this is possible. + + */ + typedef int32_t lba_t; + + /*! The type of a Logical Sector Number. Note that an lba lsn be negative + and the MMC3 specs allow for a conversion of a negative lba @see msf_t */ - typedef uint32_t lba_t; - - /*! The type of an Logical Sector Number. */ - typedef uint32_t lsn_t; + typedef int32_t lsn_t; - /*! The type of an track number 0..99. */ + /*! The type of a track number 0..99. */ typedef uint8_t track_t; /*! @@ -221,17 +226,142 @@ extern "C" { */ #define CDIO_INVALID_TRACK 0xFF + /*! The type of a session number 0..99. */ + typedef uint8_t session_t; + /*! - Constant for invalid LBA + Constant for invalid session number */ -#define CDIO_INVALID_LBA 0xFFFFFFFF +#define CDIO_INVALID_SESSION 0xFF + + /*! + Constant for invalid LBA. It is 151 less than the most negative + LBA -45150. This provide slack for the 150-frame offset in + LBA to LSN 150 conversions + */ +#define CDIO_INVALID_LBA -45301 /*! Constant for invalid LSN */ -#define CDIO_INVALID_LSN 0xFFFFFFFF +#define CDIO_INVALID_LSN CDIO_INVALID_LBA + + /*! + Number of ASCII bytes in a media catalog number (MCN). + */ +#define CDIO_MCN_SIZE 13 + + /*! + Type to hold ASCII bytes in a media catalog number (MCN). + We include an extra 0 byte so these can be used as C strings. + */ + typedef char cdio_mcn_t[CDIO_MCN_SIZE+1]; + + + /*! + Number of ASCII bytes in International Standard Recording Codes (ISRC) + */ +#define CDIO_ISRC_SIZE 12 -typedef int cdio_fs_anal_t; + /*! + Type to hold ASCII bytes in a media catalog number (MCN). + We include an extra 0 byte so these can be used as C strings. + */ + typedef char cdio_isrc_t[CDIO_ISRC_SIZE+1]; + + typedef int cdio_fs_anal_t; + + /*! The type of an drive capability bit mask. See below for values*/ + typedef uint32_t cdio_drive_read_cap_t; + typedef uint32_t cdio_drive_write_cap_t; + typedef uint32_t cdio_drive_misc_cap_t; + + /*! + \brief Drive types returned by cdio_get_drive_cap() + + NOTE: Setting a bit here means the presence of a capability. + */ + +#define CDIO_DRIVE_CAP_ERROR 0x40000 /**< Error */ +#define CDIO_DRIVE_CAP_UNKNOWN 0x80000 /**< Dunno. It can be on if we + have only partial information + or are not completely certain + */ + +#define CDIO_DRIVE_CAP_MISC_CLOSE_TRAY 0x00001 /**< caddy systems can't + close... */ +#define CDIO_DRIVE_CAP_MISC_EJECT 0x00002 /**< but can eject. */ +#define CDIO_DRIVE_CAP_MISC_LOCK 0x00004 /**< disable manual eject */ +#define CDIO_DRIVE_CAP_MISC_SELECT_SPEED 0x00008 /**< programmable speed */ +#define CDIO_DRIVE_CAP_MISC_SELECT_DISC 0x00010 /**< select disc from + juke-box */ +#define CDIO_DRIVE_CAP_MISC_MULTI_SESSION 0x00020 /**< read sessions>1 */ +#define CDIO_DRIVE_CAP_MISC_MEDIA_CHANGED 0x00080 /**< media changed */ +#define CDIO_DRIVE_CAP_MISC_RESET 0x00100 /**< hard reset device */ +#define CDIO_DRIVE_CAP_MCN 0x00200 /**< can read MCN */ +#define CDIO_DRIVE_CAP_ISRC 0x00200 /**< can read ISRC */ +#define CDIO_DRIVE_CAP_MISC_FILE 0x20000 /**< drive is really a file, + i.e a CD file image */ + + /*! Reading masks.. */ +#define CDIO_DRIVE_CAP_READ_AUDIO 0x00001 /**< drive can play CD audio */ +#define CDIO_DRIVE_CAP_READ_CD_DA 0x00002 /**< drive can read CD-DA */ +#define CDIO_DRIVE_CAP_READ_CD_G 0x00004 /**< drive can read CD+G */ +#define CDIO_DRIVE_CAP_READ_CD_R 0x00008 /**< drive can read CD-R */ +#define CDIO_DRIVE_CAP_READ_CD_RW 0x00010 /**< drive can read CD-RW */ +#define CDIO_DRIVE_CAP_READ_DVD_R 0x00020 /**< drive can read DVD-R */ +#define CDIO_DRIVE_CAP_READ_DVD_PR 0x00040 /**< drive can read DVD+R */ +#define CDIO_DRIVE_CAP_READ_DVD_RAM 0x00080 /**< drive can read DVD-RAM */ +#define CDIO_DRIVE_CAP_READ_DVD_ROM 0x00100 /**< drive can read DVD-ROM */ +#define CDIO_DRIVE_CAP_READ_DVD_RW 0x00200 /**< drive can read DVD-RW */ +#define CDIO_DRIVE_CAP_READ_DVD_RPW 0x00400 /**< drive can read DVD+RW */ +#define CDIO_DRIVE_CAP_READ_C2_ERRS 0x00800 /**< has C2 error correction */ + + /*! Writing masks.. */ +#define CDIO_DRIVE_CAP_WRITE_CD_R 0x00001 /**< drive can write CD-R */ +#define CDIO_DRIVE_CAP_WRITE_CD_RW 0x00002 /**< drive can write CD-R */ +#define CDIO_DRIVE_CAP_WRITE_DVD_R 0x00004 /**< drive can write DVD-R */ +#define CDIO_DRIVE_CAP_WRITE_DVD_PR 0x00008 /**< drive can write DVD+R */ +#define CDIO_DRIVE_CAP_WRITE_DVD_RAM 0x00010 /**< drive can write DVD-RAM */ +#define CDIO_DRIVE_CAP_WRITE_DVD_RW 0x00020 /**< drive can write DVD-RW */ +#define CDIO_DRIVE_CAP_WRITE_DVD_RPW 0x00040 /**< drive can write DVD+RW */ +#define CDIO_DRIVE_CAP_WRITE_MT_RAINIER 0x00080 /**< Mount Rainier */ +#define CDIO_DRIVE_CAP_WRITE_BURN_PROOF 0x00100 /**< burn proof */ + +/**< Masks derived from above... */ +#define CDIO_DRIVE_CAP_WRITE_CD ( \ + CDIO_DRIVE_CAP_WRITE_CD_R \ + | CDIO_DRIVE_CAP_WRITE_CD_RW \ + ) +/**< Has some sort of CD writer ability */ + +/**< Masks derived from above... */ +#define CDIO_DRIVE_CAP_WRITE_DVD ( \ + | CDIO_DRIVE_CAP_WRITE_DVD_R \ + | CDIO_DRIVE_CAP_WRITE_DVD_PR \ + | CDIO_DRIVE_CAP_WRITE_DVD_RAM \ + | CDIO_DRIVE_CAP_WRITE_DVD_RW \ + | CDIO_DRIVE_CAP_WRITE_DVD_RPW \ + ) +/**< Has some sort of DVD writer ability */ + +#define CDIO_DRIVE_CAP_WRITE \ + (CDIO_DRIVE_CAP_WRITE_CD | CDIO_DRIVE_CAP_WRITE_DVD) +/**< Has some sort of DVD or CD writing ability */ + + /*! + track flags + 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 + pre-emphasis */ + 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; #ifdef __cplusplus } diff --git a/src/input/vcd/libcdio/cdio/util.h b/src/input/vcd/libcdio/cdio/util.h index 5142653ad..3cea313b4 100644 --- a/src/input/vcd/libcdio/cdio/util.h +++ b/src/input/vcd/libcdio/cdio/util.h @@ -1,7 +1,8 @@ /* - $Id: util.h,v 1.2 2004/04/11 12:20:31 miguelfreitas Exp $ + $Id: util.h,v 1.3 2005/01/01 02:43:58 rockyb Exp $ Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> + Copyright (C) 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 @@ -71,6 +72,16 @@ _cdio_ofs_add (unsigned offset, unsigned length, int blocksize) return offset; } +static inline const char * +_cdio_bool_str (bool b) +{ + return b ? "yes" : "no"; +} + +#ifdef __cplusplus +extern "C" { +#endif + void * _cdio_malloc (size_t size); @@ -92,16 +103,26 @@ _cdio_strlenv(char **str_array); char ** _cdio_strsplit(const char str[], char delim); -static inline const char * -_cdio_bool_str (bool b) -{ - return b ? "yes" : "no"; -} +uint8_t cdio_to_bcd8(uint8_t n); +uint8_t cdio_from_bcd8(uint8_t p); -/* BCD */ +#if defined(__GNUC__) && __GNUC__ >= 3 +static inline __attribute__((deprecated)) +uint8_t to_bcd8(uint8_t n) { + return cdio_to_bcd8(n); +} +static inline __attribute__((deprecated)) +uint8_t from_bcd8(uint8_t p) { + return cdio_from_bcd8(p); +} +#else +#define to_bcd8 cdio_to_bcd8 +#define from_bcd8 cdio_from_bcd8 +#endif -uint8_t to_bcd8(uint8_t n); -uint8_t from_bcd8(uint8_t p); +#ifdef __cplusplus +} +#endif #endif /* __CDIO_UTIL_H__ */ diff --git a/src/input/vcd/libcdio/cdio/xa.h b/src/input/vcd/libcdio/cdio/xa.h index 5ff7addd4..3af27eab5 100644 --- a/src/input/vcd/libcdio/cdio/xa.h +++ b/src/input/vcd/libcdio/cdio/xa.h @@ -1,5 +1,5 @@ /* - $Id: xa.h,v 1.2 2004/04/11 12:20:31 miguelfreitas Exp $ + $Id: xa.h,v 1.3 2005/01/01 02:43:58 rockyb Exp $ Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> @@ -66,7 +66,7 @@ #define XA_FORM1_FILE (XA_ATTR_MODE2FORM1 | XA_PERM_ALL_ALL) #define XA_FORM2_FILE (XA_ATTR_MODE2FORM2 | XA_PERM_ALL_ALL) -/*! \brief "Extended Architecture according t the Philips Yellow Book. +/*! \brief "Extended Architecture according to 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 |
