mirror of
https://github.com/mpv-player/mpv
synced 2025-02-20 23:07:02 +00:00
m_option: add mp_log context to sub-module print_help callback
This commit is contained in:
parent
9242c34fa2
commit
7bdee8f35e
@ -2142,7 +2142,7 @@ static int m_obj_parse_sub_config(struct mp_log *log, struct bstr opt_name,
|
||||
print_help: ;
|
||||
if (config) {
|
||||
if (desc->print_help)
|
||||
desc->print_help();
|
||||
desc->print_help(log);
|
||||
m_config_print_option_list(config);
|
||||
} else {
|
||||
mp_warn(log, "Option %.*s doesn't exist.\n",
|
||||
|
@ -114,7 +114,7 @@ struct m_obj_desc {
|
||||
// Don't list entry with "help"
|
||||
bool hidden;
|
||||
// Callback to print custom help if "help" is passed
|
||||
void (*print_help)(void);
|
||||
void (*print_help)(struct mp_log *log);
|
||||
// Set by m_obj_list_find(). If the requested name is an old alias, this
|
||||
// is set to the old name (while the name field uses the new name).
|
||||
const char *replaced_name;
|
||||
|
@ -39,7 +39,7 @@ typedef struct vf_info {
|
||||
int priv_size;
|
||||
const void *priv_defaults;
|
||||
const struct m_option *options;
|
||||
void (*print_help)(void);
|
||||
void (*print_help)(struct mp_log *log);
|
||||
} vf_info_t;
|
||||
|
||||
typedef struct vf_instance {
|
||||
|
@ -355,18 +355,16 @@ static bool is_usable(const AVFilter *filter)
|
||||
is_single_video_only(filter->outputs);
|
||||
}
|
||||
|
||||
static void print_help(void)
|
||||
static void print_help(struct mp_log *log)
|
||||
{
|
||||
mp_msg(MSGT_CFGPARSER, MSGL_INFO, "List of libavfilter filters:\n");
|
||||
mp_info(log, "List of libavfilter filters:\n");
|
||||
for (const AVFilter *filter = avfilter_next(NULL); filter;
|
||||
filter = avfilter_next(filter))
|
||||
{
|
||||
if (is_usable(filter)) {
|
||||
mp_msg(MSGT_CFGPARSER, MSGL_INFO, " %-16s %s\n",
|
||||
filter->name, filter->description);
|
||||
}
|
||||
if (is_usable(filter))
|
||||
mp_info(log, " %-16s %s\n", filter->name, filter->description);
|
||||
}
|
||||
mp_msg(MSGT_CFGPARSER, MSGL_INFO, "\n"
|
||||
mp_info(log, "\n"
|
||||
"This lists video->video filters only. Refer to\n"
|
||||
"\n"
|
||||
" https://ffmpeg.org/ffmpeg-filters.html\n"
|
||||
|
@ -133,10 +133,10 @@ static int vf_open(vf_instance_t *vf){
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void print_help(void)
|
||||
static void print_help(struct mp_log *log)
|
||||
{
|
||||
mp_msg(MSGT_CFGPARSER, MSGL_INFO, "%s", pp_help);
|
||||
mp_msg(MSGT_CFGPARSER, MSGL_INFO,
|
||||
mp_info(log, "%s", pp_help);
|
||||
mp_info(log,
|
||||
"Don't forget to quote the filter list, e.g.: '--vf=pp=[tn:64:128:256]'\n\n");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user