Mercurial > mplayer.hg
annotate dvdread/nav_read.c @ 24047:de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
author | diego |
---|---|
date | Wed, 15 Aug 2007 11:47:22 +0000 |
parents | 22cb9d5f1e21 |
children | 1542693b2a30 |
rev | line source |
---|---|
7029 | 1 /* |
15874 | 2 * Copyright (C) 2000, 2001, 2002, 2003 Håkan Hjort <d95hjort@dtek.chalmers.se> |
14938
25df9508f9a8
Mark modified files as such to comply more closely with GPL ¡ø2a.
diego
parents:
8257
diff
changeset
|
3 * |
7029 | 4 * This program is free software; you can redistribute it and/or modify |
5 * it under the terms of the GNU General Public License as published by | |
6 * the Free Software Foundation; either version 2 of the License, or | |
7 * (at your option) any later version. | |
8 * | |
9 * This program is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 * GNU General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU General Public License | |
15 * along with this program; if not, write to the Free Software | |
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
17 */ | |
18 | |
15874 | 19 #include "config.h" |
20 | |
7029 | 21 #include <stdio.h> |
22 #include <string.h> | |
24047
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20981
diff
changeset
|
23 #if defined(HAVE_INTTYPES_H) |
7029 | 24 #include <inttypes.h> |
24047
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20981
diff
changeset
|
25 #elif defined(HAVE_STDINT_H) |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20981
diff
changeset
|
26 #include <stdint.h> |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20981
diff
changeset
|
27 #endif |
7029 | 28 |
29 #include "bswap.h" | |
30 #include "nav_types.h" | |
31 #include "nav_read.h" | |
15874 | 32 #include "dvdread_internal.h" |
7029 | 33 |
34 void navRead_PCI(pci_t *pci, unsigned char *buffer) { | |
15874 | 35 int i, j; |
7029 | 36 |
15874 | 37 CHECK_VALUE(sizeof(pci_t) == PCI_BYTES - 1); // -1 for substream id |
7029 | 38 |
39 memcpy(pci, buffer, sizeof(pci_t)); | |
40 | |
41 /* Endian conversions */ | |
42 | |
43 /* pci pci_gi */ | |
44 B2N_32(pci->pci_gi.nv_pck_lbn); | |
45 B2N_16(pci->pci_gi.vobu_cat); | |
46 B2N_32(pci->pci_gi.vobu_s_ptm); | |
47 B2N_32(pci->pci_gi.vobu_e_ptm); | |
48 B2N_32(pci->pci_gi.vobu_se_e_ptm); | |
49 | |
50 /* pci nsml_agli */ | |
51 for(i = 0; i < 9; i++) | |
52 B2N_32(pci->nsml_agli.nsml_agl_dsta[i]); | |
53 | |
54 /* pci hli hli_gi */ | |
55 B2N_16(pci->hli.hl_gi.hli_ss); | |
56 B2N_32(pci->hli.hl_gi.hli_s_ptm); | |
57 B2N_32(pci->hli.hl_gi.hli_e_ptm); | |
58 B2N_32(pci->hli.hl_gi.btn_se_e_ptm); | |
59 | |
60 /* pci hli btn_colit */ | |
61 for(i = 0; i < 3; i++) | |
62 for(j = 0; j < 2; j++) | |
63 B2N_32(pci->hli.btn_colit.btn_coli[i][j]); | |
64 | |
15874 | 65 /* NOTE: I've had to change the structure from the disk layout to get |
66 * the packing to work with Sun's Forte C compiler. */ | |
67 | |
7029 | 68 /* pci hli btni */ |
69 for(i = 0; i < 36; i++) { | |
15874 | 70 char tmp[sizeof(pci->hli.btnit[i])], swap; |
71 memcpy(tmp, &(pci->hli.btnit[i]), sizeof(pci->hli.btnit[i])); | |
72 /* Byte 4 to 7 are 'rotated' was: ABCD EFGH IJ is: ABCG DEFH IJ */ | |
73 swap = tmp[6]; | |
74 tmp[6] = tmp[5]; | |
75 tmp[5] = tmp[4]; | |
76 tmp[4] = tmp[3]; | |
77 tmp[3] = swap; | |
78 | |
79 /* Then there are the two B2N_24(..) calls */ | |
80 #ifndef WORDS_BIGENDIAN | |
81 swap = tmp[0]; | |
82 tmp[0] = tmp[2]; | |
83 tmp[2] = swap; | |
84 | |
85 swap = tmp[4]; | |
86 tmp[4] = tmp[6]; | |
87 tmp[6] = swap; | |
88 #endif | |
89 memcpy(&(pci->hli.btnit[i]), tmp, sizeof(pci->hli.btnit[i])); | |
7029 | 90 } |
91 | |
92 | |
15874 | 93 #ifndef NDEBUG |
7029 | 94 /* Asserts */ |
95 | |
96 /* pci pci gi */ | |
15874 | 97 CHECK_VALUE(pci->pci_gi.zero1 == 0); |
7029 | 98 |
99 /* pci hli hli_gi */ | |
15874 | 100 CHECK_VALUE(pci->hli.hl_gi.zero1 == 0); |
101 CHECK_VALUE(pci->hli.hl_gi.zero2 == 0); | |
102 CHECK_VALUE(pci->hli.hl_gi.zero3 == 0); | |
103 CHECK_VALUE(pci->hli.hl_gi.zero4 == 0); | |
104 CHECK_VALUE(pci->hli.hl_gi.zero5 == 0); | |
7029 | 105 |
106 /* Are there buttons defined here? */ | |
107 if((pci->hli.hl_gi.hli_ss & 0x03) != 0) { | |
15874 | 108 CHECK_VALUE(pci->hli.hl_gi.btn_ns != 0); |
109 CHECK_VALUE(pci->hli.hl_gi.btngr_ns != 0); | |
7029 | 110 } else { |
15874 | 111 CHECK_VALUE((pci->hli.hl_gi.btn_ns != 0 && pci->hli.hl_gi.btngr_ns != 0) |
7029 | 112 || (pci->hli.hl_gi.btn_ns == 0 && pci->hli.hl_gi.btngr_ns == 0)); |
113 } | |
114 | |
115 /* pci hli btnit */ | |
116 for(i = 0; i < pci->hli.hl_gi.btngr_ns; i++) { | |
117 for(j = 0; j < (36 / pci->hli.hl_gi.btngr_ns); j++) { | |
8257
635df9d22d38
100l patch by (Dominik Mierzejewski <dominik at rangers dot eu dot org>)
michael
parents:
8254
diff
changeset
|
118 int n = (36 / pci->hli.hl_gi.btngr_ns) * i + j; |
15874 | 119 CHECK_VALUE(pci->hli.btnit[n].zero1 == 0); |
120 CHECK_VALUE(pci->hli.btnit[n].zero2 == 0); | |
121 CHECK_VALUE(pci->hli.btnit[n].zero3 == 0); | |
122 CHECK_VALUE(pci->hli.btnit[n].zero4 == 0); | |
123 CHECK_VALUE(pci->hli.btnit[n].zero5 == 0); | |
124 CHECK_VALUE(pci->hli.btnit[n].zero6 == 0); | |
7029 | 125 |
126 if (j < pci->hli.hl_gi.btn_ns) { | |
15874 | 127 CHECK_VALUE(pci->hli.btnit[n].x_start <= pci->hli.btnit[n].x_end); |
128 CHECK_VALUE(pci->hli.btnit[n].y_start <= pci->hli.btnit[n].y_end); | |
129 CHECK_VALUE(pci->hli.btnit[n].up <= pci->hli.hl_gi.btn_ns); | |
130 CHECK_VALUE(pci->hli.btnit[n].down <= pci->hli.hl_gi.btn_ns); | |
131 CHECK_VALUE(pci->hli.btnit[n].left <= pci->hli.hl_gi.btn_ns); | |
132 CHECK_VALUE(pci->hli.btnit[n].right <= pci->hli.hl_gi.btn_ns); | |
7029 | 133 //vmcmd_verify(pci->hli.btnit[n].cmd); |
134 } else { | |
15874 | 135 int k; |
136 CHECK_VALUE(pci->hli.btnit[n].btn_coln == 0); | |
137 CHECK_VALUE(pci->hli.btnit[n].auto_action_mode == 0); | |
138 CHECK_VALUE(pci->hli.btnit[n].x_start == 0); | |
139 CHECK_VALUE(pci->hli.btnit[n].y_start == 0); | |
140 CHECK_VALUE(pci->hli.btnit[n].x_end == 0); | |
141 CHECK_VALUE(pci->hli.btnit[n].y_end == 0); | |
142 CHECK_VALUE(pci->hli.btnit[n].up == 0); | |
143 CHECK_VALUE(pci->hli.btnit[n].down == 0); | |
144 CHECK_VALUE(pci->hli.btnit[n].left == 0); | |
145 CHECK_VALUE(pci->hli.btnit[n].right == 0); | |
7029 | 146 for (k = 0; k < 8; k++) |
15874 | 147 CHECK_VALUE(pci->hli.btnit[n].cmd.bytes[k] == 0); //CHECK_ZERO? |
7029 | 148 } |
149 } | |
150 } | |
15874 | 151 #endif /* !NDEBUG */ |
7029 | 152 } |
153 | |
154 void navRead_DSI(dsi_t *dsi, unsigned char *buffer) { | |
155 int i; | |
156 | |
15874 | 157 CHECK_VALUE(sizeof(dsi_t) == DSI_BYTES - 1); // -1 for substream id |
7029 | 158 |
159 memcpy(dsi, buffer, sizeof(dsi_t)); | |
160 | |
161 /* Endian conversions */ | |
162 | |
163 /* dsi dsi gi */ | |
164 B2N_32(dsi->dsi_gi.nv_pck_scr); | |
165 B2N_32(dsi->dsi_gi.nv_pck_lbn); | |
166 B2N_32(dsi->dsi_gi.vobu_ea); | |
167 B2N_32(dsi->dsi_gi.vobu_1stref_ea); | |
168 B2N_32(dsi->dsi_gi.vobu_2ndref_ea); | |
169 B2N_32(dsi->dsi_gi.vobu_3rdref_ea); | |
170 B2N_16(dsi->dsi_gi.vobu_vob_idn); | |
171 | |
172 /* dsi sml pbi */ | |
173 B2N_16(dsi->sml_pbi.category); | |
174 B2N_32(dsi->sml_pbi.ilvu_ea); | |
175 B2N_32(dsi->sml_pbi.ilvu_sa); | |
176 B2N_16(dsi->sml_pbi.size); | |
177 B2N_32(dsi->sml_pbi.vob_v_s_s_ptm); | |
178 B2N_32(dsi->sml_pbi.vob_v_e_e_ptm); | |
179 | |
180 /* dsi sml agli */ | |
181 for(i = 0; i < 9; i++) { | |
182 B2N_32(dsi->sml_agli.data[ i ].address); | |
183 B2N_16(dsi->sml_agli.data[ i ].size); | |
184 } | |
185 | |
186 /* dsi vobu sri */ | |
187 B2N_32(dsi->vobu_sri.next_video); | |
188 for(i = 0; i < 19; i++) | |
189 B2N_32(dsi->vobu_sri.fwda[i]); | |
190 B2N_32(dsi->vobu_sri.next_vobu); | |
191 B2N_32(dsi->vobu_sri.prev_vobu); | |
192 for(i = 0; i < 19; i++) | |
193 B2N_32(dsi->vobu_sri.bwda[i]); | |
194 B2N_32(dsi->vobu_sri.prev_video); | |
195 | |
196 /* dsi synci */ | |
197 for(i = 0; i < 8; i++) | |
198 B2N_16(dsi->synci.a_synca[i]); | |
199 for(i = 0; i < 32; i++) | |
200 B2N_32(dsi->synci.sp_synca[i]); | |
201 | |
202 | |
203 /* Asserts */ | |
204 | |
205 /* dsi dsi gi */ | |
15874 | 206 CHECK_VALUE(dsi->dsi_gi.zero1 == 0); |
7029 | 207 } |
208 |