Mercurial > mplayer.hg
annotate libmenu/menu_dvbin.c @ 37195:ac6c37d85d65 default tip
configure: Fix initialization of variable def_local_aligned_32
It contiained the #define of HAVE_LOCAL_ALIGNED_16 instead
of HAVE_LOCAL_ALIGNED_32.
| author | al |
|---|---|
| date | Sun, 28 Sep 2014 18:38:41 +0000 |
| parents | a93891202051 |
| children |
| 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" | |
|
34174
a93891202051
Add missing mp_msg.h #includes, remove some unnecessary ones.
diego
parents:
33841
diff
changeset
|
35 #include "mp_msg.h" |
|
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
36 |
|
19431
ac69ba536915
Explicitly include libmpcodecs/img_format.h and libvo/fastmemcpy.h.
diego
parents:
19271
diff
changeset
|
37 #include "libmpcodecs/img_format.h" |
|
ac69ba536915
Explicitly include libmpcodecs/img_format.h and libvo/fastmemcpy.h.
diego
parents:
19271
diff
changeset
|
38 #include "libmpcodecs/mp_image.h" |
|
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
39 |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
40 #include "menu.h" |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
41 #include "menu_list.h" |
| 16862 | 42 #include "input/input.h" |
| 43 #include "osdep/keycodes.h" | |
|
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
44 |
|
19271
64d82a45a05d
introduce new 'stream' directory for all stream layer related components and split them from libmpdemux
ben
parents:
17945
diff
changeset
|
45 #include "stream/dvbin.h" |
|
10626
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 |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
49 struct list_entry_s { |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
50 struct list_entry p; |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
51 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
|
52 }; |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
53 |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
54 struct menu_priv_s { |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
55 menu_list_priv_t p; |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
56 char* title; |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
57 char* file; |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
58 int card; |
| 12308 | 59 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
|
60 int auto_close; |
| 12308 | 61 dvb_config_t *config; |
|
10626
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 |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
65 #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
|
66 #define mpriv (menu->priv) |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
67 |
| 30957 | 68 static const m_option_t cfg_fields[] = { |
|
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
69 MENU_LIST_PRIV_FIELDS, |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
70 { "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
|
71 { "auto-close", ST_OFF(auto_close), CONF_TYPE_FLAG, 0, 0, 1, NULL }, |
| 12308 | 72 { NULL, NULL, NULL, 0,0,0,NULL }, |
|
10626
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 |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
76 static struct menu_priv_s cfg_dflt = { |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
77 MENU_LIST_PRIV_DFLT, |
| 12308 | 78 "Select a channel: ", |
|
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
79 "channels.conf", |
| 12308 | 80 0, |
| 81 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
|
82 1, |
|
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
83 NULL, |
|
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 |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
89 static void free_entry(list_entry_t* entry) |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
90 { |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
91 free(entry->p.txt); |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
92 free(entry); |
|
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 |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
95 |
| 12308 | 96 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
|
97 { |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
98 int n; |
| 12308 | 99 dvb_channel_t *channel; |
|
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
100 list_entry_t* elem; |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
101 |
| 12308 | 102 mpriv->level = 2; |
|
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
103 if(dvb_list_ptr == NULL) |
|
25356
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
104 { |
|
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
105 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
|
106 n = 1; |
| 12308 | 107 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
|
108 { |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
109 elem->p.next = NULL; |
| 12308 | 110 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
|
111 |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
112 menu_list_add_entry(menu, elem); |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
113 } |
| 12308 | 114 return 1; |
|
25356
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
115 } |
|
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
116 for(n = 0; n < dvb_list_ptr->NUM_CHANNELS; n++) |
|
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
117 { |
|
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
118 channel = &(dvb_list_ptr->channels[n]); |
| 12308 | 119 if((elem = calloc(1, sizeof(list_entry_t))) != NULL) |
| 120 { | |
| 121 elem->p.next = NULL; | |
| 122 elem->p.txt = strdup(channel->name); | |
| 123 elem->num = n; | |
|
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28113
diff
changeset
|
124 |
| 12308 | 125 menu_list_add_entry(menu, elem); |
| 126 } | |
| 127 else | |
| 128 { | |
|
33841
25667edae85c
cleanup: adjust printf format strings to match parameter types
diego
parents:
33713
diff
changeset
|
129 mp_msg(MSGT_DEMUX, MSGL_ERR, "dvb_menu: fill_menu: couldn't malloc %zu bytes for menu item: %s, exit\n", |
| 12308 | 130 sizeof(list_entry_t), strerror(errno)); |
| 131 break; | |
| 132 } | |
|
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28113
diff
changeset
|
133 } |
|
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28113
diff
changeset
|
134 |
| 12308 | 135 return n; |
| 136 } | |
| 137 | |
| 138 | |
| 139 static int fill_cards_menu(menu_t *menu, dvb_config_t *conf) | |
| 140 { | |
| 141 int n; | |
| 142 list_entry_t* elem; | |
| 143 | |
| 144 for(n = 0; n < conf->count; n++) | |
| 145 { | |
| 146 if((elem = calloc(1, sizeof(list_entry_t))) != NULL) | |
|
25356
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
147 { |
|
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
148 elem->p.next = NULL; |
| 12308 | 149 elem->p.txt = strdup(conf->cards[n].name); |
|
25356
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
150 elem->num = n; |
|
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28113
diff
changeset
|
151 |
|
25356
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
152 if(n == 0) |
|
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
153 elem->p.prev = NULL; |
|
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28113
diff
changeset
|
154 |
|
25356
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
155 menu_list_add_entry(menu, elem); |
|
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
156 } |
|
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
157 else |
|
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
158 { |
|
33841
25667edae85c
cleanup: adjust printf format strings to match parameter types
diego
parents:
33713
diff
changeset
|
159 fprintf(stderr, "dvb_menu: fill_menu: couldn't malloc %zu bytes for menu item: %s, exit\n", |
|
25356
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
160 sizeof(list_entry_t), strerror(errno)); |
|
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
161 if(n) |
|
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
162 return 1; |
|
25356
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
163 |
|
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
164 return 0; |
|
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
165 } |
|
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28113
diff
changeset
|
166 } |
|
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28113
diff
changeset
|
167 |
| 12308 | 168 return n; |
| 169 } | |
| 170 | |
| 171 | |
| 172 static int fill_menu(menu_t* menu) | |
| 173 { | |
| 174 list_entry_t* elem; | |
| 175 dvb_channels_list *dvb_list_ptr; | |
|
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28113
diff
changeset
|
176 |
| 12308 | 177 menu_list_init(menu); |
|
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28113
diff
changeset
|
178 |
| 12308 | 179 if(mpriv->config == NULL) |
| 180 { | |
| 181 if((elem = calloc(1, sizeof(list_entry_t))) != NULL) | |
| 182 { | |
| 183 elem->p.prev = elem->p.next = NULL; | |
| 184 elem->p.txt = strdup("NO DVB configuration present!"); | |
| 185 | |
| 186 menu_list_add_entry(menu, elem); | |
|
25356
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
187 return 1; |
| 12308 | 188 } |
| 189 return 0; | |
|
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
190 } |
|
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28113
diff
changeset
|
191 |
| 12308 | 192 mpriv->p.title = mpriv->title; |
| 193 if(mpriv->level == 1 && mpriv->config->count > 1) | |
| 194 return fill_cards_menu(menu, mpriv->config); | |
| 195 else | |
| 196 { | |
| 197 dvb_list_ptr = mpriv->config->cards[mpriv->card].list; | |
| 198 return fill_channels_menu(menu, dvb_list_ptr); | |
| 199 } | |
|
10626
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 |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
203 static void read_cmd(menu_t* menu, int cmd) |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
204 { |
| 12308 | 205 list_entry_t *elem; |
|
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
206 mp_cmd_t* c; |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
207 char *cmd_name; |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
208 switch(cmd) |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
209 { |
|
17945
98f4e3704a76
Allow 6 ways (up/down/left/right/ok/cancel) navigation.
albeu
parents:
17682
diff
changeset
|
210 case MENU_CMD_RIGHT: |
|
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
211 case MENU_CMD_OK: |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
212 { |
| 12308 | 213 elem = mpriv->p.current; |
| 214 | |
| 215 if(mpriv->level == 1) | |
| 216 { | |
| 217 mpriv->card = mpriv->p.current->num; | |
| 218 mpriv->level = 2; | |
| 219 menu_list_uninit(menu, free_entry); | |
|
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28113
diff
changeset
|
220 fill_menu(menu); |
| 12308 | 221 } |
| 222 else | |
| 223 { | |
| 224 dvb_priv_t *dvbp = (dvb_priv_t*) mpriv->config->priv; | |
| 225 cmd_name = malloc(25 + strlen(elem->p.txt)); | |
| 226 if(dvbp != NULL) | |
|
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28113
diff
changeset
|
227 sprintf(cmd_name, "dvb_set_channel %d %d", elem->num, mpriv->card); |
| 12308 | 228 else |
| 229 sprintf(cmd_name, "loadfile 'dvb://%d@%s'", mpriv->card+1, elem->p.txt); | |
|
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28113
diff
changeset
|
230 |
|
25356
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
231 c = mp_input_parse_cmd(cmd_name); |
|
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
232 free(cmd_name); |
|
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
233 if(c) |
|
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
234 { |
|
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
235 if(mpriv->auto_close) |
|
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
236 mp_input_queue_cmd (mp_input_parse_cmd ("menu hide")); |
|
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
237 mp_input_queue_cmd(c); |
|
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
238 } |
|
a5c22f3e4673
cosmetics: partially reformatted this monstruosity
nicodvb
parents:
25346
diff
changeset
|
239 } |
| 12308 | 240 } |
|
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
241 break; |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
242 |
|
17945
98f4e3704a76
Allow 6 ways (up/down/left/right/ok/cancel) navigation.
albeu
parents:
17682
diff
changeset
|
243 case MENU_CMD_LEFT: |
| 12308 | 244 case MENU_CMD_CANCEL: |
| 245 { | |
| 246 elem = mpriv->p.current; | |
|
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28113
diff
changeset
|
247 |
| 12308 | 248 menu_list_uninit(menu, free_entry); |
| 249 if(mpriv->config->count > 1) | |
| 250 mpriv->level--; | |
| 251 else | |
| 252 mpriv->level = 0; | |
| 253 | |
| 254 if(mpriv->level > 0) | |
| 255 { | |
| 256 fill_menu(menu); | |
| 257 break; | |
| 258 } | |
| 259 } | |
| 260 | |
|
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
261 default: |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
262 menu_list_read_cmd(menu, cmd); |
|
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 |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
267 static void close_menu(menu_t* menu) |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
268 { |
|
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
|
269 dvb_free_config(mpriv->config); |
|
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
270 menu_list_uninit(menu, free_entry); |
|
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 |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
274 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
|
275 { |
| 12308 | 276 mpriv->config = dvb_get_config(); |
| 277 if(mpriv->config == NULL) | |
| 278 return 0; | |
| 279 | |
|
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
280 menu->draw = menu_list_draw; |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
281 menu->read_cmd = read_cmd; |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
282 menu->close = close_menu; |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
283 |
| 12308 | 284 mpriv->card = 0; |
| 285 mpriv->level = 1; | |
|
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
286 return fill_menu(menu); |
|
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 |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
289 const menu_info_t menu_info_dvbsel = |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
290 { |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
291 "DVB channels menu", //descr |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
292 "dvbsel", //name |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
293 "Nico", //author |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
294 "dvb_sel", |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
295 { //m_struct_t priv_st= |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
296 "dvb_cfg", //name |
| 12308 | 297 sizeof(struct menu_priv_s), //size |
|
10626
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
298 &cfg_dflt, //defaults |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
299 cfg_fields //settable fields |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
300 }, |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
301 open_dvb_sel //open function |
|
fd97f3727f15
Finnaly commit Nico's dvb menu. Sorry for committing this
albeu
parents:
diff
changeset
|
302 }; |
