Mercurial > libdvdread4.hg
annotate nav_print.c @ 64:70c34d162e6e src
Replaces the hard-coded values
The parental management structure has ratings levels. The size
of the bit mask is constant but magic values were being used
instead of named constants. This commit changes them to named
constants. This is based on a patch submitted by Frederic Marchal,
fmarchal at perso dot be. Thanks for this tidy cleanup.
author | erik |
---|---|
date | Sun, 30 Jan 2011 23:44:13 +0000 |
parents | 9f1804080f76 |
children |
rev | line source |
---|---|
3 | 1 /* |
22 | 2 * Copyright (C) 2000, 2001, 2002, 2003 HÃ¥kan Hjort <d95hjort@dtek.chalmers.se> |
3 | 3 * |
4 * Much of the contents in this file is based on VOBDUMP. | |
5 * | |
6 * VOBDUMP: a program for examining DVD .VOB filse | |
7 * | |
8 * Copyright 1998, 1999 Eric Smith <eric@brouhaha.com> | |
9 * | |
10 * VOBDUMP is free software; you can redistribute it and/or modify it | |
11 * under the terms of the GNU General Public License version 2 as | |
12 * published by the Free Software Foundation. Note that I am not | |
13 * granting permission to redistribute or modify VOBDUMP under the | |
14 * terms of any later version of the General Public License. | |
15 * | |
16 * This program is distributed in the hope that it will be useful (or | |
17 * at least amusing), but WITHOUT ANY WARRANTY; without even the | |
18 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | |
19 * PURPOSE. See the GNU General Public License for more details. | |
20 * | |
21 * 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
|
22 * 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
|
23 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
3 | 24 */ |
25 | |
26 #include <stdio.h> | |
27 #include <inttypes.h> | |
28 | |
33
c743d79f187b
Move installed headers into dvdread directory to make them easier to
reimar
parents:
27
diff
changeset
|
29 #include "dvdread/nav_types.h" |
c743d79f187b
Move installed headers into dvdread directory to make them easier to
reimar
parents:
27
diff
changeset
|
30 #include "dvdread/nav_print.h" |
c743d79f187b
Move installed headers into dvdread directory to make them easier to
reimar
parents:
27
diff
changeset
|
31 #include "dvdread/ifo_print.h" |
3 | 32 |
33 static void navPrint_PCI_GI(pci_gi_t *pci_gi) { | |
34 int i; | |
35 | |
36 printf("pci_gi:\n"); | |
37 printf("nv_pck_lbn 0x%08x\n", pci_gi->nv_pck_lbn); | |
38 printf("vobu_cat 0x%04x\n", pci_gi->vobu_cat); | |
39 printf("vobu_uop_ctl 0x%08x\n", *(uint32_t*)&pci_gi->vobu_uop_ctl); | |
40 printf("vobu_s_ptm 0x%08x\n", pci_gi->vobu_s_ptm); | |
41 printf("vobu_e_ptm 0x%08x\n", pci_gi->vobu_e_ptm); | |
42 printf("vobu_se_e_ptm 0x%08x\n", pci_gi->vobu_se_e_ptm); | |
43 printf("e_eltm "); | |
13
4e610984cc3f
added dvdread_print_time() and removed the file-static print_time() in nav_print.c; based on a patch by Erik Hovland org
nicodvb
parents:
3
diff
changeset
|
44 dvdread_print_time(&pci_gi->e_eltm); |
3 | 45 printf("\n"); |
20 | 46 |
3 | 47 printf("vobu_isrc \""); |
48 for(i = 0; i < 32; i++) { | |
49 char c = pci_gi->vobu_isrc[i]; | |
50 if((c >= ' ') && (c <= '~')) | |
51 printf("%c", c); | |
52 else | |
53 printf("."); | |
54 } | |
55 printf("\"\n"); | |
56 } | |
57 | |
58 static void navPrint_NSML_AGLI(nsml_agli_t *nsml_agli) { | |
59 int i, j = 0; | |
20 | 60 |
3 | 61 for(i = 0; i < 9; i++) |
62 j |= nsml_agli->nsml_agl_dsta[i]; | |
63 if(j == 0) | |
64 return; | |
20 | 65 |
3 | 66 printf("nsml_agli:\n"); |
67 for(i = 0; i < 9; i++) | |
68 if(nsml_agli->nsml_agl_dsta[i]) | |
20 | 69 printf("nsml_agl_c%d_dsta 0x%08x\n", i + 1, |
26 | 70 nsml_agli->nsml_agl_dsta[i]); |
3 | 71 } |
72 | |
73 static void navPrint_HL_GI(hl_gi_t *hl_gi, int *btngr_ns, int *btn_ns) { | |
20 | 74 |
3 | 75 if((hl_gi->hli_ss & 0x03) == 0) |
76 return; | |
20 | 77 |
3 | 78 printf("hl_gi:\n"); |
79 printf("hli_ss 0x%01x\n", hl_gi->hli_ss & 0x03); | |
80 printf("hli_s_ptm 0x%08x\n", hl_gi->hli_s_ptm); | |
81 printf("hli_e_ptm 0x%08x\n", hl_gi->hli_e_ptm); | |
82 printf("btn_se_e_ptm 0x%08x\n", hl_gi->btn_se_e_ptm); | |
83 | |
84 *btngr_ns = hl_gi->btngr_ns; | |
85 printf("btngr_ns %d\n", hl_gi->btngr_ns); | |
86 printf("btngr%d_dsp_ty 0x%02x\n", 1, hl_gi->btngr1_dsp_ty); | |
87 printf("btngr%d_dsp_ty 0x%02x\n", 2, hl_gi->btngr2_dsp_ty); | |
88 printf("btngr%d_dsp_ty 0x%02x\n", 3, hl_gi->btngr3_dsp_ty); | |
20 | 89 |
3 | 90 printf("btn_ofn %d\n", hl_gi->btn_ofn); |
91 *btn_ns = hl_gi->btn_ns; | |
92 printf("btn_ns %d\n", hl_gi->btn_ns); | |
93 printf("nsl_btn_ns %d\n", hl_gi->nsl_btn_ns); | |
94 printf("fosl_btnn %d\n", hl_gi->fosl_btnn); | |
95 printf("foac_btnn %d\n", hl_gi->foac_btnn); | |
96 } | |
97 | |
98 static void navPrint_BTN_COLIT(btn_colit_t *btn_colit) { | |
99 int i, j; | |
20 | 100 |
3 | 101 j = 0; |
102 for(i = 0; i < 6; i++) | |
103 j |= btn_colit->btn_coli[i/2][i&1]; | |
104 if(j == 0) | |
105 return; | |
20 | 106 |
3 | 107 printf("btn_colit:\n"); |
108 for(i = 0; i < 3; i++) | |
109 for(j = 0; j < 2; j++) | |
110 printf("btn_cqoli %d %s_coli: %08x\n", | |
26 | 111 i, (j == 0) ? "sl" : "ac", |
112 btn_colit->btn_coli[i][j]); | |
3 | 113 } |
114 | |
115 static void navPrint_BTNIT(btni_t *btni_table, int btngr_ns, int btn_ns) { | |
116 int i, j; | |
20 | 117 |
3 | 118 printf("btnit:\n"); |
119 printf("btngr_ns: %i\n", btngr_ns); | |
120 printf("btn_ns: %i\n", btn_ns); | |
20 | 121 |
3 | 122 if(btngr_ns == 0) |
123 return; | |
20 | 124 |
3 | 125 for(i = 0; i < btngr_ns; i++) { |
126 for(j = 0; j < (36 / btngr_ns); j++) { | |
127 if(j < btn_ns) { | |
26 | 128 btni_t *btni = &btni_table[(36 / btngr_ns) * i + j]; |
20 | 129 |
26 | 130 printf("group %d btni %d: ", i+1, j+1); |
131 printf("btn_coln %d, auto_action_mode %d\n", | |
132 btni->btn_coln, btni->auto_action_mode); | |
133 printf("coords (%d, %d) .. (%d, %d)\n", | |
134 btni->x_start, btni->y_start, btni->x_end, btni->y_end); | |
20 | 135 |
26 | 136 printf("up %d, ", btni->up); |
137 printf("down %d, ", btni->down); | |
138 printf("left %d, ", btni->left); | |
139 printf("right %d\n", btni->right); | |
20 | 140 |
26 | 141 /* ifoPrint_COMMAND(&btni->cmd); */ |
142 printf("\n"); | |
3 | 143 } |
144 } | |
145 } | |
146 } | |
147 | |
148 static void navPrint_HLI(hli_t *hli) { | |
149 int btngr_ns = 0, btn_ns = 0; | |
20 | 150 |
3 | 151 printf("hli:\n"); |
152 navPrint_HL_GI(&hli->hl_gi, & btngr_ns, & btn_ns); | |
153 navPrint_BTN_COLIT(&hli->btn_colit); | |
154 navPrint_BTNIT(hli->btnit, btngr_ns, btn_ns); | |
155 } | |
156 | |
157 void navPrint_PCI(pci_t *pci) { | |
158 printf("pci packet:\n"); | |
159 navPrint_PCI_GI(&pci->pci_gi); | |
160 navPrint_NSML_AGLI(&pci->nsml_agli); | |
161 navPrint_HLI(&pci->hli); | |
162 } | |
163 | |
164 static void navPrint_DSI_GI(dsi_gi_t *dsi_gi) { | |
165 printf("dsi_gi:\n"); | |
166 printf("nv_pck_scr 0x%08x\n", dsi_gi->nv_pck_scr); | |
167 printf("nv_pck_lbn 0x%08x\n", dsi_gi->nv_pck_lbn ); | |
168 printf("vobu_ea 0x%08x\n", dsi_gi->vobu_ea); | |
169 printf("vobu_1stref_ea 0x%08x\n", dsi_gi->vobu_1stref_ea); | |
170 printf("vobu_2ndref_ea 0x%08x\n", dsi_gi->vobu_2ndref_ea); | |
171 printf("vobu_3rdref_ea 0x%08x\n", dsi_gi->vobu_3rdref_ea); | |
172 printf("vobu_vob_idn 0x%04x\n", dsi_gi->vobu_vob_idn); | |
173 printf("vobu_c_idn 0x%02x\n", dsi_gi->vobu_c_idn); | |
174 printf("c_eltm "); | |
13
4e610984cc3f
added dvdread_print_time() and removed the file-static print_time() in nav_print.c; based on a patch by Erik Hovland org
nicodvb
parents:
3
diff
changeset
|
175 dvdread_print_time(&dsi_gi->c_eltm); |
3 | 176 printf("\n"); |
177 } | |
178 | |
179 static void navPrint_SML_PBI(sml_pbi_t *sml_pbi) { | |
180 printf("sml_pbi:\n"); | |
181 printf("category 0x%04x\n", sml_pbi->category); | |
182 if(sml_pbi->category & 0x8000) | |
183 printf("VOBU is in preunit\n"); | |
184 if(sml_pbi->category & 0x4000) | |
185 printf("VOBU is in ILVU\n"); | |
186 if(sml_pbi->category & 0x2000) | |
187 printf("VOBU at the beginning of ILVU\n"); | |
188 if(sml_pbi->category & 0x1000) | |
189 printf("VOBU at end of PREU of ILVU\n"); | |
20 | 190 |
3 | 191 printf("ilvu_ea 0x%08x\n", sml_pbi->ilvu_ea); |
192 printf("nxt_ilvu_sa 0x%08x\n", sml_pbi->ilvu_sa); | |
193 printf("nxt_ilvu_size 0x%04x\n", sml_pbi->size); | |
20 | 194 |
3 | 195 printf("vob_v_s_s_ptm 0x%08x\n", sml_pbi->vob_v_s_s_ptm); |
196 printf("vob_v_e_e_ptm 0x%08x\n", sml_pbi->vob_v_e_e_ptm); | |
20 | 197 |
3 | 198 /* $$$ more code needed here */ |
199 } | |
200 | |
201 static void navPrint_SML_AGLI(sml_agli_t *sml_agli) { | |
202 int i; | |
203 printf("sml_agli:\n"); | |
204 for(i = 0; i < 9; i++) { | |
205 printf("agl_c%d address: 0x%08x size 0x%04x\n", i, | |
26 | 206 sml_agli->data[i].address, sml_agli->data[i].size); |
3 | 207 } |
208 } | |
209 | |
210 static void navPrint_VOBU_SRI(vobu_sri_t *vobu_sri) { | |
211 int i; | |
20 | 212 int stime[19] = { 240, 120, 60, 20, 15, 14, 13, 12, 11, |
26 | 213 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; |
3 | 214 printf("vobu_sri:\n"); |
215 printf("Next VOBU with Video %08x\n", vobu_sri->next_video); | |
216 for(i = 0; i < 19; i++) { | |
217 printf("%3.1f %08x ", stime[i]/2.0, vobu_sri->fwda[i]); | |
218 } | |
219 printf("\n"); | |
220 printf("Next VOBU %08x\n", vobu_sri->next_vobu); | |
221 printf("--\n"); | |
222 printf("Prev VOBU %08x\n", vobu_sri->prev_vobu); | |
223 for(i = 0; i < 19; i++) { | |
224 printf("%3.1f %08x ", stime[18 - i]/2.0, vobu_sri->bwda[i]); | |
225 } | |
226 printf("\n"); | |
227 printf("Prev VOBU with Video %08x\n", vobu_sri->prev_video); | |
228 } | |
229 | |
230 static void navPrint_SYNCI(synci_t *synci) { | |
231 int i; | |
20 | 232 |
3 | 233 printf("synci:\n"); |
234 /* $$$ more code needed here */ | |
235 for(i = 0; i < 8; i++) | |
236 printf("%04x ", synci->a_synca[i]); | |
237 for(i = 0; i < 32; i++) | |
238 printf("%08x ", synci->sp_synca[i]); | |
239 } | |
240 | |
241 void navPrint_DSI(dsi_t *dsi) { | |
242 printf("dsi packet:\n"); | |
243 navPrint_DSI_GI(&dsi->dsi_gi); | |
244 navPrint_SML_PBI(&dsi->sml_pbi); | |
245 navPrint_SML_AGLI(&dsi->sml_agli); | |
246 navPrint_VOBU_SRI(&dsi->vobu_sri); | |
247 navPrint_SYNCI(&dsi->synci); | |
248 } |