all: Add various enums to allow debugging using #define names.

cdda: remove interface field (COOKED, SCSI). It's not going to be used.
iso9660.h: add fuzzy iso9660 search.
This commit is contained in:
rocky
2005-02-05 04:23:21 +00:00
parent 4986ea5538
commit 667af7fbb7
4 changed files with 326 additions and 155 deletions

View File

@@ -1,5 +1,5 @@
/* /*
$Id: cdda.h,v 1.14 2005/01/29 20:54:20 rocky Exp $ $Id: cdda.h,v 1.15 2005/02/05 04:23:21 rocky Exp $
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
Copyright (C) 2001 Xiph.org Copyright (C) 2001 Xiph.org
@@ -32,9 +32,16 @@
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <cdio/paranoia.h> #include <cdio/paranoia.h>
enum {
CDDA_MESSAGE_FORGETIT = 0,
CDDA_MESSAGE_PRINTIT = 1,
CDDA_MESSAGE_LOGIT = 2,
CD_FRAMESAMPLES = CDIO_CD_FRAMESIZE_RAW / 4,
MAXTRK = (CDIO_CD_MAX_TRACKS+1)
} paranoia_cdda_enums;
#define CD_FRAMESAMPLES (CDIO_CD_FRAMESIZE_RAW / 4) #define CD_FRAMESAMPLES (CDIO_CD_FRAMESIZE_RAW / 4)
#include <sys/types.h>
#include <signal.h> #include <signal.h>
/** We keep MAXTRK since this header is exposed publicly and other /** We keep MAXTRK since this header is exposed publicly and other
@@ -51,11 +58,6 @@ typedef struct TOC_s {
/** For compatibility. TOC is depricated, use TOC_t instead. */ /** For compatibility. TOC is depricated, use TOC_t instead. */
#define TOC TOC_t #define TOC TOC_t
/** interface types */
#define GENERIC_SCSI 0
#define COOKED_IOCTL 1
#define TEST_INTERFACE 2
#define CDDA_MESSAGE_FORGETIT 0 #define CDDA_MESSAGE_FORGETIT 0
#define CDDA_MESSAGE_PRINTIT 1 #define CDDA_MESSAGE_PRINTIT 1
#define CDDA_MESSAGE_LOGIT 2 #define CDDA_MESSAGE_LOGIT 2
@@ -70,7 +72,6 @@ struct cdrom_drive_s {
char *drive_model; char *drive_model;
int drive_type; int drive_type;
int interface;
int bigendianp; /**< Whether data returned on the CDDA is bigendian or int bigendianp; /**< Whether data returned on the CDDA is bigendian or
not. 1 if big endian, 0 if little endian and -1 if not. 1 if big endian, 0 if little endian and -1 if
we don't know. we don't know.
@@ -121,9 +122,25 @@ struct cdrom_drive_s {
}; };
/**< jitter testing. The first two bits are set to determine /*! An enumeration for some of the CDDA_TEST_* #defines below. This isn't
the byte-distance we will jitter the data; 0 is no shifting. really an enumeration one would really use in a program it is to
be helpful in debuggers where wants just to refer to the CDDA_TEST_
names and get something.
*/
enum {
CDDA_TEST_JITTER_SMALL = 1,
CDDA_TEST_JITTER_LARGE = 2,
CDDA_TEST_JITTER_MASSIVE = 3,
CDDA_TEST_FRAG_SMALL = (1<<3),
CDDA_TEST_FRAG_LARGE = (2<<3),
CDDA_TEST_FRAG_MASSIVE = (3<<3),
CDDA_TEST_UNDERRUN = 64
} paranoia_jitter_enums;
/** jitter testing. The first two bits are set to determine the
byte-distance we will jitter the data; 0 is no shifting.
*/ */
#define CDDA_TEST_JITTER_SMALL 1 #define CDDA_TEST_JITTER_SMALL 1
#define CDDA_TEST_JITTER_LARGE 2 #define CDDA_TEST_JITTER_LARGE 2
#define CDDA_TEST_JITTER_MASSIVE 3 #define CDDA_TEST_JITTER_MASSIVE 3
@@ -278,18 +295,21 @@ extern int data_bigendianp(cdrom_drive_t *d);
/** transport errors: */ /** transport errors: */
#define TR_OK 0 typedef enum {
#define TR_EWRITE 1 /**< Error writing packet command (transport) */ TR_OK = 0,
#define TR_EREAD 2 /**< Error reading packet data (transport) */ TR_EWRITE = 1 /**< Error writing packet command (transport) */,
#define TR_UNDERRUN 3 /**< Read underrun */ TR_EREAD = 2 /**< Error reading packet data (transport) */,
#define TR_OVERRUN 4 /**< Read overrun */ TR_UNDERRUN = 3 /**< Read underrun */,
#define TR_ILLEGAL 5 /**< Illegal/rejected request */ TR_OVERRUN = 4 /**< Read overrun */,
#define TR_MEDIUM 6 /**< Medium error */ TR_ILLEGAL = 5 /**< Illegal/rejected request */,
#define TR_BUSY 7 /**< Device busy */ TR_MEDIUM = 6 /**< Medium error */,
#define TR_NOTREADY 8 /**< Device not ready */ TR_BUSY = 7 /**< Device busy */,
#define TR_FAULT 9 /**< Device failure */ TR_NOTREADY = 8 /**< Device not ready */,
#define TR_UNKNOWN 10 /**< Unspecified error */ TR_FAULT = 9 /**< Device failure */,
#define TR_STREAMING 11 /**< loss of streaming */ TR_UNKNOWN = 10 /**< Unspecified error */,
TR_STREAMING = 11 /**< loss of streaming */,
} transport_error_t;
#ifdef NEED_STRERROR_TR #ifdef NEED_STRERROR_TR
const char *strerror_tr[]={ const char *strerror_tr[]={

View File

@@ -1,5 +1,5 @@
/* -*- c -*- /* -*- c -*-
$Id: device.h,v 1.9 2005/01/29 20:54:20 rocky Exp $ $Id: device.h,v 1.10 2005/02/05 04:23:21 rocky Exp $
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
@@ -116,7 +116,7 @@ extern "C" {
typedef enum { typedef enum {
DRIVER_OP_UNINIT = -3, /**< returned when a particular driver DRIVER_OP_UNINIT = -3, /**< returned when a particular driver
hasn't been initialized or a null hasn't been initialized or a null
CdIo_t pointer has been passed. pointer has been passed.
*/ */
DRIVER_OP_UNSUPPORTED = -2, /**< returned when a particular driver DRIVER_OP_UNSUPPORTED = -2, /**< returned when a particular driver
doesn't support a particular operation. doesn't support a particular operation.

View File

@@ -1,5 +1,5 @@
/* /*
$Id: iso9660.h,v 1.58 2005/01/29 20:54:20 rocky Exp $ $Id: iso9660.h,v 1.59 2005/02/05 04:23:21 rocky Exp $
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
@@ -45,6 +45,51 @@
#define MIN_TRACK_SIZE 4*75 #define MIN_TRACK_SIZE 4*75
#define MIN_ISO_SIZE MIN_TRACK_SIZE #define MIN_ISO_SIZE MIN_TRACK_SIZE
/*! An enumeration for some of the ISO_* #defines below. This isn't
really an enumeration one would really use in a program it is here
to be helpful in debuggers where wants just to refer to the
ISO_*_ names and get something.
*/
enum {
ISO_PVD_SECTOR = 16, /**< Sector of Primary Volume Descriptor */
ISO_EVD_SECTOR = 17, /**< Sector of End Volume Descriptor */
LEN_ISONAME = 31, /**< size in bytes of the filename
portion + null byte */
ISO_MAX_SYSTEM_ID = 32, /**< Maximum number of characters in a system
id. */
MAX_ISONAME = 37, /**< size in bytes of the filename
portion + null byte */
ISO_MAX_PREPARER_ID = 128, /**< Maximum number of characters in a
preparer id. */
MAX_ISOPATHNAME = 255,
ISO_BLOCKSIZE = 2048
} iso_enums1;
/*! An enumeration for some of the ISO_* #defines below. This isn't
really an enumeration one would really use in a program it is here
to be helpful in debuggers where wants just to refer to the
ISO_*_ names and get something.
*/
enum {
ISO_FILE = 0, /**<, Not really a flag... */
ISO_EXISTENCE = 1, /**< Do not make existence known (hidden) */
ISO_DIRECTORY = 2, /**< This file is a directory */
ISO_ASSOCIATED = 4, /**< This file is an associated file */
ISO_RECORD = 8, /**<, Record format in extended attr. != 0 */
ISO_PROECTION = 16, /**< No read/execute perm. in ext. attr. */
ISO_DRESERVED1 = 32, /**<, Reserved bit 5 */
ISO_DRESERVED2 = 64, /**<, Reserved bit 6 */
ISO_MULTIEXTENT = 128, /**< Not final entry of a mult. ext. file */
} iso_flag_enums;
enum {
ISO_VD_PRIMARY = 1, /**< Is in any ISO-9660 */
ISO_VD_SUPPLEMENARY = 2, /**< Used by Joliet */
ISO_VD_END = 255
} iso_vd_enums;
/*! /*!
An ISO filename is: "abcde.eee;1" -> <filename> '.' <ext> ';' <version #> An ISO filename is: "abcde.eee;1" -> <filename> '.' <ext> ';' <version #>
@@ -71,22 +116,22 @@
/*! \brief Maximum number of characters in the entire ISO 9660 filename. */ /*! \brief Maximum number of characters in the entire ISO 9660 filename. */
#define MAX_ISOPATHNAME 255 #define MAX_ISOPATHNAME 255
/*! \brief Maximum number of characters in an perparer id. */ /*! \brief Maximum number of characters in a preparer id. */
#define ISO_MAX_PREPARER_ID 128 #define ISO_MAX_PREPARER_ID 128
/*! \brief Maximum number of characters in an publisher id. */ /*! \brief Maximum number of characters in a publisher id. */
#define ISO_MAX_PUBLISHER_ID 128 #define ISO_MAX_PUBLISHER_ID 128
/*! \brief Maximum number of characters in an application id. */ /*! \brief Maximum number of characters in an application id. */
#define ISO_MAX_APPLICATION_ID 128 #define ISO_MAX_APPLICATION_ID 128
/*! \brief Maximum number of characters in an system id. */ /*! \brief Maximum number of characters in a system id. */
#define ISO_MAX_SYSTEM_ID 32 #define ISO_MAX_SYSTEM_ID 32
/*! \brief Maximum number of characters in an volume id. */ /*! \brief Maximum number of characters in a volume id. */
#define ISO_MAX_VOLUME_ID 32 #define ISO_MAX_VOLUME_ID 32
/*! \brief Maximum number of characters in an volume-set id. */ /*! \brief Maximum number of characters in a volume-set id. */
#define ISO_MAX_VOLUMESET_ID 128 #define ISO_MAX_VOLUMESET_ID 128
/**! ISO 9660 directory flags. */ /**! ISO 9660 directory flags. */
@@ -101,7 +146,7 @@
#define ISO_MULTIEXTENT 128 /**< Not final entry of a mult. ext. file */ #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_PRIMARY 1 /**< Is in any ISO-9660 */
#define ISO_VD_SUPPLEMENTARY 2 /**< Used by Joliet */ #define ISO_VD_SUPPLEMENTARY 2 /**< Used by Joliet */
#define ISO_VD_END 255 #define ISO_VD_END 255
@@ -111,7 +156,10 @@
/*! Sector of End Volume Descriptor */ /*! Sector of End Volume Descriptor */
#define ISO_EVD_SECTOR 17 #define ISO_EVD_SECTOR 17
/*! String inside track identifying an ISO 9660 filesystem. */ /*! String inside frame which identifies an ISO 9660 filesystem. This
string generally occurs one byte into a frame at the beginning of
an ISO_PVD_SECTOR.
*/
#define ISO_STANDARD_ID "CD001" #define ISO_STANDARD_ID "CD001"
@@ -122,12 +170,12 @@
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
enum strncpy_pad_check { typedef enum strncpy_pad_check {
ISO9660_NOCHECK = 0, ISO9660_NOCHECK = 0,
ISO9660_7BIT, ISO9660_7BIT,
ISO9660_ACHARS, ISO9660_ACHARS,
ISO9660_DCHARS ISO9660_DCHARS
}; } strncpy_pad_check_t;
#ifndef EMPTY_ARRAY_SIZE #ifndef EMPTY_ARRAY_SIZE
#define EMPTY_ARRAY_SIZE 0 #define EMPTY_ARRAY_SIZE 0
@@ -375,6 +423,42 @@ typedef struct _iso9660 iso9660_t;
iso9660_t *iso9660_open_ext (const char *psz_path, iso9660_t *iso9660_open_ext (const char *psz_path,
iso_extension_mask_t iso_extension_mask); iso_extension_mask_t iso_extension_mask);
/*!
Open an ISO 9660 image for reading with some tolerence for positioning
of the ISO9660 image. Here we will scan for ISO_STANDARD_ID and set
that position as the
Maybe in the future we will have
a mode. NULL is returned on error.
@see iso9660_open
*/
iso9660_t *iso9660_open_fuzzy (const char *psz_path /*flags, mode */,
uint16_t i_fuzz);
/*!
Open an ISO 9660 image for reading with some tolerence for positioning
of the ISO9660 image. Here we will scan for ISO_STANDARD_ID and set
that position as the
Maybe in the future we will have
a mode. NULL is returned on error.
@see iso9660_open
*/
iso9660_t *iso9660_open_fuzzy_ext (const char *psz_path,
iso_extension_mask_t iso_extension_mask,
uint16_t i_fuzz
/*flags, mode */);
/*!
Read the Super block of an ISO 9660 image but determine framesize
and datastart and a possible additional offset. Generally here we are
not reading an ISO 9660 image but a CD-Image which contains an ISO 9660
filesystem.
*/
bool iso9660_ifs_fuzzy_read_superblock (iso9660_t *p_iso,
iso_extension_mask_t iso_extension_mask,
uint16_t i_fuzz);
/*! /*!
Close previously opened ISO 9660 image. Close previously opened ISO 9660 image.
True is unconditionally returned. If there was an error false would True is unconditionally returned. If there was an error false would

View File

@@ -1,8 +1,8 @@
/* /*
$Id: sector.h,v 1.31 2005/01/04 04:33:36 rocky Exp $ $Id: sector.h,v 1.32 2005/02/05 04:23:21 rocky Exp $
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@@ -67,10 +67,10 @@
#include <cdio/types.h> #include <cdio/types.h>
/*! track modes (Table 350) /*! track modes (Table 350)
reference: MMC-3 draft revsion - 10g reference: MMC-3 draft revsion - 10g
*/ */
typedef enum { typedef enum {
AUDIO, /**< 2352 byte block length */ AUDIO, /**< 2352 byte block length */
MODE1, /**< 2048 byte block length */ MODE1, /**< 2048 byte block length */
MODE1_RAW, /**< 2352 byte block length */ MODE1_RAW, /**< 2352 byte block length */
@@ -79,12 +79,12 @@ typedef enum {
MODE2_FORM2, /**< 2324 byte block length */ MODE2_FORM2, /**< 2324 byte block length */
MODE2_FORM_MIX, /**< 2336 byte block length */ MODE2_FORM_MIX, /**< 2336 byte block length */
MODE2_RAW /**< 2352 byte block length */ MODE2_RAW /**< 2352 byte block length */
} trackmode_t; } trackmode_t;
/*! disc modes. The first combined from MMC-3 5.29.2.8 (Send CUESHEET) /*! 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. and GNU/Linux /usr/include/linux/cdrom.h and we've added DVD.
*/ */
typedef enum { typedef enum {
CDIO_DISC_MODE_CD_DA, /**< CD-DA */ CDIO_DISC_MODE_CD_DA, /**< CD-DA */
CDIO_DISC_MODE_CD_DATA, /**< CD-ROM form 1 */ CDIO_DISC_MODE_CD_DATA, /**< CD-ROM form 1 */
CDIO_DISC_MODE_CD_XA, /**< CD-ROM XA form2 */ CDIO_DISC_MODE_CD_XA, /**< CD-ROM XA form2 */
@@ -99,38 +99,73 @@ typedef enum {
CDIO_DISC_MODE_NO_INFO, CDIO_DISC_MODE_NO_INFO,
CDIO_DISC_MODE_ERROR, CDIO_DISC_MODE_ERROR,
CDIO_DISC_MODE_CD_I /**< CD-i. */ CDIO_DISC_MODE_CD_I /**< CD-i. */
} discmode_t; } discmode_t;
/*! Information that can be obtained through a Read Subchannel /*! Information that can be obtained through a Read Subchannel
command. command.
*/ */
#define CDIO_SUBCHANNEL_SUBQ_DATA 0 #define CDIO_SUBCHANNEL_SUBQ_DATA 0
#define CDIO_SUBCHANNEL_CURRENT_POSITION 1 #define CDIO_SUBCHANNEL_CURRENT_POSITION 1
#define CDIO_SUBCHANNEL_MEDIA_CATALOG 2 #define CDIO_SUBCHANNEL_MEDIA_CATALOG 2
#define CDIO_SUBCHANNEL_TRACK_ISRC 3 #define CDIO_SUBCHANNEL_TRACK_ISRC 3
/*! track flags /*! track flags
* Q Sub-channel Control Field (4.2.3.3) * Q Sub-channel Control Field (4.2.3.3)
*/ */
typedef enum { typedef enum {
NONE = 0x00, /* no flags set */ NONE = 0x00, /* no flags set */
PRE_EMPHASIS = 0x01, /* audio track recorded with pre-emphasis */ PRE_EMPHASIS = 0x01, /* audio track recorded with pre-emphasis */
COPY_PERMITTED = 0x02, /* digital copy permitted */ COPY_PERMITTED = 0x02, /* digital copy permitted */
DATA = 0x04, /* data track */ DATA = 0x04, /* data track */
FOUR_CHANNEL_AUDIO = 0x08, /* 4 audio channels */ FOUR_CHANNEL_AUDIO = 0x08, /* 4 audio channels */
SCMS = 0x10 /* SCMS (5.29.2.7) */ SCMS = 0x10 /* SCMS (5.29.2.7) */
} flag_t; } flag_t;
#define CDIO_PREGAP_SECTORS 150 #define CDIO_PREGAP_SECTORS 150
#define CDIO_POSTGAP_SECTORS 150 #define CDIO_POSTGAP_SECTORS 150
/* /*! An enumeration for some of the CDIO_CD #defines below. This isn't
Some generally useful CD-ROM information -- mostly based on the above. really an enumeration one would really use in a program it is to
This is from linux.h - not to slight other OS's. This was the first be helpful in debuggers where wants just to refer to the CDIO_CD_
place I came across such useful stuff. names and get something.
*/ */
enum {
CDIO_CD_MINS = 74, /**< max. minutes per CD, not really
a limit */
CDIO_CD_SECS_PER_MIN = 60, /**< seconds per minute */
CDIO_CD_FRAMES_PER_SEC = 75, /**< frames per second */
CDIO_CD_SYNC_SIZE = 12, /**< 12 sync bytes per raw data
frame */
CDIO_CD_CHUNK_SIZE = 24, /**< lowest-level "data bytes
piece" */
CDIO_CD_NUM_OF_CHUNKS = 98, /**< chunks per frame */
CDIO_CD_FRAMESIZE_SUB = 96, /**< subchannel data "frame" size */
CDIO_CD_HEADER_SIZE = 4, /**< header (address) bytes per raw
frame */
CDIO_CD_SUBHEADER_SIZE = 8, /**< subheader bytes per raw XA data
frame */
CDIO_CD_ECC_SIZE = 276, /**< bytes ECC per most raw data
frame types */
CDIO_CD_FRAMESIZE = 2048, /**< bytes per frame, "cooked"
mode */
CDIO_CD_FRAMESIZE_RAW = 2352, /**< bytes per frame, "raw" mode */
CDIO_CD_FRAMESIZE_RAWER = 2646, /**< The maximum possible
returned */
CDIO_CD_FRAMESIZE_RAW1 = 2340,
CDIO_CD_FRAMESIZE_RAW0 = 2336,
CDIO_CD_MAX_SESSIONS = 99,
CDIO_CD_MIN_SESSION_NO = 1, /**<, Smallest CD session number */
CDIO_CD_MAX_LSN = 450150, /**< Largest LSN in a CD */
CDIO_CD_MIN_LSN = -450150, /**< Smallest LSN in a CD */
} cdio_cd_enums;
/*!
Some generally useful CD-ROM information -- mostly based on the above.
This is from linux.h - not to slight other OS's. This was the first
place I came across such useful stuff.
*/
#define CDIO_CD_MINS 74 /**< max. minutes per CD, not really #define CDIO_CD_MINS 74 /**< max. minutes per CD, not really
a limit */ a limit */
#define CDIO_CD_SECS_PER_MIN 60 /**< seconds per minute */ #define CDIO_CD_SECS_PER_MIN 60 /**< seconds per minute */
#define CDIO_CD_FRAMES_PER_SEC 75 /**< frames per second */ #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_SYNC_SIZE 12 /**< 12 sync bytes per raw data frame */
@@ -153,121 +188,153 @@ typedef enum {
bytes */ bytes */
#define CDIO_CD_FRAMESIZE_RAW1 (CDIO_CD_CD_FRAMESIZE_RAW-CDIO_CD_SYNC_SIZE) /*2340*/ #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_HEADER_SIZE) /*2336*/ #define CDIO_CD_FRAMESIZE_RAW0 (CDIO_CD_FRAMESIZE_RAW-CDIO_CD_SYNC_SIZE-CDIO_CD_HEADER_SIZE) /*2336*/
/*! "before data" part of raw XA (green, mode2) frame */ /*! "before data" part of raw XA (green, mode2) frame */
#define CDIO_CD_XA_HEADER (CDIO_CD_HEADER_SIZE+CDIO_CD_SUBHEADER_SIZE) #define CDIO_CD_XA_HEADER (CDIO_CD_HEADER_SIZE+CDIO_CD_SUBHEADER_SIZE)
/*! "after data" part of raw XA (green, mode2 form1) frame */ /*! "after data" part of raw XA (green, mode2 form1) frame */
#define CDIO_CD_XA_TAIL (CDIO_CD_EDC_SIZE+CDIO_CD_ECC_SIZE) #define CDIO_CD_XA_TAIL (CDIO_CD_EDC_SIZE+CDIO_CD_ECC_SIZE)
/*! "before data" sync bytes + header of XA (green, mode2) frame */ /*! "before data" sync bytes + header of XA (green, mode2) frame */
#define CDIO_CD_XA_SYNC_HEADER (CDIO_CD_SYNC_SIZE+CDIO_CD_XA_HEADER) #define CDIO_CD_XA_SYNC_HEADER (CDIO_CD_SYNC_SIZE+CDIO_CD_XA_HEADER)
/*! CD-ROM address types (GNU/Linux e.g. cdrom_tocentry.cdte_format) */ /*! String of bytes used to identify the beginning of a Mode 1 or
Mode 2 sector. */
extern const uint8_t CDIO_SECTOR_SYNC_HEADER[CDIO_CD_SYNC_SIZE];
/**<
{0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0};
*/
/*! An enumeration for some of the CDIO_CDROM_* #defines below. This
isn't really an enumeration one would really use in a program; it
is to be helpful in debuggers where wants just to refer to the
CDIO_CDROM_* names and get something.
*/
enum {
CDIO_CDROM_LBA =0x01, /**< "logical block": first frame is #0 */
CDIO_CDROM_MSF =0x02, /**< "minute-second-frame": binary, not
BCD here! */
CDIO_CDROM_DATA_TRACK = 0x04,
CDIO_CDROM_CDI_TRACK = 0x10,
CDIO_CDROM_XA_TRACK = 0x20
} cdio_cdrom_enums;
/*! 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_LBA 0x01 /**< "logical block": first frame is #0 */
#define CDIO_CDROM_MSF 0x02 /**< "minute-second-frame": binary, not #define CDIO_CDROM_MSF 0x02 /**< "minute-second-frame": binary, not
BCD here! */ BCD here! */
/*! CD-ROM track format types (GNU/Linux cdte_ctrl) */ /*! CD-ROM track format types (GNU/Linux cdte_ctrl) */
#define CDIO_CDROM_DATA_TRACK 0x04 #define CDIO_CDROM_DATA_TRACK 0x04
#define CDIO_CDROM_CDI_TRACK 0x10 #define CDIO_CDROM_CDI_TRACK 0x10
#define CDIO_CDROM_XA_TRACK 0x20 #define CDIO_CDROM_XA_TRACK 0x20
/*! An enumeration for some of the M2*_SECTOR_SIZE #defines
below. This isn't really an enumeration one would really use in a
program it is to be helpful in debuggers where wants just to refer
to the M2*_SECTOR_SIZE names and get something.
*/
enum {
M2F2_SECTOR_SIZE = 2324,
M2SUB_SECTOR_SIZE = 2332,
M2RAW_SECTOR_SIZE = 2336
} m2_sector_enums;
#define M2F2_SECTOR_SIZE 2324 #define M2F2_SECTOR_SIZE 2324
#define M2SUB_SECTOR_SIZE 2332 #define M2SUB_SECTOR_SIZE 2332
#define M2RAW_SECTOR_SIZE 2336 #define M2RAW_SECTOR_SIZE 2336
/*! Largest CD session number */ /*! Largest CD session number */
#define CDIO_CD_MAX_SESSIONS 99 #define CDIO_CD_MAX_SESSIONS 99
/*! Smallest CD session number */ /*! Smallest CD session number */
#define CDIO_CD_MIN_SESSION_NO 1 #define CDIO_CD_MIN_SESSION_NO 1
/*! Largest LSN in a CD */ /*! Largest LSN in a CD */
#define CDIO_CD_MAX_LSN 450150 #define CDIO_CD_MAX_LSN 450150
/*! Smallest LSN in a CD */ /*! Smallest LSN in a CD */
#define CDIO_CD_MIN_LSN -450150 #define CDIO_CD_MIN_LSN -450150
#define CDIO_CD_FRAMES_PER_MIN \ #define CDIO_CD_FRAMES_PER_MIN \
(CDIO_CD_FRAMES_PER_SEC*CDIO_CD_SECS_PER_MIN) (CDIO_CD_FRAMES_PER_SEC*CDIO_CD_SECS_PER_MIN)
#define CDIO_CD_74MIN_SECTORS (UINT32_C(74)*CDIO_CD_FRAMES_PER_MIN) #define CDIO_CD_74MIN_SECTORS (UINT32_C(74)*CDIO_CD_FRAMES_PER_MIN)
#define CDIO_CD_80MIN_SECTORS (UINT32_C(80)*CDIO_CD_FRAMES_PER_MIN) #define CDIO_CD_80MIN_SECTORS (UINT32_C(80)*CDIO_CD_FRAMES_PER_MIN)
#define CDIO_CD_90MIN_SECTORS (UINT32_C(90)*CDIO_CD_FRAMES_PER_MIN) #define CDIO_CD_90MIN_SECTORS (UINT32_C(90)*CDIO_CD_FRAMES_PER_MIN)
#define CDIO_CD_MAX_SECTORS \ #define CDIO_CD_MAX_SECTORS \
(UINT32_C(100)*CDIO_CD_FRAMES_PER_MIN-CDIO_PREGAP_SECTORS) (UINT32_C(100)*CDIO_CD_FRAMES_PER_MIN-CDIO_PREGAP_SECTORS)
#define msf_t_SIZEOF 3 #define msf_t_SIZEOF 3
/*!
Convert an LBA into a string representation of the MSF.
\warning cdio_lba_to_msf_str returns new allocated string */
char *cdio_lba_to_msf_str (lba_t lba);
/*!
Convert an 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);
/*!
Convert an LBA into the corresponding MSF.
*/
void cdio_lba_to_msf(lba_t lba, msf_t *msf);
/*!
Convert an LSN into the corresponding LBA.
CDIO_INVALID_LBA is returned if there is an error.
*/
lba_t cdio_lsn_to_lba (lsn_t lsn);
/*!
Convert an LSN into the corresponding MSF.
*/
void cdio_lsn_to_msf (lsn_t lsn, msf_t *msf);
/*!
Convert a MSF into the corresponding LBA.
CDIO_INVALID_LBA is returned if there is an error.
*/
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);
/*!
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. Convert an LBA into a string representation of the MSF.
CDIO_INVALID_LBA is returned if there is an error. \warning cdio_lba_to_msf_str returns new allocated string */
*/ char *cdio_lba_to_msf_str (lba_t lba);
lba_t cdio_mmssff_to_lba (const char *psz_mmssff);
/*! /*!
Return true if discmode is some sort of CD. Convert an MSF into a string representation of the MSF.
*/ \warning cdio_msf_to_msf_str returns new allocated string */
bool cdio_is_discmode_cdrom (discmode_t discmode); 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);
/*!
Convert an LBA into the corresponding MSF.
*/
void cdio_lba_to_msf(lba_t lba, msf_t *msf);
/*!
Convert an LSN into the corresponding LBA.
CDIO_INVALID_LBA is returned if there is an error.
*/
lba_t cdio_lsn_to_lba (lsn_t lsn);
/*!
Convert an LSN into the corresponding MSF.
*/
void cdio_lsn_to_msf (lsn_t lsn, msf_t *msf);
/*!
Convert a MSF into the corresponding LBA.
CDIO_INVALID_LBA is returned if there is an error.
*/
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);
/*!
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);
/*!
Return true if discmode is some sort of DVD.
*/
bool cdio_is_discmode_dvd (discmode_t discmode);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif