1 /****************************************************************************
2 * cdrom_internals.h: cdrom tools private header
3 *****************************************************************************
4 * Copyright (C) 1998-2001 VLC authors and VideoLAN
7 * Authors: Johan Bilien <jobi@via.ecp.fr>
8 * Gildas Bazin <gbazin@netcourrier.com>
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation; either version 2.1 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this program; if not, write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
25 /*****************************************************************************
26 * The vcddev structure
27 *****************************************************************************/
30 char *psz_dev
; /* vcd device name */
32 /* Section used in vcd image mode */
33 int i_vcdimage_handle
; /* vcd image file descriptor */
34 int i_tracks
; /* number of tracks of the vcd */
35 int *p_sectors
; /* tracks layout on the vcd */
37 /* Section used in vcd device mode */
40 HANDLE h_device_handle
; /* vcd device descriptor */
41 #elif defined( __OS2__ )
42 HFILE hcd
; /* vcd device descriptor */
44 int i_device_handle
; /* vcd device descriptor */
55 /*****************************************************************************
57 *****************************************************************************/
58 #if defined( __APPLE__ )
59 #define darwin_freeTOC( p ) free( (void*)p )
60 #define CD_MIN_TRACK_NO 01
61 #define CD_MAX_TRACK_NO 99
66 /* Win32 DeviceIoControl specifics */
67 #ifndef MAXIMUM_NUMBER_TRACKS
68 # define MAXIMUM_NUMBER_TRACKS 100
70 typedef struct _TRACK_DATA
{
77 } TRACK_DATA
, *PTRACK_DATA
;
78 typedef struct _CDROM_TOC
{
82 TRACK_DATA TrackData
[MAXIMUM_NUMBER_TRACKS
];
83 } CDROM_TOC
, *PCDROM_TOC
;
84 typedef enum _TRACK_MODE_TYPE
{
88 } TRACK_MODE_TYPE
, *PTRACK_MODE_TYPE
;
89 typedef struct __RAW_READ_INFO
{
90 LARGE_INTEGER DiskOffset
;
92 TRACK_MODE_TYPE TrackMode
;
93 } RAW_READ_INFO
, *PRAW_READ_INFO
;
94 typedef struct _CDROM_READ_TOC_EX
{
101 } CDROM_READ_TOC_EX
, *PCDROM_READ_TOC_EX
;
103 #ifndef IOCTL_CDROM_BASE
104 # define IOCTL_CDROM_BASE FILE_DEVICE_CD_ROM
106 #ifndef IOCTL_CDROM_READ_TOC
107 # define IOCTL_CDROM_READ_TOC CTL_CODE(IOCTL_CDROM_BASE, 0x0000, \
108 METHOD_BUFFERED, FILE_READ_ACCESS)
110 #ifndef IOCTL_CDROM_RAW_READ
111 #define IOCTL_CDROM_RAW_READ CTL_CODE(IOCTL_CDROM_BASE, 0x000F, \
112 METHOD_OUT_DIRECT, FILE_READ_ACCESS)
114 #define IOCTL_CDROM_READ_TOC_EX CTL_CODE(IOCTL_CDROM_BASE, 0x0015, \
115 METHOD_BUFFERED, FILE_READ_ACCESS)
118 #define MINIMUM_CDROM_READ_TOC_EX_SIZE 2
119 #define CDROM_READ_TOC_EX_FORMAT_CDTEXT 0x05
124 #pragma pack( push, 1 )
125 typedef struct os2_msf_s
128 unsigned char second
;
129 unsigned char minute
;
130 unsigned char reserved
;
133 typedef struct cdrom_get_tochdr_s
135 unsigned char sign
[4];
136 } cdrom_get_tochdr_t
;
138 typedef struct cdrom_tochdr_s
140 unsigned char first_track
;
141 unsigned char last_track
;
145 typedef struct cdrom_get_track_s
147 unsigned char sign
[4];
151 typedef struct cdrom_track_s
155 unsigned char control
:4;
158 typedef struct cdrom_readlong_s
160 unsigned char sign
[4];
161 unsigned char addr_mode
;
162 unsigned short sectors
;
164 unsigned char reserved
;
165 unsigned char interleaved_size
;
171 #define SECTOR_TYPE_MODE2_FORM2 0x14
172 #define SECTOR_TYPE_CDDA 0x04
173 #define READ_CD_RAW_MODE2 0xF0
174 #define READ_CD_USERDATA 0x10
176 /*****************************************************************************
178 *****************************************************************************/
179 static int OpenVCDImage( vlc_object_t
*, const char *, struct vcddev_s
* );
180 static void CloseVCDImage( vlc_object_t
*, struct vcddev_s
* );
182 #if defined( __APPLE__ )
183 static CDTOC
*darwin_getTOC( vlc_object_t
*, const struct vcddev_s
* );
184 static int darwin_getNumberOfTracks( CDTOC
*, int );
186 #elif defined( _WIN32 )
187 static int win32_vcd_open( vlc_object_t
*, const char *, struct vcddev_s
*);
189 #elif defined( __OS2__ )
190 static int os2_vcd_open( vlc_object_t
*, const char *, struct vcddev_s
*);