00001 /**************************************************************************** 00002 * cdrom.h: cdrom tools header 00003 ***************************************************************************** 00004 * Copyright (C) 1998-2001 the VideoLAN team 00005 * $Id: cdrom.h 11709 2005-07-11 16:20:33Z massiot $ 00006 * 00007 * Authors: Johan Bilien <[email protected]> 00008 * Gildas Bazin <[email protected]> 00009 * 00010 * This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU General Public License 00021 * along with this program; if not, write to the Free Software 00022 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. 00023 *****************************************************************************/ 00024 00025 #define CDDA_TYPE 0 00026 #define VCD_TYPE 1 00027 00028 /* where the data start on a VCD sector */ 00029 #define VCD_DATA_START 24 00030 /* size of the availablr data on a VCD sector */ 00031 #define VCD_DATA_SIZE 2324 00032 /* size of a VCD sector, header and tail included */ 00033 #define VCD_SECTOR_SIZE 2352 00034 /* size of a CD sector */ 00035 #define CD_SECTOR_SIZE 2048 00036 /* sector containing the entry points */ 00037 #define VCD_ENTRIES_SECTOR 151 00038 00039 /* where the data start on a CDDA sector */ 00040 #define CDDA_DATA_START 0 00041 /* size of the availablr data on a CDDA sector */ 00042 #define CDDA_DATA_SIZE 2352 00043 /* size of a CDDA sector, header and tail included */ 00044 #define CDDA_SECTOR_SIZE 2352 00045 00046 /***************************************************************************** 00047 * Misc. Macros 00048 *****************************************************************************/ 00049 /* LBA = msf.frame + 75 * ( msf.second + 60 * msf.minute ) */ 00050 #define MSF_TO_LBA(min, sec, frame) ((int)frame + 75 * (sec + 60 * min)) 00051 /* LBA = msf.frame + 75 * ( msf.second - 2 + 60 * msf.minute ) */ 00052 #define MSF_TO_LBA2(min, sec, frame) ((int)frame + 75 * (sec -2 + 60 * min)) 00053 /* Converts BCD to Binary data */ 00054 #define BCD_TO_BIN(i) \ 00055 (uint8_t)((uint8_t)(0xf & (uint8_t)i)+((uint8_t)10*((uint8_t)i >> 4))) 00056 00057 typedef struct vcddev_s vcddev_t; 00058 00059 /***************************************************************************** 00060 * structure to store minute/second/frame locations 00061 *****************************************************************************/ 00062 typedef struct msf_s 00063 { 00064 uint8_t minute; 00065 uint8_t second; 00066 uint8_t frame; 00067 } msf_t; 00068 00069 /***************************************************************************** 00070 * entries_sect structure: the sector containing entry points 00071 *****************************************************************************/ 00072 typedef struct entries_sect_s 00073 { 00074 char psz_id[8]; /* "ENTRYVCD" */ 00075 uint8_t i_version; /* 0x02 VCD2.0 00076 0x01 SVCD */ 00077 uint8_t i_sys_prof_tag; /* 0x01 if VCD1.1 00078 0x00 else */ 00079 uint16_t i_entries_nb; /* entries number <= 500 */ 00080 00081 struct 00082 { 00083 uint8_t i_track; /* track number */ 00084 msf_t msf; /* msf location 00085 (in BCD format) */ 00086 } entry[500]; 00087 uint8_t zeros[36]; /* should be 0x00 */ 00088 } entries_sect_t; 00089 00090 /***************************************************************************** 00091 * Prototypes 00092 *****************************************************************************/ 00093 vcddev_t *ioctl_Open ( vlc_object_t *, const char * ); 00094 void ioctl_Close ( vlc_object_t *, vcddev_t * ); 00095 int ioctl_GetTracksMap ( vlc_object_t *, const vcddev_t *, int ** ); 00096 int ioctl_ReadSectors ( vlc_object_t *, const vcddev_t *, 00097 int, byte_t *, int, int );