diff --git a/include/cdio/Makefile.am b/include/cdio/Makefile.am index 768d13f2..ae52dcd3 100644 --- a/include/cdio/Makefile.am +++ b/include/cdio/Makefile.am @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.17 2005/01/04 04:33:36 rocky Exp $ +# $Id: Makefile.am,v 1.18 2005/01/04 10:58:03 rocky Exp $ # # Copyright (C) 2003, 2004 Rocky Bernstein # @@ -31,6 +31,7 @@ libcdioinclude_HEADERS = \ cdtext.h \ cdtext.h \ cd_types.h \ + device.h \ disc.h \ ds.h \ dvd.h \ diff --git a/include/cdio/cdio.h b/include/cdio/cdio.h index d0104f2d..5ad33899 100644 --- a/include/cdio/cdio.h +++ b/include/cdio/cdio.h @@ -1,5 +1,5 @@ /* -*- c -*- - $Id: cdio.h,v 1.72 2005/01/04 04:33:36 rocky Exp $ + $Id: cdio.h,v 1.73 2005/01/04 10:58:03 rocky Exp $ Copyright (C) 2001 Herbert Valerio Riedel Copyright (C) 2003, 2004, 2005 Rocky Bernstein @@ -44,31 +44,10 @@ #include #include -/**! 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 /**< Read source SCSI device. */ -#define CDIO_SRC_IS_NATIVE_MASK 0x0008 - #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -/*! 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; - /* For compatability. */ #define CdIo CdIo_t @@ -78,69 +57,6 @@ extern "C" { /** 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 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. - * - * NOTE: IF YOU MODIFY ENUM MAKE SURE INITIALIZATION IN CDIO.C AGREES. - * - */ - typedef enum { - DRIVER_UNKNOWN, /**< Used as input when we don't care what kind - of driver to use. */ - DRIVER_AIX, /**< AIX driver */ - DRIVER_BSDI, /**< BSDI 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. 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. -*/ -#define CDIO_MIN_DRIVER DRIVER_AIX -#define CDIO_MIN_DEVICE_DRIVER CDIO_MIN_DRIVER -#define CDIO_MAX_DRIVER DRIVER_NRG -#define CDIO_MAX_DEVICE_DRIVER DRIVER_WIN32 - - /*! 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. - - @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_t **p_cdio); - /*! Free any resources associated with p_cdio. Call this when done using p_cdio and using CD reading/control operations. @@ -149,18 +65,6 @@ extern "C" { */ void cdio_destroy (CdIo_t *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[]); - /*! Get the value associatied with key. @@ -171,143 +75,6 @@ extern "C" { */ const char * cdio_get_arg (const CdIo_t *p_cdio, const char key[]); - /*! - Get CD-Text information for a CdIo_t 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_t *p_cdio, track_t i_track); - - /*! - 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. - - @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. - - 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 (const CdIo_t *p_cdio); - - /*! Return an array of device names. If you want a specific - devices for a driver, give that device. If you want hardware - devices, give DRIVER_DEVICE and if you want all possible devices, - image drivers and hardware drivers give DRIVER_UNKNOWN. - - 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_id); - - /*! - 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. - - 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_devices_with_cap (char* ppsz_search_devices[], - cdio_fs_anal_t capabilities, bool b_any); - - /*! - 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); - - /*! - 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_t *p_cdio, - cdio_drive_read_cap_t *p_read_cap, - cdio_drive_write_cap_t *p_write_cap, - cdio_drive_misc_cap_t *p_misc_cap); - - /*! - 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. - */ - 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); - - /*! - Get a string containing the name of the driver in use. - - @return a string with driver name or NULL if CdIo_t is NULL (we - haven't initialized a specific device. - */ - const char * cdio_get_driver_name (const CdIo_t *p_cdio); - - /*! - Get the driver id. - if CdIo_t is NULL (we haven't initialized a specific device driver), - then return DRIVER_UNKNOWN. - - @return the driver id.. - */ - driver_id_t cdio_get_driver_id (const CdIo_t *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_t *p_cdio, - /* out*/ cdio_hwinfo_t *p_hw_info ); - - off_t cdio_lseek(const CdIo_t *p_cdio, off_t offset, int whence); /*! @@ -423,487 +190,22 @@ extern "C" { */ bool cdio_init(void); - /* True if xxx driver is available. where xxx=linux, solaris, nrg, ... - */ - - /*! True if AIX driver is available. */ - bool cdio_have_aix (void); - - /*! True if BSDI driver is available. */ - bool cdio_have_bsdi (void); - - /*! True if FreeBSD driver is available. */ - bool cdio_have_freebsd (void); - - /*! True if GNU/Linux driver is available. */ - bool cdio_have_linux (void); - - /*! True if Sun Solaris driver is available. */ - bool cdio_have_solaris (void); - - /*! True if Apple OSX driver is available. */ - bool cdio_have_osx (void); - - /*! True if Microsoft Windows driver is available. */ - bool cdio_have_win32 (void); - - /*! True if Nero driver is available. */ - bool cdio_have_nrg (void); - - /*! True if BIN/CUE driver is available. */ - bool cdio_have_bincue (void); - - /*! 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); - - /*! - 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 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_t * 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_t * 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_t * cdio_open_bincue (const char *psz_cue_name); - - /*! 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_t * 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_t * 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_t * 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. - - @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. - - @return the cdio object for subsequent operations. - NULL on error or there is no driver for a some sort of hardware CD-ROM. - */ - CdIo_t * cdio_open_cd (const char *device_name); - - /*! 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_t * 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 - - @return the cdio object for subsequent operations. - NULL on error. - */ - CdIo_t * cdio_open_cue (const char *cue_name); - - /*! Set up CD-ROM for reading using the AIX 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_t * cdio_open_am_aix (const char *psz_source_name, - const char *psz_access_mode); - - /*! Set up CD-ROM for reading using the AIX 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_t * cdio_open_aix (const char *psz_source_name); - - /*! Return a string containing the default device name that the - BSDI driver would use when none is specified. - - @return the cdio object for subsequent operations. - NULL on error or there is no AIX driver. - - @see cdio_open_cd, cdio_open - */ - char * cdio_get_default_device_aix(void); - - /*! Return a list of all of the CD-ROM devices that the AIX 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_aix(void); - - /*! 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_t * cdio_open_am_bsdi (const char *psz_source_name, - const char *psz_access_mode); - - /*! 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_t * 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_t * 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. - - @return the cdio object for subsequent operations. - NULL on error or there is no BSDI driver. - - @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); - - /*! 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_t * 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_t * 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. - - NULL is returned on error or there is no CD-ROM device. - */ - char * cdio_get_default_device_freebsd(void); - - /*! Return a list of all of the CD-ROM devices that the FreeBSD driver - can find. - */ - char **cdio_get_devices_freebsd(void); - - /*! 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. - - 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_t * 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_t * 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. - - 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); - - /*! Return a list of all of the CD-ROM devices that the GNU/Linux driver - can find. - */ - char **cdio_get_devices_linux(void); - - /*! 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_t * 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_t * 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. - - 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); - - /*! Return a list of all of the CD-ROM devices that the Solaris driver - can find. - */ - char **cdio_get_devices_solaris(void); - - /*! 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. - - 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_t * 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_t * 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. - - 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); - - /*! Return a list of all of the CD-ROM devices that the OSX driver - can find. - */ - char **cdio_get_devices_osx(void); - - /*! Set up CD-ROM for reading using the Microsoft Windows driver. The - device_name is the some sort of device name. - - 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_t * 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_t * 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. - - 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_win32(void); - - char **cdio_get_devices_win32(void); - - /*! 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_t * 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_t * 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.. - - NULL is returned on error or there is no CD-ROM device. - */ - char * cdio_get_default_device_nrg(void); - - char **cdio_get_devices_nrg(void); - - /*! - - 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); - - /*! - 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. - */ - bool cdio_is_nrg(const char *psz_nrg); - - /*! - 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); - #ifdef __cplusplus } #endif /* __cplusplus */ +/* CD-Text-related functions. */ +#include + /* Track-related functions. */ #include + /* Disc-related functions. */ #include +/* Drive(r)/Device-related functions. Perhaps we should break out + Driver from device? +*/ +#include + #endif /* __CDIO_H__ */ diff --git a/include/cdio/device.h b/include/cdio/device.h new file mode 100644 index 00000000..6995b398 --- /dev/null +++ b/include/cdio/device.h @@ -0,0 +1,725 @@ +/* -*- c -*- + $Id: device.h,v 1.1 2005/01/04 10:58:03 rocky Exp $ + + Copyright (C) 2005 Rocky Bernstein + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 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 device.h + * \brief The top-level header for driver or device-related libcdio calls. + * ("device" include CD-image reading devices). + */ +#ifndef __CDIO_DEVICE_H__ +#define __CDIO_DEVICE_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/*! 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; + + /**! 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 /**< Read source SCSI device. */ +#define CDIO_SRC_IS_NATIVE_MASK 0x0008 + + /** 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 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. + * + * NOTE: IF YOU MODIFY ENUM MAKE SURE INITIALIZATION IN CDIO.C AGREES. + * + */ + typedef enum { + DRIVER_UNKNOWN, /**< Used as input when we don't care what kind + of driver to use. */ + DRIVER_AIX, /**< AIX driver */ + DRIVER_BSDI, /**< BSDI 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. 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. +*/ +#define CDIO_MIN_DRIVER DRIVER_AIX +#define CDIO_MIN_DEVICE_DRIVER CDIO_MIN_DRIVER +#define CDIO_MAX_DRIVER DRIVER_NRG +#define CDIO_MAX_DEVICE_DRIVER DRIVER_WIN32 + + /*! + Eject media in CD drive if there is a routine to do so. + + @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_t **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[]); + + /*! + 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. + + @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. + + 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 (const CdIo_t *p_cdio); + + /*! Return an array of device names. If you want a specific + devices for a driver, give that device. If you want hardware + devices, give DRIVER_DEVICE and if you want all possible devices, + image drivers and hardware drivers give DRIVER_UNKNOWN. + + 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_id); + + /*! + 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. + + 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_devices_with_cap (char* ppsz_search_devices[], + cdio_fs_anal_t capabilities, bool b_any); + + /*! + 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); + + /*! + 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_t *p_cdio, + cdio_drive_read_cap_t *p_read_cap, + cdio_drive_write_cap_t *p_write_cap, + cdio_drive_misc_cap_t *p_misc_cap); + + /*! + 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. + */ + 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); + + /*! + Get a string containing the name of the driver in use. + + @return a string with driver name or NULL if CdIo_t is NULL (we + haven't initialized a specific device. + */ + const char * cdio_get_driver_name (const CdIo_t *p_cdio); + + /*! + Get the driver id. + if CdIo_t is NULL (we haven't initialized a specific device driver), + then return DRIVER_UNKNOWN. + + @return the driver id.. + */ + driver_id_t cdio_get_driver_id (const CdIo_t *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_t *p_cdio, + /* out*/ cdio_hwinfo_t *p_hw_info ); + + + /*! True if AIX driver is available. */ + bool cdio_have_aix (void); + + /*! True if BSDI driver is available. */ + bool cdio_have_bsdi (void); + + /*! True if FreeBSD driver is available. */ + bool cdio_have_freebsd (void); + + /*! True if GNU/Linux driver is available. */ + bool cdio_have_linux (void); + + /*! True if Sun Solaris driver is available. */ + bool cdio_have_solaris (void); + + /*! True if Apple OSX driver is available. */ + bool cdio_have_osx (void); + + /*! True if Microsoft Windows driver is available. */ + bool cdio_have_win32 (void); + + /*! True if Nero driver is available. */ + bool cdio_have_nrg (void); + + /*! True if BIN/CUE driver is available. */ + bool cdio_have_bincue (void); + + /*! 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); + + /*! + 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 psz_source and + 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. + + @return the cdio object or NULL on error or no device. + */ + CdIo_t * cdio_open (const char *psz_source, driver_id_t driver_id); + + /*! Sets up to read from place specified by psz_source, 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_t * cdio_open_am (const char *psz_source, + 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_t * cdio_open_bincue (const char *psz_cue_name); + + /*! 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_t * 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_t * 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_t * 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. + + @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. + + @return the cdio object for subsequent operations. + NULL on error or there is no driver for a some sort of hardware CD-ROM. + */ + CdIo_t * cdio_open_cd (const char *device_name); + + /*! 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_t * 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 + + @return the cdio object for subsequent operations. + NULL on error. + */ + CdIo_t * cdio_open_cue (const char *cue_name); + + /*! Set up CD-ROM for reading using the AIX 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_t * cdio_open_am_aix (const char *psz_source, + const char *psz_access_mode); + + /*! Set up CD-ROM for reading using the AIX 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_t * cdio_open_aix (const char *psz_source); + + /*! Return a string containing the default device name that the + BSDI driver would use when none is specified. + + @return the cdio object for subsequent operations. + NULL on error or there is no AIX driver. + + @see cdio_open_cd, cdio_open + */ + char * cdio_get_default_device_aix(void); + + /*! Return a list of all of the CD-ROM devices that the AIX 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_aix(void); + + /*! 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_t * cdio_open_am_bsdi (const char *psz_source, + const char *psz_access_mode); + + /*! 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_t * cdio_open_bsdi (const char *psz_source); + + /*! 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_t * cdio_open_am_bsdi (const char *psz_source, + const char *psz_access_mode); + + /*! Return a string containing the default device name that the + BSDI driver would use when none is specified. + + @return the cdio object for subsequent operations. + NULL on error or there is no BSDI driver. + + @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); + + /*! 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_t * cdio_open_freebsd (const char *paz_psz_source); + + /*! 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_t * cdio_open_am_freebsd (const char *psz_source, + const char *psz_access_mode); + + /*! Return a string containing the default device name that the + FreeBSD driver would use when none is specified. + + NULL is returned on error or there is no CD-ROM device. + */ + char * cdio_get_default_device_freebsd(void); + + /*! Return a list of all of the CD-ROM devices that the FreeBSD driver + can find. + */ + char **cdio_get_devices_freebsd(void); + + /*! 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. + + 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_t * cdio_open_linux (const char *psz_source); + + /*! 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_t * cdio_open_am_linux (const char *psz_source, + 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. + + 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); + + /*! Return a list of all of the CD-ROM devices that the GNU/Linux driver + can find. + */ + char **cdio_get_devices_linux(void); + + /*! 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_t * cdio_open_solaris (const char *psz_source); + + /*! 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_t * cdio_open_am_solaris (const char *psz_source, + 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. + + 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); + + /*! Return a list of all of the CD-ROM devices that the Solaris driver + can find. + */ + char **cdio_get_devices_solaris(void); + + /*! 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. + + 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_t * cdio_open_osx (const char *psz_source); + + /*! 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_t * cdio_open_am_osx (const char *psz_source, + 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. + + 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); + + /*! Return a list of all of the CD-ROM devices that the OSX driver + can find. + */ + char **cdio_get_devices_osx(void); + + /*! Set up CD-ROM for reading using the Microsoft Windows driver. The + device_name is the some sort of device name. + + 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_t * cdio_open_win32 (const char *psz_source); + + /*! 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_t * cdio_open_am_win32 (const char *psz_source, + 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. + + 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_win32(void); + + char **cdio_get_devices_win32(void); + + /*! 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_t * cdio_open_nrg (const char *psz_source); + + /*! 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_t * cdio_open_am_nrg (const char *psz_source, + 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.. + + NULL is returned on error or there is no CD-ROM device. + */ + char * cdio_get_default_device_nrg(void); + + char **cdio_get_devices_nrg(void); + + /*! + + 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); + + /*! + 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. + */ + bool cdio_is_nrg(const char *psz_nrg); + + /*! + 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 psz_source refers to a real hardware CD-ROM. + + @param psz_source 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 psz_source is a device; If false is returned we + could have a CD disk image. + */ + bool cdio_is_device(const char *psz_source, driver_id_t driver_id); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __CDIO_TRACK_H__ */ + diff --git a/include/cdio/disc.h b/include/cdio/disc.h index f6dc0691..b3bc1498 100644 --- a/include/cdio/disc.h +++ b/include/cdio/disc.h @@ -1,5 +1,5 @@ /* -*- c -*- - $Id: disc.h,v 1.1 2005/01/04 04:33:36 rocky Exp $ + $Id: disc.h,v 1.2 2005/01/04 10:58:03 rocky Exp $ Copyright (C) 2004, 2005 Rocky Bernstein @@ -18,8 +18,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/** \file dic.h - * \brief The top-level header for disc-related libcdio calls +/** \file disc.h + * \brief The top-level header for disc-related libcdio calls. */ #ifndef __CDIO_DISC_H__ #define __CDIO_DISC_H__ @@ -30,13 +30,6 @@ extern "C" { extern const char *discmode2str[]; - /*! - Get the lsn of the end of the CD - - @return the leadout LSN or CDIO_INVALID_LSN if there is an error. - */ - unsigned int cdio_get_disc_last_lsn(const CdIo *p_cdio); - /*! 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 @@ -49,7 +42,7 @@ extern "C" { @return the leadout LSN or CDIO_INVALID_LSN if there is an error. */ - unsigned int cdio_get_disc_last_lsn(const CdIo *p_cdio); + unsigned int cdio_get_disc_last_lsn(const CdIo_t *p_cdio); /*! diff --git a/include/cdio/track.h b/include/cdio/track.h index 4c396edd..9a102992 100644 --- a/include/cdio/track.h +++ b/include/cdio/track.h @@ -1,7 +1,7 @@ /* -*- c -*- - $Id: track.h,v 1.3 2005/01/04 04:33:36 rocky Exp $ + $Id: track.h,v 1.4 2005/01/04 10:58:03 rocky Exp $ - Copyright (C) 2004 Rocky Bernstein + Copyright (C) 2005 Rocky Bernstein This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,7 +19,7 @@ */ /** \file track.h - * \brief The top-level header for track-related libcdio calls + * \brief The top-level header for track-related libcdio calls. */ #ifndef __CDIO_TRACK_H__ #define __CDIO_TRACK_H__ @@ -46,6 +46,9 @@ extern "C" { #endif /* __cplusplus */ + /*! Printable tags for track_format_t enumeration. */ + extern const char *track_format2str[6]; + typedef enum { TRACK_FORMAT_AUDIO, /**< Audio track, e.g. CD-DA */ TRACK_FORMAT_CDI, /**< CD-i. How this is different from DATA below? */ @@ -70,6 +73,19 @@ extern "C" { int channels; } track_flags_t; + /*! + Get CD-Text information for a CdIo_t 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_t *p_cdio, track_t i_track); + /*! Get the number of the first track. diff --git a/lib/driver/disc.c b/lib/driver/disc.c index f41627b2..a11886c8 100644 --- a/lib/driver/disc.c +++ b/lib/driver/disc.c @@ -1,5 +1,5 @@ /* - $Id: disc.c,v 1.1 2005/01/04 04:33:36 rocky Exp $ + $Id: disc.c,v 1.2 2005/01/04 10:58:03 rocky Exp $ Copyright (C) 2003, 2004, 2005 Rocky Bernstein Copyright (C) 2001 Herbert Valerio Riedel @@ -27,6 +27,12 @@ #include #include "cdio_private.h" +unsigned int +cdio_get_disc_last_lsn(const CdIo *p_cdio) +{ + return cdio_get_track_lsn(p_cdio, CDIO_CDROM_LEADOUT_TRACK); +} + /*! Get medium associated with cd_obj. */ @@ -42,12 +48,6 @@ cdio_get_discmode (CdIo *cd_obj) } } -unsigned int -cdio_get_disc_last_lsn(const CdIo *p_cdio) -{ - return cdio_get_track_lsn(p_cdio, CDIO_CDROM_LEADOUT_TRACK); -} - /*! Return a string containing the name of the driver in use. if CdIo is NULL (we haven't initialized a specific device driver),