1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ 2 /* 3 * Libbrasero-media 4 * Copyright (C) Philippe Rouquier 2005-2009 <bonfire-app@wanadoo.fr> 5 * 6 * Libbrasero-media is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * The Libbrasero-media authors hereby grant permission for non-GPL compatible 12 * GStreamer plugins to be used and distributed together with GStreamer 13 * and Libbrasero-media. This permission is above and beyond the permissions granted 14 * by the GPL license by which Libbrasero-media is covered. If you modify this code 15 * you may extend this exception to your version of the code, but you are not 16 * obligated to do so. If you do not wish to do so, delete this exception 17 * statement from your version. 18 * 19 * Libbrasero-media is distributed in the hope that it will be useful, 20 * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 * GNU Library General Public License for more details. 23 * 24 * You should have received a copy of the GNU General Public License 25 * along with this program; if not, write to: 26 * The Free Software Foundation, Inc., 27 * 51 Franklin Street, Fifth Floor 28 * Boston, MA 02110-1301, USA. 29 */ 30 31 #include <glib.h> 32 33 #include "scsi-base.h" 34 35 #ifndef _SCSI_READ_DISC_INFO_H 36 #define _SCSI_READ_DISC_INFO_H 37 38 G_BEGIN_DECLS 39 40 typedef enum { 41 BRASERO_SCSI_SESSION_EMPTY = 0x00, 42 BRASERO_SCSI_SESSION_INCOMPLETE = 0x01, 43 BRASERO_SCSI_SESSION_DAMAGED = 0x02, 44 BRASERO_SCSI_SESSION_COMPLETE = 0x03 45 } BraseroScsiSessionState; 46 47 typedef enum { 48 BRASERO_SCSI_DISC_EMPTY = 0x00, 49 BRASERO_SCSI_DISC_INCOMPLETE = 0x01, 50 BRASERO_SCSI_DISC_FINALIZED = 0x02, 51 BRASERO_SCSI_DISC_OTHERS = 0x03 52 } BraseroScsiDiscStatus; 53 54 typedef enum { 55 BRASERO_SCSI_BG_FORMAT_BLANK_OR_NOT_RW = 0x00, 56 BRASERO_SCSI_BG_FORMAT_STARTED = 0x01, 57 BRASERO_SCSI_BG_FORMAT_IN_PROGESS = 0x02, 58 BRASERO_SCSI_BG_FORMAT_COMPLETED = 0x03 59 } BraseroScsiBgFormatStatus; 60 61 typedef enum { 62 BRASERO_SCSI_DISC_CDDA_CDROM = 0x00, 63 BRASERO_SCSI_DISC_CD_I = 0x10, 64 BRASERO_SCSI_DISC_XA = 0x20, 65 BRASERO_SCSI_DISC_UNDEFINED = 0xFF 66 /* reserved */ 67 } BraseroScsiTrackDataFormat; 68 69 70 struct _BraseroScsiOPCEntry { 71 uchar speed [2]; 72 uchar opc [6]; 73 }; 74 typedef struct _BraseroScsiOPCEntry BraseroScsiOPCEntry; 75 76 #if G_BYTE_ORDER == G_LITTLE_ENDIAN 77 78 struct _BraseroScsiDiscInfoStd { 79 uchar len [2]; 80 81 uchar status :2; 82 uchar last_session_state :2; 83 uchar erasable :1; 84 uchar info_type :3; 85 86 uchar first_track_num; 87 uchar sessions_num_low; 88 uchar first_track_nb_lastses_low; 89 uchar last_track_nb_lastses_low; 90 91 uchar bg_format_status :2; 92 uchar dbit :1; 93 uchar reserved0 :1; 94 uchar disc_app_code_valid :1; 95 uchar unrestricted_use :1; 96 uchar disc_barcode_valid :1; 97 uchar disc_id_valid :1; 98 99 uchar disc_type; 100 101 uchar sessions_num_high; 102 uchar first_track_nb_lastses_high; 103 uchar last_track_nb_lastses_high; 104 105 uchar disc_id [4]; 106 uchar last_session_leadin [4]; 107 108 uchar last_possible_leadout_res; 109 uchar last_possible_leadout_mn; 110 uchar last_possible_leadout_sec; 111 uchar last_possible_leadout_frame; 112 113 uchar disc_barcode [8]; 114 115 uchar reserved1; 116 117 uchar OPC_table_num; 118 BraseroScsiOPCEntry opc_entry [0]; 119 }; 120 121 struct _BraseroScsiTrackResInfo { 122 uchar len [2]; 123 124 uchar reserved0 :5; 125 uchar disc_info :3; 126 127 uchar reserved1; 128 129 uchar max_track_num [2]; 130 uchar track_num [2]; 131 uchar max_appendable_track [2]; 132 uchar appendable_track_num [2]; 133 }; 134 135 struct _BraseroScsiPOWResInfo { 136 uchar len [2]; 137 138 uchar reserved0 :5; 139 uchar disc_info :3; 140 141 uchar reserved1; 142 143 uchar remaining_pow_replacements[4]; 144 uchar remaining_pow_realloc [4]; 145 uchar remaining_pow_update [4]; 146 }; 147 148 #else 149 150 struct _BraseroScsiDiscInfoStd { 151 uchar len [2]; 152 153 uchar info_type :3; 154 uchar erasable :1; 155 uchar last_session_state :2; 156 uchar status :2; 157 158 uchar first_track_num; 159 uchar sessions_num_low; 160 uchar first_track_nb_lastses_low; 161 uchar last_track_nb_lastses_low; 162 163 uchar disc_id_valid :1; 164 uchar disc_barcode_valid :1; 165 uchar unrestricted_use :1; 166 uchar disc_app_code_valid :1; 167 uchar reserved0 :1; 168 uchar dbit :1; 169 uchar bg_format_status :2; 170 171 uchar disc_type; 172 173 uchar sessions_num_high; 174 uchar first_track_nb_lastses_high; 175 uchar last_track_nb_lastses_high; 176 177 uchar disc_id [4]; 178 uchar last_session_leadin [4]; 179 180 uchar last_possible_leadout_res; 181 uchar last_possible_leadout_mn; 182 uchar last_possible_leadout_sec; 183 uchar last_possible_leadout_frame; 184 185 uchar disc_barcode [8]; 186 187 uchar reserved1; 188 189 uchar OPC_table_num; 190 BraseroScsiOPCEntry opc_entry [0]; 191 }; 192 193 struct _BraseroScsiTrackResInfo { 194 uchar len [2]; 195 196 uchar disc_info :3; 197 uchar reserved0 :5; 198 199 uchar reserved1; 200 201 uchar max_track_num [2]; 202 uchar tracks_num [2]; 203 uchar max_appendable_tracks [2]; 204 uchar appendable_track_num [2]; 205 }; 206 207 struct _BraseroScsiPOWResInfo { 208 uchar len [2]; 209 210 uchar disc_info :3; 211 uchar reserved0 :5; 212 213 uchar reserved1; 214 215 uchar remaining_pow_replacements[4]; 216 uchar remaining_pow_realloc [4]; 217 uchar remaining_pow_update [4]; 218 }; 219 220 #endif 221 222 #define BRASERO_FIRST_TRACK_IN_LAST_SESSION(info) (((info)->first_track_nb_lastses_high << 8) + (info)->first_track_nb_lastses_low) 223 #define BRASERO_LAST_TRACK_IN_LAST_SESSION(info) (((info)->last_track_nb_lastses_high << 8) + (info)->last_track_nb_lastses_low) 224 #define BRASERO_SESSION_NUM(info) (((info)->sessions_num_high << 8) + (info)->sessions_num_low) 225 226 typedef struct _BraseroScsiDiscInfoStd BraseroScsiDiscInfoStd; 227 typedef struct _BraseroScsiTrackResInfo BraseroScsiTrackResInfo; 228 typedef struct _BraseroScsiPOWResInfo BraseroScsiPOWResInfo; 229 230 G_END_DECLS 231 232 #endif /* _SCSI_READ_DISC_INFO_H */ 233 234 235