libcdio  0.82
cdda.h
Go to the documentation of this file.
00001 /*
00002   $Id: cdda.h,v 1.30 2008/03/25 15:59:08 karl Exp $
00003 
00004   Copyright (C) 2004, 2005, 2006, 2008 Rocky Bernstein <rocky@gnu.org>
00005   Copyright (C) 2001 Xiph.org and Heiko Eissfeldt heiko@escape.colossus.de
00006 
00007   This program is free software: you can redistribute it and/or modify
00008   it under the terms of the GNU General Public License as published by
00009   the Free Software Foundation, either version 3 of the License, or
00010   (at your option) any later version.
00011 
00012   This program is distributed in the hope that it will be useful,
00013   but WITHOUT ANY WARRANTY; without even the implied warranty of
00014   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015   GNU General Public License for more details.
00016 
00017   You should have received a copy of the GNU General Public License
00018   along with this program.  If not, see <http://www.gnu.org/licenses/>.
00019 */
00020 
00028 #ifndef _CDDA_INTERFACE_H_
00029 #define _CDDA_INTERFACE_H_
00030 
00031 #include <cdio/cdio.h>
00032 
00033 #ifdef __cplusplus
00034 extern "C" {
00035 #endif /* __cplusplus */
00036 
00040   typedef struct cdrom_paranoia_s cdrom_paranoia_t;
00041   typedef struct cdrom_drive_s   cdrom_drive_t;
00042   
00054   typedef enum {
00055     CDDA_MESSAGE_FORGETIT = 0,
00056     CDDA_MESSAGE_PRINTIT  = 1,
00057     CDDA_MESSAGE_LOGIT    = 2,
00058     CD_FRAMESAMPLES       = CDIO_CD_FRAMESIZE_RAW / 4,
00059     MAXTRK                = (CDIO_CD_MAX_TRACKS+1)
00060   } paranoia_cdda_enums_t;
00061   
00062 
00063 #include <signal.h>
00064 
00068 #define MAXTRK (CDIO_CD_MAX_TRACKS+1)
00069 
00071 typedef struct TOC_s {  
00072   unsigned char bTrack;
00073   int32_t       dwStartSector;
00074 } TOC_t;
00075 
00077 #define TOC TOC_t
00078 
00080 struct cdrom_drive_s {
00081 
00082   CdIo_t *p_cdio;
00083   int opened; 
00085   char *cdda_device_name;
00086 
00087   char *drive_model;
00088   int drive_type;
00089   int bigendianp; 
00093   int nsectors;   
00097   int cd_extra;   
00103   bool b_swap_bytes;  
00106   track_t tracks;
00107   TOC_t disc_toc[MAXTRK]; 
00112   lsn_t audio_first_sector;
00113   lsn_t audio_last_sector;
00114 
00115   int errordest;
00116   int messagedest;
00117   char *errorbuf;
00118   char *messagebuf;
00119 
00120   /* functions specific to particular drives/interfaces */
00121 
00122   int  (*enable_cdda)  (cdrom_drive_t *d, int onoff);
00123   int  (*read_toc)     (cdrom_drive_t *d);
00124   long (*read_audio)   (cdrom_drive_t *d, void *p, lsn_t begin, 
00125                        long sectors);
00126   int  (*set_speed)    (cdrom_drive_t *d, int speed);
00127   int error_retry;
00128   int report_all;
00129 
00130   int is_atapi;
00131   int is_mmc;
00132 
00133   int i_test_flags; 
00138 };
00139 
00140 
00149   typedef enum {
00150     CDDA_TEST_JITTER_SMALL   = 1,
00151     CDDA_TEST_JITTER_LARGE   = 2,
00152     CDDA_TEST_JITTER_MASSIVE = 3,
00153     CDDA_TEST_FRAG_SMALL     = (1<<3),
00154     CDDA_TEST_FRAG_LARGE     = (2<<3),
00155     CDDA_TEST_FRAG_MASSIVE   = (3<<3),
00156     CDDA_TEST_UNDERRUN       = 64 
00157   } paranoia_jitter_t;
00158   
00168 #define CDDA_TEST_ALWAYS_JITTER     4 
00169 
00171 #define CDDA_TEST_FRAG_SMALL   (1<<3)
00172 #define CDDA_TEST_FRAG_LARGE   (2<<3)
00173 #define CDDA_TEST_FRAG_MASSIVE (3<<3)
00174 
00176 #define CDDA_TEST_UNDERRUN         64 
00177 
00178 #if TESTING_IS_FINISHED
00179 
00181 #define CDDA_TEST_SCRATCH         128
00182 #undef  CDDA_TEST_BOGUS_BYTES     256
00183 #undef  CDDA_TEST_DROPDUPE_BYTES  512
00184 #endif /* TESTING_IS_FINISHED */
00185 
00192 extern cdrom_drive_t *cdio_cddap_find_a_cdrom(int messagedest, 
00193                                               char **ppsz_message);
00194 
00199 extern cdrom_drive_t *cdio_cddap_identify(const char *psz_device, 
00200                                           int messagedest, 
00201                                           char **ppsz_message);
00202 
00209 cdrom_drive_t *cdio_cddap_identify_cdio(CdIo_t *p_cdio, 
00210                                         int messagedest, char **ppsz_messages);
00211 
00214 extern int     cdio_cddap_speed_set(cdrom_drive_t *d, int speed);
00215 extern void    cdio_cddap_verbose_set(cdrom_drive_t *d, int err_action, 
00216                                       int mes_action);
00217 extern char   *cdio_cddap_messages(cdrom_drive_t *d);
00218 extern char   *cdio_cddap_errors(cdrom_drive_t *d);
00219 
00230 bool cdio_cddap_close_no_free_cdio(cdrom_drive_t *d);
00231 
00242 extern int     cdio_cddap_close(cdrom_drive_t *d);
00243 
00244 extern int     cdio_cddap_open(cdrom_drive_t *d);
00245 
00246 extern long    cdio_cddap_read(cdrom_drive_t *d, void *p_buffer,
00247                                lsn_t beginsector, long sectors);
00248 
00250 extern lsn_t   cdio_cddap_track_firstsector(cdrom_drive_t *d, 
00251                                       track_t i_track);
00252 
00255 extern lsn_t   cdio_cddap_track_lastsector(cdrom_drive_t *d, track_t i_track);
00256 
00258 extern track_t cdio_cddap_tracks(cdrom_drive_t *d);
00259 
00265 extern int     cdio_cddap_sector_gettrack(cdrom_drive_t *d, lsn_t lsn);
00266 
00271 extern int     cdio_cddap_track_channels(cdrom_drive_t *d, track_t i_track);
00272 
00274 extern int     cdio_cddap_track_audiop(cdrom_drive_t *d, track_t i_track);
00275 
00277 extern int     cdio_cddap_track_copyp(cdrom_drive_t *d, track_t i_track);
00278 
00282 extern int     cdio_cddap_track_preemp(cdrom_drive_t *d, track_t i_track);
00283 
00285 extern lsn_t   cdio_cddap_disc_firstsector(cdrom_drive_t *d);
00286 
00290 extern lsn_t   cdio_cddap_disc_lastsector(cdrom_drive_t *d);
00291 
00306 extern int data_bigendianp(cdrom_drive_t *d);
00307 
00310 typedef enum {
00311   TR_OK =            0,
00312   TR_EWRITE =        1  ,
00313   TR_EREAD =         2  ,
00314   TR_UNDERRUN =      3  ,
00315   TR_OVERRUN =       4  ,
00316   TR_ILLEGAL =       5  ,
00317   TR_MEDIUM =        6  ,
00318   TR_BUSY =          7  ,
00319   TR_NOTREADY =      8  ,
00320   TR_FAULT =         9  ,
00321   TR_UNKNOWN =      10  ,
00322   TR_STREAMING =    11  ,
00323 } transport_error_t;
00324   
00325 
00326 #ifdef NEED_STRERROR_TR
00327 const char *strerror_tr[]={
00328   "Success",
00329   "Error writing packet command to device",
00330   "Error reading command from device",
00331   "SCSI packet data underrun (too little data)",
00332   "SCSI packet data overrun (too much data)",
00333   "Illegal SCSI request (rejected by target)",
00334   "Medium reading data from medium",
00335   "Device busy",
00336   "Device not ready",
00337   "Target hardware fault",
00338   "Unspecified error",
00339   "Drive lost streaming"
00340 };
00341 #endif /*NEED_STERROR_TR*/
00342 
00372 #ifndef DO_NOT_WANT_PARANOIA_COMPATIBILITY
00373 
00374 #define cdda_find_a_cdrom       cdio_cddap_find_a_cdrom
00375 #define cdda_identify           cdio_cddap_identify
00376 #define cdda_speed_set          cdio_cddap_speed_set
00377 #define cdda_verbose_set        cdio_cddap_verbose_set
00378 #define cdda_messages           cdio_cddap_messages
00379 #define cdda_errors             cdio_cddap_errors
00380 #define cdda_close              cdio_cddap_close
00381 #define cdda_open               cdio_cddap_open
00382 #define cdda_read               cdio_cddap_read
00383 #define cdda_track_firstsector  cdio_cddap_track_firstsector 
00384 #define cdda_track_lastsector   cdio_cddap_track_lastsector 
00385 #define cdda_tracks             cdio_cddap_tracks 
00386 #define cdda_sector_gettrack    cdio_cddap_sector_gettrack  
00387 #define cdda_track_channels     cdio_cddap_track_channels
00388 #define cdda_track_audiop       cdio_cddap_track_audiop
00389 #define cdda_track_copyp        cdio_cddap_track_copyp
00390 #define cdda_track_preemp       cdio_cddap_track_preemp
00391 #define cdda_disc_firstsector   cdio_cddap_disc_firstsector
00392 #define cdda_disc_lastsector    cdio_cddap_disc_lastsector
00393 #define cdrom_drive             cdrom_drive_t
00394 
00395 #endif /*DO_NOT_WANT_PARANOIA_COMPATIBILITY*/
00396 
00397 #ifdef __cplusplus
00398 }
00399 #endif /* __cplusplus */
00400 
00407 extern paranoia_jitter_t     debug_paranoia_jitter;
00408 extern paranoia_cdda_enums_t debug_paranoia_cdda_enums;
00409 
00410 #endif /*_CDDA_INTERFACE_H_*/
00411 

Generated for libcdio by doxygen 1.7.6.1