Mercurial > mplayer.hg
annotate dvdread/nav_print.c @ 26262:41597529c087
synced with r26073
author | ptt |
---|---|
date | Thu, 27 Mar 2008 19:58:00 +0000 |
parents | 1542693b2a30 |
children |
rev | line source |
---|---|
24050
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
1 /* -*- c-basic-offset: 2; indent-tabs-mode: nil -*- */ |
7029 | 2 /* |
15874 | 3 * 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:
7033
diff
changeset
|
4 * |
7029 | 5 * Much of the contents in this file is based on VOBDUMP. |
6 * | |
7 * VOBDUMP: a program for examining DVD .VOB filse | |
8 * | |
9 * Copyright 1998, 1999 Eric Smith <eric@brouhaha.com> | |
10 * | |
11 * VOBDUMP is free software; you can redistribute it and/or modify it | |
12 * under the terms of the GNU General Public License version 2 as | |
13 * published by the Free Software Foundation. Note that I am not | |
14 * granting permission to redistribute or modify VOBDUMP under the | |
15 * terms of any later version of the General Public License. | |
16 * | |
17 * This program is distributed in the hope that it will be useful (or | |
18 * at least amusing), but WITHOUT ANY WARRANTY; without even the | |
19 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | |
20 * PURPOSE. See the GNU General Public License for more details. | |
21 * | |
22 * You should have received a copy of the GNU General Public License | |
23 * along with this program; if not, write to the Free Software | |
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
25 */ | |
26 | |
15874 | 27 #include "config.h" |
28 | |
7029 | 29 #include <stdio.h> |
24047
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20981
diff
changeset
|
30 |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20981
diff
changeset
|
31 #if defined(HAVE_INTTYPES_H) |
7029 | 32 #include <inttypes.h> |
24047
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20981
diff
changeset
|
33 #elif defined(HAVE_STDINT_H) |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20981
diff
changeset
|
34 #include <stdint.h> |
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20981
diff
changeset
|
35 #endif |
7029 | 36 |
37 #include "nav_types.h" | |
38 #include "nav_print.h" | |
24047
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20981
diff
changeset
|
39 #include "cmd_print.h" |
15874 | 40 #include "dvdread_internal.h" |
7029 | 41 |
42 static void print_time(dvd_time_t *dtime) { | |
43 const char *rate; | |
15874 | 44 CHECK_VALUE((dtime->hour>>4) < 0xa && (dtime->hour&0xf) < 0xa); |
45 CHECK_VALUE((dtime->minute>>4) < 0x7 && (dtime->minute&0xf) < 0xa); | |
46 CHECK_VALUE((dtime->second>>4) < 0x7 && (dtime->second&0xf) < 0xa); | |
47 CHECK_VALUE((dtime->frame_u&0xf) < 0xa); | |
7029 | 48 |
49 printf("%02x:%02x:%02x.%02x", | |
24050
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
50 dtime->hour, |
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
51 dtime->minute, |
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
52 dtime->second, |
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
53 dtime->frame_u & 0x3f); |
7029 | 54 switch((dtime->frame_u & 0xc0) >> 6) { |
55 case 1: | |
56 rate = "25.00"; | |
57 break; | |
58 case 3: | |
59 rate = "29.97"; | |
60 break; | |
61 default: | |
62 rate = "(please send a bug report)"; | |
63 break; | |
64 } | |
65 printf(" @ %s fps", rate); | |
66 } | |
67 | |
68 | |
69 static void navPrint_PCI_GI(pci_gi_t *pci_gi) { | |
70 int i; | |
71 | |
72 printf("pci_gi:\n"); | |
73 printf("nv_pck_lbn 0x%08x\n", pci_gi->nv_pck_lbn); | |
74 printf("vobu_cat 0x%04x\n", pci_gi->vobu_cat); | |
75 printf("vobu_uop_ctl 0x%08x\n", *(uint32_t*)&pci_gi->vobu_uop_ctl); | |
76 printf("vobu_s_ptm 0x%08x\n", pci_gi->vobu_s_ptm); | |
77 printf("vobu_e_ptm 0x%08x\n", pci_gi->vobu_e_ptm); | |
78 printf("vobu_se_e_ptm 0x%08x\n", pci_gi->vobu_se_e_ptm); | |
79 printf("e_eltm "); | |
80 print_time(&pci_gi->e_eltm); | |
81 printf("\n"); | |
82 | |
83 printf("vobu_isrc \""); | |
84 for(i = 0; i < 32; i++) { | |
85 char c = pci_gi->vobu_isrc[i]; | |
86 if((c >= ' ') && (c <= '~')) | |
87 printf("%c", c); | |
88 else | |
89 printf("."); | |
90 } | |
91 printf("\"\n"); | |
92 } | |
93 | |
94 static void navPrint_NSML_AGLI(nsml_agli_t *nsml_agli) { | |
95 int i, j = 0; | |
96 | |
97 for(i = 0; i < 9; i++) | |
98 j |= nsml_agli->nsml_agl_dsta[i]; | |
99 if(j == 0) | |
100 return; | |
101 | |
102 printf("nsml_agli:\n"); | |
103 for(i = 0; i < 9; i++) | |
104 if(nsml_agli->nsml_agl_dsta[i]) | |
105 printf("nsml_agl_c%d_dsta 0x%08x\n", i + 1, | |
24050
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
106 nsml_agli->nsml_agl_dsta[i]); |
7029 | 107 } |
108 | |
109 static void navPrint_HL_GI(hl_gi_t *hl_gi, int *btngr_ns, int *btn_ns) { | |
110 | |
111 if((hl_gi->hli_ss & 0x03) == 0) | |
112 return; | |
113 | |
114 printf("hl_gi:\n"); | |
115 printf("hli_ss 0x%01x\n", hl_gi->hli_ss & 0x03); | |
116 printf("hli_s_ptm 0x%08x\n", hl_gi->hli_s_ptm); | |
117 printf("hli_e_ptm 0x%08x\n", hl_gi->hli_e_ptm); | |
118 printf("btn_se_e_ptm 0x%08x\n", hl_gi->btn_se_e_ptm); | |
119 | |
120 *btngr_ns = hl_gi->btngr_ns; | |
121 printf("btngr_ns %d\n", hl_gi->btngr_ns); | |
122 printf("btngr%d_dsp_ty 0x%02x\n", 1, hl_gi->btngr1_dsp_ty); | |
123 printf("btngr%d_dsp_ty 0x%02x\n", 2, hl_gi->btngr2_dsp_ty); | |
124 printf("btngr%d_dsp_ty 0x%02x\n", 3, hl_gi->btngr3_dsp_ty); | |
125 | |
126 printf("btn_ofn %d\n", hl_gi->btn_ofn); | |
127 *btn_ns = hl_gi->btn_ns; | |
128 printf("btn_ns %d\n", hl_gi->btn_ns); | |
129 printf("nsl_btn_ns %d\n", hl_gi->nsl_btn_ns); | |
130 printf("fosl_btnn %d\n", hl_gi->fosl_btnn); | |
131 printf("foac_btnn %d\n", hl_gi->foac_btnn); | |
132 } | |
133 | |
134 static void navPrint_BTN_COLIT(btn_colit_t *btn_colit) { | |
135 int i, j; | |
136 | |
137 j = 0; | |
138 for(i = 0; i < 6; i++) | |
139 j |= btn_colit->btn_coli[i/2][i&1]; | |
140 if(j == 0) | |
141 return; | |
142 | |
143 printf("btn_colit:\n"); | |
144 for(i = 0; i < 3; i++) | |
145 for(j = 0; j < 2; j++) | |
146 printf("btn_cqoli %d %s_coli: %08x\n", | |
24050
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
147 i, (j == 0) ? "sl" : "ac", |
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
148 btn_colit->btn_coli[i][j]); |
7029 | 149 } |
150 | |
151 static void navPrint_BTNIT(btni_t *btni_table, int btngr_ns, int btn_ns) { | |
152 int i, j; | |
153 | |
154 printf("btnit:\n"); | |
155 printf("btngr_ns: %i\n", btngr_ns); | |
156 printf("btn_ns: %i\n", btn_ns); | |
157 | |
158 if(btngr_ns == 0) | |
159 return; | |
160 | |
161 for(i = 0; i < btngr_ns; i++) { | |
162 for(j = 0; j < (36 / btngr_ns); j++) { | |
163 if(j < btn_ns) { | |
24050
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
164 btni_t *btni = &btni_table[(36 / btngr_ns) * i + j]; |
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
165 |
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
166 printf("group %d btni %d: ", i+1, j+1); |
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
167 printf("btn_coln %d, auto_action_mode %d\n", |
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
168 btni->btn_coln, btni->auto_action_mode); |
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
169 printf("coords (%d, %d) .. (%d, %d)\n", |
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
170 btni->x_start, btni->y_start, btni->x_end, btni->y_end); |
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
171 |
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
172 printf("up %d, ", btni->up); |
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
173 printf("down %d, ", btni->down); |
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
174 printf("left %d, ", btni->left); |
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
175 printf("right %d\n", btni->right); |
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
176 |
24047
de28f9e8cb00
Sync libdvdread with version 0.9.5 (functional changes).
diego
parents:
20981
diff
changeset
|
177 cmdPrint_CMD(0, &btni->cmd); |
24050
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
178 printf("\n"); |
7029 | 179 } |
180 } | |
181 } | |
182 } | |
183 | |
184 static void navPrint_HLI(hli_t *hli) { | |
185 int btngr_ns = 0, btn_ns = 0; | |
186 | |
187 printf("hli:\n"); | |
188 navPrint_HL_GI(&hli->hl_gi, & btngr_ns, & btn_ns); | |
189 navPrint_BTN_COLIT(&hli->btn_colit); | |
190 navPrint_BTNIT(hli->btnit, btngr_ns, btn_ns); | |
191 } | |
192 | |
193 void navPrint_PCI(pci_t *pci) { | |
194 printf("pci packet:\n"); | |
195 navPrint_PCI_GI(&pci->pci_gi); | |
196 navPrint_NSML_AGLI(&pci->nsml_agli); | |
197 navPrint_HLI(&pci->hli); | |
198 } | |
199 | |
200 static void navPrint_DSI_GI(dsi_gi_t *dsi_gi) { | |
201 printf("dsi_gi:\n"); | |
202 printf("nv_pck_scr 0x%08x\n", dsi_gi->nv_pck_scr); | |
203 printf("nv_pck_lbn 0x%08x\n", dsi_gi->nv_pck_lbn ); | |
204 printf("vobu_ea 0x%08x\n", dsi_gi->vobu_ea); | |
205 printf("vobu_1stref_ea 0x%08x\n", dsi_gi->vobu_1stref_ea); | |
206 printf("vobu_2ndref_ea 0x%08x\n", dsi_gi->vobu_2ndref_ea); | |
207 printf("vobu_3rdref_ea 0x%08x\n", dsi_gi->vobu_3rdref_ea); | |
208 printf("vobu_vob_idn 0x%04x\n", dsi_gi->vobu_vob_idn); | |
209 printf("vobu_c_idn 0x%02x\n", dsi_gi->vobu_c_idn); | |
210 printf("c_eltm "); | |
211 print_time(&dsi_gi->c_eltm); | |
212 printf("\n"); | |
213 } | |
214 | |
215 static void navPrint_SML_PBI(sml_pbi_t *sml_pbi) { | |
216 printf("sml_pbi:\n"); | |
217 printf("category 0x%04x\n", sml_pbi->category); | |
218 if(sml_pbi->category & 0x8000) | |
219 printf("VOBU is in preunit\n"); | |
220 if(sml_pbi->category & 0x4000) | |
221 printf("VOBU is in ILVU\n"); | |
222 if(sml_pbi->category & 0x2000) | |
223 printf("VOBU at the beginning of ILVU\n"); | |
224 if(sml_pbi->category & 0x1000) | |
225 printf("VOBU at end of PREU of ILVU\n"); | |
226 | |
227 printf("ilvu_ea 0x%08x\n", sml_pbi->ilvu_ea); | |
228 printf("nxt_ilvu_sa 0x%08x\n", sml_pbi->ilvu_sa); | |
229 printf("nxt_ilvu_size 0x%04x\n", sml_pbi->size); | |
230 | |
231 printf("vob_v_s_s_ptm 0x%08x\n", sml_pbi->vob_v_s_s_ptm); | |
232 printf("vob_v_e_e_ptm 0x%08x\n", sml_pbi->vob_v_e_e_ptm); | |
233 | |
234 /* $$$ more code needed here */ | |
235 } | |
236 | |
237 static void navPrint_SML_AGLI(sml_agli_t *sml_agli) { | |
238 int i; | |
239 printf("sml_agli:\n"); | |
240 for(i = 0; i < 9; i++) { | |
241 printf("agl_c%d address: 0x%08x size 0x%04x\n", i, | |
24050
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
242 sml_agli->data[i].address, sml_agli->data[i].size); |
7029 | 243 } |
244 } | |
245 | |
246 static void navPrint_VOBU_SRI(vobu_sri_t *vobu_sri) { | |
247 int i; | |
248 int stime[19] = { 240, 120, 60, 20, 15, 14, 13, 12, 11, | |
24050
1542693b2a30
Sync libdvdread with version 0.9.5 (cosmetic changes).
diego
parents:
24047
diff
changeset
|
249 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; |
7029 | 250 printf("vobu_sri:\n"); |
251 printf("Next VOBU with Video %08x\n", vobu_sri->next_video); | |
252 for(i = 0; i < 19; i++) { | |
253 printf("%3.1f %08x ", stime[i]/2.0, vobu_sri->fwda[i]); | |
254 } | |
255 printf("\n"); | |
256 printf("Next VOBU %08x\n", vobu_sri->next_vobu); | |
257 printf("--\n"); | |
258 printf("Prev VOBU %08x\n", vobu_sri->prev_vobu); | |
259 for(i = 0; i < 19; i++) { | |
260 printf("%3.1f %08x ", stime[18 - i]/2.0, vobu_sri->bwda[i]); | |
261 } | |
262 printf("\n"); | |
263 printf("Prev VOBU with Video %08x\n", vobu_sri->prev_video); | |
264 } | |
265 | |
266 static void navPrint_SYNCI(synci_t *synci) { | |
267 int i; | |
268 | |
269 printf("synci:\n"); | |
270 /* $$$ more code needed here */ | |
271 for(i = 0; i < 8; i++) | |
272 printf("%04x ", synci->a_synca[i]); | |
273 for(i = 0; i < 32; i++) | |
274 printf("%08x ", synci->sp_synca[i]); | |
275 } | |
276 | |
277 void navPrint_DSI(dsi_t *dsi) { | |
278 printf("dsi packet:\n"); | |
279 navPrint_DSI_GI(&dsi->dsi_gi); | |
280 navPrint_SML_PBI(&dsi->sml_pbi); | |
281 navPrint_SML_AGLI(&dsi->sml_agli); | |
282 navPrint_VOBU_SRI(&dsi->vobu_sri); | |
283 navPrint_SYNCI(&dsi->synci); | |
284 } | |
285 | |
286 |