# HG changeset patch # User ib # Date 1398346312 0 # Node ID 7471626e943e2251cdf96f4b3eb515104613c4c8 # Parent 4bef9233da1b09e4ede0d2994ba9170e57d20339 Relocate add_vf(). Additionally, add doxygen comment. diff -r 4bef9233da1b -r 7471626e943e gui/interface.c --- a/gui/interface.c Thu Apr 24 13:22:38 2014 +0000 +++ b/gui/interface.c Thu Apr 24 13:31:52 2014 +0000 @@ -85,6 +85,52 @@ font_fontconfig = (font_name && strchr(font_name, '/') ? -1 : orig_fontconfig); } +/** + * @brief Add a video filter + * (or change the parameter/value pairs of an existing one). + * + * @param vf video filter to be added or changed + * @param argvf pointer to an array of (new) parameter/value pairs + */ +static void add_vf(const char *vf, const char *const *argvf) +{ + if (vf_settings) { + int i = 0; + + while (vf_settings[i].name) { + if (strcmp(vf_settings[i].name, vf) == 0) + break; + + i++; + } + + if (vf_settings[i].name) { + listFree(&vf_settings[i].attribs); + vf_settings[i].attribs = listDup(argvf); + } else { + void *settings = realloc(vf_settings, (i + 2) * sizeof(m_obj_settings_t)); + + if (!settings) + return; + + vf_settings = settings; + vf_settings[i].name = strdup(vf); + vf_settings[i].attribs = listDup(argvf); + memset(&vf_settings[i + 1], 0, sizeof(m_obj_settings_t)); + } + } else { + vf_settings = calloc(2, sizeof(m_obj_settings_t)); + + if (!vf_settings) + return; + + vf_settings[0].name = strdup(vf); + vf_settings[0].attribs = listDup(argvf); + } + + mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_GUI_MSG_AddingVideoFilter, vf); +} + /* MPlayer -> GUI */ /** @@ -275,45 +321,6 @@ mp_msg(MSGT_GPLAYER, MSGL_V, "GUI done.\n"); } -static void add_vf(const char *vf, const char *const *argvf) -{ - if (vf_settings) { - int i = 0; - - while (vf_settings[i].name) { - if (strcmp(vf_settings[i].name, vf) == 0) - break; - - i++; - } - - if (vf_settings[i].name) { - listFree(&vf_settings[i].attribs); - vf_settings[i].attribs = listDup(argvf); - } else { - void *settings = realloc(vf_settings, (i + 2) * sizeof(m_obj_settings_t)); - - if (!settings) - return; - - vf_settings = settings; - vf_settings[i].name = strdup(vf); - vf_settings[i].attribs = listDup(argvf); - memset(&vf_settings[i + 1], 0, sizeof(m_obj_settings_t)); - } - } else { - vf_settings = calloc(2, sizeof(m_obj_settings_t)); - - if (!vf_settings) - return; - - vf_settings[0].name = strdup(vf); - vf_settings[0].attribs = listDup(argvf); - } - - mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_GUI_MSG_AddingVideoFilter, vf); -} - /** * @brief Issue a command to the GUI. *