avprobe: Get rid of ugly casts in the options table

This also makes sure the function pointers are stored via the same
union member as they are accessed via.

Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
Martin Storsjö 2012-08-27 14:07:12 +03:00
parent b441a4517b
commit b42be2d56a

View File

@ -877,34 +877,35 @@ void show_help_default(const char *opt, const char *arg)
show_help_children(avformat_get_class(), AV_OPT_FLAG_DECODING_PARAM);
}
static void opt_pretty(void)
static int opt_pretty(const char *opt, const char *arg)
{
show_value_unit = 1;
use_value_prefix = 1;
use_byte_value_binary_prefix = 1;
use_value_sexagesimal_format = 1;
return 0;
}
static const OptionDef real_options[] = {
#include "cmdutils_common_opts.h"
{ "f", HAS_ARG, {(void*)opt_format}, "force format", "format" },
{ "of", HAS_ARG, {(void*)&opt_output_format}, "output the document either as ini or json", "output_format" },
{ "unit", OPT_BOOL, {(void*)&show_value_unit},
{ "f", HAS_ARG, {.func_arg = opt_format}, "force format", "format" },
{ "of", HAS_ARG, {.func_arg = opt_output_format}, "output the document either as ini or json", "output_format" },
{ "unit", OPT_BOOL, {&show_value_unit},
"show unit of the displayed values" },
{ "prefix", OPT_BOOL, {(void*)&use_value_prefix},
{ "prefix", OPT_BOOL, {&use_value_prefix},
"use SI prefixes for the displayed values" },
{ "byte_binary_prefix", OPT_BOOL, {(void*)&use_byte_value_binary_prefix},
{ "byte_binary_prefix", OPT_BOOL, {&use_byte_value_binary_prefix},
"use binary prefixes for byte units" },
{ "sexagesimal", OPT_BOOL, {(void*)&use_value_sexagesimal_format},
{ "sexagesimal", OPT_BOOL, {&use_value_sexagesimal_format},
"use sexagesimal format HOURS:MM:SS.MICROSECONDS for time units" },
{ "pretty", 0, {(void*)&opt_pretty},
{ "pretty", 0, {.func_arg = opt_pretty},
"prettify the format of displayed values, make it more human readable" },
{ "show_format", OPT_BOOL, {(void*)&do_show_format} , "show format/container info" },
{ "show_format_entry", HAS_ARG, {(void*)opt_show_format_entry},
{ "show_format", OPT_BOOL, {&do_show_format} , "show format/container info" },
{ "show_format_entry", HAS_ARG, {.func_arg = opt_show_format_entry},
"show a particular entry from the format/container info", "entry" },
{ "show_packets", OPT_BOOL, {(void*)&do_show_packets}, "show packets info" },
{ "show_streams", OPT_BOOL, {(void*)&do_show_streams}, "show streams info" },
{ "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default},
{ "show_packets", OPT_BOOL, {&do_show_packets}, "show packets info" },
{ "show_streams", OPT_BOOL, {&do_show_streams}, "show streams info" },
{ "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {.func_arg = opt_default},
"generic catch all option", "" },
{ NULL, },
};