Merge branch 'master' into 'master'
[brasero.git] / libbrasero-media / scsi-read-disc-info.h
blob5a06640f8f72953bfb11206902d362f6bb5a9858
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>
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.
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.
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.
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.
31 #include <glib.h>
33 #include "scsi-base.h"
35 #ifndef _SCSI_READ_DISC_INFO_H
36 #define _SCSI_READ_DISC_INFO_H
38 G_BEGIN_DECLS
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;
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;
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;
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;
70 struct _BraseroScsiOPCEntry {
71 uchar speed [2];
72 uchar opc [6];
74 typedef struct _BraseroScsiOPCEntry BraseroScsiOPCEntry;
76 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
78 struct _BraseroScsiDiscInfoStd {
79 uchar len [2];
81 uchar status :2;
82 uchar last_session_state :2;
83 uchar erasable :1;
84 uchar info_type :3;
86 uchar first_track_num;
87 uchar sessions_num_low;
88 uchar first_track_nb_lastses_low;
89 uchar last_track_nb_lastses_low;
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;
99 uchar disc_type;
101 uchar sessions_num_high;
102 uchar first_track_nb_lastses_high;
103 uchar last_track_nb_lastses_high;
105 uchar disc_id [4];
106 uchar last_session_leadin [4];
108 uchar last_possible_leadout_res;
109 uchar last_possible_leadout_mn;
110 uchar last_possible_leadout_sec;
111 uchar last_possible_leadout_frame;
113 uchar disc_barcode [8];
115 uchar reserved1;
117 uchar OPC_table_num;
118 BraseroScsiOPCEntry opc_entry [0];
121 struct _BraseroScsiTrackResInfo {
122 uchar len [2];
124 uchar reserved0 :5;
125 uchar disc_info :3;
127 uchar reserved1;
129 uchar max_track_num [2];
130 uchar track_num [2];
131 uchar max_appendable_track [2];
132 uchar appendable_track_num [2];
135 struct _BraseroScsiPOWResInfo {
136 uchar len [2];
138 uchar reserved0 :5;
139 uchar disc_info :3;
141 uchar reserved1;
143 uchar remaining_pow_replacements[4];
144 uchar remaining_pow_realloc [4];
145 uchar remaining_pow_update [4];
148 #else
150 struct _BraseroScsiDiscInfoStd {
151 uchar len [2];
153 uchar info_type :3;
154 uchar erasable :1;
155 uchar last_session_state :2;
156 uchar status :2;
158 uchar first_track_num;
159 uchar sessions_num_low;
160 uchar first_track_nb_lastses_low;
161 uchar last_track_nb_lastses_low;
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;
171 uchar disc_type;
173 uchar sessions_num_high;
174 uchar first_track_nb_lastses_high;
175 uchar last_track_nb_lastses_high;
177 uchar disc_id [4];
178 uchar last_session_leadin [4];
180 uchar last_possible_leadout_res;
181 uchar last_possible_leadout_mn;
182 uchar last_possible_leadout_sec;
183 uchar last_possible_leadout_frame;
185 uchar disc_barcode [8];
187 uchar reserved1;
189 uchar OPC_table_num;
190 BraseroScsiOPCEntry opc_entry [0];
193 struct _BraseroScsiTrackResInfo {
194 uchar len [2];
196 uchar disc_info :3;
197 uchar reserved0 :5;
199 uchar reserved1;
201 uchar max_track_num [2];
202 uchar tracks_num [2];
203 uchar max_appendable_tracks [2];
204 uchar appendable_track_num [2];
207 struct _BraseroScsiPOWResInfo {
208 uchar len [2];
210 uchar disc_info :3;
211 uchar reserved0 :5;
213 uchar reserved1;
215 uchar remaining_pow_replacements[4];
216 uchar remaining_pow_realloc [4];
217 uchar remaining_pow_update [4];
220 #endif
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)
226 typedef struct _BraseroScsiDiscInfoStd BraseroScsiDiscInfoStd;
227 typedef struct _BraseroScsiTrackResInfo BraseroScsiTrackResInfo;
228 typedef struct _BraseroScsiPOWResInfo BraseroScsiPOWResInfo;
230 G_END_DECLS
232 #endif /* _SCSI_READ_DISC_INFO_H */