1 /****************************************************************************
2 * cdrom.h: cdrom tools 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 *****************************************************************************/
28 /* where the data start on a VCD sector */
29 #define VCD_DATA_START 24
30 /* size of the availablr data on a VCD sector */
31 #define VCD_DATA_SIZE 2324
32 /* size of a VCD sector, header and tail included */
33 #define VCD_SECTOR_SIZE 2352
34 /* size of a CD sector */
35 #define CD_SECTOR_SIZE 2048
36 /* sector containing the entry points */
37 #define VCD_ENTRIES_SECTOR 151
39 /* where the data start on a CDDA sector */
40 #define CDDA_DATA_START 0
41 /* size of the availablr data on a CDDA sector */
42 #define CDDA_DATA_SIZE 2352
43 /* size of a CDDA sector, header and tail included */
44 #define CDDA_SECTOR_SIZE 2352
46 /*****************************************************************************
48 *****************************************************************************/
49 /* LBA = msf.frame + 75 * ( msf.second + 60 * msf.minute ) */
50 #define MSF_TO_LBA(min, sec, frame) ((int)frame + 75 * (sec + 60 * min))
51 /* LBA = msf.frame + 75 * ( msf.second - 2 + 60 * msf.minute ) */
52 #define MSF_TO_LBA2(min, sec, frame) ((int)frame + 75 * (sec -2 + 60 * min))
53 /* Converts BCD to Binary data */
54 #define BCD_TO_BIN(i) \
55 (uint8_t)((uint8_t)(0xf & (uint8_t)i)+((uint8_t)10*((uint8_t)i >> 4)))
57 typedef struct vcddev_s vcddev_t;
59 /*****************************************************************************
60 * structure to store minute/second/frame locations
61 *****************************************************************************/
69 /*****************************************************************************
70 * entries_sect structure: the sector containing entry points
71 *****************************************************************************/
72 typedef struct entries_sect_s
74 char psz_id[8]; /* "ENTRYVCD" */
75 uint8_t i_version; /* 0x02 VCD2.0
77 uint8_t i_sys_prof_tag; /* 0x01 if VCD1.1
79 uint16_t i_entries_nb; /* entries number <= 500 */
83 uint8_t i_track; /* track number */
84 msf_t msf; /* msf location
87 uint8_t zeros[36]; /* should be 0x00 */
90 /*****************************************************************************
92 *****************************************************************************/
93 vcddev_t *ioctl_Open ( vlc_object_t *, const char * );
94 void ioctl_Close ( vlc_object_t *, vcddev_t * );
95 int ioctl_GetTracksMap ( vlc_object_t *, const vcddev_t *, int ** );
96 int ioctl_ReadSectors ( vlc_object_t *, const vcddev_t *,
97 int, byte_t *, int, int );