demux: ts: only seek on pcr for current program
[vlc.git] / modules / access / vcd / cdrom_internals.h
blob6fa6aa7d42f938eaca6e82f9c56e3d11256f02f1
1 /****************************************************************************
2 * cdrom_internals.h: cdrom tools private header
3 *****************************************************************************
4 * Copyright (C) 1998-2001 VLC authors and VideoLAN
5 * $Id$
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 *****************************************************************************/
28 struct vcddev_s
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 */
39 #ifdef _WIN32
40 HANDLE h_device_handle; /* vcd device descriptor */
41 #elif defined( __OS2__ )
42 HFILE hcd; /* vcd device descriptor */
43 #else
44 int i_device_handle; /* vcd device descriptor */
45 #endif
49 #ifndef O_BINARY
50 # define O_BINARY 0
51 #endif
53 #define VCDDEV_T 1
55 /*****************************************************************************
56 * Platform specifics
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
62 #endif
64 #if defined( _WIN32 )
66 /* Win32 DeviceIoControl specifics */
67 #ifndef MAXIMUM_NUMBER_TRACKS
68 # define MAXIMUM_NUMBER_TRACKS 100
69 #endif
70 typedef struct _TRACK_DATA {
71 UCHAR Reserved;
72 UCHAR Control : 4;
73 UCHAR Adr : 4;
74 UCHAR TrackNumber;
75 UCHAR Reserved1;
76 UCHAR Address[4];
77 } TRACK_DATA, *PTRACK_DATA;
78 typedef struct _CDROM_TOC {
79 UCHAR Length[2];
80 UCHAR FirstTrack;
81 UCHAR LastTrack;
82 TRACK_DATA TrackData[MAXIMUM_NUMBER_TRACKS];
83 } CDROM_TOC, *PCDROM_TOC;
84 typedef enum _TRACK_MODE_TYPE {
85 YellowMode2,
86 XAForm2,
87 CDDA
88 } TRACK_MODE_TYPE, *PTRACK_MODE_TYPE;
89 typedef struct __RAW_READ_INFO {
90 LARGE_INTEGER DiskOffset;
91 ULONG SectorCount;
92 TRACK_MODE_TYPE TrackMode;
93 } RAW_READ_INFO, *PRAW_READ_INFO;
94 typedef struct _CDROM_READ_TOC_EX {
95 UCHAR Format : 4;
96 UCHAR Reserved1 : 3;
97 UCHAR Msf : 1;
98 UCHAR SessionTrack;
99 UCHAR Reserved2;
100 UCHAR Reserved3;
101 } CDROM_READ_TOC_EX, *PCDROM_READ_TOC_EX;
103 #ifndef IOCTL_CDROM_BASE
104 # define IOCTL_CDROM_BASE FILE_DEVICE_CD_ROM
105 #endif
106 #ifndef IOCTL_CDROM_READ_TOC
107 # define IOCTL_CDROM_READ_TOC CTL_CODE(IOCTL_CDROM_BASE, 0x0000, \
108 METHOD_BUFFERED, FILE_READ_ACCESS)
109 #endif
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)
113 #endif
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
121 #endif /* _WIN32 */
123 #ifdef __OS2__
124 #pragma pack( push, 1 )
125 typedef struct os2_msf_s
127 unsigned char frame;
128 unsigned char second;
129 unsigned char minute;
130 unsigned char reserved;
131 } os2_msf_t;
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;
142 os2_msf_t lead_out;
143 } cdrom_tochdr_t;
145 typedef struct cdrom_get_track_s
147 unsigned char sign[4];
148 unsigned char track;
149 } cdrom_get_track_t;
151 typedef struct cdrom_track_s
153 os2_msf_t start;
154 unsigned char adr:4;
155 unsigned char control:4;
156 } cdrom_track_t;
158 typedef struct cdrom_readlong_s
160 unsigned char sign[4];
161 unsigned char addr_mode;
162 unsigned short sectors;
163 unsigned long start;
164 unsigned char reserved;
165 unsigned char interleaved_size;
166 } cdrom_readlong_t;
168 #pragma pack( pop )
169 #endif
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 /*****************************************************************************
177 * Local Prototypes
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 *);
191 #endif