Mercurial > mplayer.hg
changeset 37078:7471626e943e
Relocate add_vf().
Additionally, add doxygen comment.
author | ib |
---|---|
date | Thu, 24 Apr 2014 13:31:52 +0000 |
parents | 4bef9233da1b |
children | 83aa0570d6be |
files | gui/interface.c |
diffstat | 1 files changed, 46 insertions(+), 39 deletions(-) [+] |
line wrap: on
line diff
--- 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. *