Debian Codegraph @

src/nav_print.c

raw symbols SCIP
1 /*
2 * Copyright (C) 2000, 2001, 2002, 2003 Håkan Hjort <[email protected]>
3 *
4 * Much of the contents in this file is based on VOBDUMP.
5 *
6 * VOBDUMP: a program for examining DVD .VOB files
7 *
8 * Copyright 1998, 1999 Eric Smith <[email protected]>
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 or version 3 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
22 * along with this program; if not, write to the Free Software Foundation,
23 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 */
25
26 #include "config.h"
27 #include <stdio.h>
28 #include <inttypes.h>
29
30 #include "dvdread/nav_types.h"
31 #include "dvdread/nav_print.h"
32 #include "dvdread/ifo_print.h"
33
34 static void navPrint_PCI_GI(pci_gi_t *pci_gi) {
35 int i;
36
37 printf("pci_gi:\n");
38 printf("nv_pck_lbn 0x%08x\n", pci_gi->nv_pck_lbn);
39 printf("vobu_cat 0x%04x\n", pci_gi->vobu_cat);
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 ");
44 dvdread_print_time(&pci_gi->e_eltm);
45 printf("\n");
46
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;
60
61 for(i = 0; i < 9; i++)
62 j |= nsml_agli->nsml_agl_dsta[i];
63 if(j == 0)
64 return;
65
66 printf("nsml_agli:\n");
67 for(i = 0; i < 9; i++)
68 if(nsml_agli->nsml_agl_dsta[i])
69 printf("nsml_agl_c%d_dsta 0x%08x\n", i + 1,
70 nsml_agli->nsml_agl_dsta[i]);
71 }
72
73 static void navPrint_HL_GI(hl_gi_t *hl_gi, int *btngr_ns, int *btn_ns) {
74
75 if((hl_gi->hli_ss & 0x03) == 0)
76 return;
77
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 %u\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);
89
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;
100
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;
106
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",
111 i, (j == 0) ? "sl" : "ac",
112 btn_colit->btn_coli[i][j]);
113 }
114
115 static void navPrint_BTNIT(btni_t *btni_table, int btngr_ns, int btn_ns) {
116 int i, j;
117
118 printf("btnit:\n");
119 printf("btngr_ns: %i\n", btngr_ns);
120 printf("btn_ns: %i\n", btn_ns);
121
122 if(btngr_ns == 0)
123 return;
124
125 for(i = 0; i < btngr_ns; i++) {
126 for(j = 0; j < (36 / btngr_ns); j++) {
127 if(j < btn_ns) {
128 btni_t *btni = &btni_table[(36 / btngr_ns) * i + j];
129
130 printf("group %d btni %d: ", i+1, j+1);
131 printf("btn_coln %u, auto_action_mode %u\n",
132 btni->btn_coln, btni->auto_action_mode);
133 printf("coords (%u, %u) .. (%u, %u)\n",
134 btni->x_start, btni->y_start, btni->x_end, btni->y_end);
135
136 printf("up %u, ", btni->up);
137 printf("down %u, ", btni->down);
138 printf("left %u, ", btni->left);
139 printf("right %u\n", btni->right);
140
141 /* ifoPrint_COMMAND(&btni->cmd); */
142 printf("\n");
143 }
144 }
145 }
146 }
147
148 static void navPrint_HLI(hli_t *hli) {
149 int btngr_ns = 0, btn_ns = 0;
150
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 ");
175 dvdread_print_time(&dsi_gi->c_eltm);
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");
190
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);
194
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);
197
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,
206 sml_agli->data[i].address, sml_agli->data[i].size);
207 }
208 }
209
210 static void navPrint_VOBU_SRI(vobu_sri_t *vobu_sri) {
211 int i;
212 int stime[19] = { 240, 120, 60, 20, 15, 14, 13, 12, 11,
213 10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
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;
232
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 }