Mercurial > mplayer.hg
annotate libmenu/menu_dvbin.c @ 28909:e9555bd1a9fb
Set DOCTYPE in xsl-generated HTML documentation.
author | reimar |
---|---|
date | Sat, 14 Mar 2009 12:32:28 +0000 |
parents | f8b6c7045cf8 |
children | 0f1b5b68af32 |
rev | line source |
---|---|
28113 | 1 /* |
2 * This file is part of MPlayer. | |
3 * | |
4 * MPlayer is free software; you can redistribute it and/or modify | |
5 * it under the terms of the GNU General Public License as published by | |
6 * the Free Software Foundation; either version 2 of the License, or | |
7 * (at your option) any later version. | |
8 * | |
9 * MPlayer is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 * GNU General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU General Public License along | |
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., | |
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
17 */ | |
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
18 |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
19 #include <stdlib.h> |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
20 #include <stdio.h> |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
21 #include <dirent.h> |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
22 #include <errno.h> |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
23 #include <string.h> |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
24 #include <sys/types.h> |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
25 #include <sys/stat.h> |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
26 #include <ctype.h> |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
27 #include <unistd.h> |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
28 #include <limits.h> |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
29 |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
30 |
16862 | 31 #include "config.h" |
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
32 |
16862 | 33 #include "m_struct.h" |
34 #include "m_option.h" | |
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
35 |
19431
ac69ba536915
Explicitly include libmpcodecs/img_format.h and libvo/fastmemcpy.h.
diego
parents:
19271
diff
changeset
|
36 #include "libmpcodecs/img_format.h" |
ac69ba536915
Explicitly include libmpcodecs/img_format.h and libvo/fastmemcpy.h.
diego
parents:
19271
diff
changeset
|
37 #include "libmpcodecs/mp_image.h" |
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
38 |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
39 #include "menu.h" |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
40 #include "menu_list.h" |
16862 | 41 #include "input/input.h" |
42 #include "osdep/keycodes.h" | |
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
43 |
19271
64d82a45a05d
introduce new 'stream' directory for all stream layer related components and split them from libmpdemux
ben
parents:
17945
diff
changeset
|
44 #include "stream/dvbin.h" |
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
45 |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
46 |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
47 |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
48 struct list_entry_s { |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
49 struct list_entry p; |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
50 int num; //the position of the chosen channel in the list |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
51 }; |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
52 |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
53 struct menu_priv_s { |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
54 menu_list_priv_t p; |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
55 char* title; |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
56 char* file; |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
57 int card; |
12308 | 58 int level; |
17682
b865581db0d5
auto hide dvb menu if auto-close is specified in menu.conf; patch by Ben Zores ben a geexbox di org
nicodvb
parents:
16862
diff
changeset
|
59 int auto_close; |
12308 | 60 dvb_config_t *config; |
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
61 }; |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
62 |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
63 |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
64 #define ST_OFF(m) M_ST_OFF(struct menu_priv_s, m) |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
65 #define mpriv (menu->priv) |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
66 |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
67 static m_option_t cfg_fields[] = { |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
68 MENU_LIST_PRIV_FIELDS, |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
69 { "title", ST_OFF(title), CONF_TYPE_STRING, 0, 0, 0, NULL }, |
17682
b865581db0d5
auto hide dvb menu if auto-close is specified in menu.conf; patch by Ben Zores ben a geexbox di org
nicodvb
parents:
16862
diff
changeset
|
70 { "auto-close", ST_OFF(auto_close), CONF_TYPE_FLAG, 0, 0, 1, NULL }, |
12308 | 71 { NULL, NULL, NULL, 0,0,0,NULL }, |
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
72 }; |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
73 |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
74 |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
75 static struct menu_priv_s cfg_dflt = { |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
76 MENU_LIST_PRIV_DFLT, |
12308 | 77 "Select a channel: ", |
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
78 "channels.conf", |
12308 | 79 0, |
80 0, | |
17682
b865581db0d5
auto hide dvb menu if auto-close is specified in menu.conf; patch by Ben Zores ben a geexbox di org
nicodvb
parents:
16862
diff
changeset
|
81 1, |
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
82 NULL, |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
83 }; |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
84 |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
85 |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
86 |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
87 |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
88 static void free_entry(list_entry_t* entry) |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
89 { |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
90 free(entry->p.txt); |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
91 free(entry); |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
92 } |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
93 |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
94 |
12308 | 95 static int fill_channels_menu(menu_t *menu, dvb_channels_list *dvb_list_ptr) |
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
96 { |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
97 int n; |
12308 | 98 dvb_channel_t *channel; |
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
99 list_entry_t* elem; |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
100 |
12308 | 101 mpriv->level = 2; |
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
102 if(dvb_list_ptr == NULL) |
25356
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
103 { |
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
104 mp_msg(MSGT_DEMUX, MSGL_ERR, "dvb_set_channel: LIST NULL PTR, quit\n"); |
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
105 n = 1; |
12308 | 106 if((elem = calloc(1, sizeof(list_entry_t))) != NULL) |
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
107 { |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
108 elem->p.next = NULL; |
12308 | 109 elem->p.txt = strdup("There are no channels for this DVB card!"); |
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
110 |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
111 menu_list_add_entry(menu, elem); |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
112 } |
12308 | 113 return 1; |
25356
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
114 } |
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
115 for(n = 0; n < dvb_list_ptr->NUM_CHANNELS; n++) |
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
116 { |
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
117 channel = &(dvb_list_ptr->channels[n]); |
12308 | 118 if((elem = calloc(1, sizeof(list_entry_t))) != NULL) |
119 { | |
120 elem->p.next = NULL; | |
121 elem->p.txt = strdup(channel->name); | |
122 elem->num = n; | |
123 | |
124 menu_list_add_entry(menu, elem); | |
125 } | |
126 else | |
127 { | |
128 mp_msg(MSGT_DEMUX, MSGL_ERR, "dvb_menu: fill_menu: couldn't malloc %d bytes for menu item: %s, exit\n", | |
129 sizeof(list_entry_t), strerror(errno)); | |
130 break; | |
131 } | |
132 } | |
133 | |
134 return n; | |
135 } | |
136 | |
137 | |
138 static int fill_cards_menu(menu_t *menu, dvb_config_t *conf) | |
139 { | |
140 int n; | |
141 list_entry_t* elem; | |
142 | |
143 for(n = 0; n < conf->count; n++) | |
144 { | |
145 if((elem = calloc(1, sizeof(list_entry_t))) != NULL) | |
25356
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
146 { |
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
147 elem->p.next = NULL; |
12308 | 148 elem->p.txt = strdup(conf->cards[n].name); |
25356
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
149 elem->num = n; |
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
150 |
25356
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
151 if(n == 0) |
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
152 elem->p.prev = NULL; |
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
153 |
25356
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
154 menu_list_add_entry(menu, elem); |
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
155 } |
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
156 else |
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
157 { |
12308 | 158 fprintf(stderr, "dvb_menu: fill_menu: couldn't malloc %d bytes for menu item: %s, exit\n", |
25356
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
159 sizeof(list_entry_t), strerror(errno)); |
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
160 if(n) |
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
161 return 1; |
25356
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
162 |
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
163 return 0; |
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
164 } |
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
165 } |
12308 | 166 |
167 return n; | |
168 } | |
169 | |
170 | |
171 static int fill_menu(menu_t* menu) | |
172 { | |
173 list_entry_t* elem; | |
174 dvb_channels_list *dvb_list_ptr; | |
175 | |
176 menu_list_init(menu); | |
177 | |
178 if(mpriv->config == NULL) | |
179 { | |
180 if((elem = calloc(1, sizeof(list_entry_t))) != NULL) | |
181 { | |
182 elem->p.prev = elem->p.next = NULL; | |
183 elem->p.txt = strdup("NO DVB configuration present!"); | |
184 | |
185 menu_list_add_entry(menu, elem); | |
25356
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
186 return 1; |
12308 | 187 } |
188 return 0; | |
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
189 } |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
190 |
12308 | 191 mpriv->p.title = mpriv->title; |
192 if(mpriv->level == 1 && mpriv->config->count > 1) | |
193 return fill_cards_menu(menu, mpriv->config); | |
194 else | |
195 { | |
196 dvb_list_ptr = mpriv->config->cards[mpriv->card].list; | |
197 return fill_channels_menu(menu, dvb_list_ptr); | |
198 } | |
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
199 } |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
200 |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
201 |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
202 static void read_cmd(menu_t* menu, int cmd) |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
203 { |
12308 | 204 list_entry_t *elem; |
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
205 mp_cmd_t* c; |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
206 char *cmd_name; |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
207 switch(cmd) |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
208 { |
17945
98f4e3704a76
Allow 6 ways (up/down/left/right/ok/cancel) navigation.
albeu
parents:
17682
diff
changeset
|
209 case MENU_CMD_RIGHT: |
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
210 case MENU_CMD_OK: |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
211 { |
12308 | 212 elem = mpriv->p.current; |
213 | |
214 if(mpriv->level == 1) | |
215 { | |
216 mpriv->card = mpriv->p.current->num; | |
217 mpriv->level = 2; | |
218 menu_list_uninit(menu, free_entry); | |
219 fill_menu(menu); | |
220 } | |
221 else | |
222 { | |
223 dvb_priv_t *dvbp = (dvb_priv_t*) mpriv->config->priv; | |
224 cmd_name = malloc(25 + strlen(elem->p.txt)); | |
225 if(dvbp != NULL) | |
226 sprintf(cmd_name, "dvb_set_channel %d %d", elem->num, mpriv->card); | |
227 else | |
228 sprintf(cmd_name, "loadfile 'dvb://%d@%s'", mpriv->card+1, elem->p.txt); | |
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
229 |
25356
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
230 c = mp_input_parse_cmd(cmd_name); |
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
231 free(cmd_name); |
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
232 if(c) |
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
233 { |
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
234 if(mpriv->auto_close) |
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
235 mp_input_queue_cmd (mp_input_parse_cmd ("menu hide")); |
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
236 mp_input_queue_cmd(c); |
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
237 } |
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
238 } |
12308 | 239 } |
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
240 break; |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
241 |
17945
98f4e3704a76
Allow 6 ways (up/down/left/right/ok/cancel) navigation.
albeu
parents:
17682
diff
changeset
|
242 case MENU_CMD_LEFT: |
12308 | 243 case MENU_CMD_CANCEL: |
244 { | |
245 elem = mpriv->p.current; | |
246 | |
247 menu_list_uninit(menu, free_entry); | |
248 if(mpriv->config->count > 1) | |
249 mpriv->level--; | |
250 else | |
251 mpriv->level = 0; | |
252 | |
253 if(mpriv->level > 0) | |
254 { | |
255 fill_menu(menu); | |
256 break; | |
257 } | |
258 } | |
259 | |
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
260 default: |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
261 menu_list_read_cmd(menu, cmd); |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
262 } |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
263 } |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
264 |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
265 |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
266 static void close_menu(menu_t* menu) |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
267 { |
25379
9befb9809011
get rid of the file-static dvb_config and free the config at close() . Patch by Andrew Calkin and me
nicodvb
parents:
25356
diff
changeset
|
268 dvb_free_config(mpriv->config); |
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
269 menu_list_uninit(menu, free_entry); |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
270 } |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
271 |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
272 |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
273 static int open_dvb_sel(menu_t* menu, char* args) |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
274 { |
12308 | 275 mpriv->config = dvb_get_config(); |
276 if(mpriv->config == NULL) | |
277 return 0; | |
278 | |
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
279 menu->draw = menu_list_draw; |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
280 menu->read_cmd = read_cmd; |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
281 menu->close = close_menu; |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
282 |
12308 | 283 mpriv->card = 0; |
284 mpriv->level = 1; | |
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
285 return fill_menu(menu); |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
286 } |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
287 |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
288 const menu_info_t menu_info_dvbsel = |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
289 { |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
290 "DVB channels menu", //descr |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
291 "dvbsel", //name |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
292 "Nico", //author |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
293 "dvb_sel", |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
294 { //m_struct_t priv_st= |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
295 "dvb_cfg", //name |
12308 | 296 sizeof(struct menu_priv_s), //size |
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
297 &cfg_dflt, //defaults |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
298 cfg_fields //settable fields |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
299 }, |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
300 open_dvb_sel //open function |
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
301 }; |