Mercurial > mplayer.hg
annotate libmpdvdkit2/nav_types.h @ 18044:b693d92e6210
workaround to prevent segfault: when using -ve lavc with b-frames write_chunk(1st video frame) gets called with len=-1UL; -1ULl to whomever calls me that way
author | nicodvb |
---|---|
date | Wed, 05 Apr 2006 20:51:35 +0000 |
parents | 483e955893b8 |
children | 0783dd397f74 |
rev | line source |
---|---|
7029 | 1 #ifndef NAV_TYPES_H_INCLUDED |
2 #define NAV_TYPES_H_INCLUDED | |
3 | |
4 /* | |
15874 | 5 * Copyright (C) 2000, 2001, 2002 Håkan Hjort <d95hjort@dtek.chalmers.se> |
7029 | 6 * |
14938
25df9508f9a8
Mark modified files as such to comply more closely with GPL ¡ø2a.
diego
parents:
7033
diff
changeset
|
7 * Modified for use with MPlayer, changes contained in libdvdread_changes.diff. |
25df9508f9a8
Mark modified files as such to comply more closely with GPL ¡ø2a.
diego
parents:
7033
diff
changeset
|
8 * detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/ |
25df9508f9a8
Mark modified files as such to comply more closely with GPL ¡ø2a.
diego
parents:
7033
diff
changeset
|
9 * $Id$ |
25df9508f9a8
Mark modified files as such to comply more closely with GPL ¡ø2a.
diego
parents:
7033
diff
changeset
|
10 * |
7029 | 11 * The data structures in this file should represent the layout of the |
12 * pci and dsi packets as they are stored in the stream. Information | |
13 * found by reading the source to VOBDUMP is the base for the structure | |
14 * and names of these data types. | |
15 * | |
16 * VOBDUMP: a program for examining DVD .VOB files. | |
17 * Copyright 1998, 1999 Eric Smith <eric@brouhaha.com> | |
18 * | |
19 * VOBDUMP is free software; you can redistribute it and/or modify it | |
20 * under the terms of the GNU General Public License version 2 as | |
21 * published by the Free Software Foundation. Note that I am not | |
22 * granting permission to redistribute or modify VOBDUMP under the terms | |
23 * of any later version of the General Public License. | |
24 * | |
25 * This program is distributed in the hope that it will be useful (or at | |
26 * least amusing), but WITHOUT ANY WARRANTY; without even the implied | |
27 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See | |
28 * the GNU General Public License for more details. | |
29 * | |
30 * You should have received a copy of the GNU General Public License | |
31 * along with this program; if not, write to the Free Software | |
32 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |
33 * USA | |
34 */ | |
35 | |
36 #include <inttypes.h> | |
15874 | 37 #include "ifo_types.h" /* only dvd_time_t, vm_cmd_t and user_ops_t */ |
7029 | 38 |
39 | |
40 #undef ATTRIBUTE_PACKED | |
41 #undef PRAGMA_PACK_BEGIN | |
42 #undef PRAGMA_PACK_END | |
43 | |
44 #if defined(__GNUC__) | |
45 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) | |
46 #define ATTRIBUTE_PACKED __attribute__ ((packed)) | |
47 #define PRAGMA_PACK 0 | |
48 #endif | |
49 #endif | |
50 | |
51 #if !defined(ATTRIBUTE_PACKED) | |
52 #define ATTRIBUTE_PACKED | |
53 #define PRAGMA_PACK 1 | |
54 #endif | |
55 | |
56 | |
57 /* The length including the substream id byte. */ | |
58 #define PCI_BYTES 0x3d4 | |
59 #define DSI_BYTES 0x3fa | |
60 | |
61 #define PS2_PCI_SUBSTREAM_ID 0x00 | |
62 #define PS2_DSI_SUBSTREAM_ID 0x01 | |
63 | |
64 /* Remove this */ | |
65 #define DSI_START_BYTE 1031 | |
66 | |
67 | |
68 #if PRAGMA_PACK | |
69 #pragma pack(1) | |
70 #endif | |
71 | |
72 | |
73 /** | |
74 * PCI General Information | |
75 */ | |
76 typedef struct { | |
15874 | 77 uint32_t nv_pck_lbn; /**< sector address of this nav pack */ |
78 uint16_t vobu_cat; /**< 'category' of vobu */ | |
79 uint16_t zero1; /**< reserved */ | |
80 user_ops_t vobu_uop_ctl; /**< UOP of vobu */ | |
81 uint32_t vobu_s_ptm; /**< start presentation time of vobu */ | |
82 uint32_t vobu_e_ptm; /**< end presentation time of vobu */ | |
83 uint32_t vobu_se_e_ptm; /**< end ptm of sequence end in vobu */ | |
84 dvd_time_t e_eltm; /**< Cell elapsed time */ | |
7029 | 85 char vobu_isrc[32]; |
86 } ATTRIBUTE_PACKED pci_gi_t; | |
87 | |
88 /** | |
89 * Non Seamless Angle Information | |
90 */ | |
91 typedef struct { | |
15874 | 92 uint32_t nsml_agl_dsta[9]; /**< address of destination vobu in AGL_C#n */ |
7029 | 93 } ATTRIBUTE_PACKED nsml_agli_t; |
94 | |
95 /** | |
96 * Highlight General Information | |
15874 | 97 * |
98 * For btngrX_dsp_ty the bits have the following meaning: | |
99 * 000b: normal 4/3 only buttons | |
100 * XX1b: wide (16/9) buttons | |
101 * X1Xb: letterbox buttons | |
102 * 1XXb: pan&scan buttons | |
7029 | 103 */ |
104 typedef struct { | |
15874 | 105 uint16_t hli_ss; /**< status, only low 2 bits 0: no buttons, 1: different 2: equal 3: eual except for button cmds */ |
106 uint32_t hli_s_ptm; /**< start ptm of hli */ | |
107 uint32_t hli_e_ptm; /**< end ptm of hli */ | |
108 uint32_t btn_se_e_ptm; /**< end ptm of button select */ | |
7029 | 109 #ifdef WORDS_BIGENDIAN |
15874 | 110 unsigned int zero1 : 2; /**< reserved */ |
111 unsigned int btngr_ns : 2; /**< number of button groups 1, 2 or 3 with 36/18/12 buttons */ | |
112 unsigned int zero2 : 1; /**< reserved */ | |
113 unsigned int btngr1_dsp_ty : 3; /**< display type of subpic stream for button group 1 */ | |
114 unsigned int zero3 : 1; /**< reserved */ | |
115 unsigned int btngr2_dsp_ty : 3; /**< display type of subpic stream for button group 2 */ | |
116 unsigned int zero4 : 1; /**< reserved */ | |
117 unsigned int btngr3_dsp_ty : 3; /**< display type of subpic stream for button group 3 */ | |
7029 | 118 #else |
119 unsigned int btngr1_dsp_ty : 3; | |
120 unsigned int zero2 : 1; | |
121 unsigned int btngr_ns : 2; | |
122 unsigned int zero1 : 2; | |
123 unsigned int btngr3_dsp_ty : 3; | |
124 unsigned int zero4 : 1; | |
125 unsigned int btngr2_dsp_ty : 3; | |
126 unsigned int zero3 : 1; | |
127 #endif | |
15874 | 128 uint8_t btn_ofn; /**< button offset number range 0-255 */ |
129 uint8_t btn_ns; /**< number of valid buttons <= 36/18/12 (low 6 bits) */ | |
130 uint8_t nsl_btn_ns; /**< number of buttons selectable by U_BTNNi (low 6 bits) nsl_btn_ns <= btn_ns */ | |
131 uint8_t zero5; /**< reserved */ | |
132 uint8_t fosl_btnn; /**< forcedly selected button (low 6 bits) */ | |
133 uint8_t foac_btnn; /**< forcedly activated button (low 6 bits) */ | |
7029 | 134 } ATTRIBUTE_PACKED hl_gi_t; |
135 | |
136 | |
137 /** | |
138 * Button Color Information Table | |
15874 | 139 * Each entry beeing a 32bit word that contains the color indexs and alpha |
140 * values to use. They are all represented by 4 bit number and stored | |
141 * like this [Ci3, Ci2, Ci1, Ci0, A3, A2, A1, A0]. The actual palette | |
142 * that the indexes reference is in the PGC. | |
143 * @TODO split the uint32_t into a struct | |
7029 | 144 */ |
145 typedef struct { | |
15874 | 146 uint32_t btn_coli[3][2]; /**< [button color number-1][select:0/action:1] */ |
7029 | 147 } ATTRIBUTE_PACKED btn_colit_t; |
148 | |
149 /** | |
150 * Button Information | |
15874 | 151 * |
152 * NOTE: I've had to change the structure from the disk layout to get | |
153 * the packing to work with Sun's Forte C compiler. | |
154 * The 4 and 7 bytes are 'rotated' was: ABC DEF GHIJ is: ABCG DEFH IJ | |
7029 | 155 */ |
156 typedef struct { | |
157 #ifdef WORDS_BIGENDIAN | |
15874 | 158 unsigned int btn_coln : 2; /**< button color number */ |
159 unsigned int x_start : 10; /**< x start offset within the overlay */ | |
160 unsigned int zero1 : 2; /**< reserved */ | |
161 unsigned int x_end : 10; /**< x end offset within the overlay */ | |
162 | |
163 unsigned int zero3 : 2; /**< reserved */ | |
164 unsigned int up : 6; /**< button index when pressing up */ | |
7029 | 165 |
15874 | 166 unsigned int auto_action_mode : 2; /**< 0: no, 1: activated if selected */ |
167 unsigned int y_start : 10; /**< y start offset within the overlay */ | |
168 unsigned int zero2 : 2; /**< reserved */ | |
169 unsigned int y_end : 10; /**< y end offset within the overlay */ | |
170 | |
171 unsigned int zero4 : 2; /**< reserved */ | |
172 unsigned int down : 6; /**< button index when pressing down */ | |
173 unsigned int zero5 : 2; /**< reserved */ | |
174 unsigned int left : 6; /**< button index when pressing left */ | |
175 unsigned int zero6 : 2; /**< reserved */ | |
176 unsigned int right : 6; /**< button index when pressing right */ | |
7029 | 177 #else |
178 unsigned int x_end : 10; | |
179 unsigned int zero1 : 2; | |
180 unsigned int x_start : 10; | |
181 unsigned int btn_coln : 2; | |
15874 | 182 |
183 unsigned int up : 6; | |
184 unsigned int zero3 : 2; | |
185 | |
7029 | 186 unsigned int y_end : 10; |
187 unsigned int zero2 : 2; | |
188 unsigned int y_start : 10; | |
189 unsigned int auto_action_mode : 2; | |
190 | |
191 unsigned int down : 6; | |
192 unsigned int zero4 : 2; | |
193 unsigned int left : 6; | |
194 unsigned int zero5 : 2; | |
195 unsigned int right : 6; | |
196 unsigned int zero6 : 2; | |
197 #endif | |
198 vm_cmd_t cmd; | |
199 } ATTRIBUTE_PACKED btni_t; | |
200 | |
201 /** | |
202 * Highlight Information | |
203 */ | |
204 typedef struct { | |
205 hl_gi_t hl_gi; | |
206 btn_colit_t btn_colit; | |
207 btni_t btnit[36]; | |
208 } ATTRIBUTE_PACKED hli_t; | |
209 | |
210 /** | |
211 * PCI packet | |
212 */ | |
213 typedef struct { | |
214 pci_gi_t pci_gi; | |
215 nsml_agli_t nsml_agli; | |
216 hli_t hli; | |
217 uint8_t zero1[189]; | |
218 } ATTRIBUTE_PACKED pci_t; | |
219 | |
220 | |
221 | |
222 | |
223 /** | |
224 * DSI General Information | |
225 */ | |
226 typedef struct { | |
227 uint32_t nv_pck_scr; | |
15874 | 228 uint32_t nv_pck_lbn; /**< sector address of this nav pack */ |
229 uint32_t vobu_ea; /**< end address of this VOBU */ | |
230 uint32_t vobu_1stref_ea; /**< end address of the 1st reference image */ | |
231 uint32_t vobu_2ndref_ea; /**< end address of the 2nd reference image */ | |
232 uint32_t vobu_3rdref_ea; /**< end address of the 3rd reference image */ | |
233 uint16_t vobu_vob_idn; /**< VOB Id number that this VOBU is part of */ | |
234 uint8_t zero1; /**< reserved */ | |
235 uint8_t vobu_c_idn; /**< Cell Id number that this VOBU is part of */ | |
236 dvd_time_t c_eltm; /**< Cell elapsed time */ | |
7029 | 237 } ATTRIBUTE_PACKED dsi_gi_t; |
238 | |
239 /** | |
240 * Seamless Playback Information | |
241 */ | |
242 typedef struct { | |
15874 | 243 uint16_t category; /**< 'category' of seamless VOBU */ |
244 uint32_t ilvu_ea; /**< end address of interleaved Unit */ | |
245 uint32_t ilvu_sa; /**< start address of next interleaved unit */ | |
246 uint16_t size; /**< size of next interleaved unit */ | |
247 uint32_t vob_v_s_s_ptm; /**< video start ptm in vob */ | |
248 uint32_t vob_v_e_e_ptm; /**< video end ptm in vob */ | |
7029 | 249 struct { |
250 uint32_t stp_ptm1; | |
251 uint32_t stp_ptm2; | |
252 uint32_t gap_len1; | |
253 uint32_t gap_len2; | |
254 } vob_a[8]; | |
255 } ATTRIBUTE_PACKED sml_pbi_t; | |
256 | |
257 /** | |
258 * Seamless Angle Infromation for one angle | |
259 */ | |
260 typedef struct { | |
15874 | 261 uint32_t address; /**< offset to next ILVU, high bit is before/after */ |
262 uint16_t size; /**< byte size of the ILVU pointed to by address */ | |
7029 | 263 } ATTRIBUTE_PACKED sml_agl_data_t; |
264 | |
265 /** | |
266 * Seamless Angle Infromation | |
267 */ | |
268 typedef struct { | |
269 sml_agl_data_t data[9]; | |
270 } ATTRIBUTE_PACKED sml_agli_t; | |
271 | |
272 /** | |
273 * VOBU Search Information | |
274 */ | |
275 typedef struct { | |
15874 | 276 uint32_t next_video; /**< Next vobu that contains video */ |
277 uint32_t fwda[19]; /**< Forwards, time */ | |
7029 | 278 uint32_t next_vobu; |
279 uint32_t prev_vobu; | |
15874 | 280 uint32_t bwda[19]; /**< Backwards, time */ |
7029 | 281 uint32_t prev_video; |
282 } ATTRIBUTE_PACKED vobu_sri_t; | |
283 | |
284 #define SRI_END_OF_CELL 0x3fffffff | |
285 | |
286 /** | |
287 * Synchronous Information | |
288 */ | |
289 typedef struct { | |
15874 | 290 uint16_t a_synca[8]; /**< offset to first audio packet for this VOBU */ |
291 uint32_t sp_synca[32]; /**< offset to first subpicture packet */ | |
7029 | 292 } ATTRIBUTE_PACKED synci_t; |
293 | |
294 /** | |
295 * DSI packet | |
296 */ | |
297 typedef struct { | |
298 dsi_gi_t dsi_gi; | |
299 sml_pbi_t sml_pbi; | |
300 sml_agli_t sml_agli; | |
301 vobu_sri_t vobu_sri; | |
302 synci_t synci; | |
303 uint8_t zero1[471]; | |
304 } ATTRIBUTE_PACKED dsi_t; | |
305 | |
306 | |
307 #if PRAGMA_PACK | |
308 #pragma pack() | |
309 #endif | |
310 | |
311 #endif /* NAV_TYPES_H_INCLUDED */ |