comparison libmenu/menu_dvbin.c @ 25356:a5c22f3e4673

cosmetics: partially reformatted this monstruosity
author nicodvb
date Wed, 12 Dec 2007 23:01:49 +0000
parents 46736c300ae2
children 9befb9809011
comparison
equal deleted inserted replaced
25355:3110688d2406 25356:a5c22f3e4673
81 dvb_channel_t *channel; 81 dvb_channel_t *channel;
82 list_entry_t* elem; 82 list_entry_t* elem;
83 83
84 mpriv->level = 2; 84 mpriv->level = 2;
85 if(dvb_list_ptr == NULL) 85 if(dvb_list_ptr == NULL)
86 { 86 {
87 mp_msg(MSGT_DEMUX, MSGL_ERR, "dvb_set_channel: LIST NULL PTR, quit\n"); 87 mp_msg(MSGT_DEMUX, MSGL_ERR, "dvb_set_channel: LIST NULL PTR, quit\n");
88 n = 1; 88 n = 1;
89 if((elem = calloc(1, sizeof(list_entry_t))) != NULL) 89 if((elem = calloc(1, sizeof(list_entry_t))) != NULL)
90 { 90 {
91 elem->p.next = NULL; 91 elem->p.next = NULL;
92 elem->p.txt = strdup("There are no channels for this DVB card!"); 92 elem->p.txt = strdup("There are no channels for this DVB card!");
93 93
94 menu_list_add_entry(menu, elem); 94 menu_list_add_entry(menu, elem);
95 } 95 }
96 return 1; 96 return 1;
97 } 97 }
98 for(n = 0; n < dvb_list_ptr->NUM_CHANNELS; n++) 98 for(n = 0; n < dvb_list_ptr->NUM_CHANNELS; n++)
99 { 99 {
100 channel = &(dvb_list_ptr->channels[n]); 100 channel = &(dvb_list_ptr->channels[n]);
101 if((elem = calloc(1, sizeof(list_entry_t))) != NULL) 101 if((elem = calloc(1, sizeof(list_entry_t))) != NULL)
102 { 102 {
103 elem->p.next = NULL; 103 elem->p.next = NULL;
104 elem->p.txt = strdup(channel->name); 104 elem->p.txt = strdup(channel->name);
105 elem->num = n; 105 elem->num = n;
108 } 108 }
109 else 109 else
110 { 110 {
111 mp_msg(MSGT_DEMUX, MSGL_ERR, "dvb_menu: fill_menu: couldn't malloc %d bytes for menu item: %s, exit\n", 111 mp_msg(MSGT_DEMUX, MSGL_ERR, "dvb_menu: fill_menu: couldn't malloc %d bytes for menu item: %s, exit\n",
112 sizeof(list_entry_t), strerror(errno)); 112 sizeof(list_entry_t), strerror(errno));
113
114 break; 113 break;
115 } 114 }
116 } 115 }
117 116
118 return n; 117 return n;
125 list_entry_t* elem; 124 list_entry_t* elem;
126 125
127 for(n = 0; n < conf->count; n++) 126 for(n = 0; n < conf->count; n++)
128 { 127 {
129 if((elem = calloc(1, sizeof(list_entry_t))) != NULL) 128 if((elem = calloc(1, sizeof(list_entry_t))) != NULL)
130 { 129 {
131 elem->p.next = NULL; 130 elem->p.next = NULL;
132 elem->p.txt = strdup(conf->cards[n].name); 131 elem->p.txt = strdup(conf->cards[n].name);
133 elem->num = n; 132 elem->num = n;
134 133
135 if(n == 0) 134 if(n == 0)
136 elem->p.prev = NULL; 135 elem->p.prev = NULL;
137 136
138 menu_list_add_entry(menu, elem); 137 menu_list_add_entry(menu, elem);
139 } 138 }
140 else 139 else
141 { 140 {
142 fprintf(stderr, "dvb_menu: fill_menu: couldn't malloc %d bytes for menu item: %s, exit\n", 141 fprintf(stderr, "dvb_menu: fill_menu: couldn't malloc %d bytes for menu item: %s, exit\n",
143 sizeof(list_entry_t), strerror(errno)); 142 sizeof(list_entry_t), strerror(errno));
144 143 if(n)
145 if(n)
146 return 1; 144 return 1;
147 145
148 return 0; 146 return 0;
149 } 147 }
150 } 148 }
151 149
152 return n; 150 return n;
153 } 151 }
154 152
155 153
166 { 164 {
167 elem->p.prev = elem->p.next = NULL; 165 elem->p.prev = elem->p.next = NULL;
168 elem->p.txt = strdup("NO DVB configuration present!"); 166 elem->p.txt = strdup("NO DVB configuration present!");
169 167
170 menu_list_add_entry(menu, elem); 168 menu_list_add_entry(menu, elem);
171 return 1; 169 return 1;
172 } 170 }
173 return 0; 171 return 0;
174 } 172 }
175 173
176 mpriv->p.title = mpriv->title; 174 mpriv->p.title = mpriv->title;
210 if(dvbp != NULL) 208 if(dvbp != NULL)
211 sprintf(cmd_name, "dvb_set_channel %d %d", elem->num, mpriv->card); 209 sprintf(cmd_name, "dvb_set_channel %d %d", elem->num, mpriv->card);
212 else 210 else
213 sprintf(cmd_name, "loadfile 'dvb://%d@%s'", mpriv->card+1, elem->p.txt); 211 sprintf(cmd_name, "loadfile 'dvb://%d@%s'", mpriv->card+1, elem->p.txt);
214 212
215 c = mp_input_parse_cmd(cmd_name); 213 c = mp_input_parse_cmd(cmd_name);
216 free(cmd_name); 214 free(cmd_name);
217 if(c) 215 if(c)
218 { 216 {
219 if (mpriv->auto_close) 217 if(mpriv->auto_close)
220 mp_input_queue_cmd (mp_input_parse_cmd ("menu hide")); 218 mp_input_queue_cmd (mp_input_parse_cmd ("menu hide"));
221 mp_input_queue_cmd(c); 219 mp_input_queue_cmd(c);
222 } 220 }
223 } 221 }
224 } 222 }
225 break; 223 break;
226 224
227 case MENU_CMD_LEFT: 225 case MENU_CMD_LEFT:
228 case MENU_CMD_CANCEL: 226 case MENU_CMD_CANCEL: