Mercurial > libdvdnav.hg
annotate highlight.c @ 91:df9712507b30 src
Add a new API function, to allow for more flexible menu button control.
The current menu button control code relies on wrong NAV PCI packet information which is
out of sync with what is actually being displayed.
author | jcdutton |
---|---|
date | Wed, 04 Sep 2002 11:41:52 +0000 |
parents | 129ac4af16a4 |
children | 457f35f43ba6 |
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 | |
86
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
28 |
0 | 29 #define BUTTON_TESTING |
86
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
30 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
31 #include <assert.h> |
0 | 32 |
33 #include <dvdnav.h> | |
34 #include "dvdnav_internal.h" | |
35 | |
36 #include "vm.h" | |
37 #include <dvdread/nav_types.h> | |
38 | |
39 #ifdef BUTTON_TESTING | |
40 #include <dvdread/nav_print.h> | |
86
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
41 #include "vmcmd.h" |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
42 |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
43 static void print_time(dvd_time_t *dtime) { |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
44 const char *rate; |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
45 assert((dtime->hour>>4) < 0xa && (dtime->hour&0xf) < 0xa); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
46 assert((dtime->minute>>4) < 0x7 && (dtime->minute&0xf) < 0xa); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
47 assert((dtime->second>>4) < 0x7 && (dtime->second&0xf) < 0xa); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
48 assert((dtime->frame_u&0xf) < 0xa); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
49 |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
50 fprintf(MSG_OUT,"%02x:%02x:%02x.%02x", |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
51 dtime->hour, |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
52 dtime->minute, |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
53 dtime->second, |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
54 dtime->frame_u & 0x3f); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
55 switch((dtime->frame_u & 0xc0) >> 6) { |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
56 case 1: |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
57 rate = "25.00"; |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
58 break; |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
59 case 3: |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
60 rate = "29.97"; |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
61 break; |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
62 default: |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
63 rate = "(please send a bug report)"; |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
64 break; |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
65 } |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
66 fprintf(MSG_OUT," @ %s fps", rate); |
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 |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
69 static void nav_print_PCI_GI(pci_gi_t *pci_gi) { |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
70 int i; |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
71 |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
72 fprintf(MSG_OUT,"pci_gi:\n"); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
73 fprintf(MSG_OUT,"nv_pck_lbn 0x%08x\n", pci_gi->nv_pck_lbn); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
74 fprintf(MSG_OUT,"vobu_cat 0x%04x\n", pci_gi->vobu_cat); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
75 fprintf(MSG_OUT,"vobu_uop_ctl 0x%08x\n", *(uint32_t*)&pci_gi->vobu_uop_ctl); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
76 fprintf(MSG_OUT,"vobu_s_ptm 0x%08x\n", pci_gi->vobu_s_ptm); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
77 fprintf(MSG_OUT,"vobu_e_ptm 0x%08x\n", pci_gi->vobu_e_ptm); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
78 fprintf(MSG_OUT,"vobu_se_e_ptm 0x%08x\n", pci_gi->vobu_se_e_ptm); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
79 fprintf(MSG_OUT,"e_eltm "); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
80 print_time(&pci_gi->e_eltm); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
81 fprintf(MSG_OUT,"\n"); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
82 |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
83 fprintf(MSG_OUT,"vobu_isrc \""); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
84 for(i = 0; i < 32; i++) { |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
85 char c = pci_gi->vobu_isrc[i]; |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
86 if((c >= ' ') && (c <= '~')) |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
87 fprintf(MSG_OUT,"%c", c); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
88 else |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
89 fprintf(MSG_OUT,"."); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
90 } |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
91 fprintf(MSG_OUT,"\"\n"); |
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 |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
94 static void nav_print_NSML_AGLI(nsml_agli_t *nsml_agli) { |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
95 int i, j = 0; |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
96 |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
97 for(i = 0; i < 9; i++) |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
98 j |= nsml_agli->nsml_agl_dsta[i]; |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
99 if(j == 0) |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
100 return; |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
101 |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
102 fprintf(MSG_OUT,"nsml_agli:\n"); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
103 for(i = 0; i < 9; i++) |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
104 if(nsml_agli->nsml_agl_dsta[i]) |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
105 fprintf(MSG_OUT,"nsml_agl_c%d_dsta 0x%08x\n", i + 1, |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
106 nsml_agli->nsml_agl_dsta[i]); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
107 } |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
108 |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
109 static void nav_print_HL_GI(hl_gi_t *hl_gi, int *btngr_ns, int *btn_ns) { |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
110 |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
111 if((hl_gi->hli_ss & 0x03) == 0) |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
112 return; |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
113 |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
114 fprintf(MSG_OUT,"hl_gi:\n"); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
115 fprintf(MSG_OUT,"hli_ss 0x%01x\n", hl_gi->hli_ss & 0x03); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
116 fprintf(MSG_OUT,"hli_s_ptm 0x%08x\n", hl_gi->hli_s_ptm); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
117 fprintf(MSG_OUT,"hli_e_ptm 0x%08x\n", hl_gi->hli_e_ptm); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
118 fprintf(MSG_OUT,"btn_se_e_ptm 0x%08x\n", hl_gi->btn_se_e_ptm); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
119 |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
120 *btngr_ns = hl_gi->btngr_ns; |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
121 fprintf(MSG_OUT,"btngr_ns %d\n", hl_gi->btngr_ns); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
122 fprintf(MSG_OUT,"btngr%d_dsp_ty 0x%02x\n", 1, hl_gi->btngr1_dsp_ty); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
123 fprintf(MSG_OUT,"btngr%d_dsp_ty 0x%02x\n", 2, hl_gi->btngr2_dsp_ty); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
124 fprintf(MSG_OUT,"btngr%d_dsp_ty 0x%02x\n", 3, hl_gi->btngr3_dsp_ty); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
125 |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
126 fprintf(MSG_OUT,"btn_ofn %d\n", hl_gi->btn_ofn); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
127 *btn_ns = hl_gi->btn_ns; |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
128 fprintf(MSG_OUT,"btn_ns %d\n", hl_gi->btn_ns); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
129 fprintf(MSG_OUT,"nsl_btn_ns %d\n", hl_gi->nsl_btn_ns); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
130 fprintf(MSG_OUT,"fosl_btnn %d\n", hl_gi->fosl_btnn); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
131 fprintf(MSG_OUT,"foac_btnn %d\n", hl_gi->foac_btnn); |
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 |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
134 static void nav_print_BTN_COLIT(btn_colit_t *btn_colit) { |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
135 int i, j; |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
136 |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
137 j = 0; |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
138 for(i = 0; i < 6; i++) |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
139 j |= btn_colit->btn_coli[i/2][i&1]; |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
140 if(j == 0) |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
141 return; |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
142 |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
143 fprintf(MSG_OUT,"btn_colit:\n"); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
144 for(i = 0; i < 3; i++) |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
145 for(j = 0; j < 2; j++) |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
146 fprintf(MSG_OUT,"btn_cqoli %d %s_coli: %08x\n", |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
147 i, (j == 0) ? "sl" : "ac", |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
148 btn_colit->btn_coli[i][j]); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
149 } |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
150 |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
151 static void nav_print_BTNIT(btni_t *btni_table, int btngr_ns, int btn_ns) { |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
152 int i, j, k; |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
153 |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
154 fprintf(MSG_OUT,"btnit:\n"); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
155 fprintf(MSG_OUT,"btngr_ns: %i\n", btngr_ns); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
156 fprintf(MSG_OUT,"btn_ns: %i\n", btn_ns); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
157 |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
158 if(btngr_ns == 0) |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
159 return; |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
160 |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
161 for(i = 0; i < btngr_ns; i++) { |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
162 for(j = 0; j < (36 / btngr_ns); j++) { |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
163 if(j < btn_ns) { |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
164 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
|
165 |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
166 fprintf(MSG_OUT,"group %d btni %d: ", i+1, j+1); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
167 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
|
168 btni->btn_coln, btni->auto_action_mode); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
169 fprintf(MSG_OUT,"coords (%d, %d) .. (%d, %d)\n", |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
170 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
|
171 |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
172 fprintf(MSG_OUT,"up %d, ", btni->up); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
173 fprintf(MSG_OUT,"down %d, ", btni->down); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
174 fprintf(MSG_OUT,"left %d, ", btni->left); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
175 fprintf(MSG_OUT,"right %d\n", btni->right); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
176 for(k = 0; k < 8; k++) { |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
177 fprintf(MSG_OUT, "%02x ", btni->cmd.bytes[k]); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
178 } |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
179 fprintf(MSG_OUT, "| "); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
180 vmPrint_mnemonic(&btni->cmd); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
181 fprintf(MSG_OUT, "\n\n"); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
182 } |
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 static void nav_print_HLI(hli_t *hli) { |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
188 int btngr_ns = 0, btn_ns = 0; |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
189 |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
190 fprintf(MSG_OUT,"hli:\n"); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
191 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
|
192 nav_print_BTN_COLIT(&hli->btn_colit); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
193 nav_print_BTNIT(hli->btnit, btngr_ns, btn_ns); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
194 } |
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 void nav_print_PCI(pci_t *pci) { |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
197 fprintf(MSG_OUT,"pci packet:\n"); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
198 nav_print_PCI_GI(&pci->pci_gi); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
199 nav_print_NSML_AGLI(&pci->nsml_agli); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
200 nav_print_HLI(&pci->hli); |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
201 } |
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 |
0 | 204 #endif |
205 | |
206 /* Highlighting API calls */ | |
207 | |
86
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
208 |
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
209 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
210 dvdnav_status_t dvdnav_get_current_highlight(dvdnav_t *this, int* button) { |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
211 if(!this) |
0 | 212 return S_ERR; |
213 | |
214 /* Simply return the appropriate value based on the SPRM */ | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
215 (*button) = (this->vm->state.HL_BTNN_REG) >> 10; |
0 | 216 |
217 return S_OK; | |
218 } | |
219 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
220 btni_t *__get_current_button(dvdnav_t *this) { |
0 | 221 int button = 0; |
222 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
223 if(dvdnav_get_current_highlight(this, &button) != S_OK) { |
76 | 224 printerr("Unable to get information on current highlight."); |
0 | 225 return NULL; |
226 } | |
227 #ifdef BUTTON_TESTING | |
86
129ac4af16a4
Improve debugging output to help with debugging button activations.
jcdutton
parents:
76
diff
changeset
|
228 nav_print_PCI(&(this->pci)); |
0 | 229 #endif |
230 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
231 return &(this->pci.hli.btnit[button-1]); |
0 | 232 } |
233 | |
29 | 234 dvdnav_status_t dvdnav_button_auto_action(dvdnav_t *this) { |
235 btni_t *button_ptr; | |
236 | |
237 if(!this) | |
238 return S_ERR; | |
239 | |
240 if((button_ptr = __get_current_button(this)) == NULL) { | |
241 return S_ERR; | |
242 } | |
243 if (button_ptr->auto_action_mode == 1) { | |
244 return S_OK; | |
245 } | |
246 return S_ERR; | |
247 } | |
248 | |
249 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
250 dvdnav_status_t dvdnav_upper_button_select(dvdnav_t *this) { |
0 | 251 btni_t *button_ptr; |
252 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
253 if(!this) |
0 | 254 return S_ERR; |
255 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
256 if((button_ptr = __get_current_button(this)) == NULL) { |
0 | 257 return S_ERR; |
258 } | |
259 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
260 dvdnav_button_select(this, button_ptr->up); |
29 | 261 if (dvdnav_button_auto_action(this) ) { |
262 dvdnav_button_activate(this); | |
263 } | |
264 | |
0 | 265 return S_OK; |
266 } | |
267 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
268 dvdnav_status_t dvdnav_lower_button_select(dvdnav_t *this) { |
0 | 269 btni_t *button_ptr; |
270 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
271 if(!this) |
0 | 272 return S_ERR; |
273 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
274 if((button_ptr = __get_current_button(this)) == NULL) { |
0 | 275 return S_ERR; |
276 } | |
277 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
278 dvdnav_button_select(this, button_ptr->down); |
29 | 279 if (dvdnav_button_auto_action(this) ) { |
280 dvdnav_button_activate(this); | |
281 } | |
0 | 282 |
283 return S_OK; | |
284 } | |
285 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
286 dvdnav_status_t dvdnav_right_button_select(dvdnav_t *this) { |
0 | 287 btni_t *button_ptr; |
288 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
289 if(!this) |
0 | 290 return S_ERR; |
291 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
292 if((button_ptr = __get_current_button(this)) == NULL) { |
0 | 293 printerr("Error fetching information on current button."); |
294 return S_ERR; | |
295 } | |
296 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
297 dvdnav_button_select(this, button_ptr->right); |
29 | 298 if (dvdnav_button_auto_action(this) ) { |
299 dvdnav_button_activate(this); | |
300 } | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
301 |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
302 return S_OK; |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
303 } |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
304 |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
305 dvdnav_status_t dvdnav_left_button_select(dvdnav_t *this) { |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
306 btni_t *button_ptr; |
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 if(!this) |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
309 return S_ERR; |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
310 |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
311 if((button_ptr = __get_current_button(this)) == NULL) { |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
312 return S_ERR; |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
313 } |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
314 |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
315 dvdnav_button_select(this, button_ptr->left); |
29 | 316 if (dvdnav_button_auto_action(this) ) { |
317 dvdnav_button_activate(this); | |
318 } | |
0 | 319 |
320 return S_OK; | |
321 } | |
322 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
323 dvdnav_status_t dvdnav_get_highlight_area(pci_t* nav_pci , int32_t button, int32_t mode, |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
324 dvdnav_highlight_area_t* highlight) { |
0 | 325 btni_t *button_ptr; |
31 | 326 #ifdef BUTTON_TESTING |
76 | 327 fprintf(MSG_OUT, "libdvdnav: Button get_highlight_area %i\n", button); |
31 | 328 #endif |
0 | 329 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
330 /* Set the highlight SPRM if the passed button was valid*/ |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
331 if((button <= 0) || (button > nav_pci->hli.hl_gi.btn_ns)) { |
76 | 332 fprintf(MSG_OUT, "libdvdnav: Unable to select button number %i as it doesn't exist\n", |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
333 button); |
0 | 334 return S_ERR; |
335 } | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
336 button_ptr = &nav_pci->hli.btnit[button-1]; |
0 | 337 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
338 highlight->sx = button_ptr->x_start; |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
339 highlight->sy = button_ptr->y_start; |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
340 highlight->ex = button_ptr->x_end; |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
341 highlight->ey = button_ptr->y_end; |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
342 if(button_ptr->btn_coln != 0) { |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
343 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
|
344 } else { |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
345 highlight->palette = 0; |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
346 } |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
347 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
|
348 highlight->buttonN = button; |
31 | 349 #ifdef BUTTON_TESTING |
76 | 350 fprintf(MSG_OUT, "libdvdnav: highlight.c: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
|
351 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
|
352 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
|
353 1, |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
354 button); |
31 | 355 #endif |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
356 |
0 | 357 return S_OK; |
358 } | |
359 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
360 dvdnav_status_t dvdnav_button_activate(dvdnav_t *this) { |
0 | 361 int button; |
26 | 362 btni_t *button_ptr = NULL; |
0 | 363 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
364 if(!this) |
0 | 365 return S_ERR; |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
366 pthread_mutex_lock(&this->vm_lock); |
0 | 367 |
368 /* Precisely the same as selecting a button except we want | |
369 * a different palette */ | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
370 if(dvdnav_get_current_highlight(this, &button) != S_OK) { |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
371 pthread_mutex_unlock(&this->vm_lock); |
0 | 372 return S_ERR; |
373 } | |
57 | 374 /* FIXME: dvdnav_button_select should really return a |
375 * special case for explicit NO-BUTTONS. | |
376 */ | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
377 if(dvdnav_button_select(this, button) != S_OK) { |
57 | 378 /* Special code to handle still menus with no buttons. |
379 * the navigation is expected to report to the appicatino that a STILL is | |
380 * underway. In turn, the application is supposed to report to the user | |
381 * that the playback is pause. The user is then expected to undo the pause. | |
382 * ie: hit play. At that point, the navigation should release the still and | |
383 * go to the next Cell. | |
384 * Explanation by Mathieu Lavage <mathieu_lacage@realmagic.fr> | |
385 * Code added by jcdutton. | |
386 */ | |
387 if (this->position_current.still != 0) { | |
388 /* In still, but no buttons. */ | |
389 vm_get_next_cell(this->vm); | |
390 this->position_current.still = 0; | |
391 pthread_mutex_unlock(&this->vm_lock); | |
392 return S_OK; | |
393 } | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
394 pthread_mutex_unlock(&this->vm_lock); |
0 | 395 return S_ERR; |
396 } | |
26 | 397 /* FIXME: The button command should really be passed in the API instead. */ |
398 button_ptr = __get_current_button(this); | |
0 | 399 /* Finally, make the VM execute the appropriate code and |
400 * scedule a jump */ | |
31 | 401 #ifdef BUTTON_TESTING |
76 | 402 fprintf(MSG_OUT, "libdvdnav: Evaluating Button Activation commands.\n"); |
31 | 403 #endif |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
404 if(vm_eval_cmd(this->vm, &(button_ptr->cmd)) == 1) { |
26 | 405 /* Command caused a jump */ |
406 this->vm->hop_channel++; | |
407 this->position_current.still = 0; | |
0 | 408 } |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
409 pthread_mutex_unlock(&this->vm_lock); |
0 | 410 return S_OK; |
411 } | |
412 | |
91
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
413 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
|
414 { |
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
415 if(!this || !this->vm) |
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
416 return S_ERR; |
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
417 pthread_mutex_lock(&this->vm_lock); |
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
418 /* make the VM execute the appropriate code and |
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
419 * schedule a jump */ |
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
420 #ifdef BUTTON_TESTING |
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
421 fprintf(MSG_OUT, "libdvdnav:dvdnav_button_activate_cmd: Evaluating Button Activation commands.\n"); |
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
422 #endif |
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
423 if(button > 0) { |
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
424 printerrf("Select button number %i\n ", |
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
425 button); |
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
426 this->vm->state.HL_BTNN_REG = (button << 10); |
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
427 if( (vm_eval_cmd(this->vm, cmd)) == 1) { |
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
428 /* Command caused a jump */ |
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
429 this->vm->hop_channel++; |
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
430 } |
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
431 } |
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
432 /* 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
|
433 this->position_current.still = 0; |
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
434 pthread_mutex_unlock(&this->vm_lock); |
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
435 return S_OK; |
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
436 } |
df9712507b30
Add a new API function, to allow for more flexible menu button control.
jcdutton
parents:
86
diff
changeset
|
437 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
438 dvdnav_status_t dvdnav_button_select(dvdnav_t *this, int button) { |
0 | 439 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
440 if(!this) { |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
441 printerrf("Unable to select button number %i as this state bad", |
0 | 442 button); |
443 return S_ERR; | |
444 } | |
445 | |
31 | 446 #ifdef BUTTON_TESTING |
76 | 447 fprintf(MSG_OUT, "libdvdnav: Button select %i\n", button); |
31 | 448 #endif |
0 | 449 |
450 /* Set the highlight SPRM if the passed button was valid*/ | |
57 | 451 /* FIXME: this->pci should be provided by the application. */ |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
452 if((button <= 0) || (button > this->pci.hli.hl_gi.btn_ns)) { |
0 | 453 printerrf("Unable to select button number %i as it doesn't exist", |
454 button); | |
455 return S_ERR; | |
456 } | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
457 this->vm->state.HL_BTNN_REG = (button << 10); |
0 | 458 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
459 this->hli_state = 1; /* Selected */ |
0 | 460 |
64
2759605b41f6
We need to update the button info when moving around in menus.
mroi
parents:
57
diff
changeset
|
461 this->position_current.button = -1; /* Force Highligh change */ |
0 | 462 |
463 return S_OK; | |
464 } | |
465 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
466 dvdnav_status_t dvdnav_button_select_and_activate(dvdnav_t *this, |
0 | 467 int button) { |
468 /* A trivial function */ | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
469 if(dvdnav_button_select(this, button) != S_ERR) { |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
470 return dvdnav_button_activate(this); |
0 | 471 } |
472 | |
473 /* Should never get here without an error */ | |
474 return S_ERR; | |
475 } | |
476 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
477 dvdnav_status_t dvdnav_mouse_select(dvdnav_t *this, int x, int y) { |
0 | 478 int button, cur_button; |
69 | 479 uint32_t best,dist; |
480 int mx,my,dx,dy,d; | |
481 | |
0 | 482 /* FIXME: At the moment, the case of no button matchin (x,y) is |
483 * silently ignored, is this OK? */ | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
484 if(!this) |
0 | 485 return S_ERR; |
486 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
487 if(dvdnav_get_current_highlight(this, &cur_button) != S_OK) { |
0 | 488 return S_ERR; |
489 } | |
490 | |
69 | 491 best = 0; |
492 dist = 0x08000000; /* >> than (720*720)+(567*567); */ | |
493 | |
0 | 494 /* Loop through each button */ |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
495 for(button=1; button <= this->pci.hli.hl_gi.btn_ns; button++) { |
0 | 496 btni_t *button_ptr = NULL; |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
497 button_ptr = &(this->pci.hli.btnit[button-1]); |
0 | 498 if((x >= button_ptr->x_start) && (x <= button_ptr->x_end) && |
499 (y >= button_ptr->y_start) && (y <= button_ptr->y_end)) { | |
69 | 500 mx = (button_ptr->x_start + button_ptr->x_end)/2; |
501 my = (button_ptr->y_start + button_ptr->y_end)/2; | |
502 dx = mx - x; | |
503 dy = my - y; | |
504 d = (dx*dx) + (dy*dy); | |
505 /* If the mouse is within the button and the mouse is closer | |
506 * to the center of this button then it is the best choice. */ | |
507 if(d < dist) { | |
508 dist = d; best=button; | |
0 | 509 } |
510 } | |
511 } | |
69 | 512 |
513 if (best!=0) { | |
514 /* As an efficiency measure, only re-select the button | |
515 * if it is different to the previously selected one. */ | |
516 if(best != cur_button) { | |
517 dvdnav_button_select(this, best); | |
518 } | |
519 } | |
0 | 520 |
521 return S_OK; | |
522 } | |
523 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
524 dvdnav_status_t dvdnav_mouse_activate(dvdnav_t *this, int x, int y) { |
0 | 525 /* A trivial function */ |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
526 if(dvdnav_mouse_select(this, x,y) != S_ERR) { |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
10
diff
changeset
|
527 return dvdnav_button_activate(this); |
0 | 528 } |
529 | |
530 /* Should never get here without an error */ | |
531 return S_ERR; | |
532 } | |
533 |