access: srt: add support stream encryption
[vlc.git] / modules / access / vcd / cdrom.h
blob4278e245e4357199558696e009e63500111c77db
1 /****************************************************************************
2 * cdrom.h: cdrom tools 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 #ifndef VLC_CDROM_H
26 #define VLC_CDROM_H
28 enum {
29 CDDA_TYPE = 0,
30 VCD_TYPE = 1,
33 /* size of a CD sector */
34 #define CD_RAW_SECTOR_SIZE 2352
35 #define CD_ROM_MODE1_DATA_SIZE 2048
36 #define CD_ROM_MODE2_DATA_SIZE 2336
38 #define CD_ROM_XA_MODE2_F1_DATA_SIZE 2048
39 #define CD_ROM_XA_MODE2_F2_DATA_SIZE 2324
41 /* size of a CD sector */
42 #define CD_SECTOR_SIZE CD_ROM_MODE1_DATA_SIZE
44 /* where the data start on a VCD sector */
45 #define VCD_DATA_START 24
46 /* size of the available data on a VCD sector */
47 #define VCD_DATA_SIZE CD_ROM_XA_MODE2_F2_DATA_SIZE
48 /* size of a VCD sector, header and tail included */
49 #define VCD_SECTOR_SIZE CD_RAW_SECTOR_SIZE
50 /* sector containing the entry points */
51 #define VCD_ENTRIES_SECTOR 151
53 /* where the data start on a CDDA sector */
54 #define CDDA_DATA_START 0
55 /* size of the available data on a CDDA sector */
56 #define CDDA_DATA_SIZE CD_RAW_SECTOR_SIZE
57 /* size of a CDDA sector, header and tail included */
58 #define CDDA_SECTOR_SIZE CD_RAW_SECTOR_SIZE
60 /*****************************************************************************
61 * Misc. Macros
62 *****************************************************************************/
63 static inline int MSF_TO_LBA(uint8_t min, uint8_t sec, uint8_t frame)
65 return (int)(frame + 75 * (sec + 60 * min));
67 static inline int MSF_TO_LBA2(uint8_t min, uint8_t sec, uint8_t frame)
69 return (int)(frame + 75 * (sec -2 + 60 * min));
72 /* Converts BCD to Binary data */
73 #define BCD_TO_BIN(i) \
74 (uint8_t)((uint8_t)(0xf & (uint8_t)i)+((uint8_t)10*((uint8_t)i >> 4)))
76 typedef struct vcddev_s vcddev_t;
78 /*****************************************************************************
79 * structure to store minute/second/frame locations
80 *****************************************************************************/
81 typedef struct msf_s
83 uint8_t minute;
84 uint8_t second;
85 uint8_t frame;
86 } msf_t;
88 /*****************************************************************************
89 * entries_sect structure: the sector containing entry points
90 *****************************************************************************/
91 typedef struct entries_sect_s
93 char psz_id[8]; /* "ENTRYVCD" */
94 uint8_t i_version; /* 0x02 VCD2.0
95 0x01 SVCD */
96 uint8_t i_sys_prof_tag; /* 0x01 if VCD1.1
97 0x00 else */
98 uint16_t i_entries_nb; /* entries number <= 500 */
100 struct
102 uint8_t i_track; /* track number */
103 msf_t msf; /* msf location
104 (in BCD format) */
105 } entry[500];
106 uint8_t zeros[36]; /* should be 0x00 */
107 } entries_sect_t;
109 /*****************************************************************************
110 * Prototypes
111 *****************************************************************************/
112 vcddev_t *ioctl_Open ( vlc_object_t *, const char * );
113 void ioctl_Close ( vlc_object_t *, vcddev_t * );
114 int ioctl_GetTracksMap ( vlc_object_t *, const vcddev_t *, int ** );
115 int ioctl_ReadSectors ( vlc_object_t *, const vcddev_t *,
116 int, uint8_t *, int, int );
118 /* CDDA only
119 * The track 0 is for album meta data */
120 int ioctl_GetCdText( vlc_object_t *, const vcddev_t *,
121 vlc_meta_t ***ppp_tracks, int *pi_tracks );
123 #endif /* VLC_CDROM_H */