cdrom_internals.h

Go to the documentation of this file.
00001 /****************************************************************************
00002  * cdrom_internals.h: cdrom tools private header
00003  *****************************************************************************
00004  * Copyright (C) 1998-2001 the VideoLAN team
00005  * $Id: ccfb37e3d1fbeb40bc913ff5ffbf35f6ce4c02c9 $
00006  *
00007  * Authors: Johan Bilien <jobi@via.ecp.fr>
00008  *          Gildas Bazin <gbazin@netcourrier.com>
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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, 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 #else
00042     int    i_device_handle;                         /* vcd device descriptor */
00043 #endif
00044 
00045 };
00046 
00047 
00048 /*****************************************************************************
00049  * Misc. Macros
00050  *****************************************************************************/
00051 /* LBA = msf.frame + 75 * ( msf.second + 60 * msf.minute ) */
00052 #define MSF_TO_LBA(min, sec, frame) ((int)frame + 75 * (sec + 60 * min))
00053 /* LBA = msf.frame + 75 * ( msf.second - 2 + 60 * msf.minute ) */
00054 #define MSF_TO_LBA2(min, sec, frame) ((int)frame + 75 * (sec -2 + 60 * min))
00055 
00056 #ifndef O_BINARY
00057 #   define O_BINARY 0
00058 #endif
00059 
00060 #define VCDDEV_T 1
00061 
00062 /*****************************************************************************
00063  * Platform specifics
00064  *****************************************************************************/
00065 #if defined( __APPLE__ )
00066 #define darwin_freeTOC( p ) free( (void*)p )
00067 #define CD_MIN_TRACK_NO 01
00068 #define CD_MAX_TRACK_NO 99
00069 #endif
00070 
00071 #if defined( WIN32 )
00072 
00073 /* Win32 DeviceIoControl specifics */
00074 #ifndef MAXIMUM_NUMBER_TRACKS
00075 #    define MAXIMUM_NUMBER_TRACKS 100
00076 #endif
00077 typedef struct _TRACK_DATA {
00078     UCHAR Reserved;
00079     UCHAR Control : 4;
00080     UCHAR Adr : 4;
00081     UCHAR TrackNumber;
00082     UCHAR Reserved1;
00083     UCHAR Address[4];
00084 } TRACK_DATA, *PTRACK_DATA;
00085 typedef struct _CDROM_TOC {
00086     UCHAR Length[2];
00087     UCHAR FirstTrack;
00088     UCHAR LastTrack;
00089     TRACK_DATA TrackData[MAXIMUM_NUMBER_TRACKS];
00090 } CDROM_TOC, *PCDROM_TOC;
00091 typedef enum _TRACK_MODE_TYPE {
00092     YellowMode2,
00093     XAForm2,
00094     CDDA
00095 } TRACK_MODE_TYPE, *PTRACK_MODE_TYPE;
00096 typedef struct __RAW_READ_INFO {
00097     LARGE_INTEGER DiskOffset;
00098     ULONG SectorCount;
00099     TRACK_MODE_TYPE TrackMode;
00100 } RAW_READ_INFO, *PRAW_READ_INFO;
00101 typedef struct _CDROM_READ_TOC_EX {
00102   UCHAR  Format : 4;
00103   UCHAR  Reserved1 : 3;
00104   UCHAR  Msf : 1;
00105   UCHAR  SessionTrack;
00106   UCHAR  Reserved2;
00107   UCHAR  Reserved3;
00108 } CDROM_READ_TOC_EX, *PCDROM_READ_TOC_EX;
00109 
00110 #ifndef IOCTL_CDROM_BASE
00111 #    define IOCTL_CDROM_BASE FILE_DEVICE_CD_ROM
00112 #endif
00113 #ifndef IOCTL_CDROM_READ_TOC
00114 #    define IOCTL_CDROM_READ_TOC CTL_CODE(IOCTL_CDROM_BASE, 0x0000, \
00115                                           METHOD_BUFFERED, FILE_READ_ACCESS)
00116 #endif
00117 #ifndef IOCTL_CDROM_RAW_READ
00118 #define IOCTL_CDROM_RAW_READ CTL_CODE(IOCTL_CDROM_BASE, 0x000F, \
00119                                       METHOD_OUT_DIRECT, FILE_READ_ACCESS)
00120 #endif
00121 #define IOCTL_CDROM_READ_TOC_EX CTL_CODE(IOCTL_CDROM_BASE, 0x0015, \
00122                                          METHOD_BUFFERED, FILE_READ_ACCESS)
00123 
00124 
00125 #define MINIMUM_CDROM_READ_TOC_EX_SIZE    2
00126 #define CDROM_READ_TOC_EX_FORMAT_CDTEXT   0x05
00127 
00128 #endif /* WIN32 */
00129 
00130 #define SECTOR_TYPE_MODE2_FORM2 0x14
00131 #define SECTOR_TYPE_CDDA 0x04
00132 #define READ_CD_RAW_MODE2 0xF0
00133 #define READ_CD_USERDATA 0x10
00134 
00135 /*****************************************************************************
00136  * Local Prototypes
00137  *****************************************************************************/
00138 static int    OpenVCDImage( vlc_object_t *, const char *, struct vcddev_s * );
00139 static void   CloseVCDImage( vlc_object_t *, struct vcddev_s * );
00140 
00141 #if defined( __APPLE__ )
00142 static CDTOC *darwin_getTOC( vlc_object_t *, const struct vcddev_s * );
00143 static int    darwin_getNumberOfTracks( CDTOC *, int );
00144 
00145 #elif defined( WIN32 )
00146 static int    win32_vcd_open( vlc_object_t *, const char *, struct vcddev_s *);
00147 #endif

Generated on Tue May 25 08:04:53 2010 for VLC by  doxygen 1.5.6