Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

cdrom_internals.h

00001 /****************************************************************************
00002  * cdrom_internals.h: cdrom tools private header
00003  *****************************************************************************
00004  * Copyright (C) 1998-2001 the VideoLAN team
00005  * $Id: cdrom_internals.h 11664 2005-07-09 06:17:09Z courmisch $
00006  *
00007  * Authors: Johan Bilien <[email protected]>
00008  *          Gildas Bazin <[email protected]>
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  * 
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
00023  *****************************************************************************/
00024 
00025 /*****************************************************************************
00026  * The vcddev structure
00027  *****************************************************************************/
00028 struct vcddev_s
00029 {
00030     char   *psz_dev;                                      /* vcd device name */
00031 
00032     /* Section used in vcd image mode */
00033     int    i_vcdimage_handle;                   /* vcd image file descriptor */
00034     int    i_tracks;                          /* number of tracks of the vcd */
00035     int    *p_sectors;                           /* tracks layout on the vcd */
00036 
00037     /* Section used in vcd device mode */
00038 
00039 #ifdef WIN32
00040     HANDLE h_device_handle;                         /* vcd device descriptor */
00041     long  hASPI;
00042     short i_sid;
00043     long  (*lpSendCommand)( void* );
00044 
00045 #else
00046     int    i_device_handle;                         /* vcd device descriptor */
00047 #endif
00048 
00049 };
00050 
00051 
00052 /*****************************************************************************
00053  * Misc. Macros
00054  *****************************************************************************/
00055 /* LBA = msf.frame + 75 * ( msf.second + 60 * msf.minute ) */
00056 #define MSF_TO_LBA(min, sec, frame) ((int)frame + 75 * (sec + 60 * min))
00057 /* LBA = msf.frame + 75 * ( msf.second - 2 + 60 * msf.minute ) */
00058 #define MSF_TO_LBA2(min, sec, frame) ((int)frame + 75 * (sec -2 + 60 * min))
00059 
00060 #ifndef O_BINARY
00061 #   define O_BINARY 0
00062 #endif
00063 
00064 #define VCDDEV_T 1
00065 
00066 /*****************************************************************************
00067  * Platform specifics
00068  *****************************************************************************/
00069 #if defined( SYS_DARWIN )
00070 #define darwin_freeTOC( p ) free( (void*)p )
00071 #define CD_MIN_TRACK_NO 01
00072 #define CD_MAX_TRACK_NO 99
00073 #endif
00074 
00075 #if defined( WIN32 )
00076 
00077 /* Win32 DeviceIoControl specifics */
00078 #ifndef MAXIMUM_NUMBER_TRACKS
00079 #    define MAXIMUM_NUMBER_TRACKS 100
00080 #endif
00081 typedef struct _TRACK_DATA {
00082     UCHAR Reserved;
00083     UCHAR Control : 4;
00084     UCHAR Adr : 4;
00085     UCHAR TrackNumber;
00086     UCHAR Reserved1;
00087     UCHAR Address[4];
00088 } TRACK_DATA, *PTRACK_DATA;
00089 typedef struct _CDROM_TOC {
00090     UCHAR Length[2];
00091     UCHAR FirstTrack;
00092     UCHAR LastTrack;
00093     TRACK_DATA TrackData[MAXIMUM_NUMBER_TRACKS];
00094 } CDROM_TOC, *PCDROM_TOC;
00095 typedef enum _TRACK_MODE_TYPE {
00096     YellowMode2,
00097     XAForm2,
00098     CDDA
00099 } TRACK_MODE_TYPE, *PTRACK_MODE_TYPE;
00100 typedef struct __RAW_READ_INFO {
00101     LARGE_INTEGER DiskOffset;
00102     ULONG SectorCount;
00103     TRACK_MODE_TYPE TrackMode;
00104 } RAW_READ_INFO, *PRAW_READ_INFO;
00105 
00106 #ifndef IOCTL_CDROM_BASE
00107 #    define IOCTL_CDROM_BASE FILE_DEVICE_CD_ROM
00108 #endif
00109 #ifndef IOCTL_CDROM_READ_TOC
00110 #    define IOCTL_CDROM_READ_TOC CTL_CODE(IOCTL_CDROM_BASE, 0x0000, \
00111                                           METHOD_BUFFERED, FILE_READ_ACCESS)
00112 #endif
00113 #ifndef IOCTL_CDROM_RAW_READ
00114 #define IOCTL_CDROM_RAW_READ CTL_CODE(IOCTL_CDROM_BASE, 0x000F, \
00115                                       METHOD_OUT_DIRECT, FILE_READ_ACCESS)
00116 #endif
00117 
00118 /* Win32 aspi specific */
00119 #define WIN_NT               ( GetVersion() < 0x80000000 )
00120 #define ASPI_HAID           0
00121 #define ASPI_TARGET         0
00122 #define DTYPE_CDROM         0x05
00123 
00124 #define SENSE_LEN           0x0E
00125 #define SC_GET_DEV_TYPE     0x01
00126 #define SC_EXEC_SCSI_CMD    0x02
00127 #define SC_GET_DISK_INFO    0x06
00128 #define SS_COMP             0x01
00129 #define SS_PENDING          0x00
00130 #define SS_NO_ADAPTERS      0xE8
00131 #define SRB_DIR_IN          0x08
00132 #define SRB_DIR_OUT         0x10
00133 #define SRB_EVENT_NOTIFY    0x40
00134 
00135 #define READ_CD 0xbe
00136 #define SECTOR_TYPE_MODE2_FORM2 0x14
00137 #define SECTOR_TYPE_CDDA 0x04
00138 #define READ_CD_RAW_MODE2 0xF0
00139 #define READ_CD_USERDATA 0x10
00140 
00141 #define READ_TOC 0x43
00142 #define READ_TOC_FORMAT_TOC 0x0
00143 
00144 #pragma pack(1)
00145 
00146 struct SRB_GetDiskInfo
00147 {
00148     unsigned char   SRB_Cmd;
00149     unsigned char   SRB_Status;
00150     unsigned char   SRB_HaId;
00151     unsigned char   SRB_Flags;
00152     unsigned long   SRB_Hdr_Rsvd;
00153     unsigned char   SRB_Target;
00154     unsigned char   SRB_Lun;
00155     unsigned char   SRB_DriveFlags;
00156     unsigned char   SRB_Int13HDriveInfo;
00157     unsigned char   SRB_Heads;
00158     unsigned char   SRB_Sectors;
00159     unsigned char   SRB_Rsvd1[22];
00160 };
00161 
00162 struct SRB_GDEVBlock
00163 {
00164     unsigned char SRB_Cmd;
00165     unsigned char SRB_Status;
00166     unsigned char SRB_HaId;
00167     unsigned char SRB_Flags;
00168     unsigned long SRB_Hdr_Rsvd;
00169     unsigned char SRB_Target;
00170     unsigned char SRB_Lun;
00171     unsigned char SRB_DeviceType;
00172     unsigned char SRB_Rsvd1;
00173 };
00174 
00175 struct SRB_ExecSCSICmd
00176 {
00177     unsigned char   SRB_Cmd;
00178     unsigned char   SRB_Status;
00179     unsigned char   SRB_HaId;
00180     unsigned char   SRB_Flags;
00181     unsigned long   SRB_Hdr_Rsvd;
00182     unsigned char   SRB_Target;
00183     unsigned char   SRB_Lun;
00184     unsigned short  SRB_Rsvd1;
00185     unsigned long   SRB_BufLen;
00186     unsigned char   *SRB_BufPointer;
00187     unsigned char   SRB_SenseLen;
00188     unsigned char   SRB_CDBLen;
00189     unsigned char   SRB_HaStat;
00190     unsigned char   SRB_TargStat;
00191     unsigned long   *SRB_PostProc;
00192     unsigned char   SRB_Rsvd2[20];
00193     unsigned char   CDBByte[16];
00194     unsigned char   SenseArea[SENSE_LEN+2];
00195 };
00196 
00197 #pragma pack()
00198 #endif /* WIN32 */
00199 
00200 
00201 /*****************************************************************************
00202  * Local Prototypes
00203  *****************************************************************************/
00204 static int    OpenVCDImage( vlc_object_t *, const char *, struct vcddev_s * );
00205 static void   CloseVCDImage( vlc_object_t *, struct vcddev_s * );
00206 
00207 #if defined( SYS_DARWIN )
00208 static CDTOC *darwin_getTOC( vlc_object_t *, const struct vcddev_s * );
00209 static int    darwin_getNumberOfDescriptors( CDTOC * );
00210 static int    darwin_getNumberOfTracks( CDTOC *, int );
00211 
00212 #elif defined( WIN32 )
00213 static int    win32_vcd_open( vlc_object_t *, const char *, struct vcddev_s *);
00214 #endif

Generated on Tue Dec 20 10:14:26 2005 for vlc-0.8.4a by  doxygen 1.4.2