From: Michael R. <mr...@us...> - 2005-01-03 21:14:11
|
Update of /cvsroot/xine/xine-lib/src/input/vcd/libcdio/cdio In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23168/src/input/vcd/libcdio/cdio Modified Files: Tag: xine-1_0 Makefile.am cd_types.h cdio.h iso9660.h logging.h sector.h types.h util.h xa.h Added Files: Tag: xine-1_0 bytesex.h bytesex_asm.h cdtext.h ds.h dvd.h scsi_mmc.h Log Message: cumulative fixes from HEAD: * fixed build with newer libtool versions (rename LT_* to XINE_LT_*) * update of VCD libraries * UTF-8 fix in unsharp * m4a extension added in QT demuxer --- NEW FILE: bytesex.h --- /* $Id: bytesex.h,v 1.1.2.1 2005/01/03 21:13:59 mroi Exp $ Copyright (C) 2000, 2004 Herbert Valerio Riedel <hv...@gn...> 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_BYTESEX_H__ #define __CDIO_BYTESEX_H__ #include <cdio/types.h> #include <cdio/bytesex_asm.h> #include <cdio/logging.h> /* generic byteswap routines */ #define UINT16_SWAP_LE_BE_C(val) ((uint16_t) ( \ (((uint16_t) (val) & (uint16_t) 0x00ffU) << 8) | \ (((uint16_t) (val) & (uint16_t) 0xff00U) >> 8))) #define UINT32_SWAP_LE_BE_C(val) ((uint32_t) ( \ (((uint32_t) (val) & (uint32_t) 0x000000ffU) << 24) | \ (((uint32_t) (val) & (uint32_t) 0x0000ff00U) << 8) | \ (((uint32_t) (val) & (uint32_t) 0x00ff0000U) >> 8) | \ (((uint32_t) (val) & (uint32_t) 0xff000000U) >> 24))) #define UINT64_SWAP_LE_BE_C(val) ((uint64_t) ( \ (((uint64_t) (val) & (uint64_t) UINT64_C(0x00000000000000ff)) << 56) | \ (((uint64_t) (val) & (uint64_t) UINT64_C(0x000000000000ff00)) << 40) | \ (((uint64_t) (val) & (uint64_t) UINT64_C(0x0000000000ff0000)) << 24) | \ (((uint64_t) (val) & (uint64_t) UINT64_C(0x00000000ff000000)) << 8) | \ (((uint64_t) (val) & (uint64_t) UINT64_C(0x000000ff00000000)) >> 8) | \ (((uint64_t) (val) & (uint64_t) UINT64_C(0x0000ff0000000000)) >> 24) | \ (((uint64_t) (val) & (uint64_t) UINT64_C(0x00ff000000000000)) >> 40) | \ (((uint64_t) (val) & (uint64_t) UINT64_C(0xff00000000000000)) >> 56))) #ifndef UINT16_SWAP_LE_BE # define UINT16_SWAP_LE_BE UINT16_SWAP_LE_BE_C #endif #ifndef UINT32_SWAP_LE_BE # define UINT32_SWAP_LE_BE UINT32_SWAP_LE_BE_C #endif #ifndef UINT64_SWAP_LE_BE # define UINT64_SWAP_LE_BE UINT64_SWAP_LE_BE_C #endif inline static uint16_t uint16_swap_le_be (const uint16_t val) { return UINT16_SWAP_LE_BE (val); } inline static uint32_t uint32_swap_le_be (const uint32_t val) { return UINT32_SWAP_LE_BE (val); } inline static uint64_t uint64_swap_le_be (const uint64_t val) { return UINT64_SWAP_LE_BE (val); } # define UINT8_TO_BE(val) ((uint8_t) (val)) # define UINT8_TO_LE(val) ((uint8_t) (val)) #ifdef WORDS_BIGENDIAN # define UINT16_TO_BE(val) ((uint16_t) (val)) # define UINT16_TO_LE(val) ((uint16_t) UINT16_SWAP_LE_BE(val)) # define UINT32_TO_BE(val) ((uint32_t) (val)) # define UINT32_TO_LE(val) ((uint32_t) UINT32_SWAP_LE_BE(val)) # define UINT64_TO_BE(val) ((uint64_t) (val)) # define UINT64_TO_LE(val) ((uint64_t) UINT64_SWAP_LE_BE(val)) #else # define UINT16_TO_BE(val) ((uint16_t) UINT16_SWAP_LE_BE(val)) # define UINT16_TO_LE(val) ((uint16_t) (val)) # define UINT32_TO_BE(val) ((uint32_t) UINT32_SWAP_LE_BE(val)) # define UINT32_TO_LE(val) ((uint32_t) (val)) # define UINT64_TO_BE(val) ((uint64_t) UINT64_SWAP_LE_BE(val)) # define UINT64_TO_LE(val) ((uint64_t) (val)) #endif /* symmetric conversions */ #define UINT8_FROM_BE(val) (UINT8_TO_BE (val)) #define UINT8_FROM_LE(val) (UINT8_TO_LE (val)) #define UINT16_FROM_BE(val) (UINT16_TO_BE (val)) #define UINT16_FROM_LE(val) (UINT16_TO_LE (val)) #define UINT32_FROM_BE(val) (UINT32_TO_BE (val)) #define UINT32_FROM_LE(val) (UINT32_TO_LE (val)) #define UINT64_FROM_BE(val) (UINT64_TO_BE (val)) #define UINT64_FROM_LE(val) (UINT64_TO_LE (val)) /* converter function template */ #define CVT_TO_FUNC(bits) \ static inline uint ## bits ## _t \ uint ## bits ## _to_be (uint ## bits ## _t val) \ { return UINT ## bits ## _TO_BE (val); } \ static inline uint ## bits ## _t \ uint ## bits ## _to_le (uint ## bits ## _t val) \ { return UINT ## bits ## _TO_LE (val); } \ CVT_TO_FUNC(8) CVT_TO_FUNC(16) CVT_TO_FUNC(32) CVT_TO_FUNC(64) #undef CVT_TO_FUNC #define uint8_from_be(val) (uint8_to_be (val)) #define uint8_from_le(val) (uint8_to_le (val)) #define uint16_from_be(val) (uint16_to_be (val)) #define uint16_from_le(val) (uint16_to_le (val)) #define uint32_from_be(val) (uint32_to_be (val)) #define uint32_from_le(val) (uint32_to_le (val)) #define uint64_from_be(val) (uint64_to_be (val)) #define uint64_from_le(val) (uint64_to_le (val)) /* ISO9660 related stuff */ #define to_711(i) uint8_to_le(i) #define from_711(i) uint8_from_le(i) #define to_721(i) uint16_to_le(i) #define from_721(i) uint16_from_le(i) #define to_721(i) uint16_to_le(i) #define from_721(i) uint16_from_le(i) #define to_722(i) uint16_to_be(i) #define from_722(i) uint16_from_be(i) static inline uint32_t to_723(uint16_t i) { return uint32_swap_le_be(i) | i; } static inline uint16_t from_723 (uint32_t p) { if (uint32_swap_le_be (p) != p) cdio_warn ("from_723: broken byte order"); return (0xFFFF & p); } #define to_731(i) uint32_to_le(i) #define from_731(i) uint32_from_le(i) #define to_732(i) uint32_to_be(i) #define from_732(i) uint32_from_be(i) static inline uint64_t to_733(uint32_t i) { return uint64_swap_le_be(i) | i; } static inline uint32_t from_733 (uint64_t p) { if (uint64_swap_le_be (p) != p) cdio_warn ("from_733: broken byte order"); return (UINT32_C(0xFFFFFFFF) & p); } #endif /* __CDIO_BYTESEX_H__ */ /* * Local variables: * c-file-style: "gnu" * tab-width: 8 * indent-tabs-mode: nil * End: */ --- NEW FILE: bytesex_asm.h --- /* $Id: bytesex_asm.h,v 1.1.2.1 2005/01/03 21:13:59 mroi Exp $ Copyright (C) 2001 Sven Ottemann <ac-...@fr...> 2001, 2004 Herbert Valerio Riedel <hv...@gn...> 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_BYTESEX_ASM_H__ #define __CDIO_BYTESEX_ASM_H__ #if !defined(DISABLE_ASM_OPTIMIZE) #include <cdio/types.h> #if defined(__powerpc__) && defined(__GNUC__) inline static uint32_t uint32_swap_le_be_asm(const uint32_t a) { uint32_t b; __asm__ ("lwbrx %0,0,%1" :"=r"(b) :"r"(&a), "m"(a)); return b; } inline static uint16_t uint16_swap_le_be_asm(const uint16_t a) { uint32_t b; __asm__ ("lhbrx %0,0,%1" :"=r"(b) :"r"(&a), "m"(a)); return b; } #define UINT16_SWAP_LE_BE uint16_swap_le_be_asm #define UINT32_SWAP_LE_BE uint32_swap_le_be_asm #elif defined(__mc68000__) && defined(__STORMGCC__) inline static uint32_t uint32_swap_le_be_asm(uint32_t a __asm__("d0")) { /* __asm__("rolw #8,%0; swap %0; rolw #8,%0" : "=d" (val) : "0" (val)); */ __asm__("move.l %1,d0;rol.w #8,d0;swap d0;rol.w #8,d0;move.l d0,%0" :"=r"(a) :"r"(a)); return(a); } inline static uint16_t uint16_swap_le_be_asm(uint16_t a __asm__("d0")) { __asm__("move.l %1,d0;rol.w #8,d0;move.l d0,%0" :"=r"(a) :"r"(a)); return(a); } #define UINT16_SWAP_LE_BE uint16_swap_le_be_asm #define UINT32_SWAP_LE_BE uint32_swap_le_be_asm #elif 0 && defined(__i386__) && defined(__GNUC__) inline static uint32_t uint32_swap_le_be_asm(uint32_t a) { __asm__("xchgb %b0,%h0\n\t" /* swap lower bytes */ "rorl $16,%0\n\t" /* swap words */ "xchgb %b0,%h0" /* swap higher bytes */ :"=q" (a) : "0" (a)); return(a); } inline static uint16_t uint16_swap_le_be_asm(uint16_t a) { __asm__("xchgb %b0,%h0" /* swap bytes */ : "=q" (a) : "0" (a)); return(a); } #define UINT16_SWAP_LE_BE uint16_swap_le_be_asm #define UINT32_SWAP_LE_BE uint32_swap_le_be_asm #endif #endif /* !defined(DISABLE_ASM_OPTIMIZE) */ #endif /* __CDIO_BYTESEX_ASM_H__ */ /* * Local variables: * c-file-style: "gnu" * tab-width: 8 * indent-tabs-mode: nil * End: */ --- NEW FILE: cdtext.h --- /* $Id: cdtext.h,v 1.1.2.1 2005/01/03 21:13:59 mroi Exp $ Copyright (C) 2004 Rocky Bernstein <ro...@pa...> adapted from cuetools Copyright (C) 2003 Svend Sanjay Sorensen <sso...@fa...> 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: */ --- NEW FILE: ds.h --- /* $Id: ds.h,v 1.1.2.1 2005/01/03 21:13:59 mroi Exp $ Copyright (C) 2000 Herbert Valerio Riedel <hv...@gn...> 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: */ --- NEW FILE: dvd.h --- /* $Id: dvd.h,v 1.1.2.1 2005/01/03 21:13:59 mroi Exp $ Copyright (C) 2004 Rocky Bernstein <ro...@pa...> 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__ */ --- NEW FILE: scsi_mmc.h --- /* $Id: scsi_mmc.h,v 1.1.2.1 2005/01/03 21:13:59 mroi Exp $ Copyright (C) 2003, 2004 Rocky Bernstein <ro...@pa...> 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__ */ Index: Makefile.am =================================================================== RCS file: /cvsroot/xine/xine-lib/src/input/vcd/libcdio/cdio/Makefile.am,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- Makefile.am 13 Oct 2003 17:51:38 -0000 1.2 +++ Makefile.am 3 Jan 2005 21:13:59 -0000 1.2.2.1 @@ -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 Index: cd_types.h =================================================================== RCS file: /cvsroot/xine/xine-lib/src/input/vcd/libcdio/cdio/cd_types.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- cd_types.h 11 Apr 2004 12:20:31 -0000 1.2 +++ cd_types.h 3 Jan 2005 21:13:59 -0000 1.2.2.1 @@ -67,6 +67,15 @@ */ #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 @@ * 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 @@ 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; /** Index: cdio.h =================================================================== RCS file: /cvsroot/xine/xine-lib/src/input/vcd/libcdio/cdio/cdio.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- cdio.h 11 Apr 2004 12:20:31 -0000 1.2 +++ cdio.h 3 Jan 2005 21:13:59 -0000 1.2.2.1 @@ -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> [...980 lines suppressed...] + /*! + 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); Index: iso9660.h =================================================================== RCS file: /cvsroot/xine/xine-lib/src/input/vcd/libcdio/cdio/iso9660.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- iso9660.h 11 Apr 2004 12:20:31 -0000 1.2 +++ iso9660.h 3 Jan 2005 21:13:59 -0000 1.2.2.1 @@ -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 + +/*! String inside track identifying an ISO 9660 filesystem. */ +#define ISO_STANDARD_ID "CD001" -#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 */ + +/*! Number of bytes in an ISO 9660 block */ +#define ISO_BLOCKSIZE 2048 #ifdef __cplusplus extern "C" { @@ -98,6 +125,10 @@ ISO9660_DCHARS }; +#ifndef EMPTY_ARRAY_SIZE +#define EMPTY_ARRAY_SIZE 0 +#endif + PRAGMA_BEGIN_PACKED /*! @@ -144,33 +175,62 @@ 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 @@ 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 @@ 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 @@ 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 @@ /*! 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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[]); -uint8_t iso9660_get_dir_len(const iso9660_dir_t *idr); +/*! + 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); + +/*! + 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 @@ 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); -uint8_t iso9660_get_pvd_type(const iso9660_pvd_t *pvd); +/*! + Return a string containing the preparer id with trailing + blanks removed. +*/ +char *iso9660_get_preparer_id(const iso9660_pvd_t *p_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); + +/*! + 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 *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 volu... [truncated message content] |