1 /****************************************************************************
2 * cdrom_internals.h: cdrom tools private header
3 *****************************************************************************
4 * Copyright (C) 1998-2001 the VideoLAN team
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
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 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 General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, 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 */
42 int i_device_handle; /* vcd device descriptor */
48 /*****************************************************************************
50 *****************************************************************************/
51 /* LBA = msf.frame + 75 * ( msf.second + 60 * msf.minute ) */
52 #define MSF_TO_LBA(min, sec, frame) ((int)frame + 75 * (sec + 60 * min))
53 /* LBA = msf.frame + 75 * ( msf.second - 2 + 60 * msf.minute ) */
54 #define MSF_TO_LBA2(min, sec, frame) ((int)frame + 75 * (sec -2 + 60 * min))
62 /*****************************************************************************
64 *****************************************************************************/
65 #if defined( __APPLE__ )
66 #define darwin_freeTOC( p ) free( (void*)p )
67 #define CD_MIN_TRACK_NO 01
68 #define CD_MAX_TRACK_NO 99
73 /* Win32 DeviceIoControl specifics */
74 #ifndef MAXIMUM_NUMBER_TRACKS
75 # define MAXIMUM_NUMBER_TRACKS 100
77 typedef struct _TRACK_DATA {
84 } TRACK_DATA, *PTRACK_DATA;
85 typedef struct _CDROM_TOC {
89 TRACK_DATA TrackData[MAXIMUM_NUMBER_TRACKS];
90 } CDROM_TOC, *PCDROM_TOC;
91 typedef enum _TRACK_MODE_TYPE {
95 } TRACK_MODE_TYPE, *PTRACK_MODE_TYPE;
96 typedef struct __RAW_READ_INFO {
97 LARGE_INTEGER DiskOffset;
99 TRACK_MODE_TYPE TrackMode;
100 } RAW_READ_INFO, *PRAW_READ_INFO;
101 typedef struct _CDROM_READ_TOC_EX {
108 } CDROM_READ_TOC_EX, *PCDROM_READ_TOC_EX;
110 #ifndef IOCTL_CDROM_BASE
111 # define IOCTL_CDROM_BASE FILE_DEVICE_CD_ROM
113 #ifndef IOCTL_CDROM_READ_TOC
114 # define IOCTL_CDROM_READ_TOC CTL_CODE(IOCTL_CDROM_BASE, 0x0000, \
115 METHOD_BUFFERED, FILE_READ_ACCESS)
117 #ifndef IOCTL_CDROM_RAW_READ
118 #define IOCTL_CDROM_RAW_READ CTL_CODE(IOCTL_CDROM_BASE, 0x000F, \
119 METHOD_OUT_DIRECT, FILE_READ_ACCESS)
121 #define IOCTL_CDROM_READ_TOC_EX CTL_CODE(IOCTL_CDROM_BASE, 0x0015, \
122 METHOD_BUFFERED, FILE_READ_ACCESS)
125 #define MINIMUM_CDROM_READ_TOC_EX_SIZE 2
126 #define CDROM_READ_TOC_EX_FORMAT_CDTEXT 0x05
130 #define SECTOR_TYPE_MODE2_FORM2 0x14
131 #define SECTOR_TYPE_CDDA 0x04
132 #define READ_CD_RAW_MODE2 0xF0
133 #define READ_CD_USERDATA 0x10
135 /*****************************************************************************
137 *****************************************************************************/
138 static int OpenVCDImage( vlc_object_t *, const char *, struct vcddev_s * );
139 static void CloseVCDImage( vlc_object_t *, struct vcddev_s * );
141 #if defined( __APPLE__ )
142 static CDTOC *darwin_getTOC( vlc_object_t *, const struct vcddev_s * );
143 static int darwin_getNumberOfTracks( CDTOC *, int );
145 #elif defined( WIN32 )
146 static int win32_vcd_open( vlc_object_t *, const char *, struct vcddev_s *);