| 1 |
/* -*- c -*- |
| 2 |
Copyright (C) 2006, 2008, 2011 Rocky Bernstein <[email protected]> |
| 3 |
See end for license. |
| 4 |
*/ |
| 5 |
%define DOCSTRING |
| 6 |
"A Perl wrapper for The CD Input and Control library's ISO-9660 library's |
| 7 |
MultiMedia Commands (MMC)." |
| 8 |
%enddef |
| 9 |
%module(docstring=DOCSTRING) perlmmc |
| 10 |
|
| 11 |
/* See <cdio/mmc.h> for more extensive documentation. */ |
| 12 |
|
| 13 |
%{ |
| 14 |
/* Includes the header in the wrapper code */ |
| 15 |
#include <cdio/cdio.h> |
| 16 |
#include <cdio/mmc.h> |
| 17 |
%} |
| 18 |
|
| 19 |
#include <cdio/cdio.h> |
| 20 |
#include <cdio/mmc.h> |
| 21 |
|
| 22 |
%include "types.swg" |
| 23 |
|
| 24 |
typedef long int cdio_mmc_level_t; |
| 25 |
|
| 26 |
%constant long int GPCMD_INQUIRY = CDIO_MMC_GPCMD_INQUIRY; |
| 27 |
%constant long int GPCMD_MODE_SELECT_6 = CDIO_MMC_GPCMD_MODE_SELECT_6; |
| 28 |
%constant long int GPCMD_MODE_SENSE_6 = CDIO_MMC_GPCMD_MODE_SENSE_6; |
| 29 |
%constant long int GPCMD_START_STOP = CDIO_MMC_GPCMD_START_STOP; |
| 30 |
%constant long int GPCMD_ALLOW_MEDIUM_REMOVAL = |
| 31 |
CDIO_MMC_GPCMD_ALLOW_MEDIUM_REMOVAL; |
| 32 |
|
| 33 |
/** Group 2 Commands (CDB's here are 10-bytes) */ |
| 34 |
|
| 35 |
%constant long int CDIO_MMC_GPCMD_READ_10 = CDIO_MMC_GPCMD_READ_10; |
| 36 |
%constant long int GPCMD_READ_SUBCHANNEL = CDIO_MMC_GPCMD_READ_SUBCHANNEL; |
| 37 |
%constant long int GPCMD_READ_HEADER = CDIO_MMC_GPCMD_READ_HEADER; |
| 38 |
%constant long int GPCMD_PLAY_AUDIO_10 = CDIO_MMC_GPCMD_PLAY_AUDIO_10; |
| 39 |
%constant long int GPCMD_GET_CONFIGURATION = CDIO_MMC_GPCMD_GET_CONFIGURATION; |
| 40 |
%constant long int GPCMD_PLAY_AUDIO_MSF = CDIO_MMC_GPCMD_PLAY_AUDIO_MSF; |
| 41 |
%constant long int GPCMD_PLAY_AUDIO_TI = CDIO_MMC_GPCMD_PLAY_AUDIO_TI; |
| 42 |
%constant long int GPCMD_PLAY_TRACK_REL_10 = CDIO_MMC_GPCMD_PLAY_TRACK_REL_10; |
| 43 |
%constant long int GPCMD_GET_EVENT_STATUS = CDIO_MMC_GPCMD_GET_EVENT_STATUS; |
| 44 |
%constant long int GPCMD_PAUSE_RESUME = CDIO_MMC_GPCMD_PAUSE_RESUME; |
| 45 |
%constant long int GPCMD_READ_DISC_INFO = CDIO_MMC_GPCMD_READ_DISC_INFO; |
| 46 |
%constant long int GPCMD_MODE_SELECT_10 = CDIO_MMC_GPCMD_MODE_SELECT_10; |
| 47 |
%constant long int GPCMD_MODE_SENSE_10 = CDIO_MMC_GPCMD_MODE_SENSE_10; |
| 48 |
%constant long int GPCMD_PLAY_AUDIO_12 = CDIO_MMC_GPCMD_PLAY_AUDIO_12; |
| 49 |
%constant long int GPCMD_LOAD_UNLOAD = CDIO_MMC_GPCMD_LOAD_UNLOAD; |
| 50 |
%constant long int GPCMD_READ_12 = CDIO_MMC_GPCMD_READ_12; |
| 51 |
%constant long int GPCMD_PLAY_TRACK_REL_12 = CDIO_MMC_GPCMD_PLAY_TRACK_REL_12; |
| 52 |
%constant long int GPCMD_READ_DVD_STRUCTURE= CDIO_MMC_GPCMD_READ_DVD_STRUCTURE; |
| 53 |
%constant long int GPCMD_READ_MSF = CDIO_MMC_GPCMD_READ_MSF; |
| 54 |
%constant long int GPCMD_SET_SPEED = CDIO_MMC_GPCMD_SET_SPEED; |
| 55 |
%constant long int GPCMD_READ_CD = CDIO_MMC_GPCMD_READ_CD; |
| 56 |
|
| 57 |
/** Vendor-unique Commands */ |
| 58 |
%constant long int GPCMD_CD_PLAYBACK_STATUS= CDIO_MMC_GPCMD_CD_PLAYBACK_STATUS; |
| 59 |
%constant long int GPCMD_PLAYBACK_CONTROL = CDIO_MMC_GPCMD_PLAYBACK_CONTROL; |
| 60 |
%constant long int GPCMD_READ_CDDA = CDIO_MMC_GPCMD_READ_CDDA; |
| 61 |
%constant long int GPCMD_READ_CDXA = CDIO_MMC_GPCMD_READ_CDXA; |
| 62 |
%constant long int GPCMD_READ_ALL_SUBCODES = CDIO_MMC_GPCMD_READ_ALL_SUBCODES; |
| 63 |
|
| 64 |
/** Read Subchannel states */ |
| 65 |
%constant long int READ_SUB_ST_INVALID = CDIO_MMC_READ_SUB_ST_INVALID; |
| 66 |
%constant long int READ_SUB_ST_PLAY = CDIO_MMC_READ_SUB_ST_PLAY; |
| 67 |
%constant long int READ_SUB_ST_PAUSED = CDIO_MMC_READ_SUB_ST_PAUSED; |
| 68 |
%constant long int READ_SUB_ST_COMPLETED = CDIO_MMC_READ_SUB_ST_COMPLETED; |
| 69 |
%constant long int READ_SUB_ST_ERROR = CDIO_MMC_READ_SUB_ST_ERROR; |
| 70 |
%constant long int READ_SUB_ST_NO_STATUS = CDIO_MMC_READ_SUB_ST_NO_STATUS; |
| 71 |
|
| 72 |
%constant long int READ_TYPE_ANY = CDIO_MMC_READ_TYPE_ANY; |
| 73 |
%constant long int READ_TYPE_CDDA = CDIO_MMC_READ_TYPE_CDDA; |
| 74 |
%constant long int READ_TYPE_MODE1 = CDIO_MMC_READ_TYPE_MODE1; |
| 75 |
%constant long int READ_TYPE_MODE2 = CDIO_MMC_READ_TYPE_MODE2; |
| 76 |
%constant long int READ_TYPE_M2F1 = CDIO_MMC_READ_TYPE_M2F1; |
| 77 |
%constant long int READ_TYPE_M2F2 = CDIO_MMC_READ_TYPE_M2F2; |
| 78 |
|
| 79 |
/*! Format values for READ_TOC */ |
| 80 |
%constant long int READTOC_FMT_TOC = CDIO_MMC_READTOC_FMT_TOC; |
| 81 |
%constant long int READTOC_FMT_SESSION = CDIO_MMC_READTOC_FMT_SESSION; |
| 82 |
%constant long int READTOC_FMT_FULTOC = CDIO_MMC_READTOC_FMT_FULTOC; |
| 83 |
|
| 84 |
%constant long int CDIO_MMC_READTOC_FMT_PMA= CDIO_MMC_READTOC_FMT_PMA; |
| 85 |
%constant long int READTOC_FMT_PMA = CDIO_MMC_READTOC_FMT_PMA; |
| 86 |
%constant long int READTOC_FMT_ATIP = CDIO_MMC_READTOC_FMT_ATIP; |
| 87 |
%constant long int READTOC_FMT_CDTEXT = CDIO_MMC_READTOC_FMT_CDTEXT; |
| 88 |
|
| 89 |
/* Page codes for MODE SENSE and MODE SET. */ |
| 90 |
%constant long int R_W_ERROR_PAGE = CDIO_MMC_R_W_ERROR_PAGE; |
| 91 |
%constant long int WRITE_PARMS_PAGE = CDIO_MMC_WRITE_PARMS_PAGE; |
| 92 |
%constant long int CDR_PARMS_PAGE = CDIO_MMC_CDR_PARMS_PAGE; |
| 93 |
%constant long int AUDIO_CTL_PAGE = CDIO_MMC_AUDIO_CTL_PAGE; |
| 94 |
%constant long int POWER_PAGE = CDIO_MMC_POWER_PAGE; |
| 95 |
%constant long int FAULT_FAIL_PAGE = CDIO_MMC_FAULT_FAIL_PAGE; |
| 96 |
%constant long int TO_PROTECT_PAGE = CDIO_MMC_TO_PROTECT_PAGE; |
| 97 |
%constant long int CAPABILITIES_PAGE = CDIO_MMC_CAPABILITIES_PAGE; |
| 98 |
%constant long int ALL_PAGES = CDIO_MMC_ALL_PAGES; |
| 99 |
|
| 100 |
/* Return type codes for GET_CONFIGURATION. */ |
| 101 |
%constant long int GET_CONF_ALL_FEATURES = CDIO_MMC_GET_CONF_ALL_FEATURES; |
| 102 |
%constant long int GET_CONF_CURRENT_FEATURES= CDIO_MMC_GET_CONF_CURRENT_FEATURES; |
| 103 |
%constant long int GET_CONF_NAMED_FEATURE = CDIO_MMC_GET_CONF_NAMED_FEATURE; |
| 104 |
|
| 105 |
/* FEATURE codes used in GET CONFIGURATION. */ |
| 106 |
%constant long int FEATURE_PROFILE_LIST = CDIO_MMC_FEATURE_PROFILE_LIST; |
| 107 |
%constant long int FEATURE_CORE = CDIO_MMC_FEATURE_CORE; |
| 108 |
%constant long int FEATURE_MORPHING = CDIO_MMC_FEATURE_MORPHING; |
| 109 |
%constant long int FEATURE_REMOVABLE_MEDIUM= CDIO_MMC_FEATURE_REMOVABLE_MEDIUM; |
| 110 |
%constant long int FEATURE_WRITE_PROTECT = CDIO_MMC_FEATURE_WRITE_PROTECT; |
| 111 |
%constant long int FEATURE_RANDOM_READABLE = CDIO_MMC_FEATURE_RANDOM_READABLE; |
| 112 |
%constant long int FEATURE_MULTI_READ = CDIO_MMC_FEATURE_MULTI_READ; |
| 113 |
%constant long int FEATURE_CD_READ = CDIO_MMC_FEATURE_CD_READ; |
| 114 |
%constant long int FEATURE_DVD_READ = CDIO_MMC_FEATURE_DVD_READ; |
| 115 |
%constant long int FEATURE_RANDOM_WRITABLE = CDIO_MMC_FEATURE_RANDOM_WRITABLE; |
| 116 |
%constant long int FEATURE_INCR_WRITE = CDIO_MMC_FEATURE_INCR_WRITE; |
| 117 |
%constant long int FEATURE_SECTOR_ERASE = CDIO_MMC_FEATURE_SECTOR_ERASE; |
| 118 |
%constant long int FEATURE_FORMATABLE = CDIO_MMC_FEATURE_FORMATABLE; |
| 119 |
%constant long int FEATURE_DEFECT_MGMT = CDIO_MMC_FEATURE_DEFECT_MGMT; |
| 120 |
%constant long int FEATURE_WRITE_ONCE = CDIO_MMC_FEATURE_WRITE_ONCE; |
| 121 |
%constant long int FEATURE_RESTRICT_OVERW = CDIO_MMC_FEATURE_RESTRICT_OVERW; |
| 122 |
%constant long int FEATURE_CD_RW_CAV = CDIO_MMC_FEATURE_CD_RW_CAV; |
| 123 |
%constant long int FEATURE_MRW = CDIO_MMC_FEATURE_MRW; |
| 124 |
%constant long int FEATURE_ENHANCED_DEFECT = CDIO_MMC_FEATURE_ENHANCED_DEFECT; |
| 125 |
%constant long int FEATURE_DVD_PRW = CDIO_MMC_FEATURE_DVD_PRW; |
| 126 |
%constant long int FEATURE_DVD_PR = CDIO_MMC_FEATURE_DVD_PR; |
| 127 |
%constant long int FEATURE_RIGID_RES_OVERW = CDIO_MMC_FEATURE_RIGID_RES_OVERW; |
| 128 |
%constant long int FEATURE_CD_TAO = CDIO_MMC_FEATURE_CD_TAO; |
| 129 |
%constant long int FEATURE_CD_SAO = CDIO_MMC_FEATURE_CD_SAO; |
| 130 |
%constant long int FEATURE_DVD_R_RW_WRITE = CDIO_MMC_FEATURE_DVD_R_RW_WRITE; |
| 131 |
%constant long int FEATURE_CD_RW_MEDIA_WRITE= CDIO_MMC_FEATURE_CD_RW_MEDIA_WRITE; |
| 132 |
%constant long int FEATURE_DVD_PR_2_LAYER = CDIO_MMC_FEATURE_DVD_PR_2_LAYER; |
| 133 |
%constant long int FEATURE_POWER_MGMT = CDIO_MMC_FEATURE_POWER_MGMT; |
| 134 |
%constant long int FEATURE_CDDA_EXT_PLAY = CDIO_MMC_FEATURE_CDDA_EXT_PLAY; |
| 135 |
%constant long int FEATURE_MCODE_UPGRADE = CDIO_MMC_FEATURE_MCODE_UPGRADE; |
| 136 |
%constant long int FEATURE_TIME_OUT = CDIO_MMC_FEATURE_TIME_OUT; |
| 137 |
%constant long int FEATURE_DVD_CSS = CDIO_MMC_FEATURE_DVD_CSS; |
| 138 |
%constant long int FEATURE_RT_STREAMING = CDIO_MMC_FEATURE_RT_STREAMING; |
| 139 |
%constant long int FEATURE_LU_SN = CDIO_MMC_FEATURE_LU_SN; |
| 140 |
%constant long int FEATURE_FIRMWARE_DATE = CDIO_MMC_FEATURE_FIRMWARE_DATE; |
| 141 |
/* Profile profile codes used in GET_CONFIGURATION - PROFILE LIST. */ |
| 142 |
|
| 143 |
%constant long int FEATURE_PROF_NON_REMOVABLE = CDIO_MMC_FEATURE_PROF_NON_REMOVABLE; |
| 144 |
%constant long int FEATURE_PROF_REMOVABLE = CDIO_MMC_FEATURE_PROF_REMOVABLE; |
| 145 |
%constant long int FEATURE_PROF_MO_ERASABLE= CDIO_MMC_FEATURE_PROF_MO_ERASABLE; |
| 146 |
%constant long int FEATURE_PROF_MO_WRITE_ONCE= CDIO_MMC_FEATURE_PROF_MO_WRITE_ONCE; |
| 147 |
|
| 148 |
%constant long int FEATURE_PROF_AS_MO = CDIO_MMC_FEATURE_PROF_AS_MO; |
| 149 |
%constant long int FEATURE_PROF_CD_ROM = CDIO_MMC_FEATURE_PROF_CD_ROM; |
| 150 |
%constant long int FEATURE_PROF_CD_R = CDIO_MMC_FEATURE_PROF_CD_R; |
| 151 |
%constant long int FEATURE_PROF_CD_RW = CDIO_MMC_FEATURE_PROF_CD_RW; |
| 152 |
%constant long int FEATURE_PROF_DVD_ROM = CDIO_MMC_FEATURE_PROF_DVD_ROM; |
| 153 |
%constant long int FEATURE_PROF_DVD_R_SEQ = CDIO_MMC_FEATURE_PROF_DVD_R_SEQ; |
| 154 |
%constant long int FEATURE_PROF_DVD_RAM = CDIO_MMC_FEATURE_PROF_DVD_RAM; |
| 155 |
%constant long int FEATURE_PROF_DVD_RW_RO = CDIO_MMC_FEATURE_PROF_DVD_RW_RO; |
| 156 |
%constant long int FEATURE_PROF_DVD_RW_SEQ = CDIO_MMC_FEATURE_PROF_DVD_RW_SEQ; |
| 157 |
%constant long int FEATURE_PROF_DVD_PRW = CDIO_MMC_FEATURE_PROF_DVD_PRW; |
| 158 |
%constant long int FEATURE_PROF_DVD_PR = CDIO_MMC_FEATURE_PROF_DVD_PR; |
| 159 |
%constant long int FEATURE_PROF_DDCD_ROM = CDIO_MMC_FEATURE_PROF_DDCD_ROM; |
| 160 |
%constant long int FEATURE_PROF_DDCD_R = CDIO_MMC_FEATURE_PROF_DDCD_R; |
| 161 |
%constant long int FEATURE_PROF_DDCD_RW = CDIO_MMC_FEATURE_PROF_DDCD_RW; |
| 162 |
%constant long int FEATURE_PROF_DVD_PR = CDIO_MMC_FEATURE_PROF_DVD_PR; |
| 163 |
%constant long int FEATURE_PROF_NON_CONFORM= CDIO_MMC_FEATURE_PROF_NON_CONFORM; |
| 164 |
%constant long int FEATURE_INTERFACE_UNSPECIFIED = CDIO_MMC_FEATURE_INTERFACE_UNSPECIFIED; |
| 165 |
%constant long int FEATURE_INTERFACE_SCSI = CDIO_MMC_FEATURE_INTERFACE_SCSI; |
| 166 |
%constant long int FEATURE_INTERFACE_ATAPI = CDIO_MMC_FEATURE_INTERFACE_ATAPI; |
| 167 |
%constant long int FEATURE_INTERFACE_IEEE_1394= CDIO_MMC_FEATURE_INTERFACE_IEEE_1394; |
| 168 |
%constant long int FEATURE_INTERFACE_IEEE_1394A= CDIO_MMC_FEATURE_INTERFACE_IEEE_1394A; |
| 169 |
%constant long int FEATURE_INTERFACE_FIBRE_CH= CDIO_MMC_FEATURE_INTERFACE_FIBRE_CH; |
| 170 |
|
| 171 |
|
| 172 |
%feature("autodoc", |
| 173 |
"Read Audio Subchannel information |
| 174 |
|
| 175 |
param p_cdio the CD object to be acted upon. |
| 176 |
param p_subchannel place for returned subchannel information |
| 177 |
."); |
| 178 |
%rename mmc_audio_read_subchannel audio_read_subchannel; |
| 179 |
|
| 180 |
%feature("autodoc", |
| 181 |
"Return a string containing the name of the audio state as returned from |
| 182 |
the Q_SUBCHANNEL. |
| 183 |
"); |
| 184 |
%rename mmc_audio_state2str audio_state2str; |
| 185 |
|
| 186 |
/*! |
| 187 |
Eject using MMC commands. If CD-ROM is "locked" we'll unlock it. |
| 188 |
Command is not "immediate" -- we'll wait for the command to complete. |
| 189 |
For a more general (and lower-level) routine, @see mmc_start_stop_media. |
| 190 |
*/ |
| 191 |
//%rename mmc_eject_media eject_media; |
| 192 |
int mmc_eject_media(const CdIo_t *p_cdio); |
| 193 |
%inline %{ |
| 194 |
extern int mmc_eject_media(const CdIo_t *p_cdio); |
| 195 |
%} |
| 196 |
/*! |
| 197 |
Return a string containing the name of the given feature |
| 198 |
*/ |
| 199 |
%rename mmc_feature2str feature2str; |
| 200 |
|
| 201 |
/*! |
| 202 |
Return a string containing the name of the given feature |
| 203 |
*/ |
| 204 |
%rename mmc_feature_profile2str feature_profile2str; |
| 205 |
|
| 206 |
/*! |
| 207 |
Return the length in bytes of the Command Descriptor |
| 208 |
Buffer (CDB) for a given MMC command. The length will be |
| 209 |
either 6, 10, or 12. |
| 210 |
*/ |
| 211 |
%rename mmc_get_cmd_len get_cmd_len; |
| 212 |
|
| 213 |
/*! |
| 214 |
Get the block size used in read requests, via MMC. |
| 215 |
@return the blocksize if > 0; error if <= 0 |
| 216 |
*/ |
| 217 |
%rename mmc_get_blocksize get_blocksize; |
| 218 |
|
| 219 |
/*! |
| 220 |
Get the lsn of the end of the CD |
| 221 |
|
| 222 |
@return the lsn. On error return CDIO_INVALID_LSN. |
| 223 |
*/ |
| 224 |
%rename mmc_get_disc_last_lsn get_lsn; |
| 225 |
|
| 226 |
/*! |
| 227 |
Return the discmode as reported by the MMC Read (FULL) TOC |
| 228 |
command. |
| 229 |
|
| 230 |
Information was obtained from Section 5.1.13 (Read TOC/PMA/ATIP) |
| 231 |
pages 56-62 from the MMC draft specification, revision 10a |
| 232 |
at http://www.t10.org/ftp/t10/drafts/mmc/mmc-r10a.pdf See |
| 233 |
especially tables 72, 73 and 75. |
| 234 |
*/ |
| 235 |
%rename mmc_get_discmode get_discmode; |
| 236 |
|
| 237 |
/*! |
| 238 |
Get drive capabilities for a device. |
| 239 |
@return the drive capabilities. |
| 240 |
*/ |
| 241 |
%rename mmc_get_drive_cap get_drive_cap; |
| 242 |
|
| 243 |
/*! |
| 244 |
Get the MMC level supported by the device. |
| 245 |
*/ |
| 246 |
%rename mmc_get_drive_mmc_cap get_drive_mmc_cap; |
| 247 |
|
| 248 |
/*! |
| 249 |
Get the DVD type associated with cd object. |
| 250 |
|
| 251 |
@return the DVD discmode. |
| 252 |
*/ |
| 253 |
%rename mmc_get_dvd_struct_physical get_dvd_struct_physical; |
| 254 |
|
| 255 |
/*! |
| 256 |
Get the CD-ROM hardware info via an MMC INQUIRY command. |
| 257 |
|
| 258 |
@return true if we were able to get hardware info, false if we had |
| 259 |
an error. |
| 260 |
*/ |
| 261 |
%rename mmc_get_hwinfo get_hwinfo; |
| 262 |
|
| 263 |
/*! |
| 264 |
Find out if media has changed since the last call. |
| 265 |
@param p_cdio the CD object to be acted upon. |
| 266 |
@return 1 if media has changed since last call, 0 if not. Error |
| 267 |
return codes are the same as driver_return_code_t |
| 268 |
*/ |
| 269 |
%rename mmc_get_media_changed get_media_changed; |
| 270 |
|
| 271 |
/*! |
| 272 |
Get the media catalog number (MCN) from the CD via MMC. |
| 273 |
|
| 274 |
@return the media catalog number r NULL if there is none or we |
| 275 |
don't have the ability to get it. |
| 276 |
|
| 277 |
Note: string is malloc'd so caller has to free() the returned |
| 278 |
string when done with it. |
| 279 |
|
| 280 |
*/ |
| 281 |
%rename mmc_get_mcn get_mcn; |
| 282 |
|
| 283 |
/** Get the output port volumes and port selections used on AUDIO PLAY |
| 284 |
commands via a MMC MODE SENSE command using the CD Audio Control |
| 285 |
Page. |
| 286 |
*/ |
| 287 |
%rename mmc_audio_get_volume audio_get_volume; |
| 288 |
|
| 289 |
/*! |
| 290 |
Report if CD-ROM has a praticular kind of interface (ATAPI, SCSCI, ...) |
| 291 |
Is it possible for an interface to have serveral? If not this |
| 292 |
routine could probably return the single mmc_feature_interface_t. |
| 293 |
@return true if we have the interface and false if not. |
| 294 |
*/ |
| 295 |
%rename mmc_have_interface have_interface; |
| 296 |
|
| 297 |
/*! Run a MODE_SENSE command (6- or 10-byte version) |
| 298 |
and put the results in p_buf |
| 299 |
@return DRIVER_OP_SUCCESS if we ran the command ok. |
| 300 |
*/ |
| 301 |
%rename mmc_mode_sense mode_sense; |
| 302 |
|
| 303 |
/*! Run a MODE_SENSE command (10-byte version) |
| 304 |
and put the results in p_buf |
| 305 |
@return DRIVER_OP_SUCCESS if we ran the command ok. |
| 306 |
*/ |
| 307 |
%rename mmc_mode_sense_10 mode_sense_10; |
| 308 |
|
| 309 |
/*! Run a MODE_SENSE command (6-byte version) |
| 310 |
and put the results in p_buf |
| 311 |
@return DRIVER_OP_SUCCESS if we ran the command ok. |
| 312 |
*/ |
| 313 |
%rename mmc_mode_sense_6 mode_sense_6; |
| 314 |
|
| 315 |
/*! Issue a MMC READ_CD command. |
| 316 |
|
| 317 |
@param p_cdio object to read from |
| 318 |
|
| 319 |
@param p_buf Place to store data. The caller should ensure that |
| 320 |
p_buf can hold at least i_blocksize * i_blocks bytes. |
| 321 |
|
| 322 |
@param i_lsn sector to read |
| 323 |
|
| 324 |
@param expected_sector_type restricts reading to a specific CD |
| 325 |
sector type. Only 3 bits with values 1-5 are used: |
| 326 |
0 all sector types |
| 327 |
1 CD-DA sectors only |
| 328 |
2 Mode 1 sectors only |
| 329 |
3 Mode 2 formless sectors only. Note in contrast to all other |
| 330 |
values an MMC CD-ROM is not required to support this mode. |
| 331 |
4 Mode 2 Form 1 sectors only |
| 332 |
5 Mode 2 Form 2 sectors only |
| 333 |
|
| 334 |
@param b_digital_audio_play Control error concealment when the |
| 335 |
data being read is CD-DA. If the data being read is not CD-DA, |
| 336 |
this parameter is ignored. If the data being read is CD-DA and |
| 337 |
DAP is false zero, then the user data returned should not be |
| 338 |
modified by flaw obscuring mechanisms such as audio data mute and |
| 339 |
interpolate. If the data being read is CD-DA and DAP is true, |
| 340 |
then the user data returned should be modified by flaw obscuring |
| 341 |
mechanisms such as audio data mute and interpolate. |
| 342 |
|
| 343 |
b_sync_header return the sync header (which will probably have |
| 344 |
the same value as CDIO_SECTOR_SYNC_HEADER of size |
| 345 |
CDIO_CD_SYNC_SIZE). |
| 346 |
|
| 347 |
@param header_codes Header Codes refer to the sector header and |
| 348 |
the sub-header that is present in mode 2 formed sectors: |
| 349 |
|
| 350 |
0 No header information is returned. |
| 351 |
1 The 4-byte sector header of data sectors is be returned, |
| 352 |
2 The 8-byte sector sub-header of mode 2 formed sectors is |
| 353 |
returned. |
| 354 |
3 Both sector header and sub-header (12 bytes) is returned. |
| 355 |
The Header preceeds the rest of the bytes (e.g. user-data bytes) |
| 356 |
that might get returned. |
| 357 |
|
| 358 |
@param b_user_data Return user data if true. |
| 359 |
|
| 360 |
For CD-DA, the User Data is CDIO_CD_FRAMESIZE_RAW bytes. |
| 361 |
|
| 362 |
For Mode 1, The User Data is ISO_BLOCKSIZE bytes beginning at |
| 363 |
offset CDIO_CD_HEADER_SIZE+CDIO_CD_SUBHEADER_SIZE. |
| 364 |
|
| 365 |
For Mode 2 formless, The User Data is M2RAW_SECTOR_SIZE bytes |
| 366 |
beginning at offset CDIO_CD_HEADER_SIZE+CDIO_CD_SUBHEADER_SIZE. |
| 367 |
|
| 368 |
For data Mode 2, form 1, User Data is ISO_BLOCKSIZE bytes beginning at |
| 369 |
offset CDIO_CD_XA_SYNC_HEADER. |
| 370 |
|
| 371 |
For data Mode 2, form 2, User Data is 2 324 bytes beginning at |
| 372 |
offset CDIO_CD_XA_SYNC_HEADER. |
| 373 |
|
| 374 |
@param b_sync |
| 375 |
|
| 376 |
@param b_edc_ecc true if we return EDC/ECC error detection/correction bits. |
| 377 |
|
| 378 |
The presence and size of EDC redundancy or ECC parity is defined |
| 379 |
according to sector type: |
| 380 |
|
| 381 |
CD-DA sectors have neither EDC redundancy nor ECC parity. |
| 382 |
|
| 383 |
Data Mode 1 sectors have 288 bytes of EDC redundancy, Pad, and |
| 384 |
ECC parity beginning at offset 2064. |
| 385 |
|
| 386 |
Data Mode 2 formless sectors have neither EDC redundancy nor ECC |
| 387 |
parity |
| 388 |
|
| 389 |
Data Mode 2 form 1 sectors have 280 bytes of EDC redundancy and |
| 390 |
ECC parity beginning at offset 2072 |
| 391 |
|
| 392 |
Data Mode 2 form 2 sectors optionally have 4 bytes of EDC |
| 393 |
redundancy beginning at offset 2348. |
| 394 |
|
| 395 |
|
| 396 |
@param c2_error_information If true associate a bit with each |
| 397 |
sector for C2 error The resulting bit field is ordered exactly as |
| 398 |
the main channel bytes. Each 8-bit boundary defines a byte of |
| 399 |
flag bits. |
| 400 |
|
| 401 |
@param subchannel_selection subchannel-selection bits |
| 402 |
|
| 403 |
0 No Sub-channel data shall be returned. (0 bytes) |
| 404 |
1 RAW P-W Sub-channel data shall be returned. (96 byte) |
| 405 |
2 Formatted Q sub-channel data shall be transferred (16 bytes) |
| 406 |
3 Reserved |
| 407 |
4 Corrected and de-interleaved R-W sub-channel (96 bytes) |
| 408 |
5-7 Reserved |
| 409 |
|
| 410 |
@param i_blocksize size of the a block expected to be returned |
| 411 |
|
| 412 |
@param i_blocks number of blocks expected to be returned. |
| 413 |
|
| 414 |
*/ |
| 415 |
%rename mmc_read_cd read_cd; |
| 416 |
|
| 417 |
/*! Read just the user data part of some sort of data sector (via |
| 418 |
mmc_read_cd). |
| 419 |
|
| 420 |
@param p_cdio object to read from |
| 421 |
|
| 422 |
@param p_buf place to read data into. The caller should make sure |
| 423 |
this location can store at least CDIO_CD_FRAMESIZE, |
| 424 |
M2RAW_SECTOR_SIZE, or M2F2_SECTOR_SIZE depending on |
| 425 |
the kind of sector getting read. If you don't know |
| 426 |
whether you have a Mode 1/2, Form 1/ Form 2/Formless |
| 427 |
sector best to reserve space for the maximum, |
| 428 |
M2RAW_SECTOR_SIZE. |
| 429 |
|
| 430 |
@param i_lsn sector to read |
| 431 |
@param i_blocksize size of each block |
| 432 |
@param i_blocks number of blocks to read |
| 433 |
|
| 434 |
*/ |
| 435 |
%rename mmc_read_data_sectors read_data_sectors; |
| 436 |
|
| 437 |
/*! Read sectors using SCSI-MMC GPCMD_READ_CD. |
| 438 |
Can read only up to 25 blocks. |
| 439 |
*/ |
| 440 |
%rename mmc_read_sectors read_sectors; |
| 441 |
|
| 442 |
/*! |
| 443 |
Run a Multimedia command (MMC). |
| 444 |
|
| 445 |
@param p_cdio CD structure set by cdio_open(). |
| 446 |
@param i_timeout_ms time in milliseconds we will wait for the command |
| 447 |
to complete. |
| 448 |
@param p_cdb CDB bytes. All values that are needed should be set |
| 449 |
on input. We'll figure out what the right CDB length |
| 450 |
should be. |
| 451 |
@param e_direction direction the transfer is to go. |
| 452 |
@param i_buf Size of buffer |
| 453 |
@param p_buf Buffer for data, both sending and receiving. |
| 454 |
|
| 455 |
@return 0 if command completed successfully. |
| 456 |
*/ |
| 457 |
%rename mmc_run_cmd run_cmd; |
| 458 |
|
| 459 |
/*! |
| 460 |
Set the block size for subsequest read requests, via MMC. |
| 461 |
*/ |
| 462 |
%rename mmc_set_blocksize set_blocksize; |
| 463 |
|
| 464 |
/*! |
| 465 |
Set the drive speed. |
| 466 |
*/ |
| 467 |
%rename mmc_set_speed set_speed; |
| 468 |
|
| 469 |
/*! |
| 470 |
Load or Unload media using a MMC START STOP command. |
| 471 |
|
| 472 |
@param p_cdio the CD object to be acted upon. |
| 473 |
@param b_eject eject if true and close tray if false |
| 474 |
@param b_immediate wait or don't wait for operation to complete |
| 475 |
@param power_condition Set CD-ROM to idle/standby/sleep. If nonzero |
| 476 |
eject/load is ignored, so set to 0 if you want to eject or load. |
| 477 |
|
| 478 |
@see mmc_eject_media or mmc_close_tray |
| 479 |
*/ |
| 480 |
%rename mmc_start_stop_unit stop_media; |
| 481 |
int mmc_start_stop_unit (const CdIo_t *p_cdio); |
| 482 |
%feature("autodoc", |
| 483 |
"mmc_start_stop_unit cmd, a more general (and lower-level) routine |
| 484 |
to eject media / open tray. mmc_eject_media sometimes does not work."); |
| 485 |
int mmc_close_tray(CdIo_t *p_cdio); |
| 486 |
|
| 487 |
|
| 488 |
extern char * mmc_get_isrc(CdIo_t *p_cdio, track_t track); |
| 489 |
%inline %{ |
| 490 |
extern int mmc_close_tray(CdIo_t *p_cdio); |
| 491 |
extern int mmc_start_stop_unit (const CdIo_t *p_cdio); |
| 492 |
extern char *mmc_get_track_isrc (const CdIo_t *p_cdio, track_t i_track); |
| 493 |
|
| 494 |
char * mmc_get_isrc(CdIo_t *p_cdio, track_t track) { |
| 495 |
return mmc_get_track_isrc (p_cdio, track); |
| 496 |
} |
| 497 |
%} |
| 498 |
|
| 499 |
%perlcode %{ |
| 500 |
|
| 501 |
import Device::Cdio::VERSION; |
| 502 |
$VERSION = $Device::Cdio::VERSION; |
| 503 |
use strict; |
| 504 |
|
| 505 |
=pod |
| 506 |
|
| 507 |
=head1 NAME |
| 508 |
|
| 509 |
perlmmc - lower-level wrapper to MMC from libcdio, the ISO 9660 library of the CD Input and Control package |
| 510 |
|
| 511 |
=head1 SYNOPSIS |
| 512 |
|
| 513 |
This is fairly straight-forward wrapper around the MultiMedia commands from |
| 514 |
the C library libcdio. Although this is perfectly usable on its own, it is expected that the interfaces L<Device::Cdio::MMC> or L<Device::Cdio::Device::MMC> |
| 515 |
is what most people will want to use. |
| 516 |
|
| 517 |
There are various constants that are defined here. |
| 518 |
|
| 519 |
=head1 METHODS |
| 520 |
|
| 521 |
=head2 this |
| 522 |
|
| 523 |
This seems to be an artifact of SWIG. |
| 524 |
|
| 525 |
=head1 SEE ALSO |
| 526 |
|
| 527 |
L<http://www.gnu.org/software/libcdio> has documentation on |
| 528 |
libcdio including the a manual and the API via doxygen. |
| 529 |
|
| 530 |
=head1 AUTHORS |
| 531 |
|
| 532 |
Rocky Bernstein C<< <rocky at cpan.org> >>. |
| 533 |
|
| 534 |
=head1 COPYRIGHT |
| 535 |
|
| 536 |
Copyright (C) 2006, 2008, 2011 Rocky Bernstein <[email protected]> |
| 537 |
|
| 538 |
This program is free software: you can redistribute it and/or modify |
| 539 |
it under the terms of the GNU General Public License as published by |
| 540 |
the Free Software Foundation, either version 3 of the License, or |
| 541 |
(at your option) any later version. |
| 542 |
|
| 543 |
This program is distributed in the hope that it will be useful, |
| 544 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 545 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 546 |
GNU General Public License for more details. |
| 547 |
|
| 548 |
You should have received a copy of the GNU General Public License |
| 549 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 550 |
|
| 551 |
=cut |
| 552 |
|
| 553 |
%} |