1 /****************************************************************************
2 * cdrom.h: cdrom tools header
3 *****************************************************************************
4 * Copyright (C) 1998-2001 VideoLAN
5 * $Id: cdrom.h,v 1.5 2003/05/17 20:30:31 gbazin Exp $
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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
23 *****************************************************************************/
25 /* where the data start on a VCD sector */
26 #define VCD_DATA_START 24
27 /* size of the availablr data on a VCD sector */
28 #define VCD_DATA_SIZE 2324
29 /* size of a VCD sector, header and tail included */
30 #define VCD_SECTOR_SIZE 2352
31 /* size of a CD sector */
32 #define CD_SECTOR_SIZE 2048
33 /* sector containing the entry points */
34 #define VCD_ENTRIES_SECTOR 151
36 /* where the data start on a CDDA sector */
37 #define CDDA_DATA_START 0
38 /* size of the availablr data on a CDDA sector */
39 #define CDDA_DATA_SIZE 2352
40 /* size of a CDDA sector, header and tail included */
41 #define CDDA_SECTOR_SIZE 2352
43 /*****************************************************************************
45 *****************************************************************************/
46 /* LBA = msf.frame + 75 * ( msf.second + 60 * msf.minute ) */
47 #define MSF_TO_LBA(min, sec, frame) ((int)frame + 75 * (sec + 60 * min))
48 /* LBA = msf.frame + 75 * ( msf.second - 2 + 60 * msf.minute ) */
49 #define MSF_TO_LBA2(min, sec, frame) ((int)frame + 75 * (sec -2 + 60 * min))
50 /* Converts BCD to Binary data */
51 #define BCD_TO_BIN(i) \
52 (uint8_t)((uint8_t)(0xf & (uint8_t)i)+((uint8_t)10*((uint8_t)i >> 4)))
54 typedef struct vcddev_s vcddev_t;
56 /*****************************************************************************
57 * structure to store minute/second/frame locations
58 *****************************************************************************/
66 /*****************************************************************************
67 * entries_sect structure: the sector containing entry points
68 *****************************************************************************/
69 typedef struct entries_sect_s
71 uint8_t psz_id[8]; /* "ENTRYVCD" */
72 uint8_t i_version; /* 0x02 VCD2.0
74 uint8_t i_sys_prof_tag; /* 0x01 if VCD1.1
76 uint16_t i_entries_nb; /* entries number <= 500 */
80 uint8_t i_track; /* track number */
81 msf_t msf; /* msf location
84 uint8_t zeros[36]; /* should be 0x00 */
87 /*****************************************************************************
89 *****************************************************************************/
90 vcddev_t *ioctl_Open ( vlc_object_t *, const char * );
91 void ioctl_Close ( vlc_object_t *, vcddev_t * );
92 int ioctl_GetTracksMap ( vlc_object_t *, const vcddev_t *, int ** );
93 int ioctl_ReadSector ( vlc_object_t *, const vcddev_t *,
94 int, byte_t *, size_t, size_t );