Mercurial > libdvdread4.hg
annotate dvdread/nav_types.h @ 74:133be2fe0eef src
Use NULL instead of 0 consistently.
Since this is C and not C++, NULL is the stylistic choice
for pointer assignments and checking. This patch, kindly submitted
by Frederic Marchal <fmarchal AT perso DOT be> changes all of
places were ptl_mait is used in ifo_read.c. Thanks!
author | erik |
---|---|
date | Fri, 07 Oct 2011 16:56:02 +0000 |
parents | eac01aeb7be5 |
children |
rev | line source |
---|---|
3 | 1 /* |
22 | 2 * Copyright (C) 2000, 2001, 2002 HÃ¥kan Hjort <d95hjort@dtek.chalmers.se> |
3 | 3 * |
4 * The data structures in this file should represent the layout of the | |
5 * pci and dsi packets as they are stored in the stream. Information | |
6 * found by reading the source to VOBDUMP is the base for the structure | |
7 * and names of these data types. | |
8 * | |
9 * VOBDUMP: a program for examining DVD .VOB files. | |
10 * Copyright 1998, 1999 Eric Smith <eric@brouhaha.com> | |
11 * | |
12 * VOBDUMP is free software; you can redistribute it and/or modify it | |
13 * under the terms of the GNU General Public License version 2 as | |
14 * published by the Free Software Foundation. Note that I am not | |
15 * granting permission to redistribute or modify VOBDUMP under the terms | |
16 * of any later version of the General Public License. | |
17 * | |
18 * This program is distributed in the hope that it will be useful (or at | |
19 * least amusing), but WITHOUT ANY WARRANTY; without even the implied | |
20 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See | |
21 * the GNU General Public License for more details. | |
22 * | |
23 * You should have received a copy of the GNU General Public License | |
21
4aa618ae094f
Use consistent license headers everywhere: Fix FSF address and boilerplate.
diego
parents:
20
diff
changeset
|
24 * along with this program; if not, write to the Free Software Foundation, |
4aa618ae094f
Use consistent license headers everywhere: Fix FSF address and boilerplate.
diego
parents:
20
diff
changeset
|
25 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
3 | 26 */ |
27 | |
23 | 28 #ifndef LIBDVDREAD_NAV_TYPES_H |
29 #define LIBDVDREAD_NAV_TYPES_H | |
30 | |
3 | 31 #include <inttypes.h> |
32 #include "ifo_types.h" /* only dvd_time_t, vm_cmd_t and user_ops_t */ | |
33 | |
34 /* The length including the substream id byte. */ | |
35 #define PCI_BYTES 0x3d4 | |
36 #define DSI_BYTES 0x3fa | |
37 | |
38 #define PS2_PCI_SUBSTREAM_ID 0x00 | |
39 #define PS2_DSI_SUBSTREAM_ID 0x01 | |
40 | |
41 /* Remove this */ | |
42 #define DSI_START_BYTE 1031 | |
43 | |
44 /** | |
20 | 45 * PCI General Information |
3 | 46 */ |
47 typedef struct { | |
48 uint32_t nv_pck_lbn; /**< sector address of this nav pack */ | |
49 uint16_t vobu_cat; /**< 'category' of vobu */ | |
50 uint16_t zero1; /**< reserved */ | |
51 user_ops_t vobu_uop_ctl; /**< UOP of vobu */ | |
52 uint32_t vobu_s_ptm; /**< start presentation time of vobu */ | |
53 uint32_t vobu_e_ptm; /**< end presentation time of vobu */ | |
54 uint32_t vobu_se_e_ptm; /**< end ptm of sequence end in vobu */ | |
55 dvd_time_t e_eltm; /**< Cell elapsed time */ | |
56 char vobu_isrc[32]; | |
57 } ATTRIBUTE_PACKED pci_gi_t; | |
58 | |
59 /** | |
60 * Non Seamless Angle Information | |
61 */ | |
62 typedef struct { | |
63 uint32_t nsml_agl_dsta[9]; /**< address of destination vobu in AGL_C#n */ | |
64 } ATTRIBUTE_PACKED nsml_agli_t; | |
65 | |
20 | 66 /** |
67 * Highlight General Information | |
3 | 68 * |
69 * For btngrX_dsp_ty the bits have the following meaning: | |
70 * 000b: normal 4/3 only buttons | |
71 * XX1b: wide (16/9) buttons | |
72 * X1Xb: letterbox buttons | |
73 * 1XXb: pan&scan buttons | |
74 */ | |
75 typedef struct { | |
76 uint16_t hli_ss; /**< status, only low 2 bits 0: no buttons, 1: different 2: equal 3: eual except for button cmds */ | |
77 uint32_t hli_s_ptm; /**< start ptm of hli */ | |
78 uint32_t hli_e_ptm; /**< end ptm of hli */ | |
79 uint32_t btn_se_e_ptm; /**< end ptm of button select */ | |
80 unsigned int zero1 : 2; /**< reserved */ | |
81 unsigned int btngr_ns : 2; /**< number of button groups 1, 2 or 3 with 36/18/12 buttons */ | |
82 unsigned int zero2 : 1; /**< reserved */ | |
83 unsigned int btngr1_dsp_ty : 3; /**< display type of subpic stream for button group 1 */ | |
84 unsigned int zero3 : 1; /**< reserved */ | |
85 unsigned int btngr2_dsp_ty : 3; /**< display type of subpic stream for button group 2 */ | |
86 unsigned int zero4 : 1; /**< reserved */ | |
87 unsigned int btngr3_dsp_ty : 3; /**< display type of subpic stream for button group 3 */ | |
88 uint8_t btn_ofn; /**< button offset number range 0-255 */ | |
20 | 89 uint8_t btn_ns; /**< number of valid buttons <= 36/18/12 (low 6 bits) */ |
3 | 90 uint8_t nsl_btn_ns; /**< number of buttons selectable by U_BTNNi (low 6 bits) nsl_btn_ns <= btn_ns */ |
91 uint8_t zero5; /**< reserved */ | |
92 uint8_t fosl_btnn; /**< forcedly selected button (low 6 bits) */ | |
93 uint8_t foac_btnn; /**< forcedly activated button (low 6 bits) */ | |
94 } ATTRIBUTE_PACKED hl_gi_t; | |
95 | |
96 | |
20 | 97 /** |
98 * Button Color Information Table | |
3 | 99 * Each entry beeing a 32bit word that contains the color indexs and alpha |
100 * values to use. They are all represented by 4 bit number and stored | |
101 * like this [Ci3, Ci2, Ci1, Ci0, A3, A2, A1, A0]. The actual palette | |
102 * that the indexes reference is in the PGC. | |
103 * @TODO split the uint32_t into a struct | |
104 */ | |
105 typedef struct { | |
106 uint32_t btn_coli[3][2]; /**< [button color number-1][select:0/action:1] */ | |
107 } ATTRIBUTE_PACKED btn_colit_t; | |
108 | |
20 | 109 /** |
3 | 110 * Button Information |
111 * | |
112 * NOTE: I've had to change the structure from the disk layout to get | |
113 * the packing to work with Sun's Forte C compiler. | |
114 * The 4 and 7 bytes are 'rotated' was: ABC DEF GHIJ is: ABCG DEFH IJ | |
115 */ | |
116 typedef struct { | |
117 unsigned int btn_coln : 2; /**< button color number */ | |
118 unsigned int x_start : 10; /**< x start offset within the overlay */ | |
119 unsigned int zero1 : 2; /**< reserved */ | |
120 unsigned int x_end : 10; /**< x end offset within the overlay */ | |
121 | |
122 unsigned int auto_action_mode : 2; /**< 0: no, 1: activated if selected */ | |
123 unsigned int y_start : 10; /**< y start offset within the overlay */ | |
124 unsigned int zero2 : 2; /**< reserved */ | |
125 unsigned int y_end : 10; /**< y end offset within the overlay */ | |
126 | |
127 unsigned int zero3 : 2; /**< reserved */ | |
128 unsigned int up : 6; /**< button index when pressing up */ | |
129 unsigned int zero4 : 2; /**< reserved */ | |
130 unsigned int down : 6; /**< button index when pressing down */ | |
131 unsigned int zero5 : 2; /**< reserved */ | |
132 unsigned int left : 6; /**< button index when pressing left */ | |
133 unsigned int zero6 : 2; /**< reserved */ | |
134 unsigned int right : 6; /**< button index when pressing right */ | |
135 vm_cmd_t cmd; | |
136 } ATTRIBUTE_PACKED btni_t; | |
137 | |
138 /** | |
20 | 139 * Highlight Information |
3 | 140 */ |
141 typedef struct { | |
142 hl_gi_t hl_gi; | |
143 btn_colit_t btn_colit; | |
144 btni_t btnit[36]; | |
145 } ATTRIBUTE_PACKED hli_t; | |
146 | |
147 /** | |
148 * PCI packet | |
149 */ | |
150 typedef struct { | |
151 pci_gi_t pci_gi; | |
152 nsml_agli_t nsml_agli; | |
153 hli_t hli; | |
154 uint8_t zero1[189]; | |
155 } ATTRIBUTE_PACKED pci_t; | |
156 | |
157 | |
158 | |
159 | |
160 /** | |
20 | 161 * DSI General Information |
3 | 162 */ |
163 typedef struct { | |
164 uint32_t nv_pck_scr; | |
165 uint32_t nv_pck_lbn; /**< sector address of this nav pack */ | |
166 uint32_t vobu_ea; /**< end address of this VOBU */ | |
167 uint32_t vobu_1stref_ea; /**< end address of the 1st reference image */ | |
168 uint32_t vobu_2ndref_ea; /**< end address of the 2nd reference image */ | |
169 uint32_t vobu_3rdref_ea; /**< end address of the 3rd reference image */ | |
170 uint16_t vobu_vob_idn; /**< VOB Id number that this VOBU is part of */ | |
171 uint8_t zero1; /**< reserved */ | |
172 uint8_t vobu_c_idn; /**< Cell Id number that this VOBU is part of */ | |
173 dvd_time_t c_eltm; /**< Cell elapsed time */ | |
174 } ATTRIBUTE_PACKED dsi_gi_t; | |
175 | |
176 /** | |
177 * Seamless Playback Information | |
178 */ | |
179 typedef struct { | |
180 uint16_t category; /**< 'category' of seamless VOBU */ | |
181 uint32_t ilvu_ea; /**< end address of interleaved Unit */ | |
182 uint32_t ilvu_sa; /**< start address of next interleaved unit */ | |
183 uint16_t size; /**< size of next interleaved unit */ | |
184 uint32_t vob_v_s_s_ptm; /**< video start ptm in vob */ | |
185 uint32_t vob_v_e_e_ptm; /**< video end ptm in vob */ | |
186 struct { | |
187 uint32_t stp_ptm1; | |
188 uint32_t stp_ptm2; | |
189 uint32_t gap_len1; | |
20 | 190 uint32_t gap_len2; |
3 | 191 } vob_a[8]; |
192 } ATTRIBUTE_PACKED sml_pbi_t; | |
193 | |
194 /** | |
61 | 195 * Seamless Angle Information for one angle |
3 | 196 */ |
197 typedef struct { | |
27
98951f8ec89c
cosmetics: Sync indentation and similar changes from libdvdread 0.9.5.
diego
parents:
23
diff
changeset
|
198 uint32_t address; /**< offset to next ILVU, high bit is before/after */ |
98951f8ec89c
cosmetics: Sync indentation and similar changes from libdvdread 0.9.5.
diego
parents:
23
diff
changeset
|
199 uint16_t size; /**< byte size of the ILVU pointed to by address */ |
3 | 200 } ATTRIBUTE_PACKED sml_agl_data_t; |
201 | |
202 /** | |
61 | 203 * Seamless Angle Information |
3 | 204 */ |
205 typedef struct { | |
206 sml_agl_data_t data[9]; | |
207 } ATTRIBUTE_PACKED sml_agli_t; | |
208 | |
209 /** | |
20 | 210 * VOBU Search Information |
3 | 211 */ |
212 typedef struct { | |
213 uint32_t next_video; /**< Next vobu that contains video */ | |
214 uint32_t fwda[19]; /**< Forwards, time */ | |
215 uint32_t next_vobu; | |
216 uint32_t prev_vobu; | |
217 uint32_t bwda[19]; /**< Backwards, time */ | |
218 uint32_t prev_video; | |
219 } ATTRIBUTE_PACKED vobu_sri_t; | |
220 | |
221 #define SRI_END_OF_CELL 0x3fffffff | |
222 | |
223 /** | |
224 * Synchronous Information | |
20 | 225 */ |
3 | 226 typedef struct { |
227 uint16_t a_synca[8]; /**< offset to first audio packet for this VOBU */ | |
228 uint32_t sp_synca[32]; /**< offset to first subpicture packet */ | |
229 } ATTRIBUTE_PACKED synci_t; | |
230 | |
231 /** | |
232 * DSI packet | |
233 */ | |
234 typedef struct { | |
235 dsi_gi_t dsi_gi; | |
236 sml_pbi_t sml_pbi; | |
237 sml_agli_t sml_agli; | |
238 vobu_sri_t vobu_sri; | |
239 synci_t synci; | |
240 uint8_t zero1[471]; | |
241 } ATTRIBUTE_PACKED dsi_t; | |
242 | |
243 | |
244 #if PRAGMA_PACK | |
245 #pragma pack() | |
246 #endif | |
247 | |
23 | 248 #endif /* LIBDVDREAD_NAV_TYPES_H */ |