X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=cmdutils.c;h=a0ad3ef747d40a67ac04ada87ff01aef07f99d18;hb=f61ee9b5649192e2b644df59c6def6eac1d0bf48;hp=a5871c3207f34bef62085ae82c180b5fc803f986;hpb=4abb88d7e84208d86750091b3ec9082767ca74c1;p=ffmpeg diff --git a/cmdutils.c b/cmdutils.c index a5871c3207f..a0ad3ef747d 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -316,8 +316,7 @@ int parse_option(void *optctx, const char *opt, const char *arg, } else if (po->flags & OPT_DOUBLE) { *(double *)dst = parse_number_or_die(opt, arg, OPT_DOUBLE, -INFINITY, INFINITY); } else if (po->u.func_arg) { - int ret = po->flags & OPT_FUNC2 ? po->u.func2_arg(optctx, opt, arg) - : po->u.func_arg(opt, arg); + int ret = po->u.func_arg(optctx, opt, arg); if (ret < 0) { av_log(NULL, AV_LOG_ERROR, "Failed to set value '%s' for option '%s'\n", arg, opt); @@ -416,7 +415,7 @@ void parse_loglevel(int argc, char **argv, const OptionDef *options) if (!idx) idx = locate_option(argc, argv, options, "v"); if (idx && argv[idx + 1]) - opt_loglevel("loglevel", argv[idx + 1]); + opt_loglevel(NULL, "loglevel", argv[idx + 1]); idx = locate_option(argc, argv, options, "report"); if (idx || getenv("FFREPORT")) { opt_report("report"); @@ -433,7 +432,7 @@ void parse_loglevel(int argc, char **argv, const OptionDef *options) } #define FLAGS (o->type == AV_OPT_TYPE_FLAGS) ? AV_DICT_APPEND : 0 -int opt_default(const char *opt, const char *arg) +int opt_default(void *optctx, const char *opt, const char *arg) { const AVOption *o; char opt_stripped[128]; @@ -482,7 +481,7 @@ int opt_default(const char *opt, const char *arg) return AVERROR_OPTION_NOT_FOUND; } -int opt_loglevel(const char *opt, const char *arg) +int opt_loglevel(void *optctx, const char *opt, const char *arg) { const struct { const char *name; int level; } log_levels[] = { { "quiet" , AV_LOG_QUIET }, @@ -549,7 +548,7 @@ int opt_report(const char *opt) return 0; } -int opt_max_alloc(const char *opt, const char *arg) +int opt_max_alloc(void *optctx, const char *opt, const char *arg) { char *tail; size_t max; @@ -563,7 +562,7 @@ int opt_max_alloc(const char *opt, const char *arg) return 0; } -int opt_cpuflags(const char *opt, const char *arg) +int opt_cpuflags(void *optctx, const char *opt, const char *arg) { int ret; unsigned flags = av_get_cpu_flags(); @@ -575,13 +574,13 @@ int opt_cpuflags(const char *opt, const char *arg) return 0; } -int opt_codec_debug(const char *opt, const char *arg) +int opt_codec_debug(void *optctx, const char *opt, const char *arg) { av_log_set_level(AV_LOG_DEBUG); - return opt_default(opt, arg); + return opt_default(NULL, opt, arg); } -int opt_timelimit(const char *opt, const char *arg) +int opt_timelimit(void *optctx, const char *opt, const char *arg) { #if HAVE_SETRLIMIT int lim = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX); @@ -680,7 +679,7 @@ void show_banner(int argc, char **argv, const OptionDef *options) print_all_libs_info(INDENT|SHOW_VERSION, AV_LOG_INFO); } -int show_version(const char *opt, const char *arg) +int show_version(void *optctx, const char *opt, const char *arg) { av_log_set_callback(log_callback_help); print_program_info (0 , AV_LOG_INFO); @@ -689,7 +688,7 @@ int show_version(const char *opt, const char *arg) return 0; } -int show_license(const char *opt, const char *arg) +int show_license(void *optctx, const char *opt, const char *arg) { printf( #if CONFIG_NONFREE @@ -760,7 +759,7 @@ int show_license(const char *opt, const char *arg) return 0; } -int show_formats(const char *opt, const char *arg) +int show_formats(void *optctx, const char *opt, const char *arg) { AVInputFormat *ifmt = NULL; AVOutputFormat *ofmt = NULL; @@ -902,18 +901,20 @@ static void print_codecs_for_id(enum AVCodecID id, int encoder) printf(")"); } -int show_codecs(const char *opt, const char *arg) +int show_codecs(void *optctx, const char *opt, const char *arg) { const AVCodecDescriptor *desc = NULL; printf("Codecs:\n" - " D... = Decoding supported\n" - " .E.. = Encoding supported\n" - " ..V. = Video codec\n" - " ..A. = Audio codec\n" - " ..S. = Subtitle codec\n" - " ...I = Intra frame-only codec\n" - " -----\n"); + " D..... = Decoding supported\n" + " .E.... = Encoding supported\n" + " ..V... = Video codec\n" + " ..A... = Audio codec\n" + " ..S... = Subtitle codec\n" + " ...I.. = Intra frame-only codec\n" + " ....L. = Lossy compression\n" + " .....S = Lossless compression\n" + " -------\n"); while ((desc = avcodec_descriptor_next(desc))) { const AVCodec *codec = NULL; @@ -923,6 +924,8 @@ int show_codecs(const char *opt, const char *arg) printf("%c", get_media_type_char(desc->type)); printf((desc->props & AV_CODEC_PROP_INTRA_ONLY) ? "I" : "."); + printf((desc->props & AV_CODEC_PROP_LOSSY) ? "L" : "."); + printf((desc->props & AV_CODEC_PROP_LOSSLESS) ? "S" : "."); printf(" %-20s %s", desc->name, desc->long_name ? desc->long_name : ""); @@ -982,19 +985,19 @@ static void print_codecs(int encoder) } } -int show_decoders(const char *opt, const char *arg) +int show_decoders(void *optctx, const char *opt, const char *arg) { print_codecs(0); return 0; } -int show_encoders(const char *opt, const char *arg) +int show_encoders(void *optctx, const char *opt, const char *arg) { print_codecs(1); return 0; } -int show_bsfs(const char *opt, const char *arg) +int show_bsfs(void *optctx, const char *opt, const char *arg) { AVBitStreamFilter *bsf = NULL; @@ -1005,7 +1008,7 @@ int show_bsfs(const char *opt, const char *arg) return 0; } -int show_protocols(const char *opt, const char *arg) +int show_protocols(void *optctx, const char *opt, const char *arg) { void *opaque = NULL; const char *name; @@ -1020,7 +1023,7 @@ int show_protocols(const char *opt, const char *arg) return 0; } -int show_filters(const char *opt, const char *arg) +int show_filters(void *optctx, const char *opt, const char *arg) { AVFilter av_unused(**filter) = NULL; char descr[64], *descr_cur; @@ -1052,7 +1055,7 @@ int show_filters(const char *opt, const char *arg) return 0; } -int show_pix_fmts(const char *opt, const char *arg) +int show_pix_fmts(void *optctx, const char *opt, const char *arg) { enum PixelFormat pix_fmt; @@ -1087,7 +1090,36 @@ int show_pix_fmts(const char *opt, const char *arg) return 0; } -int show_sample_fmts(const char *opt, const char *arg) +int show_layouts(void *optctx, const char *opt, const char *arg) +{ + int i = 0; + uint64_t layout, j; + const char *name, *descr; + + printf("Individual channels:\n" + "NAME DESCRIPTION\n"); + for (i = 0; i < 63; i++) { + name = av_get_channel_name((uint64_t)1 << i); + if (!name) + continue; + descr = av_get_channel_description((uint64_t)1 << i); + printf("%-12s%s\n", name, descr); + } + printf("\nStandard channel layouts:\n" + "NAME DECOMPOSITION\n"); + for (i = 0; !av_get_standard_channel_layout(i, &layout, &name); i++) { + if (name) { + printf("%-12s", name); + for (j = 1; j; j <<= 1) + if ((layout & j)) + printf("%s%s", (layout & (j - 1)) ? "+" : "", av_get_channel_name(j)); + printf("\n"); + } + } + return 0; +} + +int show_sample_fmts(void *optctx, const char *opt, const char *arg) { int i; char fmt_str[128]; @@ -1182,7 +1214,7 @@ static void show_help_muxer(const char *name) show_help_children(fmt->priv_class, AV_OPT_FLAG_ENCODING_PARAM); } -int show_help(const char *opt, const char *arg) +int show_help(void *optctx, const char *opt, const char *arg) { char *topic, *par; av_log_set_callback(log_callback_help);