mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	* [iso] add ISO support part 5 (cleanup)
* remove unneeded headers
This commit is contained in:
		
							parent
							
								
									be9956aaee
								
							
						
					
					
						commit
						e4d621d088
					
				
					 10 changed files with 96 additions and 2519 deletions
				
			
		|  | @ -1,146 +0,0 @@ | |||
| /* -*- c -*-
 | ||||
|     Copyright (C) 2005, 2007, 2008 Rocky Bernstein <rocky@gnu.org> | ||||
| 
 | ||||
|     This program is free software: you can redistribute it and/or modify | ||||
|     it under the terms of the GNU General Public License as published by | ||||
|     the Free Software Foundation, either version 3 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, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| 
 | ||||
| /** \file audio.h 
 | ||||
|  * | ||||
|  *  \brief The top-level header for CD audio-related libcdio | ||||
|  *         calls.  These control playing of the CD-ROM through its  | ||||
|  *         line-out jack. | ||||
|  */ | ||||
| #ifndef __CDIO_AUDIO_H__ | ||||
| #define __CDIO_AUDIO_H__ | ||||
| 
 | ||||
| #include <cdio/types.h> | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
|   /*! This struct is used by the cdio_audio_read_subchannel */ | ||||
|   typedef struct cdio_subchannel_s  | ||||
|   { | ||||
|     uint8_t format; | ||||
|     uint8_t audio_status; | ||||
|     uint8_t address:	4; | ||||
|     uint8_t control:	4; | ||||
|     uint8_t track; | ||||
|     uint8_t index; | ||||
|     msf_t   abs_addr; | ||||
|     msf_t   rel_addr; | ||||
|   } cdio_subchannel_t; | ||||
|    | ||||
|   /*! This struct is used by cdio_audio_get_volume and cdio_audio_set_volume */ | ||||
|   typedef struct cdio_audio_volume_s | ||||
|   { | ||||
|     uint8_t level[4]; | ||||
|   } cdio_audio_volume_t; | ||||
|    | ||||
| 
 | ||||
|   /*! This struct is used by the CDROMPLAYTRKIND ioctl */ | ||||
|   typedef struct cdio_track_index_s | ||||
|   { | ||||
|     uint8_t	i_start_track;	/**< start track */ | ||||
|     uint8_t	i_start_index;	/**< start index */ | ||||
|     uint8_t	i_end_track;	/**< end track */ | ||||
|     uint8_t	i_end_index;	/**< end index */ | ||||
|   } cdio_track_index_t; | ||||
| 
 | ||||
|   /*!
 | ||||
|     Get volume of an audio CD. | ||||
|      | ||||
|     @param p_cdio the CD object to be acted upon. | ||||
|     @param p_volume place to put the list of volume outputs levels | ||||
| 
 | ||||
|     p_volume can be NULL in which case we return only whether the driver | ||||
|     has the ability to get the volume or not. | ||||
| 
 | ||||
|   */ | ||||
|   driver_return_code_t cdio_audio_get_volume (CdIo_t *p_cdio,  /*out*/ | ||||
| 					      cdio_audio_volume_t *p_volume); | ||||
| 
 | ||||
|   /*! 
 | ||||
|     Return the number of seconds (discarding frame portion) of an MSF  | ||||
|   */ | ||||
|   uint32_t cdio_audio_get_msf_seconds(msf_t *p_msf); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Pause playing CD through analog output | ||||
| 
 | ||||
|     @param p_cdio the CD object to be acted upon. | ||||
|   */ | ||||
|   driver_return_code_t cdio_audio_pause (CdIo_t *p_cdio); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Playing CD through analog output at the given MSF. | ||||
| 
 | ||||
|     @param p_cdio the CD object to be acted upon. | ||||
|     @param p_start_msf pointer to staring MSF | ||||
|     @param p_end_msf pointer to ending MSF | ||||
|   */ | ||||
|   driver_return_code_t cdio_audio_play_msf (CdIo_t *p_cdio,  | ||||
| 					    /*in*/msf_t *p_start_msf, | ||||
| 					    /*in*/ msf_t *p_end_msf); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Playing CD through analog output at the desired track and index | ||||
| 
 | ||||
|     @param p_cdio the CD object to be acted upon. | ||||
|     @param p_track_index location to start/end. | ||||
|   */ | ||||
|   driver_return_code_t cdio_audio_play_track_index  | ||||
|   ( CdIo_t *p_cdio,  cdio_track_index_t *p_track_index); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Get subchannel information. | ||||
| 
 | ||||
|     @param p_cdio the CD object to be acted upon. | ||||
|     @param p_subchannel place for returned subchannel information | ||||
|   */ | ||||
|   driver_return_code_t cdio_audio_read_subchannel (CdIo_t *p_cdio,  | ||||
| 						   /*out*/ cdio_subchannel_t *p_subchannel); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Resume playing an audio CD. | ||||
|      | ||||
|     @param p_cdio the CD object to be acted upon. | ||||
| 
 | ||||
|   */ | ||||
|   driver_return_code_t cdio_audio_resume (CdIo_t *p_cdio); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Set volume of an audio CD. | ||||
|      | ||||
|     @param p_cdio the CD object to be acted upon. | ||||
|     @param p_volume place for returned volume-level information | ||||
| 
 | ||||
|   */ | ||||
|   driver_return_code_t cdio_audio_set_volume (CdIo_t *p_cdio, /*out*/ | ||||
| 					      cdio_audio_volume_t *p_volume); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Stop playing an audio CD. | ||||
|      | ||||
|     @param p_cdio the CD object to be acted upon. | ||||
| 
 | ||||
