comparison gui/interface.c @ 37078:7471626e943e

Relocate add_vf(). Additionally, add doxygen comment.
author ib
date Thu, 24 Apr 2014 13:31:52 +0000
parents 4bef9233da1b
children 83aa0570d6be
comparison
equal deleted inserted replaced
37077:4bef9233da1b 37078:7471626e943e
83 static void set_fontconfig(void) 83 static void set_fontconfig(void)
84 { 84 {
85 font_fontconfig = (font_name && strchr(font_name, '/') ? -1 : orig_fontconfig); 85 font_fontconfig = (font_name && strchr(font_name, '/') ? -1 : orig_fontconfig);
86 } 86 }
87 87
88 /**
89 * @brief Add a video filter
90 * (or change the parameter/value pairs of an existing one).
91 *
92 * @param vf video filter to be added or changed
93 * @param argvf pointer to an array of (new) parameter/value pairs
94 */
95 static void add_vf(const char *vf, const char *const *argvf)
96 {
97 if (vf_settings) {
98 int i = 0;
99
100 while (vf_settings[i].name) {
101 if (strcmp(vf_settings[i].name, vf) == 0)
102 break;
103
104 i++;
105 }
106
107 if (vf_settings[i].name) {
108 listFree(&vf_settings[i].attribs);
109 vf_settings[i].attribs = listDup(argvf);
110 } else {
111 void *settings = realloc(vf_settings, (i + 2) * sizeof(m_obj_settings_t));
112
113 if (!settings)
114 return;
115
116 vf_settings = settings;
117 vf_settings[i].name = strdup(vf);
118 vf_settings[i].attribs = listDup(argvf);
119 memset(&vf_settings[i + 1], 0, sizeof(m_obj_settings_t));
120 }
121 } else {
122 vf_settings = calloc(2, sizeof(m_obj_settings_t));
123
124 if (!vf_settings)
125 return;
126
127 vf_settings[0].name = strdup(vf);
128 vf_settings[0].attribs = listDup(argvf);
129 }
130
131 mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_GUI_MSG_AddingVideoFilter, vf);
132 }
133
88 /* MPlayer -> GUI */ 134 /* MPlayer -> GUI */
89 135
90 /** 136 /**
91 * @brief Initialize and start the GUI. 137 * @brief Initialize and start the GUI.
92 */ 138 */
271 m_config_free(gui_conf); 317 m_config_free(gui_conf);
272 gui_conf = NULL; 318 gui_conf = NULL;
273 } 319 }
274 320
275 mp_msg(MSGT_GPLAYER, MSGL_V, "GUI done.\n"); 321 mp_msg(MSGT_GPLAYER, MSGL_V, "GUI done.\n");
276 }
277
278 static void add_vf(const char *vf, const char *const *argvf)
279 {
280 if (vf_settings) {
281 int i = 0;
282
283 while (vf_settings[i].name) {
284 if (strcmp(vf_settings[i].name, vf) == 0)
285 break;
286
287 i++;
288 }
289
290 if (vf_settings[i].name) {
291 listFree(&vf_settings[i].attribs);
292 vf_settings[i].attribs = listDup(argvf);
293 } else {
294 void *settings = realloc(vf_settings, (i + 2) * sizeof(m_obj_settings_t));
295
296 if (!settings)
297 return;
298
299 vf_settings = settings;
300 vf_settings[i].name = strdup(vf);
301 vf_settings[i].attribs = listDup(argvf);
302 memset(&vf_settings[i + 1], 0, sizeof(m_obj_settings_t));
303 }
304 } else {
305 vf_settings = calloc(2, sizeof(m_obj_settings_t));
306
307 if (!vf_settings)
308 return;
309
310 vf_settings[0].name = strdup(vf);
311 vf_settings[0].attribs = listDup(argvf);
312 }
313
314 mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_GUI_MSG_AddingVideoFilter, vf);
315 } 322 }
316 323
317 /** 324 /**
318 * @brief Issue a command to the GUI. 325 * @brief Issue a command to the GUI.
319 * 326 *