Mercurial > libdvdnav.hg
annotate highlight.c @ 278:ef3b33441db5 src
include inttypes.h wherever necessary
| author | nicodvb |
|---|---|
| date | Mon, 16 Apr 2007 22:43:56 +0000 |
| parents | bd734ab914d0 |
| children | 52877d182e96 |
| rev | line source |
|---|---|
| 0 | 1 /* |
| 2 * Copyright (C) 2000 Rich Wareham <richwareham@users.sourceforge.net> | |
| 3 * | |
| 4 * This file is part of libdvdnav, a DVD navigation library. | |
| 5 * | |
| 6 * libdvdnav is free software; you can redistribute it and/or modify | |
| 7 * it under the terms of the GNU General Public License as published by | |
| 8 * the Free Software Foundation; either version 2 of the License, or | |
| 9 * (at your option) any later version. | |
| 10 * | |
| 11 * libdvdnav is distributed in the hope that it will be useful, | |
| 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 * GNU General Public License for more details. | |
| 15 * | |
| 16 * You should have received a copy of the GNU General Public License | |
| 17 * along with this program; if not, write to the Free Software | |
| 18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA | |
| 19 * | |
| 20 * $Id$ | |
| 21 * | |
| 22 */ | |
| 23 | |
| 24 #ifdef HAVE_CONFIG_H | |
| 25 #include "config.h" | |
| 26 #endif | |
| 27 | |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
28 #include <assert.h> |
| 278 | 29 #include <inttypes.h> |
| 169 | 30 #include "nav_types.h" |
| 0 | 31 #include "dvdnav_internal.h" |
| 32 | |
| 114 | 33 /* |
| 34 #define BUTTON_TESTING | |
| 35 */ | |
| 36 | |
| 0 | 37 #ifdef BUTTON_TESTING |
| 114 | 38 |
| 169 | 39 #include "nav_print.h" |
|
86
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
40 |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
41 static void print_time(dvd_time_t *dtime) { |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
42 const char *rate; |
| 114 | 43 |
|
86
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
44 assert((dtime->hour>>4) < 0xa && (dtime->hour&0xf) < 0xa); |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
45 assert((dtime->minute>>4) < 0x7 && (dtime->minute&0xf) < 0xa); |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
46 assert((dtime->second>>4) < 0x7 && (dtime->second&0xf) < 0xa); |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
47 assert((dtime->frame_u&0xf) < 0xa); |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
48 |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
49 fprintf(MSG_OUT,"%02x:%02x:%02x.%02x", |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
50 dtime->hour, |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
51 dtime->minute, |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
52 dtime->second, |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
53 dtime->frame_u & 0x3f); |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
54 switch((dtime->frame_u & 0xc0) >> 6) { |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
55 case 1: |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
56 rate = "25.00"; |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
57 break; |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
58 case 3: |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
59 rate = "29.97"; |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
60 break; |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
61 default: |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
62 rate = "(please send a bug report)"; |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
63 break; |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
64 } |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
65 fprintf(MSG_OUT," @ %s fps", rate); |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
66 } |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
67 |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
68 static void nav_print_PCI_GI(pci_gi_t *pci_gi) { |
| 196 | 69 int32_t i; |
|
86
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
70 |
| 114 | 71 fprintf(MSG_OUT,"libdvdnav: pci_gi:\n"); |
| 72 fprintf(MSG_OUT,"libdvdnav: nv_pck_lbn 0x%08x\n", pci_gi->nv_pck_lbn); | |
| 73 fprintf(MSG_OUT,"libdvdnav: vobu_cat 0x%04x\n", pci_gi->vobu_cat); | |
| 74 fprintf(MSG_OUT,"libdvdnav: vobu_uop_ctl 0x%08x\n", *(uint32_t*)&pci_gi->vobu_uop_ctl); | |
| 75 fprintf(MSG_OUT,"libdvdnav: vobu_s_ptm 0x%08x\n", pci_gi->vobu_s_ptm); | |
| 76 fprintf(MSG_OUT,"libdvdnav: vobu_e_ptm 0x%08x\n", pci_gi->vobu_e_ptm); | |
| 77 fprintf(MSG_OUT,"libdvdnav: vobu_se_e_ptm 0x%08x\n", pci_gi->vobu_se_e_ptm); | |
| 78 fprintf(MSG_OUT,"libdvdnav: e_eltm "); | |
|
86
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
79 print_time(&pci_gi->e_eltm); |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
80 fprintf(MSG_OUT,"\n"); |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
81 |
| 114 | 82 fprintf(MSG_OUT,"libdvdnav: vobu_isrc \""); |
|
86
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
83 for(i = 0; i < 32; i++) { |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
84 char c = pci_gi->vobu_isrc[i]; |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
85 if((c >= ' ') && (c <= '~')) |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
86 fprintf(MSG_OUT,"%c", c); |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
87 else |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
88 fprintf(MSG_OUT,"."); |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
89 } |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
90 fprintf(MSG_OUT,"\"\n"); |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
91 } |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
92 |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
93 static void nav_print_NSML_AGLI(nsml_agli_t *nsml_agli) { |
| 196 | 94 int32_t i, j = 0; |
|
86
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
95 |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
96 for(i = 0; i < 9; i++) |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
97 j |= nsml_agli->nsml_agl_dsta[i]; |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
98 if(j == 0) |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
99 return; |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
100 |
| 114 | 101 fprintf(MSG_OUT,"libdvdnav: nsml_agli:\n"); |
|
86
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
102 for(i = 0; i < 9; i++) |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
103 if(nsml_agli->nsml_agl_dsta[i]) |
| 114 | 104 fprintf(MSG_OUT,"libdvdnav: nsml_agl_c%d_dsta 0x%08x\n", i + 1, |
|
86
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
105 nsml_agli->nsml_agl_dsta[i]); |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
106 } |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
107 |
| 196 | 108 static void nav_print_HL_GI(hl_gi_t *hl_gi, int32_t *btngr_ns, int32_t *btn_ns) { |
|
86
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
109 |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
110 if((hl_gi->hli_ss & 0x03) == 0) |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
111 return; |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
112 |
| 114 | 113 fprintf(MSG_OUT,"libdvdnav: hl_gi:\n"); |
| 114 fprintf(MSG_OUT,"libdvdnav: hli_ss 0x%01x\n", hl_gi->hli_ss & 0x03); | |
| 115 fprintf(MSG_OUT,"libdvdnav: hli_s_ptm 0x%08x\n", hl_gi->hli_s_ptm); | |
| 116 fprintf(MSG_OUT,"libdvdnav: hli_e_ptm 0x%08x\n", hl_gi->hli_e_ptm); | |
| 117 fprintf(MSG_OUT,"libdvdnav: btn_se_e_ptm 0x%08x\n", hl_gi->btn_se_e_ptm); | |
|
86
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
118 |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
119 *btngr_ns = hl_gi->btngr_ns; |
| 114 | 120 fprintf(MSG_OUT,"libdvdnav: btngr_ns %d\n", hl_gi->btngr_ns); |
| 121 fprintf(MSG_OUT,"libdvdnav: btngr%d_dsp_ty 0x%02x\n", 1, hl_gi->btngr1_dsp_ty); | |
| 122 fprintf(MSG_OUT,"libdvdnav: btngr%d_dsp_ty 0x%02x\n", 2, hl_gi->btngr2_dsp_ty); | |
| 123 fprintf(MSG_OUT,"libdvdnav: btngr%d_dsp_ty 0x%02x\n", 3, hl_gi->btngr3_dsp_ty); | |
|
86
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
124 |
| 114 | 125 fprintf(MSG_OUT,"libdvdnav: btn_ofn %d\n", hl_gi->btn_ofn); |
|
86
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
126 *btn_ns = hl_gi->btn_ns; |
| 114 | 127 fprintf(MSG_OUT,"libdvdnav: btn_ns %d\n", hl_gi->btn_ns); |
| 128 fprintf(MSG_OUT,"libdvdnav: nsl_btn_ns %d\n", hl_gi->nsl_btn_ns); | |
| 129 fprintf(MSG_OUT,"libdvdnav: fosl_btnn %d\n", hl_gi->fosl_btnn); | |
| 130 fprintf(MSG_OUT,"libdvdnav: foac_btnn %d\n", hl_gi->foac_btnn); | |
|
86
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
131 } |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
132 |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
133 static void nav_print_BTN_COLIT(btn_colit_t *btn_colit) { |
| 196 | 134 int32_t i, j; |
|
86
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
135 |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
136 j = 0; |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
137 for(i = 0; i < 6; i++) |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
138 j |= btn_colit->btn_coli[i/2][i&1]; |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
139 if(j == 0) |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
140 return; |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
141 |
| 114 | 142 fprintf(MSG_OUT,"libdvdnav: btn_colit:\n"); |
|
86
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
143 for(i = 0; i < 3; i++) |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
144 for(j = 0; j < 2; j++) |
| 114 | 145 fprintf(MSG_OUT,"libdvdnav: btn_cqoli %d %s_coli: %08x\n", |
|
86
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
146 i, (j == 0) ? "sl" : "ac", |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
147 btn_colit->btn_coli[i][j]); |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
148 } |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
149 |
| 196 | 150 static void nav_print_BTNIT(btni_t *btni_table, int32_t btngr_ns, int32_t btn_ns) { |
| 151 int32_t i, j, k; | |
|
86
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
152 |
| 114 | 153 fprintf(MSG_OUT,"libdvdnav: btnit:\n"); |
| 154 fprintf(MSG_OUT,"libdvdnav: btngr_ns: %i\n", btngr_ns); | |
| 155 fprintf(MSG_OUT,"libdvdnav: btn_ns: %i\n", btn_ns); | |
|
86
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
156 |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
157 if(btngr_ns == 0) |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
158 return; |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
159 |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
160 for(i = 0; i < btngr_ns; i++) { |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
161 for(j = 0; j < (36 / btngr_ns); j++) { |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
162 if(j < btn_ns) { |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
163 btni_t *btni = &btni_table[(36 / btngr_ns) * i + j]; |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
164 |
| 114 | 165 fprintf(MSG_OUT,"libdvdnav: group %d btni %d: ", i+1, j+1); |
|
86
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
166 fprintf(MSG_OUT,"btn_coln %d, auto_action_mode %d\n", |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
167 btni->btn_coln, btni->auto_action_mode); |
| 114 | 168 fprintf(MSG_OUT,"libdvdnav: coords (%d, %d) .. (%d, %d)\n", |
|
86
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
169 btni->x_start, btni->y_start, btni->x_end, btni->y_end); |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
170 |
| 114 | 171 fprintf(MSG_OUT,"libdvdnav: up %d, ", btni->up); |
|
86
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
172 fprintf(MSG_OUT,"down %d, ", btni->down); |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
173 fprintf(MSG_OUT,"left %d, ", btni->left); |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
174 fprintf(MSG_OUT,"right %d\n", btni->right); |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
175 for(k = 0; k < 8; k++) { |
| 114 | 176 fprintf(MSG_OUT, "libdvdnav: %02x ", btni->cmd.bytes[k]); |
|
86
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
177 } |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
178 fprintf(MSG_OUT, "| "); |
| 166 | 179 #ifdef TRACE |
| 153 | 180 vm_print_mnemonic(&btni->cmd); |
| 166 | 181 #endif |
| 114 | 182 fprintf(MSG_OUT, "\n"); |
|
86
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
183 } |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
184 } |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
185 } |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
186 } |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
187 |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
188 static void nav_print_HLI(hli_t *hli) { |
| 196 | 189 int32_t btngr_ns = 0, btn_ns = 0; |
|
86
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
190 |
| 114 | 191 fprintf(MSG_OUT,"libdvdnav: hli:\n"); |
|
86
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
192 nav_print_HL_GI(&hli->hl_gi, & btngr_ns, & btn_ns); |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
193 nav_print_BTN_COLIT(&hli->btn_colit); |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
194 nav_print_BTNIT(hli->btnit, btngr_ns, btn_ns); |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
195 } |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
196 |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
197 void nav_print_PCI(pci_t *pci) { |
| 114 | 198 fprintf(MSG_OUT,"libdvdnav: pci packet:\n"); |
|
86
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
199 nav_print_PCI_GI(&pci->pci_gi); |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
200 nav_print_NSML_AGLI(&pci->nsml_agli); |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
201 nav_print_HLI(&pci->hli); |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
202 } |
|
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
203 |
| 114 | 204 #endif |
|
86
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
205 |
| 0 | 206 |
| 207 /* Highlighting API calls */ | |
| 208 | |
| 196 | 209 dvdnav_status_t dvdnav_get_current_highlight(dvdnav_t *this, int32_t *button) { |
| 0 | 210 /* Simply return the appropriate value based on the SPRM */ |
|
205
ba43bdbb07e8
Update to allow events sent to the gui to tell it whether we are in a button or not.
jcdutton
parents:
197
diff
changeset
|
211 if(((*button) = this->position_current.button) == -1) |
|
ba43bdbb07e8
Update to allow events sent to the gui to tell it whether we are in a button or not.
jcdutton
parents:
197
diff
changeset
|
212 (*button) = this->vm->state.HL_BTNN_REG >> 10; |
| 0 | 213 |
| 193 | 214 return DVDNAV_STATUS_OK; |
| 0 | 215 } |
| 216 | |
| 114 | 217 static btni_t *get_current_button(dvdnav_t *this, pci_t *pci) { |
| 196 | 218 int32_t button = 0; |
| 0 | 219 |
| 166 | 220 if(!pci->hli.hl_gi.hli_ss) { |
| 221 printerr("Not in a menu."); | |
|
197
a20a5976a207
last_cmd_nav_lbn has to be initialized with an invalid value, so that the first
mroi
parents:
196
diff
changeset
|
222 return NULL; |
| 166 | 223 } |
|
191
dbea22936623
when a command has been issued to leave a menu, filter all further commands
mroi
parents:
169
diff
changeset
|
224 if(this->last_cmd_nav_lbn == pci->pci_gi.nv_pck_lbn) { |
|
dbea22936623
when a command has been issued to leave a menu, filter all further commands
mroi
parents:
169
diff
changeset
|
225 printerr("This NAV has already been left."); |
|
197
a20a5976a207
last_cmd_nav_lbn has to be initialized with an invalid value, so that the first
mroi
parents:
196
diff
changeset
|
226 return NULL; |
|
191
dbea22936623
when a command has been issued to leave a menu, filter all further commands
mroi
parents:
169
diff
changeset
|
227 } |
| 117 | 228 |
| 229 button = this->vm->state.HL_BTNN_REG >> 10; | |
| 0 | 230 #ifdef BUTTON_TESTING |
| 166 | 231 nav_print_PCI(pci); |
| 0 | 232 #endif |
| 233 | |
| 98 | 234 return &(pci->hli.btnit[button-1]); |
| 0 | 235 } |
| 236 | |
| 114 | 237 static dvdnav_status_t button_auto_action(dvdnav_t *this, pci_t *pci) { |
| 238 if (get_current_button(this, pci)->auto_action_mode) | |
| 239 return dvdnav_button_activate(this, pci); | |
|
197
a20a5976a207
last_cmd_nav_lbn has to be initialized with an invalid value, so that the first
mroi
parents:
196
diff
changeset
|
240 return DVDNAV_STATUS_OK; |
| 29 | 241 } |
| 242 | |
| 98 | 243 dvdnav_status_t dvdnav_upper_button_select(dvdnav_t *this, pci_t *pci) { |
| 0 | 244 btni_t *button_ptr; |
| 245 | |
| 114 | 246 if(!(button_ptr = get_current_button(this, pci))) |
| 193 | 247 return DVDNAV_STATUS_ERR; |
| 114 | 248 |
| 98 | 249 dvdnav_button_select(this, pci, button_ptr->up); |
|
197
a20a5976a207
last_cmd_nav_lbn has to be initialized with an invalid value, so that the first
mroi
parents:
196
diff
changeset
|
250 return button_auto_action(this, pci); |
| 0 | 251 } |
| 252 | |
| 98 | 253 dvdnav_status_t dvdnav_lower_button_select(dvdnav_t *this, pci_t *pci) { |
| 0 | 254 btni_t *button_ptr; |
| 255 | |
| 114 | 256 if(!(button_ptr = get_current_button(this, pci))) |
| 193 | 257 return DVDNAV_STATUS_ERR; |
| 114 | 258 |
| 98 | 259 dvdnav_button_select(this, pci, button_ptr->down); |
|
197
a20a5976a207
last_cmd_nav_lbn has to be initialized with an invalid value, so that the first
mroi
parents:
196
diff
changeset
|
260 return button_auto_action(this, pci); |
| 0 | 261 } |
| 262 | |
| 98 | 263 dvdnav_status_t dvdnav_right_button_select(dvdnav_t *this, pci_t *pci) { |
| 0 | 264 btni_t *button_ptr; |
| 265 | |
| 114 | 266 if(!(button_ptr = get_current_button(this, pci))) |
| 193 | 267 return DVDNAV_STATUS_ERR; |
| 114 | 268 |
| 98 | 269 dvdnav_button_select(this, pci, button_ptr->right); |
|
197
a20a5976a207
last_cmd_nav_lbn has to be initialized with an invalid value, so that the first
mroi
parents:
196
diff
changeset
|
270 return button_auto_action(this, pci); |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
271 } |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
272 |
| 98 | 273 dvdnav_status_t dvdnav_left_button_select(dvdnav_t *this, pci_t *pci) { |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
274 btni_t *button_ptr; |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
275 |
| 114 | 276 if(!(button_ptr = get_current_button(this, pci))) |
| 193 | 277 return DVDNAV_STATUS_ERR; |
| 114 | 278 |
| 98 | 279 dvdnav_button_select(this, pci, button_ptr->left); |
|
197
a20a5976a207
last_cmd_nav_lbn has to be initialized with an invalid value, so that the first
mroi
parents:
196
diff
changeset
|
280 return button_auto_action(this, pci); |
| 0 | 281 } |
| 282 | |
| 114 | 283 dvdnav_status_t dvdnav_get_highlight_area(pci_t *nav_pci , int32_t button, int32_t mode, |
| 284 dvdnav_highlight_area_t *highlight) { | |
| 0 | 285 btni_t *button_ptr; |
| 114 | 286 |
| 31 | 287 #ifdef BUTTON_TESTING |
| 76 | 288 fprintf(MSG_OUT, "libdvdnav: Button get_highlight_area %i\n", button); |
| 31 | 289 #endif |
| 166 | 290 |
| 291 if(!nav_pci->hli.hl_gi.hli_ss) | |
| 193 | 292 return DVDNAV_STATUS_ERR; |
| 114 | 293 if((button <= 0) || (button > nav_pci->hli.hl_gi.btn_ns)) |
| 193 | 294 return DVDNAV_STATUS_ERR; |
| 114 | 295 |
| 166 | 296 |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
297 button_ptr = &nav_pci->hli.btnit[button-1]; |
| 0 | 298 |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
299 highlight->sx = button_ptr->x_start; |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
300 highlight->sy = button_ptr->y_start; |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
301 highlight->ex = button_ptr->x_end; |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
302 highlight->ey = button_ptr->y_end; |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
303 if(button_ptr->btn_coln != 0) { |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
304 highlight->palette = nav_pci->hli.btn_colit.btn_coli[button_ptr->btn_coln-1][mode]; |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
305 } else { |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
306 highlight->palette = 0; |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
307 } |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
308 highlight->pts = nav_pci->hli.hl_gi.hli_s_ptm; |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
309 highlight->buttonN = button; |
| 31 | 310 #ifdef BUTTON_TESTING |
| 114 | 311 fprintf(MSG_OUT, "libdvdnav: highlight: Highlight area is (%u,%u)-(%u,%u), display = %i, button = %u\n", |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
312 button_ptr->x_start, button_ptr->y_start, |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
313 button_ptr->x_end, button_ptr->y_end, |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
314 1, |
|
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
315 button); |
| 31 | 316 #endif |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
317 |
| 193 | 318 return DVDNAV_STATUS_OK; |
| 0 | 319 } |
| 320 | |
| 98 | 321 dvdnav_status_t dvdnav_button_activate(dvdnav_t *this, pci_t *pci) { |
| 196 | 322 int32_t button; |
| 26 | 323 btni_t *button_ptr = NULL; |
| 114 | 324 |
| 166 | 325 if(!pci->hli.hl_gi.hli_ss) { |
| 326 printerr("Not in a menu."); | |
| 193 | 327 return DVDNAV_STATUS_ERR; |
| 166 | 328 } |
|
191
dbea22936623
when a command has been issued to leave a menu, filter all further commands
mroi
parents:
169
diff
changeset
|
329 if(this->last_cmd_nav_lbn == pci->pci_gi.nv_pck_lbn) { |
|
dbea22936623
when a command has been issued to leave a menu, filter all further commands
mroi
parents:
169
diff
changeset
|
330 printerr("This NAV has already been left."); |
| 193 | 331 return DVDNAV_STATUS_ERR; |
|
191
dbea22936623
when a command has been issued to leave a menu, filter all further commands
mroi
parents:
169
diff
changeset
|
332 } |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
333 pthread_mutex_lock(&this->vm_lock); |
| 0 | 334 |
| 117 | 335 button = this->vm->state.HL_BTNN_REG >> 10; |
| 114 | 336 |
| 337 if((button <= 0) || (button > pci->hli.hl_gi.btn_ns)) { | |
| 57 | 338 /* Special code to handle still menus with no buttons. |
| 166 | 339 * The navigation is expected to report to the application that a STILL is |
| 57 | 340 * underway. In turn, the application is supposed to report to the user |
| 166 | 341 * that the playback is paused. The user is then expected to undo the pause, |
| 57 | 342 * ie: hit play. At that point, the navigation should release the still and |
| 343 * go to the next Cell. | |
| 166 | 344 * Explanation by Mathieu Lacage <mathieu_lacage@realmagic.fr> |
| 57 | 345 * Code added by jcdutton. |
| 346 */ | |
| 347 if (this->position_current.still != 0) { | |
| 348 /* In still, but no buttons. */ | |
| 349 vm_get_next_cell(this->vm); | |
| 350 this->position_current.still = 0; | |
| 116 | 351 this->sync_wait = 0; |
|
191
dbea22936623
when a command has been issued to leave a menu, filter all further commands
mroi
parents:
169
diff
changeset
|
352 this->last_cmd_nav_lbn = pci->pci_gi.nv_pck_lbn; |
| 57 | 353 pthread_mutex_unlock(&this->vm_lock); |
| 114 | 354 /* clear error message */ |
| 355 printerr(""); | |
| 193 | 356 return DVDNAV_STATUS_OK; |
| 57 | 357 } |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
358 pthread_mutex_unlock(&this->vm_lock); |
| 193 | 359 return DVDNAV_STATUS_ERR; |
| 0 | 360 } |
| 114 | 361 |
| 362 button_ptr = get_current_button(this, pci); | |
| 363 /* Finally, make the VM execute the appropriate code and probably | |
| 0 | 364 * scedule a jump */ |
| 31 | 365 #ifdef BUTTON_TESTING |
| 76 | 366 fprintf(MSG_OUT, "libdvdnav: Evaluating Button Activation commands.\n"); |
| 31 | 367 #endif |
| 114 | 368 if(vm_exec_cmd(this->vm, &(button_ptr->cmd)) == 1) { |
| 26 | 369 /* Command caused a jump */ |
| 370 this->vm->hop_channel++; | |
| 371 this->position_current.still = 0; | |
|
191
dbea22936623
when a command has been issued to leave a menu, filter all further commands
mroi
parents:
169
diff
changeset
|
372 this->last_cmd_nav_lbn = pci->pci_gi.nv_pck_lbn; |
| 0 | 373 } |
| 114 | 374 |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
375 pthread_mutex_unlock(&this->vm_lock); |
| 193 | 376 return DVDNAV_STATUS_OK; |
| 0 | 377 } |
| 378 | |
|
91
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
379 dvdnav_status_t dvdnav_button_activate_cmd(dvdnav_t *this, int32_t button, vm_cmd_t *cmd) |
|
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
380 { |
| 114 | 381 pthread_mutex_lock(&this->vm_lock); |
| 382 /* make the VM execute the appropriate code and probably | |
|
91
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
383 * schedule a jump */ |
|
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
384 #ifdef BUTTON_TESTING |
| 114 | 385 fprintf(MSG_OUT, "libdvdnav: dvdnav_button_activate_cmd: Evaluating Button Activation commands.\n"); |
|
91
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
386 #endif |
|
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
387 if(button > 0) { |
|
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
388 this->vm->state.HL_BTNN_REG = (button << 10); |
| 114 | 389 if(vm_exec_cmd(this->vm, cmd) == 1) { |
|
91
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
390 /* Command caused a jump */ |
|
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
391 this->vm->hop_channel++; |
|
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
392 } |
|
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
393 } |
|
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
394 /* Always remove still, because some still menus have no buttons. */ |
|
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
395 this->position_current.still = 0; |
| 116 | 396 this->sync_wait = 0; |
|
91
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
397 pthread_mutex_unlock(&this->vm_lock); |
| 193 | 398 return DVDNAV_STATUS_OK; |
|
91
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
399 } |
|
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
400 |
| 196 | 401 dvdnav_status_t dvdnav_button_select(dvdnav_t *this, pci_t *pci, int32_t button) { |
| 166 | 402 if(!pci->hli.hl_gi.hli_ss) { |
| 403 printerr("Not in a menu."); | |
| 193 | 404 return DVDNAV_STATUS_ERR; |
| 166 | 405 } |
|
191
dbea22936623
when a command has been issued to leave a menu, filter all further commands
mroi
parents:
169
diff
changeset
|
406 if(this->last_cmd_nav_lbn == pci->pci_gi.nv_pck_lbn) { |
|
dbea22936623
when a command has been issued to leave a menu, filter all further commands
mroi
parents:
169
diff
changeset
|
407 printerr("This NAV has already been left."); |
| 193 | 408 return DVDNAV_STATUS_ERR; |
|
191
dbea22936623
when a command has been issued to leave a menu, filter all further commands
mroi
parents:
169
diff
changeset
|
409 } |
| 0 | 410 |
| 31 | 411 #ifdef BUTTON_TESTING |
| 76 | 412 fprintf(MSG_OUT, "libdvdnav: Button select %i\n", button); |
| 31 | 413 #endif |
| 0 | 414 |
| 98 | 415 if((button <= 0) || (button > pci->hli.hl_gi.btn_ns)) { |
| 114 | 416 printerr("Button does not exist."); |
| 193 | 417 return DVDNAV_STATUS_ERR; |
| 0 | 418 } |
| 114 | 419 |
|
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
420 this->vm->state.HL_BTNN_REG = (button << 10); |
|
64
2759605b41f6
We need to update the button info when moving around in menus.
mroi
parents:
57
diff
changeset
|
421 this->position_current.button = -1; /* Force Highligh change */ |
| 0 | 422 |
| 193 | 423 return DVDNAV_STATUS_OK; |
| 0 | 424 } |
| 425 | |
| 98 | 426 dvdnav_status_t dvdnav_button_select_and_activate(dvdnav_t *this, pci_t *pci, |
| 196 | 427 int32_t button) { |
| 0 | 428 /* A trivial function */ |
| 193 | 429 if(dvdnav_button_select(this, pci, button) != DVDNAV_STATUS_ERR) |
| 98 | 430 return dvdnav_button_activate(this, pci); |
| 193 | 431 return DVDNAV_STATUS_ERR; |
| 0 | 432 } |
| 433 | |
| 196 | 434 dvdnav_status_t dvdnav_mouse_select(dvdnav_t *this, pci_t *pci, int32_t x, int32_t y) { |
| 435 int32_t button, cur_button; | |
| 436 int32_t best,dist,d; | |
| 437 int32_t mx,my,dx,dy; | |
| 69 | 438 |
| 166 | 439 if(!pci->hli.hl_gi.hli_ss) { |
| 440 printerr("Not in a menu."); | |
| 193 | 441 return DVDNAV_STATUS_ERR; |
| 166 | 442 } |
|
191
dbea22936623
when a command has been issued to leave a menu, filter all further commands
mroi
parents:
169
diff
changeset
|
443 if(this->last_cmd_nav_lbn == pci->pci_gi.nv_pck_lbn) { |
|
dbea22936623
when a command has been issued to leave a menu, filter all further commands
mroi
parents:
169
diff
changeset
|
444 printerr("This NAV has already been left."); |
| 193 | 445 return DVDNAV_STATUS_ERR; |
|
191
dbea22936623
when a command has been issued to leave a menu, filter all further commands
mroi
parents:
169
diff
changeset
|
446 } |
| 0 | 447 |
| 117 | 448 cur_button = this->vm->state.HL_BTNN_REG >> 10; |
| 114 | 449 |
| 450 best = 0; | |
| 69 | 451 dist = 0x08000000; /* >> than (720*720)+(567*567); */ |
| 452 | |
| 114 | 453 /* Loop through all buttons */ |
| 454 for(button = 1; button <= pci->hli.hl_gi.btn_ns; button++) { | |
|
227
10af49ee5118
Fix a bug. We pass pci_t as a function param, so why bother looking at an
jcdutton
parents:
205
diff
changeset
|
455 btni_t *button_ptr = &(pci->hli.btnit[button-1]); |
|
10af49ee5118
Fix a bug. We pass pci_t as a function param, so why bother looking at an
jcdutton
parents:
205
diff
changeset
|
456 |
| 0 | 457 if((x >= button_ptr->x_start) && (x <= button_ptr->x_end) && |
| 458 (y >= button_ptr->y_start) && (y <= button_ptr->y_end)) { | |
| 69 | 459 mx = (button_ptr->x_start + button_ptr->x_end)/2; |
| 114 | 460 my = (button_ptr->y_start + button_ptr->y_end)/2; |
| 69 | 461 dx = mx - x; |
| 462 dy = my - y; | |
| 463 d = (dx*dx) + (dy*dy); | |
| 464 /* If the mouse is within the button and the mouse is closer | |
| 465 * to the center of this button then it is the best choice. */ | |
| 466 if(d < dist) { | |
| 114 | 467 dist = d; |
| 468 best = button; | |
| 0 | 469 } |
| 470 } | |
| 471 } | |
| 114 | 472 /* As an efficiency measure, only re-select the button |
| 473 * if it is different to the previously selected one. */ | |
| 474 if (best != 0 && best != cur_button) | |
| 475 dvdnav_button_select(this, pci, best); | |
| 476 | |
| 193 | 477 /* return DVDNAV_STATUS_OK only if we actually found a matching button */ |
| 478 return best ? DVDNAV_STATUS_OK : DVDNAV_STATUS_ERR; | |
| 0 | 479 } |
| 480 | |
| 196 | 481 dvdnav_status_t dvdnav_mouse_activate(dvdnav_t *this, pci_t *pci, int32_t x, int32_t y) { |
| 0 | 482 /* A trivial function */ |
| 193 | 483 if(dvdnav_mouse_select(this, pci, x,y) != DVDNAV_STATUS_ERR) |
| 98 | 484 return dvdnav_button_activate(this, pci); |
| 193 | 485 return DVDNAV_STATUS_ERR; |
| 0 | 486 } |