|   */ | ||||
|   driver_return_code_t cdio_audio_stop (CdIo_t *p_cdio); | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
| #endif /* __CDIO_AUDIO_H__ */ | ||||
|  | @ -61,7 +61,6 @@ extern "C" { | |||
| /* Drive(r)/Device-related functions. Perhaps we should break out 
 | ||||
|    Driver from device? | ||||
| */ | ||||
| // TODO: die die die
 | ||||
| #include <cdio/device.h> | ||||
| 
 | ||||
| /* Disc-related functions. */ | ||||
|  | @ -73,11 +72,9 @@ extern "C" { | |||
| #include <cdio/read.h> | ||||
| 
 | ||||
| /* CD-Text-related functions. */ | ||||
| // TODO: die die die
 | ||||
| #include <cdio/cdtext.h> | ||||
| //#include <cdio/cdtext.h>
 | ||||
| 
 | ||||
| /* Track-related functions. */ | ||||
| // TODO: die die die
 | ||||
| #include <cdio/track.h> | ||||
| //#include <cdio/track.h>
 | ||||
| 
 | ||||
| #endif /* __CDIO_H__ */ | ||||
|  |  | |||
|  | @ -1,177 +0,0 @@ | |||
| /*
 | ||||
|     $Id: cdtext.h,v 1.14 2008/03/25 15:59:08 karl Exp $ | ||||
| 
 | ||||
|     Copyright (C) 2004, 2005, 2008 Rocky Bernstein <rocky@gnu.org> | ||||
|     adapted from cuetools | ||||
|     Copyright (C) 2003 Svend Sanjay Sorensen <ssorensen@fastmail.fm> | ||||
| 
 | ||||
|     This program is free software: you can redistribute it and/or modify | ||||
|     it under the terms of the GNU General Public License as published by | ||||
|     the Free Software Foundation, either version 3 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, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| /*!
 | ||||
|  * \file cdtext.h  | ||||
|  * | ||||
|  * \brief The top-level header for CD-Text information. Applications | ||||
|  *  include this for CD-Text access. | ||||
| */ | ||||
| 
 | ||||
|  | ||||
| #ifndef __CDIO_CDTEXT_H__ | ||||
| #define __CDIO_CDTEXT_H__ | ||||
| 
 | ||||
| #include <cdio/cdio.h> | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
| #define MAX_CDTEXT_FIELDS 13 | ||||
| #define MIN_CDTEXT_FIELD  0 | ||||
| #define MAX_CDTEXT_DATA_LENGTH 5000 | ||||
| #define MAX_CDTEXT_GENRE_CODE 28 | ||||
| 
 | ||||
|    | ||||
|   /*! \brief structure for holding CD-Text information
 | ||||
| 
 | ||||
|   @see cdtext_init, cdtext_destroy, cdtext_get, and cdtext_set. | ||||
|   */ | ||||
|   struct cdtext { | ||||
|     char *field[MAX_CDTEXT_FIELDS]; | ||||
|   }; | ||||
|   typedef struct cdtext cdtext_track_t; | ||||
| 
 | ||||
|   struct cdtext_s { | ||||
|     cdtext_track_t track[100];  /* cdtext for track 1..99. 0 represents cd-text of disc */ | ||||
|     uint16_t genre_code;        /* genre code */ | ||||
|     uint8_t  block; | ||||
|     char encoding[16];          /* encoding of character strings */ | ||||
|     char language[3];           /* ISO 639-1 (2 letter) language code */ | ||||
|   }; | ||||
|    | ||||
|   /*! \brief A list of all of the CD-Text fields. Because
 | ||||
|     the interval has no gaps, we can use ++ to iterate over 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); | ||||
| 
 | ||||
|   /*! CD-Text genre codes */ | ||||
|   typedef enum { | ||||
|     CDIO_CDTEXT_GENRE_UNUSED         =  0,        /**< not used  */ | ||||
|     CDIO_CDTEXT_GENRE_UNDEFINED      =  1,        /**< not defined */ | ||||
|     CDIO_CDTEXT_GENRE_ADULT_CONTEMP  =  2,        /**< Adult Contemporary       */ | ||||
|     CDIO_CDTEXT_GENRE_ALT_ROCK       =  3,        /**< Alternative Rock         */ | ||||
|     CDIO_CDTEXT_GENRE_CHILDRENS      =  4,        /**< Childrens Music          */ | ||||
|     CDIO_CDTEXT_GENRE_CLASSIC        =  5,        /**< Classical                */ | ||||
|     CDIO_CDTEXT_GENRE_CHRIST_CONTEMP =  6,        /**< Contemporary Christian   */ | ||||
|     CDIO_CDTEXT_GENRE_COUNTRY        =  7,        /**< Country                  */ | ||||
|     CDIO_CDTEXT_GENRE_DANCE          =  8,        /**< Dance                    */ | ||||
|     CDIO_CDTEXT_GENRE_EASY_LISTENING =  9,        /**< Easy Listening           */ | ||||
|     CDIO_CDTEXT_GENRE_EROTIC         = 10,        /**< Erotic                   */ | ||||
|     CDIO_CDTEXT_GENRE_FOLK           = 11,        /**< Folk                     */ | ||||
|     CDIO_CDTEXT_GENRE_GOSPEL         = 12,        /**< Gospel                   */ | ||||
|     CDIO_CDTEXT_GENRE_HIPHOP         = 13,        /**< Hip Hop                  */ | ||||
|     CDIO_CDTEXT_GENRE_JAZZ           = 14,        /**< Jazz                     */ | ||||
|     CDIO_CDTEXT_GENRE_LATIN          = 15,        /**< Latin                    */ | ||||
|     CDIO_CDTEXT_GENRE_MUSICAL        = 16,        /**< Musical                  */ | ||||
|     CDIO_CDTEXT_GENRE_NEWAGE         = 17,        /**< New Age                  */ | ||||
|     CDIO_CDTEXT_GENRE_OPERA          = 18,        /**< Opera                    */ | ||||
|     CDIO_CDTEXT_GENRE_OPERETTA       = 19,        /**< Operetta                 */ | ||||
|     CDIO_CDTEXT_GENRE_POP            = 20,        /**< Pop Music                */ | ||||
|     CDIO_CDTEXT_GENRE_RAP            = 21,        /**< RAP                      */ | ||||
|     CDIO_CDTEXT_GENRE_REGGAE         = 22,        /**< Reggae                   */ | ||||
|     CDIO_CDTEXT_GENRE_ROCK           = 23,        /**< Rock Music               */ | ||||
|     CDIO_CDTEXT_GENRE_RYTHMANDBLUES  = 24,        /**< Rhythm & Blues           */ | ||||
|     CDIO_CDTEXT_GENRE_SOUNDEFFECTS   = 25,        /**< Sound Effects            */ | ||||
|     CDIO_CDTEXT_GENRE_SOUNDTRACK     = 26,        /**< Soundtrack               */ | ||||
|     CDIO_CDTEXT_GENRE_SPOKEN_WORD    = 27,        /**< Spoken Word              */ | ||||
|     CDIO_CDTEXT_GENRE_WORLD_MUSIC    = 28         /**< World Music              */ | ||||
|   } cdtext_genre_t; | ||||
|    | ||||
|   /*! Return string representation of the given genre code */ | ||||
|   const char *cdtext_genre2str (cdtext_genre_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); | ||||
| 
 | ||||
|   /*! Parse raw CD-Text data into cdtext structure */  | ||||
|   bool cdtext_data_init(cdtext_t *cdtext, uint8_t *wdata, size_t length); | ||||
|    | ||||
|   /*! Free memory assocated with cdtext*/ | ||||
|   void cdtext_destroy (cdtext_t *cdtext); | ||||
|    | ||||
|   /*! returns an allocated string associated with the given field.  NULL is
 | ||||
|     returned if key is CDTEXT_INVALID or the field is not set. | ||||
| 
 | ||||
|     The user needs to free the string when done with it. | ||||
| 
 | ||||
|     @see cdio_get_const to retrieve a constant string that doesn't | ||||
|     have to be freed. | ||||
|   */ | ||||
|   char *cdtext_get (cdtext_field_t key, track_t track, const cdtext_t *cdtext); | ||||
| 
 | ||||
| 
 | ||||
|   /*! returns a const string associated with the given field.  NULL is
 | ||||
|     returned if key is CDTEXT_INVALID or the field is not set. | ||||
| 
 | ||||
|     Don't use the string when the cdtext object (i.e. the CdIo_t object | ||||
|     you got it from) is no longer valid. | ||||
| 
 | ||||
|     @see cdio_get to retrieve an allocated string that persists past | ||||
|     the cdtext object. | ||||
|   */ | ||||
|   const char *cdtext_get_const (cdtext_field_t key, track_t track, 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, track_t track, 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: | ||||
|  */ | ||||
|  | @ -1,811 +0,0 @@ | |||
| /*
 | ||||
|     Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 | ||||
|                   Rocky Bernstein <rocky@gnu.org> | ||||
| 
 | ||||
|     This program is free software: you can redistribute it and/or modify | ||||
|     it under the terms of the GNU General Public License as published by | ||||
|     the Free Software Foundation, either version 3 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, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| 
 | ||||
| /**
 | ||||
|    \file mmc.h  | ||||
|     | ||||
|    \brief Common definitions for MMC (Multimedia Commands). Applications | ||||
|    include this for direct MMC access. | ||||
| 
 | ||||
|    The documents we make use of are described in several | ||||
|    specifications made by the SCSI committee T10 | ||||
|    http://www.t10.org. In particular, SCSI Primary Commands (SPC),
 | ||||
|    SCSI Block Commands (SBC), and Multi-Media Commands (MMC). These | ||||
|    documents generally have a numeric level number appended. For | ||||
|    example SPC-3 refers to ``SCSI Primary Commands - 3'. | ||||
| 
 | ||||
|    In year 2010 the current versions were SPC-3, SBC-2, MMC-5. | ||||
| 
 | ||||
| */ | ||||
| 
 | ||||
| #ifndef __CDIO_MMC_H__ | ||||
| #define __CDIO_MMC_H__ | ||||
| 
 | ||||
| #include <cdio/cdio.h> | ||||
| #include <cdio/types.h> | ||||
| #include <cdio/dvd.h> | ||||
| #include <cdio/audio.h> | ||||
| #include <cdio/mmc_util.h> | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
| /* On GNU/Linux see <linux/byteorder/big_endian.h> and 
 | ||||
|    <linux/byteorder/little_endian.h> | ||||
| */ | ||||
| #ifdef WORDS_BIGENDIAN | ||||
| #  if !defined(__LITTLE_ENDIAN_BITFIELD) && !defined(__BIG_ENDIAN_BITFIELD) | ||||
| #  define __MMC_BIG_ENDIAN_BITFIELD | ||||
| #  endif | ||||
| #else  | ||||
| #  if !defined(__LITTLE_ENDIAN_BITFIELD) && !defined(__BIG_ENDIAN_BITFIELD) | ||||
| #  define __MMC_LITTLE_ENDIAN_BITFIELD | ||||
| #  endif | ||||
| #endif | ||||
| 
 | ||||
|    /**
 | ||||
|       Structure of a SCSI/MMC sense reply. | ||||
|       | ||||
|       This has been adapted from GNU/Linux request_sense of <linux/cdrom.h> | ||||
|       include this for direct MMC access. | ||||
|       See SCSI Primary Commands-2 (SPC-3) table 26 page 38. | ||||
|     */ | ||||
|     typedef struct cdio_mmc_request_sense { | ||||
| #if defined(__MMC_BIG_ENDIAN_BITFIELD) | ||||
| 	uint8_t valid		: 1;  /**< valid bit is 1 if info is valid */ | ||||
| 	uint8_t error_code	: 7; | ||||
| #else | ||||
| 	uint8_t error_code	: 7; | ||||
| 	uint8_t valid		: 1;  /**< valid bit is 1 if info is valid */ | ||||
| #endif | ||||
| 	uint8_t segment_number; | ||||
| #if defined(__MMC_BIG_ENDIAN_BITFIELD) | ||||
| 	uint8_t filemark	: 1; /**< manditory in sequential
 | ||||
|                                       * access devices */ | ||||
| 	uint8_t eom	        : 1; /**< end of medium. manditory in
 | ||||
|                                       * sequential access and | ||||
|                                       * printer devices */ | ||||
| 	uint8_t ili		: 1; /**< incorrect length indicator */ | ||||
| 	uint8_t reserved1	: 1; | ||||
| 	uint8_t sense_key	: 4; | ||||
| #else | ||||
| 	uint8_t sense_key	: 4; | ||||
| 	uint8_t reserved1	: 1; | ||||
| 	uint8_t ili		: 1; /**< incorrect length indicator */ | ||||
| 	uint8_t eom	        : 1; /**< end of medium. manditory in
 | ||||
|                                       * sequential access and | ||||
|                                       * printer devices */ | ||||
| 	uint8_t filemark	: 1; /**< manditory in sequential
 | ||||
|                                       * access devices */ | ||||
| #endif | ||||
| 	uint8_t information[4]; | ||||
| 	uint8_t additional_sense_len; /**< Additional sense length (n-7) */ | ||||
| 	uint8_t command_info[4];      /**< Command-specific information */ | ||||
| 	uint8_t asc;                  /**< Additional sense code */ | ||||
| 	uint8_t ascq;                 /**< Additional sense code qualifier */ | ||||
| 	uint8_t fruc;                 /**< Field replaceable unit code */ | ||||
| 	uint8_t sks[3];               /**< Sense-key specific */ | ||||
| 	uint8_t asb[46];              /**< Additional sense bytes */ | ||||
|     } cdio_mmc_request_sense_t; | ||||
| 
 | ||||
| 
 | ||||
|     /**
 | ||||
|        Meanings of the values of mmc_request_sense.sense_key | ||||
|      */ | ||||
|     typedef enum { | ||||
|         CDIO_MMC_SENSE_KEY_NO_SENSE        =  0, | ||||
|         CDIO_MMC_SENSE_KEY_RECOVERED_ERROR =  1, | ||||
|         CDIO_MMC_SENSE_KEY_NOT_READY       =  2, | ||||
|         CDIO_MMC_SENSE_KEY_MEDIUM_ERROR    =  3, | ||||
|         CDIO_MMC_SENSE_KEY_HARDWARE_ERROR  =  4, | ||||
|         CDIO_MMC_SENSE_KEY_ILLEGAL_REQUEST =  5, | ||||
|         CDIO_MMC_SENSE_KEY_UNIT_ATTENTION  =  6, | ||||
|         CDIO_MMC_SENSE_KEY_DATA_PROTECT    =  7, | ||||
|         CDIO_MMC_SENSE_KEY_BLANK_CHECK     =  8, | ||||
|         CDIO_MMC_SENSE_KEY_VENDOR_SPECIFIC =  9, | ||||
|         CDIO_MMC_SENSE_KEY_COPY_ABORTED    = 10, | ||||
|         CDIO_MMC_SENSE_KEY_ABORTED_COMMAND = 11, | ||||
|         CDIO_MMC_SENSE_KEY_OBSOLETE        = 12, | ||||
|     } cdio_mmc_sense_key_t; | ||||
| 
 | ||||
|     /**
 | ||||
|        \brief The opcode-portion (generic packet commands) of an MMC command. | ||||
|         | ||||
|        In general, those opcodes that end in 6 take a 6-byte command | ||||
|        descriptor, those that end in 10 take a 10-byte | ||||
|        descriptor and those that in in 12 take a 12-byte descriptor.  | ||||
|         | ||||
|        (Not that you need to know that, but it seems to be a | ||||
|        big deal in the MMC specification.) | ||||
|         | ||||
|     */ | ||||
|     typedef enum { | ||||
|   CDIO_MMC_GPCMD_TEST_UNIT_READY        = 0x00, /**< test if drive ready. */ | ||||
|   CDIO_MMC_GPCMD_INQUIRY                = 0x12, /**< Request drive 
 | ||||
|                                                    information. */ | ||||
|   CDIO_MMC_GPCMD_MODE_SELECT_6          = 0x15, /**< Select medium 
 | ||||
|                                                    (6 bytes). */ | ||||
|   CDIO_MMC_GPCMD_MODE_SENSE_6           = 0x1a, /**< Get medium or device
 | ||||
|                                                  information. Should be issued | ||||
|                                                  before MODE SELECT to get | ||||
|                                                  mode support or save current | ||||
|                                                  settings. (6 bytes). */ | ||||
|   CDIO_MMC_GPCMD_START_STOP_UNIT        = 0x1b, /**< Enable/disable Disc
 | ||||
|                                                      operations. (6 bytes). */ | ||||
|   CDIO_MMC_GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL  | ||||
|                                         = 0x1e, /**< Enable/disable Disc 
 | ||||
|                                                    removal. (6 bytes). */ | ||||
| 
 | ||||
|   /**
 | ||||
|       Group 2 Commands (CDB's here are 10-bytes)    | ||||
|   */ | ||||
|   CDIO_MMC_GPCMD_READ_10                = 0x28, /**< Read data from drive 
 | ||||
|                                                    (10 bytes). */ | ||||
|   CDIO_MMC_GPCMD_READ_SUBCHANNEL        = 0x42, /**< Read Sub-Channel data.
 | ||||
|                                                    (10 bytes). */ | ||||
|   CDIO_MMC_GPCMD_READ_TOC               = 0x43, /**< READ TOC/PMA/ATIP. 
 | ||||
|                                                    (10 bytes). */ | ||||
|   CDIO_MMC_GPCMD_READ_HEADER            = 0x44, | ||||
|   CDIO_MMC_GPCMD_PLAY_AUDIO_10          = 0x45, /**< Begin audio playing at
 | ||||
|                                                    current position | ||||
|                                                    (10 bytes). */ | ||||
|   CDIO_MMC_GPCMD_GET_CONFIGURATION      = 0x46, /**< Get drive Capabilities 
 | ||||
|                                                    (10 bytes) */ | ||||
|   CDIO_MMC_GPCMD_PLAY_AUDIO_MSF         = 0x47, /**< Begin audio playing at
 | ||||
|                                                    specified MSF (10 | ||||
|                                                    bytes). */ | ||||
|   CDIO_MMC_GPCMD_PLAY_AUDIO_TI          = 0x48, | ||||
|   CDIO_MMC_GPCMD_PLAY_TRACK_REL_10      = 0x49, /**< Play audio at the track
 | ||||
|                                                    relative LBA. (10 bytes). | ||||
|                                                    Doesn't seem to be part | ||||
|                                                    of MMC standards but is | ||||
|                                                    handled by Plextor drives. | ||||
|                                                 */ | ||||
|                                                     | ||||
|   CDIO_MMC_GPCMD_GET_EVENT_STATUS       = 0x4a, /**< Report events and 
 | ||||
|                                                    Status. */ | ||||
|   CDIO_MMC_GPCMD_PAUSE_RESUME           = 0x4b, /**< Stop or restart audio 
 | ||||
|                                                    playback. (10 bytes).  | ||||
|                                                    Used with a PLAY command. */ | ||||
| 
 | ||||
|   CDIO_MMC_GPCMD_READ_DISC_INFO         = 0x51, /**< Get CD information.
 | ||||
|                                                    (10 bytes). */ | ||||
|   CDIO_MMC_GPCMD_READ_TRACK_INFORMATION = 0x52, /**< Information about a 
 | ||||
|                                                    logical track. */ | ||||
|   CDIO_MMC_GPCMD_MODE_SELECT_10         = 0x55, /**< Select medium 
 | ||||
|                                                    (10-bytes). */ | ||||
|   CDIO_MMC_GPCMD_MODE_SENSE_10          = 0x5a, /**< Get medium or device
 | ||||
|                                                  information. Should be issued | ||||
|                                                  before MODE SELECT to get | ||||
|                                                  mode support or save current | ||||
|                                                  settings. (6 bytes). */ | ||||
| 
 | ||||
|   /**
 | ||||
|       Group 5 Commands (CDB's here are 12-bytes)  | ||||
|   */ | ||||
|   CDIO_MMC_GPCMD_PLAY_AUDIO_12          = 0xa5, /**< Begin audio playing at
 | ||||
|                                                    current position | ||||
|                                                  (12 bytes) */ | ||||
|   CDIO_MMC_GPCMD_LOAD_UNLOAD            = 0xa6, /**< Load/unload a Disc
 | ||||
|                                                  (12 bytes) */ | ||||
|   CDIO_MMC_GPCMD_READ_12                = 0xa8, /**< Read data from drive 
 | ||||
|                                                    (12 bytes). */ | ||||
|   CDIO_MMC_GPCMD_PLAY_TRACK_REL_12      = 0xa9, /**< Play audio at the track
 | ||||
|                                                    relative LBA. (12 bytes). | ||||
|                                                    Doesn't seem to be part | ||||
|                                                    of MMC standards but is | ||||
|                                                    handled by Plextor drives. | ||||
|                                                 */ | ||||
|   CDIO_MMC_GPCMD_READ_DVD_STRUCTURE     = 0xad, /**< Get DVD structure info
 | ||||
|                                                    from media (12 bytes). */ | ||||
|   CDIO_MMC_GPCMD_READ_MSF               = 0xb9, /**< Read almost any field 
 | ||||
|                                                    of a CD sector at specified | ||||
|                                                    MSF. (12 bytes). */ | ||||
|   CDIO_MMC_GPCMD_SET_SPEED              = 0xbb, /**< Set drive speed 
 | ||||
|                                                    (12 bytes). 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. */ | ||||
|   CDIO_MMC_GPCMD_READ_CD                = 0xbe, /**< Read almost any field 
 | ||||
|                                                    of a CD sector at current | ||||
|                                                    location. (12 bytes). */ | ||||
|   /**
 | ||||
|       Vendor-unique Commands   | ||||
|   */ | ||||
|   CDIO_MMC_GPCMD_CD_PLAYBACK_STATUS  = 0xc4 /**< SONY unique  = command */, | ||||
|   CDIO_MMC_GPCMD_PLAYBACK_CONTROL    = 0xc9 /**< SONY unique  = command */, | ||||
|   CDIO_MMC_GPCMD_READ_CDDA           = 0xd8 /**< Vendor unique  = command */, | ||||
|   CDIO_MMC_GPCMD_READ_CDXA           = 0xdb /**< Vendor unique  = command */, | ||||
|   CDIO_MMC_GPCMD_READ_ALL_SUBCODES   = 0xdf /**< Vendor unique  = command */ | ||||
|   } cdio_mmc_gpcmd_t; | ||||
| 
 | ||||
| 
 | ||||
|   /**
 | ||||
|       Read Subchannel states  | ||||
|   */ | ||||
|   typedef enum { | ||||
|     CDIO_MMC_READ_SUB_ST_INVALID   = 0x00, /**< audio status not supported */ | ||||
|     CDIO_MMC_READ_SUB_ST_PLAY      = 0x11, /**< audio play operation in 
 | ||||
|                                               progress */ | ||||
|     CDIO_MMC_READ_SUB_ST_PAUSED    = 0x12, /**< audio play operation paused */ | ||||
|     CDIO_MMC_READ_SUB_ST_COMPLETED = 0x13, /**< audio play successfully 
 | ||||
|                                               completed */ | ||||
|     CDIO_MMC_READ_SUB_ST_ERROR     = 0x14, /**< audio play stopped due to 
 | ||||
|                                               error */ | ||||
|     CDIO_MMC_READ_SUB_ST_NO_STATUS = 0x15, /**< no current audio status to
 | ||||
|                                               return */ | ||||
|   } cdio_mmc_read_sub_state_t; | ||||
| 
 | ||||
|   /** Level values that can go into READ_CD */ | ||||
|   typedef enum { | ||||
|     CDIO_MMC_READ_TYPE_ANY  =  0,  /**< All types */ | ||||
|     CDIO_MMC_READ_TYPE_CDDA =  1,  /**< Only CD-DA sectors */ | ||||
|     CDIO_MMC_READ_TYPE_MODE1 = 2,  /**< mode1 sectors (user data = 2048) */ | ||||
|     CDIO_MMC_READ_TYPE_MODE2 = 3,  /**< mode2 sectors form1 or form2 */ | ||||
|     CDIO_MMC_READ_TYPE_M2F1 =  4,  /**< mode2 sectors form1 */ | ||||
|     CDIO_MMC_READ_TYPE_M2F2 =  5   /**< mode2 sectors form2 */ | ||||
|   } cdio_mmc_read_cd_type_t; | ||||
| 
 | ||||
|   /**
 | ||||
|       Format values for READ_TOC  | ||||
|   */ | ||||
|   typedef enum { | ||||
|     CDIO_MMC_READTOC_FMT_TOC     =  0, | ||||
|     CDIO_MMC_READTOC_FMT_SESSION =  1,   | ||||
|     CDIO_MMC_READTOC_FMT_FULTOC  =  2, | ||||
|     CDIO_MMC_READTOC_FMT_PMA     =  3,  /**< Q subcode data */ | ||||
|     CDIO_MMC_READTOC_FMT_ATIP    =  4,  /**< includes media type */ | ||||
|     CDIO_MMC_READTOC_FMT_CDTEXT  =  5   /**< CD-TEXT info  */ | ||||
|   } cdio_mmc_readtoc_t; | ||||
|      | ||||
|   /**
 | ||||
|      Page codes for MODE SENSE and MODE SET.  | ||||
|   */ | ||||
|   typedef enum { | ||||
|       CDIO_MMC_R_W_ERROR_PAGE     = 0x01, | ||||
|       CDIO_MMC_WRITE_PARMS_PAGE   = 0x05, | ||||
|       CDIO_MMC_CDR_PARMS_PAGE     = 0x0d, | ||||
|       CDIO_MMC_AUDIO_CTL_PAGE     = 0x0e, | ||||
|       CDIO_MMC_POWER_PAGE         = 0x1a, | ||||
|       CDIO_MMC_FAULT_FAIL_PAGE    = 0x1c, | ||||
|       CDIO_MMC_TO_PROTECT_PAGE    = 0x1d, | ||||
|       CDIO_MMC_CAPABILITIES_PAGE  = 0x2a, | ||||
|       CDIO_MMC_ALL_PAGES          = 0x3f, | ||||
|   } cdio_mmc_mode_page_t; | ||||
| 
 | ||||
|  /**
 | ||||
|     READ DISC INFORMATION Data Types | ||||
|  */ | ||||
|   typedef enum { | ||||
|       CDIO_MMC_READ_DISC_INFO_STANDARD   = 0x0, | ||||
|       CDIO_MMC_READ_DISC_INFO_TRACK      = 0x1, | ||||
|       CDIO_MMC_READ_DISC_INFO_POW        = 0x2, | ||||
|   } cdio_mmc_read_disc_info_datatype_t; | ||||
|          | ||||
| 
 | ||||
| PRAGMA_BEGIN_PACKED | ||||
|   struct mmc_audio_volume_entry_s  | ||||
|   { | ||||
|     uint8_t  selection; /* Only the lower 4 bits are used. */ | ||||
|     uint8_t  volume; | ||||
|   } GNUC_PACKED; | ||||
| 
 | ||||
|   typedef struct mmc_audio_volume_entry_s mmc_audio_volume_entry_t; | ||||
|    | ||||
|   /**
 | ||||
|       This struct is used by cdio_audio_get_volume and cdio_audio_set_volume  | ||||
|   */ | ||||
|   struct mmc_audio_volume_s | ||||
|   { | ||||
|     mmc_audio_volume_entry_t port[4]; | ||||
|   } GNUC_PACKED; | ||||
| 
 | ||||
|   typedef struct mmc_audio_volume_s mmc_audio_volume_t; | ||||
|    | ||||
| PRAGMA_END_PACKED | ||||
|    | ||||
| 
 | ||||
| /**
 | ||||
|     Return type codes for GET_CONFIGURATION.  | ||||
| */ | ||||
| typedef enum { | ||||
|   CDIO_MMC_GET_CONF_ALL_FEATURES     = 0,  /**< all features without regard
 | ||||
|                                               to currency. */ | ||||
|   CDIO_MMC_GET_CONF_CURRENT_FEATURES = 1,  /**< features which are currently
 | ||||
|                                               in effect (e.g. based on | ||||
|                                               medium inserted). */ | ||||
|   CDIO_MMC_GET_CONF_NAMED_FEATURE    = 2   /**< just the feature named in
 | ||||
|                                               the GET_CONFIGURATION cdb. */ | ||||
| } cdio_mmc_get_conf_t; | ||||
|    | ||||
| 
 | ||||
| /**
 | ||||
|     FEATURE codes used in GET CONFIGURATION.  | ||||
| */ | ||||
| 
 | ||||
| typedef enum { | ||||
|   CDIO_MMC_FEATURE_PROFILE_LIST     = 0x000, /**< Profile List Feature */ | ||||
|   CDIO_MMC_FEATURE_CORE             = 0x001,  | ||||
|   CDIO_MMC_FEATURE_MORPHING         = 0x002, /**< Report/prevent operational
 | ||||
|                                                   changes  */ | ||||
|   CDIO_MMC_FEATURE_REMOVABLE_MEDIUM = 0x003, /**< Removable Medium Feature */ | ||||
|   CDIO_MMC_FEATURE_WRITE_PROTECT    = 0x004, /**< Write Protect Feature */ | ||||
|   CDIO_MMC_FEATURE_RANDOM_READABLE  = 0x010, /**< Random Readable Feature */ | ||||
|   CDIO_MMC_FEATURE_MULTI_READ       = 0x01D, /**< Multi-Read Feature */ | ||||
|   CDIO_MMC_FEATURE_CD_READ          = 0x01E, /**< CD Read Feature */ | ||||
|   CDIO_MMC_FEATURE_DVD_READ         = 0x01F, /**< DVD Read Feature */ | ||||
|   CDIO_MMC_FEATURE_RANDOM_WRITABLE  = 0x020, /**< Random Writable Feature */ | ||||
|   CDIO_MMC_FEATURE_INCR_WRITE       = 0x021, /**< Incremental Streaming 
 | ||||
|                                                 Writable Feature */ | ||||
|   CDIO_MMC_FEATURE_SECTOR_ERASE     = 0x022, /**< Sector Erasable Feature */ | ||||
|   CDIO_MMC_FEATURE_FORMATABLE       = 0x023, /**< Formattable Feature */ | ||||
|   CDIO_MMC_FEATURE_DEFECT_MGMT      = 0x024, /**< Management Ability of the 
 | ||||
|                                                 Logical Unit/media system to | ||||
|                                                 provide an apparently  | ||||
|                                                 defect-free space.*/ | ||||
|   CDIO_MMC_FEATURE_WRITE_ONCE       = 0x025, /**< Write Once
 | ||||
|                                                    Feature */ | ||||
|   CDIO_MMC_FEATURE_RESTRICT_OVERW   = 0x026, /**< Restricted Overwrite
 | ||||
|                                                 Feature */ | ||||
|   CDIO_MMC_FEATURE_CD_RW_CAV        = 0x027, /**< CD-RW CAV Write Feature */ | ||||
|   CDIO_MMC_FEATURE_MRW              = 0x028, /**< MRW Feature */ | ||||
|   CDIO_MMC_FEATURE_ENHANCED_DEFECT  = 0x029, /**< Enhanced Defect Reporting */ | ||||
|   CDIO_MMC_FEATURE_DVD_PRW          = 0x02A, /**< DVD+RW Feature */ | ||||
|   CDIO_MMC_FEATURE_DVD_PR           = 0x02B, /**< DVD+R Feature */ | ||||
|   CDIO_MMC_FEATURE_RIGID_RES_OVERW  = 0x02C, /**< Rigid Restricted Overwrite */ | ||||
|   CDIO_MMC_FEATURE_CD_TAO           = 0x02D, /**< CD Track at Once */  | ||||
|   CDIO_MMC_FEATURE_CD_SAO           = 0x02E, /**< CD Mastering (Session at 
 | ||||
|                                                 Once) */ | ||||
|   CDIO_MMC_FEATURE_DVD_R_RW_WRITE   = 0x02F, /**< DVD-R/RW Write */ | ||||
|   CDIO_MMC_FEATURE_CD_RW_MEDIA_WRITE= 0x037, /**< CD-RW Media Write Support */ | ||||
|   CDIO_MMC_FEATURE_DVD_PR_2_LAYER   = 0x03B, /**< DVD+R Double Layer */ | ||||
|   CDIO_MMC_FEATURE_POWER_MGMT       = 0x100, /**< Initiator and device directed
 | ||||
|                                                 power management */ | ||||
|   CDIO_MMC_FEATURE_CDDA_EXT_PLAY    = 0x103, /**< Ability to play audio CDs 
 | ||||
|                                                 via the Logical Unit's own | ||||
|                                                 analog output */ | ||||
|   CDIO_MMC_FEATURE_MCODE_UPGRADE    = 0x104, /* Ability for the device to 
 | ||||
|                                                 accept  new microcode via | ||||
|                                                 the interface */ | ||||
|   CDIO_MMC_FEATURE_TIME_OUT         = 0x105, /**< Ability to respond to all
 | ||||
|                                                 commands within a specific  | ||||
|                                                 time */ | ||||
|   CDIO_MMC_FEATURE_DVD_CSS          = 0x106, /**< Ability to perform DVD
 | ||||
|                                                 CSS/CPPM authentication and | ||||
|                                                 RPC */ | ||||
|   CDIO_MMC_FEATURE_RT_STREAMING     = 0x107, /**< Ability to read and write 
 | ||||
|                                                 using Initiator requested | ||||
|                                                 performance parameters   */ | ||||
|   CDIO_MMC_FEATURE_LU_SN            = 0x108, /**< The Logical Unit has a unique
 | ||||
|                                                 identifier. */ | ||||
|   CDIO_MMC_FEATURE_FIRMWARE_DATE    = 0x1FF, /**< Firmware creation date 
 | ||||
|                                                 report */ | ||||
| } cdio_mmc_feature_t; | ||||
|                                  | ||||
| typedef enum { | ||||
|   CDIO_MMC_FEATURE_INTERFACE_UNSPECIFIED = 0, | ||||
|   CDIO_MMC_FEATURE_INTERFACE_SCSI        = 1, | ||||
|   CDIO_MMC_FEATURE_INTERFACE_ATAPI       = 2, | ||||
|   CDIO_MMC_FEATURE_INTERFACE_IEEE_1394   = 3, | ||||
|   CDIO_MMC_FEATURE_INTERFACE_IEEE_1394A  = 4, | ||||
|   CDIO_MMC_FEATURE_INTERFACE_FIBRE_CH    = 5 | ||||
| } cdio_mmc_feature_interface_t; | ||||
|    | ||||
| 
 | ||||
| /**
 | ||||
|     The largest Command Descriptor Block (CDB) size. | ||||
|     The possible sizes are 6, 10, and 12 bytes. | ||||
| */ | ||||
| #define MAX_CDB_LEN 12 | ||||
| 
 | ||||
| /**
 | ||||
|     \brief A Command Descriptor Block (CDB) used in sending MMC  | ||||
|     commands. | ||||
|  */ | ||||
| typedef struct mmc_cdb_s { | ||||
|   uint8_t field[MAX_CDB_LEN]; | ||||
| } mmc_cdb_t; | ||||
|    | ||||
|   /**
 | ||||
|       \brief Format of header block in data returned from an MMC | ||||
|     GET_CONFIGURATION command. | ||||
|   */ | ||||
|   typedef struct mmc_feature_list_header_s { | ||||
|     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; | ||||
|   } cdio_mmc_feature_list_header_t; | ||||
| 
 | ||||
|   /**
 | ||||
|       An enumeration indicating whether an MMC command is sending | ||||
|       data, or getting data, or does none of both. | ||||
|   */ | ||||
|   typedef enum mmc_direction_s { | ||||
|     SCSI_MMC_DATA_READ, | ||||
|     SCSI_MMC_DATA_WRITE, | ||||
|     SCSI_MMC_DATA_NONE | ||||
|   } cdio_mmc_direction_t; | ||||
|   /**
 | ||||
|      Indicate to applications that SCSI_MMC_DATA_NONE is available. | ||||
|      It has been added after version 0.82 and should be used with commands | ||||
|      that neither read nor write payload bytes. (At least on Linux such | ||||
|      commands did work with SCSI_MMC_DATA_READ or SCSI_MMC_DATA_WRITE, too.) | ||||
|   */ | ||||
| #define SCSI_MMC_HAS_DIR_NONE 1 | ||||
|    | ||||
|   typedef struct mmc_subchannel_s | ||||
|   { | ||||
|     uint8_t       reserved; | ||||
|     uint8_t       audio_status; | ||||
|     uint16_t      data_length; /**< Really ISO 9660 7.2.2 */ | ||||
|     uint8_t       format; | ||||
|     uint8_t       address:      4; | ||||
|     uint8_t       control:      4; | ||||
|     uint8_t       track; | ||||
|     uint8_t       index; | ||||
|     uint8_t       abs_addr[4]; | ||||
|     uint8_t       rel_addr[4]; | ||||
|   } cdio_mmc_subchannel_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_GETPOS_LEN16(p, pos)           \ | ||||
|   (p[pos]<<8) + p[pos+1] | ||||
|    | ||||
| #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 0xf | ||||
| 
 | ||||
| #define CDIO_MMC_SET_MAIN_CHANNEL_SELECTION_BITS(cdb, val) \ | ||||
|   cdb[9] = val << 3; | ||||
| 
 | ||||
| /**
 | ||||
|    Get the output port volumes and port selections used on AUDIO PLAY | ||||
|    commands via a MMC MODE SENSE command using the CD Audio Control | ||||
|    Page. | ||||
|    @param p_cdio the CD object to be acted upon. | ||||
|    @param p_volume volume parameters retrieved | ||||
|    @return DRIVER_OP_SUCCESS if we ran the command ok. | ||||
| */ | ||||
| driver_return_code_t mmc_audio_get_volume (CdIo_t *p_cdio,  /*out*/ | ||||
|                                            mmc_audio_volume_t *p_volume); | ||||
|    | ||||
|   /**
 | ||||
|      Read Audio Subchannel information | ||||
|       | ||||
|      @param p_cdio the CD object to be acted upon. | ||||
|      @param p_subchannel place for returned subchannel information | ||||
|   */ | ||||
|     driver_return_code_t | ||||
|     mmc_audio_read_subchannel (CdIo_t *p_cdio,  | ||||
|                            /*out*/ cdio_subchannel_t *p_subchannel); | ||||
|    | ||||
|   /**
 | ||||
|      Read ISRC Subchannel information. Contributed by | ||||
|      Scot C. Bontrager (scot@indievisible.org)  | ||||
|      May 15, 2011 - | ||||
|       | ||||
|      @param p_cdio the CD object to be acted upon. | ||||
|      @param track the track you to get ISRC info | ||||
|      @param p_isrc place to put ISRC info | ||||
|   */ | ||||
|     driver_return_code_t | ||||
|     mmc_isrc_track_read_subchannel (CdIo_t *p_cdio,  /*in*/ const track_t track, | ||||
|                                     /*out*/ char *p_isrc); | ||||
|    | ||||
|   /**
 | ||||
|     Return a string containing the name of the audio state as returned from | ||||
|     the Q_SUBCHANNEL. | ||||
|   */ | ||||
|   const char *mmc_audio_state2str( uint8_t i_audio_state ); | ||||
|    | ||||
|   /**
 | ||||
|      Get the block size used in read requests, via MMC (e.g. READ_10,  | ||||
|      READ_MSF, ...) | ||||
|      @param p_cdio the CD object to be acted upon. | ||||
|      @return the blocksize if > 0; error if <= 0 | ||||
|   */ | ||||
|   int mmc_get_blocksize ( CdIo_t *p_cdio ); | ||||
|    | ||||
|   /**
 | ||||
|     Return the length in bytes of the Command Descriptor | ||||
|     Buffer (CDB) for a given MMC command. The length will be  | ||||
|     either 6, 10, or 12.  | ||||
|   */ | ||||
|   uint8_t mmc_get_cmd_len(uint8_t mmc_cmd); | ||||
|    | ||||
|   /**
 | ||||
|     Get the lsn of the end of the CD | ||||
|      | ||||
|     @param p_cdio the CD object to be acted upon. | ||||
|     @return the lsn. On error return CDIO_INVALID_LSN. | ||||
|   */ | ||||
|   lsn_t mmc_get_disc_last_lsn( const CdIo_t *p_cdio ); | ||||
|    | ||||
|   /**
 | ||||
|     Return the discmode as reported by the MMC Read (FULL) TOC | ||||
|     command. | ||||
|      | ||||
|     Information was obtained from Section 5.1.13 (Read TOC/PMA/ATIP) | ||||
|     pages 56-62 from the MMC draft specification, revision 10a | ||||
|     at http://www.t10.org/ftp/t10/drafts/mmc/mmc-r10a.pdf See
 | ||||
|     especially tables 72, 73 and 75. | ||||
|   */ | ||||
|   discmode_t mmc_get_discmode( const CdIo_t *p_cdio ); | ||||
|    | ||||
|    | ||||
|   typedef enum { | ||||
|     CDIO_MMC_LEVEL_WEIRD, | ||||
|     CDIO_MMC_LEVEL_1, | ||||
|     CDIO_MMC_LEVEL_2, | ||||
|     CDIO_MMC_LEVEL_3, | ||||
|     CDIO_MMC_LEVEL_NONE | ||||
|   } cdio_mmc_level_t; | ||||
|    | ||||
|   /**
 | ||||
|     Get the MMC level supported by the device. | ||||
|     @param p_cdio the CD object to be acted upon. | ||||
|     @return MMC level supported by the device. | ||||
|   */ | ||||
|   cdio_mmc_level_t mmc_get_drive_mmc_cap(CdIo_t *p_cdio); | ||||
|    | ||||
| 
 | ||||
|   /**
 | ||||
|     Get the DVD type associated with cd object. | ||||
|      | ||||
|     @param p_cdio the CD object to be acted upon. | ||||
|     @param s location to store DVD information. | ||||
|     @return the DVD discmode. | ||||
|   */ | ||||
|   discmode_t mmc_get_dvd_struct_physical ( const CdIo_t *p_cdio,  | ||||
|                                            cdio_dvd_struct_t *s); | ||||
|    | ||||
|   /**
 | ||||
|     Find out if media tray is open or closed. | ||||
|     @param p_cdio the CD object to be acted upon. | ||||
|     @return 1 if media is open, 0 if closed. Error | ||||
|     return codes are the same as driver_return_code_t | ||||
|   */ | ||||
|   int mmc_get_tray_status ( const CdIo_t *p_cdio ); | ||||
| 
 | ||||
|   /**
 | ||||
|     Get the CD-ROM hardware info via an MMC INQUIRY command. | ||||
|      | ||||
|     @param p_cdio the CD object to be acted upon. | ||||
|     @param p_hw_info place to store hardware information retrieved | ||||
|     @return true if we were able to get hardware info, false if we had | ||||
|     an error. | ||||
|   */ | ||||
|   bool mmc_get_hwinfo ( const CdIo_t *p_cdio,  | ||||
|                         /* out*/ cdio_hwinfo_t *p_hw_info ); | ||||
|    | ||||
|    | ||||
|   /**
 | ||||
|     Find out if media has changed since the last call. | ||||
|     @param p_cdio the CD object to be acted upon. | ||||
|     @return 1 if media has changed since last call, 0 if not. Error | ||||
|     return codes are the same as driver_return_code_t | ||||
|   */ | ||||
|   int mmc_get_media_changed(const CdIo_t *p_cdio); | ||||
|    | ||||
|   /**
 | ||||
|     Get the media catalog number (MCN) from the CD via MMC. | ||||
|      | ||||
|     @param p_cdio the CD object to be acted upon. | ||||
|     @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 * mmc_get_mcn(const CdIo_t *p_cdio); | ||||
|    | ||||
|   /**
 | ||||
|     Report if CD-ROM has a particular kind of interface (ATAPI, SCSCI, ...) | ||||
|     Is it possible for an interface to have several? If not this  | ||||
|     routine could probably return the single mmc_feature_interface_t. | ||||
|     @param p_cdio the CD object to be acted upon. | ||||
|     @param e_interface  | ||||
|     @return true if we have the interface and false if not. | ||||
|   */ | ||||
|   bool_3way_t mmc_have_interface(CdIo_t *p_cdio,  | ||||
|                                  cdio_mmc_feature_interface_t e_interface ); | ||||
|    | ||||
| 
 | ||||
|   /**
 | ||||
|       Read just the user data part of some sort of data sector (via  | ||||
|       mmc_read_cd).  | ||||
|      | ||||
|       @param p_cdio object to read from | ||||
| 
 | ||||
|       @param p_buf place to read data into.  The caller should make | ||||
|              sure this location can store at least CDIO_CD_FRAMESIZE, | ||||
|              M2RAW_SECTOR_SIZE, or M2F2_SECTOR_SIZE depending on the | ||||
|              kind of sector getting read. If you don't know whether | ||||
|              you have a Mode 1/2, Form 1/ Form 2/Formless sector best | ||||
|              to reserve space for the maximum, M2RAW_SECTOR_SIZE. | ||||
| 
 | ||||
|       @param i_lsn sector to read | ||||
|       @param i_blocksize size of each block | ||||
|       @param i_blocks number of blocks to read | ||||
| 
 | ||||
|   */ | ||||
|   driver_return_code_t mmc_read_data_sectors ( CdIo_t *p_cdio, void *p_buf,  | ||||
|                                                lsn_t i_lsn,  | ||||
|                                                uint16_t i_blocksize, | ||||
|                                                uint32_t i_blocks ); | ||||
|    | ||||
|   /**
 | ||||
|       Read sectors using SCSI-MMC GPCMD_READ_CD.  | ||||
|       Can read only up to 25 blocks. | ||||
|   */ | ||||
|   driver_return_code_t mmc_read_sectors ( const CdIo_t *p_cdio, void *p_buf,  | ||||
|                                           lsn_t i_lsn,  int read_sector_type,  | ||||
|                                           uint32_t i_blocks); | ||||
|    | ||||
|   /**
 | ||||
|     Run a Multimedia command (MMC).  | ||||
|      | ||||
|     @param p_cdio        CD structure set by cdio_open(). | ||||
|     @param i_timeout_ms  time in milliseconds we will wait for the command | ||||
|                          to complete.  | ||||
|     @param 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. | ||||
|     @param e_direction   direction the transfer is to go. | ||||
|     @param i_buf         Size of buffer | ||||
|     @param p_buf         Buffer for data, both sending and receiving. | ||||
| 
 | ||||
|     @return 0 if command completed successfully. | ||||
|   */ | ||||
|   driver_return_code_t | ||||
|   mmc_run_cmd( const CdIo_t *p_cdio, unsigned int i_timeout_ms, | ||||
|                const mmc_cdb_t *p_cdb, | ||||
|                cdio_mmc_direction_t e_direction, unsigned int i_buf,  | ||||
|                /*in/out*/ void *p_buf ); | ||||
| 
 | ||||
|   /**
 | ||||
|     Run a Multimedia command (MMC) specifying the CDB length. | ||||
|     The motivation here is for example ot use in is an undocumented  | ||||
|     debug command for LG drives (namely E7), whose length is being  | ||||
|     miscalculated by mmc_get_cmd_len(); it doesn't follow the usual  | ||||
|     code number to length conventions. Patch supplied by SukkoPera. | ||||
| 
 | ||||
|     @param p_cdio        CD structure set by cdio_open(). | ||||
|     @param i_timeout_ms  time in milliseconds we will wait for the command | ||||
|                          to complete.  | ||||
|     @param p_cdb         CDB bytes. All values that are needed should be set  | ||||
|                          on input.  | ||||
|     @param i_cdb         number of CDB bytes.  | ||||
|     @param e_direction   direction the transfer is to go. | ||||
|     @param i_buf         Size of buffer | ||||
|     @param p_buf         Buffer for data, both sending and receiving. | ||||
| 
 | ||||
|     @return 0 if command completed successfully. | ||||
|   */ | ||||
|   driver_return_code_t | ||||
|   mmc_run_cmd_len( const CdIo_t *p_cdio, unsigned int i_timeout_ms, | ||||
|                    const mmc_cdb_t *p_cdb, unsigned int i_cdb, | ||||
|                    cdio_mmc_direction_t e_direction, unsigned int i_buf, | ||||
|                    /*in/out*/ void *p_buf ); | ||||
| 
 | ||||
|   /**
 | ||||
|       Obtain the SCSI sense reply of the most-recently-performed MMC command. | ||||
|       These bytes give an indication of possible problems which occured in | ||||
|       the drive while the command was performed. With some commands they tell | ||||
|       about the current state of the drive (e.g. 00h TEST UNIT READY). | ||||
|       @param p_cdio CD structure set by cdio_open(). | ||||
| 
 | ||||
|       @param pp_sense returns the sense bytes received from the drive. | ||||
|       This is allocated memory or NULL if no sense bytes are | ||||
|       available. Dispose non-NULL pointers by free() when no longer | ||||
|       needed.  See SPC-3 4.5.3 Fixed format sense data.  SCSI error | ||||
|       codes as of SPC-3 Annex D, MMC-5 Annex F: sense[2]&15 = Key , | ||||
|       sense[12] = ASC , sense[13] = ASCQ | ||||
| 
 | ||||
|       @return number of valid bytes in sense, 0 in case of no sense | ||||
|               bytes available, <0 in case of internal error. | ||||
|   */ | ||||
|   int mmc_last_cmd_sense ( const CdIo_t *p_cdio,  | ||||
|                            cdio_mmc_request_sense_t **pp_sense); | ||||
| 
 | ||||
|   /**
 | ||||
|     Set the block size for subsequest read requests, via MMC. | ||||
|   */ | ||||
|   driver_return_code_t mmc_set_blocksize ( const CdIo_t *p_cdio,  | ||||
|                                            uint16_t i_blocksize); | ||||
|    | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
| /**
 | ||||
|     The below variables are trickery to force the above enum symbol | ||||
|     values to be recorded in debug symbol tables. They are used to | ||||
|     allow one to refer to the enumeration value names in the typedefs | ||||
|     above in a debugger and debugger expressions | ||||
| */ | ||||
| extern cdio_mmc_feature_t           debug_cdio_mmc_feature; | ||||
| extern cdio_mmc_feature_interface_t debug_cdio_mmc_feature_interface; | ||||
| extern cdio_mmc_feature_profile_t   debug_cdio_mmc_feature_profile; | ||||
| extern cdio_mmc_get_conf_t          debug_cdio_mmc_get_conf; | ||||
| extern cdio_mmc_gpcmd_t             debug_cdio_mmc_gpcmd; | ||||
| extern cdio_mmc_read_sub_state_t    debug_cdio_mmc_read_sub_state; | ||||
| extern cdio_mmc_read_cd_type_t      debug_cdio_mmc_read_cd_type; | ||||
| extern cdio_mmc_readtoc_t           debug_cdio_mmc_readtoc; | ||||
| extern cdio_mmc_mode_page_t         debug_cdio_mmc_mode_page; | ||||
|    | ||||
| #ifndef DO_NOT_WANT_OLD_MMC_COMPATIBILITY | ||||
| #define CDIO_MMC_GPCMD_START_STOP CDIO_MMC_GPCMD_START_STOP_UNIT  | ||||
| #define CDIO_MMC_GPCMD_ALLOW_MEDIUM_REMOVAL  \ | ||||
|     CDIO_MMC_GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL | ||||
| #endif /*DO_NOT_WANT_PARANOIA_COMPATIBILITY*/ | ||||
| 
 | ||||
| #endif /* __MMC_H__ */ | ||||
|  | ||||
| /* 
 | ||||
|  * Local variables: | ||||
|  *  c-file-style: "ruby" | ||||
|  *  tab-width: 8 | ||||
|  *  indent-tabs-mode: nil | ||||
|  * End: | ||||
|  */ | ||||
|  | @ -1,157 +0,0 @@ | |||
| /*
 | ||||
|     Copyright (C) 2010 Rocky Bernstein <rocky@gnu.org> | ||||
| 
 | ||||
|     This program is free software: you can redistribute it and/or modify | ||||
|     it under the terms of the GNU General Public License as published by | ||||
|     the Free Software Foundation, either version 3 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, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| 
 | ||||
| /**
 | ||||
|    \file mmc_util.h  | ||||
|     | ||||
|    \brief Multimedia Command (MMC) "helper" routines that don't depend | ||||
|    on anything other than headers. | ||||
| */ | ||||
| 
 | ||||
| #ifndef __CDIO_MMC_UTIL_H__ | ||||
| #define __CDIO_MMC_UTIL_H__ | ||||
| 
 | ||||
| #include <cdio/device.h> | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
|     /**
 | ||||
|        Profile profile codes used in GET_CONFIGURATION - PROFILE LIST. */ | ||||
|     typedef enum { | ||||
|         CDIO_MMC_FEATURE_PROF_NON_REMOVABLE = 0x0001, /**< Re-writable disc, capable
 | ||||
|                                                          of changing behavior */ | ||||
|         CDIO_MMC_FEATURE_PROF_REMOVABLE     = 0x0002, /**< disk Re-writable; with 
 | ||||
|                                                          removable  media */ | ||||
|         CDIO_MMC_FEATURE_PROF_MO_ERASABLE   = 0x0003, /**< Erasable Magneto-Optical
 | ||||
|                                                          disk with sector erase | ||||
|                                                          capability */ | ||||
|         CDIO_MMC_FEATURE_PROF_MO_WRITE_ONCE = 0x0004, /**< Write Once Magneto-Optical
 | ||||
|                                                          write once */ | ||||
|         CDIO_MMC_FEATURE_PROF_AS_MO         = 0x0005, /**< Advance Storage
 | ||||
|                                                          Magneto-Optical */ | ||||
|         CDIO_MMC_FEATURE_PROF_CD_ROM        = 0x0008, /**< Read only Compact Disc
 | ||||
|                                                          capable */ | ||||
|         CDIO_MMC_FEATURE_PROF_CD_R          = 0x0009, /**< Write once Compact Disc
 | ||||
|                                                          capable */ | ||||
|         CDIO_MMC_FEATURE_PROF_CD_RW         = 0x000A, /**< CD-RW Re-writable
 | ||||
|                                                          Compact Disc capable */ | ||||
|          | ||||
|         CDIO_MMC_FEATURE_PROF_DVD_ROM       = 0x0010, /**< Read only DVD */ | ||||
|         CDIO_MMC_FEATURE_PROF_DVD_R_SEQ     = 0x0011, /**< Re-recordable DVD using
 | ||||
|                                                          Sequential recording */ | ||||
|         CDIO_MMC_FEATURE_PROF_DVD_RAM       = 0x0012, /**< Re-writable DVD */ | ||||
|         CDIO_MMC_FEATURE_PROF_DVD_RW_RO     = 0x0013, /**< Re-recordable DVD using
 | ||||
|                                                          Restricted Overwrite */ | ||||
|         CDIO_MMC_FEATURE_PROF_DVD_RW_SEQ    = 0x0014, /**< Re-recordable DVD using
 | ||||
|                                                          Sequential recording */ | ||||
|         CDIO_MMC_FEATURE_PROF_DVD_R_DL_SEQ  = 0x0015, /**< DVD-R/DL sequential
 | ||||
|                                                          recording */ | ||||
|         CDIO_MMC_FEATURE_PROF_DVD_R_DL_JR   = 0x0016, /**< DVD-R/DL layer jump 
 | ||||
|                                                          recording */ | ||||
|         CDIO_MMC_FEATURE_PROF_DVD_PRW       = 0x001A, /**< DVD+RW - DVD ReWritable */ | ||||
|         CDIO_MMC_FEATURE_PROF_DVD_PR        = 0x001B, /**< DVD+R - DVD Recordable */ | ||||
|         CDIO_MMC_FEATURE_PROF_DDCD_ROM      = 0x0020, /**< Read only  DDCD */ | ||||
|         CDIO_MMC_FEATURE_PROF_DDCD_R        = 0x0021, /**< DDCD-R Write only DDCD */ | ||||
|         CDIO_MMC_FEATURE_PROF_DDCD_RW       = 0x0022, /**< Re-Write only DDCD */ | ||||
|         CDIO_MMC_FEATURE_PROF_DVD_PRW_DL    = 0x002A, /**< "DVD+RW/DL */ | ||||
|         CDIO_MMC_FEATURE_PROF_DVD_PR_DL     = 0x002B, /**< DVD+R - DVD Recordable 
 | ||||
|                                                          double layer */ | ||||
|          | ||||
|         CDIO_MMC_FEATURE_PROF_BD_ROM        = 0x0040, /**< BD-ROM */ | ||||
|         CDIO_MMC_FEATURE_PROF_BD_SEQ        = 0x0041, /**< BD-R sequential 
 | ||||
|                                                          recording */ | ||||
|         CDIO_MMC_FEATURE_PROF_BD_R_RANDOM   = 0x0042, /**< BD-R random recording */ | ||||
|         CDIO_MMC_FEATURE_PROF_BD_RE         = 0x0043, /**< BD-RE */ | ||||
|          | ||||
|         CDIO_MMC_FEATURE_PROF_HD_DVD_ROM    = 0x0050, /**< HD-DVD-ROM */ | ||||
|         CDIO_MMC_FEATURE_PROF_HD_DVD_R      = 0x0051, /**< HD-DVD-R */ | ||||
|         CDIO_MMC_FEATURE_PROF_HD_DVD_RAM    = 0x0052, /**<"HD-DVD-RAM */ | ||||
|          | ||||
|         CDIO_MMC_FEATURE_PROF_NON_CONFORM   = 0xFFFF, /**< The Logical Unit does not
 | ||||
|                                                          conform to any Profile. */ | ||||
|     } cdio_mmc_feature_profile_t; | ||||
|    | ||||
|     /**
 | ||||
|        @param i_feature MMC feature number | ||||
|        @return string containing the name of the given feature | ||||
|     */ | ||||
|     const char *mmc_feature2str( int i_feature ); | ||||
|      | ||||
|     /**
 | ||||
|        Get drive capabilities for a device. | ||||
|        @param p_cdio the CD object to be acted upon. | ||||
|        @param p_read_cap  list of read capabilities that are set on return | ||||
|        @param p_write_cap list of write capabilities that are set on return | ||||
|        @param p_misc_cap  list of miscellaneous capabilities (that are neither | ||||
|        read nor write related) that are set on return | ||||
|     */ | ||||
|     void mmc_get_drive_cap ( CdIo_t *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); | ||||
|      | ||||
|     /**
 | ||||
|        Return a string containing the name of the given feature | ||||
|     */ | ||||
|     const char *mmc_feature_profile2str( int i_feature_profile ); | ||||
| 
 | ||||
|     bool mmc_is_disctype_bd(cdio_mmc_feature_profile_t disctype); | ||||
|     bool mmc_is_disctype_cdrom(cdio_mmc_feature_profile_t disctype); | ||||
|     bool mmc_is_disctype_dvd(cdio_mmc_feature_profile_t disctype); | ||||
|     bool mmc_is_disctype_hd_dvd (cdio_mmc_feature_profile_t disctype); | ||||
|     bool mmc_is_disctype_overwritable (cdio_mmc_feature_profile_t disctype); | ||||
|     bool mmc_is_disctype_rewritable(cdio_mmc_feature_profile_t disctype); | ||||
|      | ||||
|     /** The default read timeout is 3 minutes. */ | ||||
| #define MMC_READ_TIMEOUT_DEFAULT 3*60*1000 | ||||
|      | ||||
|     /**
 | ||||
|        Set this to the maximum value in milliseconds that we will | ||||
|        wait on an MMC read command.   | ||||
|     */ | ||||
|     extern uint32_t mmc_read_timeout_ms; | ||||
|      | ||||
|     /**
 | ||||
|        Maps a mmc_sense_key_t into a string name. | ||||
|     */ | ||||
|     extern const char mmc_sense_key2str[16][40]; | ||||
| 
 | ||||
|     /**
 | ||||
|        The default timeout (non-read) is 6 seconds.  | ||||
|     */ | ||||
| #define MMC_TIMEOUT_DEFAULT 6000 | ||||
| 
 | ||||
|     /**
 | ||||
|        Set this to the maximum value in milliseconds that we will | ||||
|        wait on an MMC command.   | ||||
|     */ | ||||
|     extern uint32_t mmc_timeout_ms;  | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
| #endif /* __MMC_UTIL_H__ */ | ||||
| /* 
 | ||||
|  * Local variables: | ||||
|  *  c-file-style: "gnu" | ||||
|  *  tab-width: 8 | ||||
|  *  indent-tabs-mode: nil | ||||
|  * End: | ||||
|  */ | ||||
|  | @ -1,256 +0,0 @@ | |||
| /*
 | ||||
|     $Id: track.h,v 1.14 2008/03/25 15:59:09 karl Exp $ | ||||
| 
 | ||||
|     Copyright (C) 2005, 2006, 2008 Rocky Bernstein <rocky@gnu.org> | ||||
| 
 | ||||
|     This program is free software: you can redistribute it and/or modify | ||||
|     it under the terms of the GNU General Public License as published by | ||||
|     the Free Software Foundation, either version 3 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, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| 
 | ||||
| /** \file track.h 
 | ||||
|  *  \brief  The top-level header for track-related libcdio calls. | ||||
|  */ | ||||
| #ifndef __CDIO_TRACK_H__ | ||||
| #define __CDIO_TRACK_H__ | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| 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? */ | ||||
|     TRACK_FORMAT_XA,      /**< Mode2 of some sort */ | ||||
|     TRACK_FORMAT_DATA,    /**< Mode1 of some sort */ | ||||
|     TRACK_FORMAT_PSX,     /**< Playstation CD. Like audio but only 2336 bytes
 | ||||
| 			   *   of user data. | ||||
| 			   */ | ||||
|     TRACK_FORMAT_ERROR    /**< Dunno what is, or some other error. */ | ||||
|   } track_format_t; | ||||
| 
 | ||||
|   typedef enum { | ||||
|     CDIO_TRACK_FLAG_FALSE,  | ||||
|     CDIO_TRACK_FLAG_TRUE,  | ||||
|     CDIO_TRACK_FLAG_ERROR,  | ||||
|     CDIO_TRACK_FLAG_UNKNOWN | ||||
|   } track_flag_t; | ||||
| 
 | ||||
|   /*! \brief Structure containing attributes associated with a track */ | ||||
|   typedef struct { | ||||
|     track_flag_t preemphasis; /**< Linear preemphasis on an audio track */ | ||||
|     track_flag_t copy_permit; /**< Whether copying is permitted */ | ||||
|     int channels;             /**< Number of audio channels, 2, 4. -2 if not
 | ||||
| 				   implemented or -1 for error. | ||||
| 			      */ | ||||
|   } track_flags_t; | ||||
|      | ||||
|   /*! The leadout track is always 0xAA, regardless of # of tracks on
 | ||||
|     disc, or what value may be used internally. For example although | ||||
|     OS X uses a different value for the lead-out track internally than | ||||
|     given below, programmers should use CDIO_CDROM_LEADOUT_TRACK and | ||||
|     not worry about this. | ||||
|   */ | ||||
| 
 | ||||
|   /*! 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. | ||||
|   */ | ||||
|   extern enum cdio_track_enums { | ||||
|     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_CD_MAX_TRACKS       =   99, /**< Largest CD track number */ | ||||
|     CDIO_CDROM_LEADOUT_TRACK = 0xAA, /**< Lead-out track number */ | ||||
|     CDIO_INVALID_TRACK       = 0xFF, /**<  Constant for invalid track number */ | ||||
| 
 | ||||
|    } cdio_track_enums; | ||||
|    | ||||
| #define CDIO_CD_MIN_TRACK_NO  1 /**< Smallest CD track number */ | ||||
|    | ||||
|   /*! track modes (Table 350) 
 | ||||
|     reference: MMC-3 draft revsion - 10g | ||||
|   */ | ||||
|   typedef enum { | ||||
|     AUDIO,			/**< 2352 byte block length */ | ||||
|     MODE1,			/**< 2048 byte block length */ | ||||
|     MODE1_RAW,			/**< 2352 byte block length */ | ||||
|     MODE2,			/**< 2336 byte block length */ | ||||
|     MODE2_FORM1,		/**< 2048 byte block length */ | ||||
|     MODE2_FORM2,		/**< 2324 byte block length */ | ||||
|     MODE2_FORM_MIX,		/**< 2336 byte block length */ | ||||
|     MODE2_RAW			/**< 2352 byte block length */ | ||||
|   } trackmode_t; | ||||
|    | ||||
|   /*!
 | ||||
|     Get the number of the first track.  | ||||
| 
 | ||||
|     @return the track number or CDIO_INVALID_TRACK  | ||||
|     on error. | ||||
|   */ | ||||
|   track_t cdio_get_first_track_num(const CdIo_t *p_cdio); | ||||
|    | ||||
|   /*!
 | ||||
|     Return the last track number. | ||||
|     CDIO_INVALID_TRACK is returned on error. | ||||
|   */ | ||||
|   track_t cdio_get_last_track_num (const CdIo_t *p_cdio); | ||||
|    | ||||
| 
 | ||||
|   /*! Find the track which contains lsn.
 | ||||
|     CDIO_INVALID_TRACK is returned if the lsn outside of the CD or | ||||
|     if there was some error.  | ||||
|      | ||||
|     If the lsn is before the pregap of the first track 0 is returned. | ||||
|     Otherwise we return the track that spans the lsn. | ||||
|   */ | ||||
|   track_t cdio_get_track(const CdIo_t *p_cdio, lsn_t lsn); | ||||
| 
 | ||||
|   /*! Return number of channels in track: 2 or 4; -2 if not
 | ||||
|       implemented or -1 for error. | ||||
|       Not meaningful if track is not an audio track. | ||||
|   */ | ||||
|   int cdio_get_track_channels(const CdIo_t *p_cdio, track_t i_track); | ||||
|    | ||||
|   /*! Return copy protection status on a track. Is this meaningful
 | ||||
|       if not an audio track? | ||||
|    */ | ||||
|   track_flag_t cdio_get_track_copy_permit(const CdIo_t *p_cdio,  | ||||
| 					  track_t i_track); | ||||
|    | ||||
|   /*!  
 | ||||
|     Get the format (audio, mode2, mode1) of track.  | ||||
|   */ | ||||
|   track_format_t cdio_get_track_format(const CdIo_t *p_cdio, track_t i_track); | ||||
|    | ||||
|   /*!
 | ||||
|     Return true if we have XA data (green, mode2 form1) or | ||||
|     XA data (green, mode2 form2). That is track begins: | ||||
|     sync - header - subheader | ||||
|     12     4      -  8 | ||||
|      | ||||
|     FIXME: there's gotta be a better design for this and get_track_format? | ||||
|   */ | ||||
|   bool cdio_get_track_green(const CdIo_t *p_cdio, track_t i_track); | ||||
|      | ||||
|   /*!  
 | ||||
|     Return the ending LSN for track number | ||||
|     i_track in cdio.  CDIO_INVALID_LSN is returned on error. | ||||
|   */ | ||||
|   lsn_t cdio_get_track_last_lsn(const CdIo_t *p_cdio, track_t i_track); | ||||
| 
 | ||||
|   /*!  
 | ||||
|     Get the starting LBA for track number | ||||
|     i_track in p_cdio.  Track numbers usually start at something  | ||||
|     greater than 0, usually 1. | ||||
| 
 | ||||
|     The "leadout" track is specified either by | ||||
|     using i_track CDIO_CDROM_LEADOUT_TRACK or the total tracks+1. | ||||
| 
 | ||||
|     @param p_cdio object to get information from | ||||
|     @param i_track  the track number we want the LSN for | ||||
|     @return the starting LBA or CDIO_INVALID_LBA on error. | ||||
|   */ | ||||
|   lba_t cdio_get_track_lba(const CdIo_t *p_cdio, track_t i_track); | ||||
|    | ||||
|   /*!  
 | ||||
|     Return the starting LSN for track number | ||||
|     i_track in p_cdio.  Track numbers usually start at something  | ||||
|     greater than 0, usually 1. | ||||
| 
 | ||||
|     The "leadout" track is specified either by | ||||
|     using i_track CDIO_CDROM_LEADOUT_TRACK or the total tracks+1. | ||||
| 
 | ||||
|     @param p_cdio object to get information from | ||||
|     @param i_track  the track number we want the LSN for | ||||
|     @return the starting LSN or CDIO_INVALID_LSN on error. | ||||
|   */ | ||||
|   lsn_t cdio_get_track_lsn(const CdIo_t *p_cdio, track_t i_track); | ||||
| 
 | ||||
|   /*!  
 | ||||
|     Return the starting LBA for the pregap for track number | ||||
|     i_track in p_cdio.  Track numbers usually start at something  | ||||
|     greater than 0, usually 1. | ||||
| 
 | ||||
|     @param p_cdio object to get information from | ||||
|     @param i_track  the track number we want the LBA for | ||||
|     @return the starting LBA or CDIO_INVALID_LBA on error. | ||||
|   */ | ||||
|   lba_t cdio_get_track_pregap_lba(const CdIo_t *p_cdio, track_t i_track); | ||||
| 
 | ||||
|   /*!  
 | ||||
|     Return the starting LSN for the pregap for track number | ||||
|     i_track in p_cdio.  Track numbers usually start at something  | ||||
|     greater than 0, usually 1. | ||||
| 
 | ||||
|     @param p_cdio object to get information from | ||||
|     @param i_track  the track number we want the LSN for | ||||
|     @return the starting LSN or CDIO_INVALID_LSN on error. | ||||
|   */ | ||||
|   lsn_t cdio_get_track_pregap_lsn(const CdIo_t *p_cdio, track_t i_track); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Get the International Standard Recording Code (ISRC) for track number | ||||
|     i_track in p_cdio.  Track numbers usually start at something | ||||
|     greater than 0, usually 1. | ||||
| 
 | ||||
|     @return the International Standard Recording Code (ISRC) or 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 * cdio_get_track_isrc (const CdIo_t *p_cdio, track_t i_track); | ||||
|    | ||||
|   /*!  
 | ||||
|     Return the starting MSF (minutes/secs/frames) for track number | ||||
|     i_track in p_cdio.  Track numbers usually start at something  | ||||
|     greater than 0, usually 1. | ||||
| 
 | ||||
|     The "leadout" track is specified either by | ||||
|     using i_track CDIO_CDROM_LEADOUT_TRACK or the total tracks+1. | ||||
|      | ||||
|     @return true if things worked or false if there is no track entry. | ||||
|   */ | ||||
|   bool cdio_get_track_msf(const CdIo_t *p_cdio, track_t i_track,  | ||||
| 			  /*out*/ msf_t *msf); | ||||
|    | ||||
|   /*! Get linear preemphasis status on an audio track 
 | ||||
|       This is not meaningful if not an audio track? | ||||
|    */ | ||||
|   track_flag_t cdio_get_track_preemphasis(const CdIo_t *p_cdio, | ||||
| 					  track_t i_track); | ||||
|    | ||||
|   /*!  
 | ||||
|     Get the number of sectors between this track an the next.  This | ||||
|     includes any pregap sectors before the start of the next track. | ||||
|     Track numbers usually start at something  | ||||
|     greater than 0, usually 1. | ||||
| 
 | ||||
|     @return the number of sectors or 0 if there is an error. | ||||
|   */ | ||||
|   unsigned int cdio_get_track_sec_count(const CdIo_t *p_cdio, track_t i_track); | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
| #endif /* __CDIO_TRACK_H__ */ | ||||
| 
 | ||||
|  | @ -27,536 +27,62 @@ | |||
| #endif | ||||
| 
 | ||||
| #include <cdio/cdio.h> | ||||
| #include <cdio/audio.h> | ||||
| #include <cdio/cdtext.h> | ||||
| #include "mmc/mmc_private.h" | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
|   extern const char * cdio_dirname(const char *fname); | ||||
|   extern const char *cdio_abspath(const char *cwd, const char *fname); | ||||
| 
 | ||||
|   /* Opaque type */ | ||||
|   typedef struct _CdioDataSource CdioDataSource_t; | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| 
 | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
| #include "generic.h" | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
| 
 | ||||
|   typedef struct { | ||||
|      | ||||
|     /*!
 | ||||
|       Get volume of an audio CD. | ||||
|        | ||||
|       @param p_env the CD object to be acted upon. | ||||
|        | ||||
|     */ | ||||
|     driver_return_code_t (*audio_get_volume)  | ||||
| 	 (void *p_env,  /*out*/ cdio_audio_volume_t *p_volume); | ||||
| 
 | ||||
|     /*!
 | ||||
|       Pause playing CD through analog output | ||||
|        | ||||
|       @param p_env the CD object to be acted upon. | ||||
|     */ | ||||
|     driver_return_code_t (*audio_pause) (void *p_env); | ||||
|      | ||||
|     /*!
 | ||||
|       Playing CD through analog output | ||||
|        | ||||
|       @param p_env the CD object to be acted upon. | ||||
|     */ | ||||
|     driver_return_code_t (*audio_play_msf) ( void *p_env,  | ||||
| 					     msf_t *p_start_msf, | ||||
| 					     msf_t *p_end_msf ); | ||||
| 
 | ||||
|     /*!
 | ||||
|       Playing CD through analog output | ||||
|        | ||||
|       @param p_env the CD object to be acted upon. | ||||
|     */ | ||||
|     driver_return_code_t (*audio_play_track_index)  | ||||
| 	 ( void *p_env, cdio_track_index_t *p_track_index ); | ||||
| 
 | ||||
|     /*!
 | ||||
|       Get subchannel information. | ||||
|        | ||||
|       @param p_env the CD object to be acted upon. | ||||
|     */ | ||||
|     driver_return_code_t (*audio_read_subchannel)  | ||||
| 	 ( void *p_env, cdio_subchannel_t *subchannel ); | ||||
| 
 | ||||
|     /*!
 | ||||
|       Resume playing an audio CD. | ||||
|        | ||||
|       @param p_env the CD object to be acted upon. | ||||
|        | ||||
|     */ | ||||
|     driver_return_code_t (*audio_resume) ( void *p_env ); | ||||
|      | ||||
|     /*!
 | ||||
|       Set volume of an audio CD. | ||||
|        | ||||
|       @param p_env the CD object to be acted upon. | ||||
|        | ||||
|     */ | ||||
|     driver_return_code_t (*audio_set_volume)  | ||||
| 	 ( void *p_env,  cdio_audio_volume_t *p_volume ); | ||||
| 
 | ||||
|     /*!
 | ||||
|       Stop playing an audio CD. | ||||
|        | ||||
|       @param p_env the CD object to be acted upon. | ||||
|        | ||||
|     */ | ||||
|     driver_return_code_t (*audio_stop) ( void *p_env ); | ||||
|      | ||||
|     /*!
 | ||||
|       Eject media in CD drive. If successful, as a side effect we  | ||||
|       also free p_env.  | ||||
| 
 | ||||
|       @param p_env the CD object to be acted upon. | ||||
|       If the CD is ejected *p_env is freed and p_env set to NULL. | ||||
|     */ | ||||
|     driver_return_code_t (*eject_media) ( void *p_env ); | ||||
|      | ||||
|     /*!
 | ||||
|       Release and free resources associated with cd.  | ||||
|     */ | ||||
|     void (*free) (void *p_env); | ||||
|      | ||||
|     /*!
 | ||||
|       Return the value associated with the key "arg". | ||||
|     */ | ||||
|     const char * (*get_arg) (void *p_env, const char key[]); | ||||
|      | ||||
|     /*!
 | ||||
|       Get the block size for subsequest read requests, via a SCSI MMC  | ||||
|       MODE_SENSE 6 command. | ||||
|     */ | ||||
|     int (*get_blocksize) ( void *p_env ); | ||||
|      | ||||
|     /*! 
 | ||||
|       Get cdtext information for a CdIo object. | ||||
|      | ||||
|       @param obj the CD object that may contain CD-TEXT information. | ||||
|       @return the CD-TEXT object or NULL if obj is NULL | ||||
|       or CD-TEXT information does not exist. | ||||
|     */ | ||||
|     cdtext_t * (*get_cdtext) ( void *p_env ); | ||||
| 
 | ||||
|     /*!
 | ||||
|       Get raw cdtext information as on the disc for a CdIo object | ||||
| 
 | ||||
|       @param obj the CD object that may contain CD-TEXT information. | ||||
|       @return pointer to the raw CD-TEXT data or NULL if obj is NULL | ||||
|       or no CD-TEXT information present on the disc. | ||||
| 
 | ||||
|       free when done and not NULL. | ||||
|     */ | ||||
|     uint8_t * (*get_cdtext_raw) ( void *p_env ); | ||||
|      | ||||
|     /*!
 | ||||
|       Return an array of device names. if CdIo is NULL (we haven't | ||||
|       initialized a specific device driver), then find a suitable device  | ||||
|       driver. | ||||
|        | ||||
|       NULL is returned if we couldn't return a list of devices. | ||||
|     */ | ||||
|     char ** (*get_devices) ( void ); | ||||
|      | ||||
|     /*!
 | ||||
|       Get the default CD device. | ||||
| 
 | ||||
|       @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 * (*get_default_device) ( void ); | ||||
|      | ||||
|     /*!
 | ||||
|       Return the size of the CD in logical block address (LBA) units. | ||||
|       @return the lsn. On error 0 or CDIO_INVALD_LSN. | ||||
|     */ | ||||
|     lsn_t (*get_disc_last_lsn) ( void *p_env ); | ||||
| 
 | ||||
|     /*! 
 | ||||
|       Get disc mode associated with cd_obj. | ||||
|     */ | ||||
|     discmode_t (*get_discmode) ( void *p_env ); | ||||
| 
 | ||||
|     /*!
 | ||||
|       Return the what kind of device we've got. | ||||
|        | ||||
|       See cd_types.h for a list of bitmasks for the drive type; | ||||
|     */ | ||||
|     void (*get_drive_cap) (const void *p_env, | ||||
| 			   cdio_drive_read_cap_t  *p_read_cap, | ||||
| 			   cdio_drive_write_cap_t *p_write_cap, | ||||
| 			   cdio_drive_misc_cap_t  *p_misc_cap); | ||||
|     /*!
 | ||||
|       Return the number of of the first track.  | ||||
|       CDIO_INVALID_TRACK is returned on error. | ||||
|     */ | ||||
|     track_t (*get_first_track_num) ( void *p_env ); | ||||
|      | ||||
|     /*! 
 | ||||
|       Get the CD-ROM hardware info via a SCSI MMC INQUIRY command. | ||||
|       False is returned if we had an error getting the information. | ||||
|     */ | ||||
|     bool (*get_hwinfo)  | ||||
| 	 ( const CdIo_t *p_cdio, /* out*/ cdio_hwinfo_t *p_hw_info ); | ||||
| 
 | ||||
|     /*! Get the LSN of the first track of the last session of
 | ||||
|       on the CD. | ||||
| 	    | ||||
|        @param p_cdio the CD object to be acted upon. | ||||
|        @param i_last_session pointer to the session number to be returned. | ||||
|     */ | ||||
|     driver_return_code_t (*get_last_session) | ||||
| 	 ( void *p_env, /*out*/ lsn_t *i_last_session ); | ||||
| 
 | ||||
|     /*! 
 | ||||
|       Find out if media has changed since the last call. | ||||
|       @param p_env the CD object to be acted upon. | ||||
|       @return 1 if media has changed since last call, 0 if not. Error | ||||
|       return codes are the same as driver_return_code_t | ||||
|     */ | ||||
|     int (*get_media_changed) ( const void *p_env ); | ||||
| 
 | ||||
|     /*!  
 | ||||
|       Return the media catalog number MCN from the CD or NULL if | ||||
|       there is none or we don't have the ability to get it. | ||||
|     */ | ||||
|     char * (*get_mcn) ( const void *p_env ); | ||||
| 
 | ||||
|     /*! 
 | ||||
|       Return the number of tracks in the current medium. | ||||
|       CDIO_INVALID_TRACK is returned on error. | ||||
|     */ | ||||
|     track_t (*get_num_tracks) ( void *p_env ); | ||||
|      | ||||
|     /*! Return number of channels in track: 2 or 4; -2 if not
 | ||||
|       implemented or -1 for error. | ||||
|       Not meaningful if track is not an audio track. | ||||
|     */ | ||||
|     int (*get_track_channels) ( const void *p_env, track_t i_track ); | ||||
|    | ||||
|     /*! Return 0 if track is copy protected, 1 if not, or -1 for error
 | ||||
|       or -2 if not implimented (yet). Is this meaningful if not an | ||||
|       audio track? | ||||
|     */ | ||||
|     track_flag_t (*get_track_copy_permit) ( void *p_env, track_t i_track ); | ||||
|    | ||||
|     /*!  
 | ||||
|       Return the starting LBA for track number | ||||
|       i_track in p_env.  Tracks numbers start at 1. | ||||
|       The "leadout" track is specified either by | ||||
|       using track_num LEADOUT_TRACK or the total tracks+1. | ||||
|       CDIO_INVALID_LBA is returned on error. | ||||
|     */ | ||||
|     lba_t (*get_track_lba) ( void *p_env, track_t i_track ); | ||||
| 
 | ||||
|     /*!  
 | ||||
|       Return the starting LBA for the pregap for track number | ||||
|       i_track in p_env.  Tracks numbers start at 1. | ||||
|       CDIO_INVALID_LBA is returned on error. | ||||
|     */ | ||||
|     lba_t (*get_track_pregap_lba) ( const void *p_env, track_t i_track ); | ||||
| 
 | ||||
|     /*!
 | ||||
|       Return the International Standard Recording Code (ISRC) for track number | ||||
|       i_track in p_cdio.  Track numbers start at 1. | ||||
| 
 | ||||
|       Note: string is malloc'd so caller has to free() the returned | ||||
|       string when done with it. | ||||
|     */ | ||||
|     char * (*get_track_isrc) ( const void *p_env, track_t i_track ); | ||||
|      | ||||
|     /*!  
 | ||||
|       Get format of track.  | ||||
|     */ | ||||
|     track_format_t (*get_track_format) ( void *p_env, track_t i_track ); | ||||
|      | ||||
|     /*!
 | ||||
|       Return true if we have XA data (green, mode2 form1) or | ||||
|       XA data (green, mode2 form2). That is track begins: | ||||
|       sync - header - subheader | ||||
|       12     4      -  8 | ||||
|        | ||||
|       FIXME: there's gotta be a better design for this and get_track_format? | ||||
|     */ | ||||
|     bool (*get_track_green) ( void *p_env, track_t i_track ); | ||||
|      | ||||
|     /*!  
 | ||||
|       Return the starting MSF (minutes/secs/frames) for track number | ||||
|       i_track in p_env.  Tracks numbers start at 1. | ||||
|       The "leadout" track is specified either by | ||||
|       using i_track LEADOUT_TRACK or the total tracks+1. | ||||
|       False is returned on error. | ||||
|     */ | ||||
|     bool (*get_track_msf) ( void *p_env, track_t i_track, msf_t *p_msf ); | ||||
|      | ||||
|     /*! Return 1 if track has pre-emphasis, 0 if not, or -1 for error
 | ||||
|       or -2 if not implimented (yet). Is this meaningful if not an | ||||
|       audio track? | ||||
|     */ | ||||
|     track_flag_t (*get_track_preemphasis)  | ||||
| 	 ( const void  *p_env, track_t i_track ); | ||||
|    | ||||
|     /*!
 | ||||
|       lseek - reposition read/write file offset | ||||
|       Returns (off_t) -1 on error.  | ||||
|       Similar to libc's lseek() | ||||
|     */ | ||||
|     off_t (*lseek) ( void *p_env, off_t offset, int whence ); | ||||
|      | ||||
|     /*!
 | ||||
|       Reads into buf the next size bytes. | ||||
|       Returns -1 on error.  | ||||
|       Similar to libc's read() | ||||
|     */ | ||||
|     ssize_t (*read) ( void *p_env, void *p_buf, size_t i_size ); | ||||
|      | ||||
|     /*!
 | ||||
|       Reads a single mode2 sector from cd device into buf starting | ||||
|       from lsn. Returns 0 if no error.  | ||||
|     */ | ||||
|     int (*read_audio_sectors) ( void *p_env, void *p_buf, lsn_t i_lsn, | ||||
| 				unsigned int i_blocks ); | ||||
|      | ||||
|     /*!
 | ||||
|       Read a data sector | ||||
|        | ||||
|       @param p_env environment to read from | ||||
| 
 | ||||
|       @param p_buf place to read data into.  The caller should make sure | ||||
|       this location can store at least CDIO_CD_FRAMESIZE,  | ||||
|       M2RAW_SECTOR_SIZE, or M2F2_SECTOR_SIZE depending | ||||
|       on the kind of sector getting read. If you don't  | ||||
|       know whether you have a Mode 1/2, Form 1/ Form 2/Formless | ||||
|       sector best to reserve space for the maximum,  | ||||
|       M2RAW_SECTOR_SIZE. | ||||
| 
 | ||||
|       @param i_lsn sector to read | ||||
|       @param i_blocksize size of block. Should be either CDIO_CD_FRAMESIZE,  | ||||
|       M2RAW_SECTOR_SIZE, or M2F2_SECTOR_SIZE. See comment above under p_buf. | ||||
|     */ | ||||
|     driver_return_code_t (*read_data_sectors)  | ||||
| 	 ( void *p_env, void *p_buf, lsn_t i_lsn, uint16_t i_blocksize, | ||||
| 	   uint32_t i_blocks ); | ||||
|      | ||||
|     /*!
 | ||||
|       Reads a single mode2 sector from cd device into buf starting | ||||
|       from lsn. Returns 0 if no error.  | ||||
|     */ | ||||
|     int (*read_mode2_sector)  | ||||
| 	 ( void *p_env, void *p_buf, lsn_t i_lsn, bool b_mode2_form2 ); | ||||
|      | ||||
|     /*!
 | ||||
|       Reads i_blocks of mode2 sectors from cd device into data starting | ||||
|       from lsn. | ||||
|       Returns 0 if no error.  | ||||
|     */ | ||||
|     int (*read_mode2_sectors)  | ||||
| 	 ( void *p_env, void *p_buf, lsn_t i_lsn, bool b_mode2_form2,  | ||||
| 	   unsigned int i_blocks ); | ||||
|      | ||||
|     /*!
 | ||||
|       Reads a single mode1 sector from cd device into buf starting | ||||
|       from lsn. Returns 0 if no error.  | ||||
|     */ | ||||
|     int (*read_mode1_sector)  | ||||
| 	 ( void *p_env, void *p_buf, lsn_t i_lsn, bool mode1_form2 ); | ||||
|      | ||||
|     /*!
 | ||||
|       Reads i_blocks of mode1 sectors from cd device into data starting | ||||
|       from lsn. | ||||
|       Returns 0 if no error.  | ||||
|     */ | ||||
|     int (*read_mode1_sectors)  | ||||
| 	 ( void *p_env, void *p_buf, lsn_t i_lsn, bool mode1_form2,  | ||||
| 	   unsigned int i_blocks ); | ||||
|      | ||||
|     bool (*read_toc) ( void *p_env ) ; | ||||
| 
 | ||||
|     /*!
 | ||||
|       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.  | ||||
|       cdb_len           number of bytes in cdb (6, 10, or 12). | ||||
|       cdb	        CDB bytes. All values that are needed should be set on  | ||||
|                         input.  | ||||
|       b_return_data	TRUE if the command expects data to be returned in  | ||||
|                         the buffer | ||||
|       len	        Size of buffer | ||||
|       buf	        Buffer for data, both sending and receiving | ||||
|        | ||||
|       Returns 0 if command completed successfully. | ||||
|     */ | ||||
|     mmc_run_cmd_fn_t run_mmc_cmd; | ||||
| 
 | ||||
|     /*!
 | ||||
|       Set the arg "key" with "value" in the source device. | ||||
|     */ | ||||
|     int (*set_arg) ( void *p_env, const char key[], const char value[] ); | ||||
|      | ||||
|     /*!
 | ||||
|       Set the blocksize for subsequent reads.  | ||||
|     */ | ||||
|     driver_return_code_t (*set_blocksize) ( void *p_env,  | ||||
| 					    uint16_t i_blocksize ); | ||||
| 
 | ||||
|     /*!
 | ||||
|       Set the drive speed.  | ||||
|        | ||||
|       @return 0 if everything went okay, -1 if we had an error. is -2 | ||||
|       returned if this is not implemented for the current driver. | ||||
|     */ | ||||
|     int (*set_speed) ( void *p_env, int i_speed ); | ||||
| 
 | ||||
|   } cdio_funcs_t; | ||||
| #include <cdio/disc.h> | ||||
| #include <cdio/iso9660.h> | ||||
| 
 | ||||
| #define CdioDataSource_t int | ||||
| 
 | ||||
|   /*! Implementation of CdIo type */ | ||||
|   struct _CdIo { | ||||
|     driver_id_t driver_id; /**< Particular driver opened. */ | ||||
|     cdio_funcs_t op;       /**< driver-specific routines handling
 | ||||
| 			        implementation*/ | ||||
| //    driver_id_t driver_id; /**< Particular driver opened. */
 | ||||
| //    cdio_funcs_t op;       /**< driver-specific routines handling
 | ||||
| //			        implementation*/
 | ||||
|     void *env;             /**< environment. Passed to routine above. */ | ||||
|   }; | ||||
| 
 | ||||
|   /* This is used in drivers that must keep their own internal 
 | ||||
|      position pointer for doing seeks. Stream-based drivers (like bincue, | ||||
|      nrg, toc, network) would use this.  | ||||
|   typedef struct { | ||||
|     char *source_name;      /**< Name used in open. */ | ||||
|     bool  init;             /**< True if structure has been initialized */ | ||||
|     bool  toc_init;         /**< True if TOC read in */ | ||||
|     bool  b_cdtext_error;   /**< True if trouble reading CD-Text */ | ||||
|      | ||||
|     int   ioctls_debugged;  /**< for debugging */ | ||||
| 
 | ||||
|     /* Only one of data_source or fd is used; fd  is for CD-ROM
 | ||||
|        devices and the data_source for stream reading (bincue, nrg, toc, | ||||
|        network). | ||||
|      */ | ||||
|   typedef struct  | ||||
|   { | ||||
|     off_t   buff_offset;      /* buffer offset in disk-image seeks. */ | ||||
|     track_t index;            /* Current track index in tocent. */ | ||||
|     lba_t   lba;              /* Current LBA */ | ||||
|   } internal_position_t; | ||||
|     CdioDataSource_t *data_source; | ||||
|     int     fd;             /**< File descriptor of device */ | ||||
|     track_t i_first_track;  /**< The starting track number. */ | ||||
|     track_t i_tracks;       /**< The number of tracks. */ | ||||
| 
 | ||||
|   CdIo_t * cdio_new (generic_img_private_t *p_env, cdio_funcs_t *p_funcs); | ||||
|     uint8_t i_joliet_level; /**< 0 = no Joliet extensions.
 | ||||
| 			       1-3: Joliet level. */ | ||||
|     iso9660_pvd_t pvd;       | ||||
|     iso9660_svd_t svd;       | ||||
|     CdIo_t   *cdio;         /**< a way to call general cdio routines. */ | ||||
| //    cdtext_t *cdtext;       /**< CD-Text for disc. */
 | ||||
| //    track_flags_t track_flags[CDIO_CD_MAX_TRACKS+1];
 | ||||
| 
 | ||||
|   /* The below structure describes a specific CD Input driver  */ | ||||
|   typedef struct  | ||||
|   { | ||||
|     driver_id_t  id; | ||||
|     unsigned int flags; | ||||
|     const char  *name; | ||||
|     const char  *describe; | ||||
|     bool (*have_driver) (void);  | ||||
|     CdIo_t *(*driver_open) (const char *psz_source_name);  | ||||
|     CdIo_t *(*driver_open_am) (const char *psz_source_name,  | ||||
| 			     const char *psz_access_mode);  | ||||
|     char *(*get_default_device) (void);  | ||||
|     bool (*is_device) (const char *psz_source_name); | ||||
|     char **(*get_devices) (void); | ||||
|     driver_return_code_t (*close_tray) (const char *psz_device); | ||||
|   } CdIo_driver_t; | ||||
| 
 | ||||
|   /* The below array gives of the drivers that are currently available for 
 | ||||
|      on a particular host. */ | ||||
|   extern CdIo_driver_t CdIo_driver[]; | ||||
| 
 | ||||
|   /* The last valid entry of Cdio_driver. -1 means uninitialzed. -2 
 | ||||
|      means some sort of error. | ||||
|     /* Memorized sense reply of the most recent SCSI command.
 | ||||
|        Recorded by driver implementations of cdio_funcs_t.run_mmc_cmd().  | ||||
|        Read by API function mmc_get_cmd_scsi_sense(). | ||||
|     */ | ||||
|   extern int CdIo_last_driver;  | ||||
| //    unsigned char  scsi_mmc_sense[263];   /* See SPC-3 4.5.3 : 252 bytes legal
 | ||||
| //                                             but 263 bytes possible */
 | ||||
| //    int            scsi_mmc_sense_valid;  /* Number of valid sense bytes */
 | ||||
| 
 | ||||
|   /* The below array gives all drivers that can possibly appear.
 | ||||
|      on a particular host. */ | ||||
|   extern CdIo_driver_t CdIo_all_drivers[]; | ||||
| 
 | ||||
|   /*! 
 | ||||
|     Add/allocate a drive to the end of drives.  | ||||
|     Use cdio_free_device_list() to free this device_list. | ||||
|     /* Memorized eventual system specific SCSI address tuple text.
 | ||||
|        Empty text means that there is no such text defined for the drive. | ||||
|        NULL means that the driver does not support "scsi-tuple". | ||||
|        To be read by cdio_get_arg("scsi-tuple"). | ||||
|        System specific suffixes to the key may demand and eventually | ||||
|        guarantee a further specified format. | ||||
|        E.g. "scsi-tuple-linux" guarantees either "Bus,Host,Channel,Target,Lun", | ||||
|                                or empty text, or NULL. No other forms. | ||||
|     */ | ||||
|   void cdio_add_device_list(char **device_list[], const char *psz_drive, | ||||
| 			    unsigned int *i_drives); | ||||
|     char *scsi_tuple; | ||||
|   } generic_img_private_t; | ||||
|    | ||||
|   driver_return_code_t close_tray_bsdi    (const char *psz_drive); | ||||
|   driver_return_code_t close_tray_freebsd (const char *psz_drive); | ||||
|   driver_return_code_t close_tray_linux   (const char *psz_drive); | ||||
|   driver_return_code_t close_tray_netbsd  (const char *psz_drive); | ||||
|   driver_return_code_t close_tray_os2     (const char *psz_drive); | ||||
|   driver_return_code_t close_tray_osx     (const char *psz_drive); | ||||
|   driver_return_code_t close_tray_solaris (const char *psz_drive); | ||||
|   driver_return_code_t close_tray_win32   (const char *psz_drive); | ||||
| 
 | ||||
|   bool cdio_have_netbsd(void); | ||||
|   CdIo_t * cdio_open_netbsd (const char *psz_source); | ||||
|   char * cdio_get_default_device_netbsd(void); | ||||
|   char **cdio_get_devices_netbsd(void); | ||||
|   /*! Set up CD-ROM for reading using the NetBSD 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_netbsd (const char *psz_source, | ||||
| 				const char *psz_access_mode); | ||||
| 
 | ||||
|   /*! DEPRICATED: use cdio_have_driver().
 | ||||
|     True if AIX driver is available. */ | ||||
|   bool cdio_have_aix    (void); | ||||
| 
 | ||||
|   /*! DEPRICATED: use cdio_have_driver().
 | ||||
|     True if BSDI driver is available. */ | ||||
|   bool cdio_have_bsdi    (void); | ||||
| 
 | ||||
|   /*! DEPRICATED: use cdio_have_driver().
 | ||||
|     True if FreeBSD driver is available. */ | ||||
|   bool cdio_have_freebsd (void); | ||||
| 
 | ||||
|   /*! DEPRICATED: use cdio_have_driver().
 | ||||
|     True if GNU/Linux driver is available. */ | ||||
|   bool cdio_have_linux   (void); | ||||
| 
 | ||||
|   /*! DEPRICATED: use cdio_have_driver().
 | ||||
|     True if Sun Solaris driver is available. */ | ||||
|   bool cdio_have_solaris (void); | ||||
| 
 | ||||
|   /*! DEPRICATED: use cdio_have_driver().
 | ||||
|     True if IBM OS2 driver is available. */ | ||||
|   bool cdio_have_os2     (void); | ||||
| 
 | ||||
|   /*! DEPRICATED: use cdio_have_driver().
 | ||||
|     True if Apple OSX driver is available. */ | ||||
|   bool cdio_have_osx     (void); | ||||
| 
 | ||||
|   /*! DEPRICATED: use cdio_have_driver().
 | ||||
|     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); | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
| #endif /* __CDIO_PRIVATE_H__ */ | ||||
| #endif | ||||
|  |  | |||
|  | @ -1,249 +0,0 @@ | |||
| /*
 | ||||
|   Copyright (C) 2004, 2005, 2006, 2008, 2009 Rocky Bernstein <rocky@gnu.org> | ||||
| 
 | ||||
|   This program is free software: you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|   the Free Software Foundation, either version 3 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, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| 
 | ||||
| /* Internal routines for CD I/O drivers. */ | ||||
| 
 | ||||
|  | ||||
| #ifndef __CDIO_GENERIC_H__ | ||||
| #define __CDIO_GENERIC_H__ | ||||
| 
 | ||||
| #if defined(HAVE_CONFIG_H) && !defined(LIBCDIO_CONFIG_H) | ||||
| # include "config.h" | ||||
| #endif | ||||
| 
 | ||||
| #include <cdio/cdio.h> | ||||
| #include <cdio/cdtext.h> | ||||
| #include <cdio/iso9660.h> | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
|   /*!
 | ||||
|     Things common to private device structures. Even though not all | ||||
|     devices may have some of these fields, by listing common ones | ||||
|     we facilitate writing generic routines and even cut-and-paste | ||||
|     code. | ||||
|    */ | ||||
|   typedef struct { | ||||
|     char *source_name;      /**< Name used in open. */ | ||||
|     bool  init;             /**< True if structure has been initialized */ | ||||
|     bool  toc_init;         /**< True if TOC read in */ | ||||
|     bool  b_cdtext_error;   /**< True if trouble reading CD-Text */ | ||||
|      | ||||
|     int   ioctls_debugged;  /**< for debugging */ | ||||
| 
 | ||||
|     /* Only one of data_source or fd is used; fd  is for CD-ROM
 | ||||
|        devices and the data_source for stream reading (bincue, nrg, toc, | ||||
|        network). | ||||
|      */ | ||||
|     CdioDataSource_t *data_source; | ||||
|     int     fd;             /**< File descriptor of device */ | ||||
|     track_t i_first_track;  /**< The starting track number. */ | ||||
|     track_t i_tracks;       /**< The number of tracks. */ | ||||
| 
 | ||||
|     uint8_t i_joliet_level; /**< 0 = no Joliet extensions.
 | ||||
| 			       1-3: Joliet level. */ | ||||
|     iso9660_pvd_t pvd;       | ||||
|     iso9660_svd_t svd;       | ||||
|     CdIo_t   *cdio;         /**< a way to call general cdio routines. */ | ||||
|     cdtext_t *cdtext;       /**< CD-Text for disc. */ | ||||
|     track_flags_t track_flags[CDIO_CD_MAX_TRACKS+1]; | ||||
| 
 | ||||
|     /* Memorized sense reply of the most recent SCSI command.
 | ||||
|        Recorded by driver implementations of cdio_funcs_t.run_mmc_cmd().  | ||||
|        Read by API function mmc_get_cmd_scsi_sense(). | ||||
|     */ | ||||
|     unsigned char  scsi_mmc_sense[263];   /* See SPC-3 4.5.3 : 252 bytes legal
 | ||||
|                                              but 263 bytes possible */ | ||||
|     int            scsi_mmc_sense_valid;  /* Number of valid sense bytes */ | ||||
| 
 | ||||
|     /* Memorized eventual system specific SCSI address tuple text.
 | ||||
|        Empty text means that there is no such text defined for the drive. | ||||
|        NULL means that the driver does not support "scsi-tuple". | ||||
|        To be read by cdio_get_arg("scsi-tuple"). | ||||
|        System specific suffixes to the key may demand and eventually | ||||
|        guarantee a further specified format. | ||||
|        E.g. "scsi-tuple-linux" guarantees either "Bus,Host,Channel,Target,Lun", | ||||
|                                or empty text, or NULL. No other forms. | ||||
|     */ | ||||
|     char *scsi_tuple; | ||||
|   } generic_img_private_t; | ||||
| 
 | ||||
|   /*!
 | ||||
|     Bogus eject media when there is no ejectable media, e.g. a disk image | ||||
|     We always return 2. Should we also free resources?  | ||||
|   */ | ||||
|   driver_return_code_t cdio_generic_unimplemented_eject_media (void *p_env); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Set the blocksize for subsequent reads.  | ||||
|      | ||||
|     @return -2 since it's not implemented. | ||||
|   */ | ||||
|   driver_return_code_t  | ||||
|   cdio_generic_unimplemented_set_blocksize (void *p_user_data,  | ||||
|                                             uint16_t i_blocksize); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Set the drive speed. | ||||
|      | ||||
|     @return -2 since it's not implemented. | ||||
|   */ | ||||
|   driver_return_code_t cdio_generic_unimplemented_set_speed (void *p_user_data, | ||||
|                                                              int i_speed); | ||||
|    | ||||
|   /*!
 | ||||
|     Release and free resources associated with cd.  | ||||
|   */ | ||||
|   void cdio_generic_free (void *p_env); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Initialize CD device. | ||||
|   */ | ||||
|   bool cdio_generic_init (void *p_env, int open_mode); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Reads into buf the next size bytes. | ||||
|     Returns -1 on error.  | ||||
|     Is in fact libc's read(). | ||||
|   */ | ||||
|   off_t cdio_generic_lseek (void *p_env, off_t offset, int whence); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Reads into buf the next size bytes. | ||||
|     Returns -1 on error.  | ||||
|     Is in fact libc's read(). | ||||
|   */ | ||||
|   ssize_t cdio_generic_read (void *p_env, void *p_buf, size_t size); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Reads a single form1 sector from cd device into data starting | ||||
|     from lsn. Returns 0 if no error.  | ||||
|   */ | ||||
|   int cdio_generic_read_form1_sector (void * user_data, void *data,  | ||||
|                                       lsn_t lsn); | ||||
|    | ||||
|   /*!
 | ||||
|     Release and free resources associated with stream or disk image. | ||||
|   */ | ||||
|   void cdio_generic_stdio_free (void *env); | ||||
| 
 | ||||
|   /*!  
 | ||||
|     Return true if source_name could be a device containing a CD-ROM on | ||||
|     Win32 | ||||
|   */ | ||||
|   bool cdio_is_device_win32(const char *source_name); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Return true if source_name could be a device containing a CD-ROM on | ||||
|     OS/2 | ||||
|   */ | ||||
|   bool cdio_is_device_os2(const char *source_name); | ||||
| 
 | ||||
|    | ||||
|   /*!  
 | ||||
|     Return true if source_name could be a device containing a CD-ROM on | ||||
|     most Unix servers with block and character devices. | ||||
|   */ | ||||
|   bool cdio_is_device_generic(const char *source_name); | ||||
| 
 | ||||
|    | ||||
|   /*!  
 | ||||
|     Like above, but don't give a warning device doesn't exist. | ||||
|   */ | ||||
|   bool cdio_is_device_quiet_generic(const char *source_name); | ||||
| 
 | ||||
|   /*! 
 | ||||
|     Get cdtext information for a CdIo object . | ||||
|      | ||||
|     @param obj the CD object that may contain CD-TEXT information. | ||||
|     @return the CD-TEXT object or NULL if obj is NULL | ||||
|     or CD-TEXT information does not exist. | ||||
|   */ | ||||
|   cdtext_t *get_cdtext_generic (void *p_user_data); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Return the number of of the first track.  | ||||
|     CDIO_INVALID_TRACK is returned on error. | ||||
|   */ | ||||
|   track_t get_first_track_num_generic(void *p_user_data); | ||||
| 
 | ||||
|   /*!
 | ||||
|     Return the number of tracks in the current medium. | ||||
|   */ | ||||
|   track_t get_num_tracks_generic(void *p_user_data); | ||||
|    | ||||
|   /*! 
 | ||||
|     Get disc type associated with cd object. | ||||
|   */ | ||||
|   discmode_t get_discmode_generic (void *p_user_data ); | ||||
|    | ||||
|   /*! 
 | ||||
|     Same as above but only handles CD cases | ||||
|   */ | ||||
|   discmode_t get_discmode_cd_generic (void *p_user_data ); | ||||
|    | ||||
|   /*! Return number of channels in track: 2 or 4; -2 if not
 | ||||
|     implemented or -1 for error. | ||||
|     Not meaningful if track is not an audio track. | ||||
|   */ | ||||
|   int  get_track_channels_generic(const void *p_user_data, track_t i_track); | ||||
|    | ||||
|   /*! Return 1 if copy is permitted on the track, 0 if not, or -1 for error.
 | ||||
|     Is this meaningful if not an audio track? | ||||
|   */ | ||||
|   track_flag_t get_track_copy_permit_generic(void *p_user_data,  | ||||
| 					     track_t i_track); | ||||
|    | ||||
|   /*! Return 1 if track has pre-emphasis, 0 if not, or -1 for error.
 | ||||
|     Is this meaningful if not an audio track? | ||||
|      | ||||
|     pre-emphasis is a non linear frequency response. | ||||
|   */ | ||||
|   track_flag_t get_track_preemphasis_generic(const void *p_user_data,  | ||||
| 					     track_t i_track); | ||||
|    | ||||
|   /*!
 | ||||
|     Read cdtext information for a CdIo object . | ||||
|    | ||||
|     return true on success, false on error or CD-Text information does | ||||
|     not exist. | ||||
|   */ | ||||
|   uint8_t * read_cdtext_generic (void *p_env); | ||||
|    | ||||
|   void set_track_flags(track_flags_t *p_track_flag, uint8_t flag); | ||||
|    | ||||
|   /*! Read mode 1 or mode2 sectors (using cooked mode).  */ | ||||
|   driver_return_code_t read_data_sectors_generic (void *p_user_data,  | ||||
| 						  void *p_buf, lsn_t i_lsn,  | ||||
| 						  uint16_t i_blocksize,  | ||||
| 						  uint32_t i_blocks); | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif /* __cplusplus */ | ||||
| 
 | ||||
| #endif /* __CDIO_GENERIC_H__ */ | ||||
| 
 | ||||
|  | ||||
| /* 
 | ||||
|  * Local variables: | ||||
|  *  c-file-style: "gnu" | ||||
|  *  tab-width: 8 | ||||
|  *  indent-tabs-mode: nil | ||||
|  * End: | ||||
|  */ | ||||
|  | @ -1,150 +0,0 @@ | |||
| /* private MMC helper routines.
 | ||||
|   Copyright (C) 2004, 2005, 2006, 2008 Rocky Bernstein <rocky@gnu.org> | ||||
| 
 | ||||
|   This program is free software: you can redistribute it and/or modify | ||||
|   it under the terms of the GNU General Public License as published by | ||||
|   the Free Software Foundation, either version 3 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, see <http://www.gnu.org/licenses/>.
 | ||||
| */ | ||||
| 
 | ||||
| #include <cdio/mmc.h> | ||||
| 
 | ||||
| /*! Convert milliseconds to seconds taking the ceiling value, i.e.
 | ||||
|     1002 milliseconds gets rounded to 2 seconds. | ||||
| */ | ||||
| #define SECS2MSECS 1000 | ||||
| static inline unsigned int  | ||||
| msecs2secs(unsigned int msecs)  | ||||
| { | ||||
|   return (msecs+(SECS2MSECS-1)) / SECS2MSECS; | ||||
| } | ||||
| #undef SECS2MSECS | ||||
| 
 | ||||
| /***********************************************************
 | ||||
|   MMC CdIo Operations which a driver may use.  | ||||
|   These are not directly user-accessible. | ||||
| ************************************************************/ | ||||
| /*!
 | ||||
|   Read Audio Subchannel information | ||||
|    | ||||
|   @param p_user_data the CD object to be acted upon. | ||||
|    | ||||
| */ | ||||
| driver_return_code_t | ||||
| audio_read_subchannel_mmc ( void *p_user_data,  | ||||
| 			    cdio_subchannel_t *p_subchannel); | ||||
| 
 | ||||
| /*!
 | ||||
|   Get the block size for subsequest read requests, via a SCSI MMC  | ||||
|   MODE_SENSE 6 command. | ||||
| */ | ||||
| int get_blocksize_mmc (void *p_user_data); | ||||
| 
 | ||||
| /*!  
 | ||||
|   Get the lsn of the end of the CD | ||||
|    | ||||
|   @return the lsn. On error return CDIO_INVALID_LSN. | ||||
| */ | ||||
| lsn_t get_disc_last_lsn_mmc( void *p_user_data ); | ||||
|    | ||||
| void get_drive_cap_mmc (const void *p_user_data, | ||||
| 			/*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); | ||||
| 
 | ||||
| int get_media_changed_mmc (const void *p_user_data); | ||||
| 
 | ||||
| char *get_mcn_mmc (const void *p_user_data); | ||||
| 
 | ||||
| driver_return_code_t get_tray_status (const void *p_user_data); | ||||
| 
 | ||||
| /*! Read just the user data part of some sort of data sector (via 
 | ||||
|     mmc_read_cd).  | ||||
| 
 | ||||
|     @param p_user_data object to read from | ||||
| 
 | ||||
|     @param p_buf place to read data into.  The caller should make sure | ||||
|                  this location can store at least CDIO_CD_FRAMESIZE, | ||||
|                  M2RAW_SECTOR_SIZE, or M2F2_SECTOR_SIZE depending on | ||||
|                  the kind of sector getting read. If you don't know | ||||
|                  whether you have a Mode 1/2, Form 1/ Form 2/Formless | ||||
|                  sector best to reserve space for the maximum, | ||||
|                  M2RAW_SECTOR_SIZE. | ||||
| 
 | ||||
|     @param i_lsn sector to read | ||||
|     @param i_blocksize size of block. Should be either CDIO_CD_FRAMESIZE,  | ||||
|     M2RAW_SECTOR_SIZE, or M2F2_SECTOR_SIZE. See comment above under p_buf. | ||||
| 
 | ||||
| */ | ||||
| driver_return_code_t read_data_sectors_mmc ( void *p_user_data,  | ||||
| 					     void *p_buf,  lsn_t i_lsn, | ||||
| 					     uint16_t i_blocksize, | ||||
| 					     uint32_t i_blocks ); | ||||
| char *get_mcn_mmc (const void *p_user_data); | ||||
| 
 | ||||
| /* Set read blocksize (via MMC) */ | ||||
| driver_return_code_t set_blocksize_mmc (void *p_user_data,  | ||||
| 					uint16_t i_blocksize); | ||||
| 
 | ||||
| /* Set the drive speed in CD-ROM speed units (via MMC). */ | ||||
| driver_return_code_t set_drive_speed_mmc (void *p_user_data, int i_speed); | ||||
| 
 | ||||
| /* Set CD-ROM drive speed  in K bytes per second. (via MMC) */ | ||||
| driver_return_code_t set_speed_mmc (void *p_user_data, int i_Kbs_speed); | ||||
| 
 | ||||
| /***********************************************************
 | ||||
|   Miscellaenous other "private" routines. Probably need | ||||
|   to better classify these. | ||||
| ************************************************************/ | ||||
| 
 | ||||
| typedef driver_return_code_t (*mmc_run_cmd_fn_t)  | ||||
|      ( void *p_user_data,  | ||||
|        unsigned int i_timeout_ms, | ||||
|        unsigned int i_cdb,  | ||||
|        const mmc_cdb_t *p_cdb,  | ||||
|        cdio_mmc_direction_t e_direction,  | ||||
|        unsigned int i_buf, /*in/out*/ void *p_buf ); | ||||
| 			      | ||||
| int mmc_set_blocksize_mmc_private ( const void *p_env, const | ||||
| 				    mmc_run_cmd_fn_t run_mmc_cmd, | ||||
| 				    uint16_t i_blocksize ); | ||||
| 
 | ||||
| /*! 
 | ||||
|   Get the DVD type associated with cd object. | ||||
| */ | ||||
| discmode_t  | ||||
| mmc_get_dvd_struct_physical_private ( void *p_env, | ||||
| 				      mmc_run_cmd_fn_t run_mmc_cmd,  | ||||
| 				      cdio_dvd_struct_t *s ); | ||||
| 
 | ||||
| 
 | ||||
| char *mmc_get_mcn_private ( void *p_env, | ||||
| 			    mmc_run_cmd_fn_t run_mmc_cmd | ||||
| 			    ); | ||||
| 
 | ||||
| uint8_t * mmc_read_cdtext_private ( void *p_user_data,  | ||||
| 			       mmc_run_cmd_fn_t run_mmc_cmd | ||||
| 			       ); | ||||
| 
 | ||||
| /*!
 | ||||
|   On input a MODE_SENSE command was issued and we have the results | ||||
|   in p. We interpret this and return a bit mask set according to the  | ||||
|   capabilities. | ||||
|  */ | ||||
| void mmc_get_drive_cap_buf(const uint8_t *p, | ||||
| 			   /*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); | ||||
| 
 | ||||
| driver_return_code_t | ||||
| mmc_set_blocksize_private ( void *p_env,  | ||||
| 			    const mmc_run_cmd_fn_t run_mmc_cmd,  | ||||
| 			    uint16_t i_blocksize); | ||||
							
								
								
									
										12
									
								
								src/rufus.rc
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								src/rufus.rc
									
										
									
									
									
								
							|  | @ -33,7 +33,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL | |||
| IDD_DIALOG DIALOGEX 12, 12, 206, 278 | ||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||
| EXSTYLE WS_EX_APPWINDOW | ||||
| CAPTION "Rufus v1.0.7.122" | ||||
| CAPTION "Rufus v1.0.7.123" | ||||
| FONT 8, "MS Shell Dlg", 400, 0, 0x1 | ||||
| BEGIN | ||||
|     DEFPUSHBUTTON   "Start",IDC_START,94,236,50,14 | ||||
|  | @ -69,7 +69,7 @@ BEGIN | |||
|     DEFPUSHBUTTON   "OK",IDOK,231,175,50,14,WS_GROUP | ||||
|     CONTROL         "<a href=""http://rufus.akeo.ie"">http://rufus.akeo.ie</a>",IDC_ABOUT_RUFUS_URL, | ||||
|                     "SysLink",WS_TABSTOP,46,47,114,9 | ||||
|     LTEXT           "Version 1.0.7 (Build 122)",IDC_STATIC,46,19,78,8 | ||||
|     LTEXT           "Version 1.0.7 (Build 123)",IDC_STATIC,46,19,78,8 | ||||
|     PUSHBUTTON      "License...",IDC_ABOUT_LICENSE,46,175,50,14,WS_GROUP | ||||
|     EDITTEXT        IDC_ABOUT_COPYRIGHTS,46,107,235,63,ES_MULTILINE | ES_READONLY | WS_VSCROLL | ||||
|     LTEXT           "Report bugs or request enhancements at:",IDC_STATIC,46,66,187,8 | ||||
|  | @ -207,8 +207,8 @@ END | |||
| // | ||||
| 
 | ||||
| VS_VERSION_INFO VERSIONINFO | ||||
|  FILEVERSION 1,0,7,122 | ||||
|  PRODUCTVERSION 1,0,7,122 | ||||
|  FILEVERSION 1,0,7,123 | ||||
|  PRODUCTVERSION 1,0,7,123 | ||||
|  FILEFLAGSMASK 0x3fL | ||||
| #ifdef _DEBUG | ||||
|  FILEFLAGS 0x1L | ||||
|  | @ -225,13 +225,13 @@ BEGIN | |||
|         BEGIN | ||||
|             VALUE "CompanyName", "akeo.ie" | ||||
|             VALUE "FileDescription", "Rufus" | ||||
|             VALUE "FileVersion", "1.0.7.122" | ||||
|             VALUE "FileVersion", "1.0.7.123" | ||||
|             VALUE "InternalName", "Rufus" | ||||
|             VALUE "LegalCopyright", "© 2011 Pete Batard (GPL v3)" | ||||
|             VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" | ||||
|             VALUE "OriginalFilename", "rufus.exe" | ||||
|             VALUE "ProductName", "Rufus" | ||||
|             VALUE "ProductVersion", "1.0.7.122" | ||||
|             VALUE "ProductVersion", "1.0.7.123" | ||||
|         END | ||||
|     END | ||||
|     BLOCK "VarFileInfo" | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue