Mercurial > libdvdnav.hg
comparison highlight.c @ 86:129ac4af16a4 src
Improve debugging output to help with debugging button activations.
author | jcdutton |
---|---|
date | Sun, 01 Sep 2002 12:33:06 +0000 |
parents | 0e2abe7083de |
children | df9712507b30 |
comparison
equal
deleted
inserted
replaced
85:aa14e5673881 | 86:129ac4af16a4 |
---|---|
23 | 23 |
24 #ifdef HAVE_CONFIG_H | 24 #ifdef HAVE_CONFIG_H |
25 #include "config.h" | 25 #include "config.h" |
26 #endif | 26 #endif |
27 | 27 |
28 /* | 28 |
29 #define BUTTON_TESTING | 29 #define BUTTON_TESTING |
30 */ | 30 |
31 #include <assert.h> | 31 #include <assert.h> |
32 | 32 |
33 #include <dvdnav.h> | 33 #include <dvdnav.h> |
34 #include "dvdnav_internal.h" | 34 #include "dvdnav_internal.h" |
35 | 35 |
36 #include "vm.h" | 36 #include "vm.h" |
37 #include <dvdread/nav_types.h> | 37 #include <dvdread/nav_types.h> |
38 | 38 |
39 #ifdef BUTTON_TESTING | 39 #ifdef BUTTON_TESTING |
40 #include <dvdread/nav_print.h> | 40 #include <dvdread/nav_print.h> |
41 #include "vmcmd.h" | |
42 | |
43 static void print_time(dvd_time_t *dtime) { | |
44 const char *rate; | |
45 assert((dtime->hour>>4) < 0xa && (dtime->hour&0xf) < 0xa); | |
46 assert((dtime->minute>>4) < 0x7 && (dtime->minute&0xf) < 0xa); | |
47 assert((dtime->second>>4) < 0x7 && (dtime->second&0xf) < 0xa); | |
48 assert((dtime->frame_u&0xf) < 0xa); | |
49 | |
50 fprintf(MSG_OUT,"%02x:%02x:%02x.%02x", | |
51 dtime->hour, | |
52 dtime->minute, | |
53 dtime->second, | |
54 dtime->frame_u & 0x3f); | |
55 switch((dtime->frame_u & 0xc0) >> 6) { | |
56 case 1: | |
57 rate = "25.00"; | |
58 break; | |
59 case 3: | |
60 rate = "29.97"; | |
61 break; | |
62 default: | |
63 rate = "(please send a bug report)"; | |
64 break; | |
65 } | |
66 fprintf(MSG_OUT," @ %s fps", rate); | |
67 } | |
68 | |
69 static void nav_print_PCI_GI(pci_gi_t *pci_gi) { | |
70 int i; | |
71 | |
72 fprintf(MSG_OUT,"pci_gi:\n"); | |
73 fprintf(MSG_OUT,"nv_pck_lbn 0x%08x\n", pci_gi->nv_pck_lbn); | |
74 fprintf(MSG_OUT,"vobu_cat 0x%04x\n", pci_gi->vobu_cat); | |
75 fprintf(MSG_OUT,"vobu_uop_ctl 0x%08x\n", *(uint32_t*)&pci_gi->vobu_uop_ctl); | |
76 fprintf(MSG_OUT,"vobu_s_ptm 0x%08x\n", pci_gi->vobu_s_ptm); | |
77 fprintf(MSG_OUT,"vobu_e_ptm 0x%08x\n", pci_gi->vobu_e_ptm); | |
78 fprintf(MSG_OUT,"vobu_se_e_ptm 0x%08x\n", pci_gi->vobu_se_e_ptm); | |
79 fprintf(MSG_OUT,"e_eltm "); | |
80 print_time(&pci_gi->e_eltm); | |
81 fprintf(MSG_OUT,"\n"); | |
82 | |
83 fprintf(MSG_OUT,"vobu_isrc \""); | |
84 for(i = 0; i < 32; i++) { | |
85 char c = pci_gi->vobu_isrc[i]; | |
86 if((c >= ' ') && (c <= '~')) | |
87 fprintf(MSG_OUT,"%c", c); | |
88 else | |
89 fprintf(MSG_OUT,"."); | |
90 } | |
91 fprintf(MSG_OUT,"\"\n"); | |
92 } | |
93 | |
94 static void nav_print_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 fprintf(MSG_OUT,"nsml_agli:\n"); | |
103 for(i = 0; i < 9; i++) | |
104 if(nsml_agli->nsml_agl_dsta[i]) | |
105 fprintf(MSG_OUT,"nsml_agl_c%d_dsta 0x%08x\n", i + 1, | |
106 nsml_agli->nsml_agl_dsta[i]); | |
107 } | |
108 | |
109 static void nav_print_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 fprintf(MSG_OUT,"hl_gi:\n"); | |
115 fprintf(MSG_OUT,"hli_ss 0x%01x\n", hl_gi->hli_ss & 0x03); | |
116 fprintf(MSG_OUT,"hli_s_ptm 0x%08x\n", hl_gi->hli_s_ptm); | |
117 fprintf(MSG_OUT,"hli_e_ptm 0x%08x\n", hl_gi->hli_e_ptm); | |
118 fprintf(MSG_OUT,"btn_se_e_ptm 0x%08x\n", hl_gi->btn_se_e_ptm); | |
119 | |
120 *btngr_ns = hl_gi->btngr_ns; | |
121 fprintf(MSG_OUT,"btngr_ns %d\n", hl_gi->btngr_ns); | |
122 fprintf(MSG_OUT,"btngr%d_dsp_ty 0x%02x\n", 1, hl_gi->btngr1_dsp_ty); | |
123 fprintf(MSG_OUT,"btngr%d_dsp_ty 0x%02x\n", 2, hl_gi->btngr2_dsp_ty); | |
124 fprintf(MSG_OUT,"btngr%d_dsp_ty 0x%02x\n", 3, hl_gi->btngr3_dsp_ty); | |
125 | |
126 fprintf(MSG_OUT,"btn_ofn %d\n", hl_gi->btn_ofn); | |
127 *btn_ns = hl_gi->btn_ns; | |
128 fprintf(MSG_OUT,"btn_ns %d\n", hl_gi->btn_ns); | |
129 fprintf(MSG_OUT,"nsl_btn_ns %d\n", hl_gi->nsl_btn_ns); | |
130 fprintf(MSG_OUT,"fosl_btnn %d\n", hl_gi->fosl_btnn); | |
131 fprintf(MSG_OUT,"foac_btnn %d\n", hl_gi->foac_btnn); | |
132 } | |
133 | |
134 static void nav_print_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 fprintf(MSG_OUT,"btn_colit:\n"); | |
144 for(i = 0; i < 3; i++) | |
145 for(j = 0; j < 2; j++) | |
146 fprintf(MSG_OUT,"btn_cqoli %d %s_coli: %08x\n", | |
147 i, (j == 0) ? "sl" : "ac", | |
148 btn_colit->btn_coli[i][j]); | |
149 } | |
150 | |
151 static void nav_print_BTNIT(btni_t *btni_table, int btngr_ns, int btn_ns) { | |
152 int i, j, k; | |
153 | |
154 fprintf(MSG_OUT,"btnit:\n"); | |
155 fprintf(MSG_OUT,"btngr_ns: %i\n", btngr_ns); | |
156 fprintf(MSG_OUT,"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) { | |
164 btni_t *btni = &btni_table[(36 / btngr_ns) * i + j]; | |
165 | |
166 fprintf(MSG_OUT,"group %d btni %d: ", i+1, j+1); | |
167 fprintf(MSG_OUT,"btn_coln %d, auto_action_mode %d\n", | |
168 btni->btn_coln, btni->auto_action_mode); | |
169 fprintf(MSG_OUT,"coords (%d, %d) .. (%d, %d)\n", | |
170 btni->x_start, btni->y_start, btni->x_end, btni->y_end); | |
171 | |
172 fprintf(MSG_OUT,"up %d, ", btni->up); | |
173 fprintf(MSG_OUT,"down %d, ", btni->down); | |
174 fprintf(MSG_OUT,"left %d, ", btni->left); | |
175 fprintf(MSG_OUT,"right %d\n", btni->right); | |
176 for(k = 0; k < 8; k++) { | |
177 fprintf(MSG_OUT, "%02x ", btni->cmd.bytes[k]); | |
178 } | |
179 fprintf(MSG_OUT, "| "); | |
180 vmPrint_mnemonic(&btni->cmd); | |
181 fprintf(MSG_OUT, "\n\n"); | |
182 } | |
183 } | |
184 } | |
185 } | |
186 | |
187 static void nav_print_HLI(hli_t *hli) { | |
188 int btngr_ns = 0, btn_ns = 0; | |
189 | |
190 fprintf(MSG_OUT,"hli:\n"); | |
191 nav_print_HL_GI(&hli->hl_gi, & btngr_ns, & btn_ns); | |
192 nav_print_BTN_COLIT(&hli->btn_colit); | |
193 nav_print_BTNIT(hli->btnit, btngr_ns, btn_ns); | |
194 } | |
195 | |
196 void nav_print_PCI(pci_t *pci) { | |
197 fprintf(MSG_OUT,"pci packet:\n"); | |
198 nav_print_PCI_GI(&pci->pci_gi); | |
199 nav_print_NSML_AGLI(&pci->nsml_agli); | |
200 nav_print_HLI(&pci->hli); | |
201 } | |
202 | |
203 | |
41 #endif | 204 #endif |
42 | 205 |
43 /* Highlighting API calls */ | 206 /* Highlighting API calls */ |
207 | |
208 | |
44 | 209 |
45 dvdnav_status_t dvdnav_get_current_highlight(dvdnav_t *this, int* button) { | 210 dvdnav_status_t dvdnav_get_current_highlight(dvdnav_t *this, int* button) { |
46 if(!this) | 211 if(!this) |
47 return S_ERR; | 212 return S_ERR; |
48 | 213 |
58 if(dvdnav_get_current_highlight(this, &button) != S_OK) { | 223 if(dvdnav_get_current_highlight(this, &button) != S_OK) { |
59 printerr("Unable to get information on current highlight."); | 224 printerr("Unable to get information on current highlight."); |
60 return NULL; | 225 return NULL; |
61 } | 226 } |
62 #ifdef BUTTON_TESTING | 227 #ifdef BUTTON_TESTING |
63 navPrint_PCI(&(this->pci)); | 228 nav_print_PCI(&(this->pci)); |
64 #endif | 229 #endif |
65 | 230 |
66 return &(this->pci.hli.btnit[button-1]); | 231 return &(this->pci.hli.btnit[button-1]); |
67 } | 232 } |
68 | 233 |