]> git.sesse.net Git - vlc/blob - modules/access/vcd/cdrom.h
* modules/access/cdda.c, modules/access/vcd/*: New CD digital audio module (by me...
[vlc] / modules / access / vcd / cdrom.h
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 $
6  *
7  * Authors: Johan Bilien <jobi@via.ecp.fr>
8  *          Gildas Bazin <gbazin@netcourrier.com>
9  *
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.
14  * 
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.
19  *
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  *****************************************************************************/
24
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
35
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
42
43 /*****************************************************************************
44  * Misc. Macros
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)))
53
54 typedef struct vcddev_s vcddev_t;
55
56 /*****************************************************************************
57  * structure to store minute/second/frame locations
58  *****************************************************************************/
59 typedef struct msf_s
60 {
61     uint8_t minute;
62     uint8_t second;
63     uint8_t frame;
64 } msf_t;
65
66 /*****************************************************************************
67  * entries_sect structure: the sector containing entry points
68  *****************************************************************************/
69 typedef struct entries_sect_s
70 {
71     uint8_t psz_id[8];                              /* "ENTRYVCD" */
72     uint8_t i_version;                              /* 0x02 VCD2.0
73                                                        0x01 SVCD  */
74     uint8_t i_sys_prof_tag;                         /* 0x01 if VCD1.1
75                                                        0x00 else */
76     uint16_t i_entries_nb;                          /* entries number <= 500 */
77
78     struct
79     {
80         uint8_t i_track;                            /* track number */
81         msf_t   msf;                                /* msf location
82                                                        (in BCD format) */
83     } entry[500];
84     uint8_t zeros[36];                              /* should be 0x00 */
85 } entries_sect_t;
86
87 /*****************************************************************************
88  * Prototypes
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 );