Revision 77ddf4df ffmpeg.c

View differences:

ffmpeg.c
2356 2356

  
2357 2357
static int opt_loglevel(const char *opt, const char *arg)
2358 2358
{
2359
    int level = parse_number_or_die(opt, arg, OPT_INT, INT_MIN, INT_MAX);
2359
    const struct { const char *name; int level; } const log_levels[] = {
2360
        { "quiet"  , AV_LOG_QUIET   },
2361
        { "panic"  , AV_LOG_PANIC   },
2362
        { "fatal"  , AV_LOG_FATAL   },
2363
        { "error"  , AV_LOG_ERROR   },
2364
        { "warning", AV_LOG_WARNING },
2365
        { "info"   , AV_LOG_INFO    },
2366
        { "verbose", AV_LOG_VERBOSE },
2367
        { "debug"  , AV_LOG_DEBUG   },
2368
    };
2369
    char *tail;
2370
    int level;
2371
    int i;
2372

  
2373
    for (i = 0; i < FF_ARRAY_ELEMS(log_levels); i++) {
2374
        if (!strcmp(log_levels[i].name, arg)) {
2375
            av_log_set_level(log_levels[i].level);
2376
            return 0;
2377
        }
2378
    }
2379

  
2380
    level = strtol(arg, &tail, 10);
2381
    if (*tail) {
2382
        fprintf(stderr, "Invalid loglevel \"%s\". "
2383
                        "Possible levels are numbers or:\n", arg);
2384
        for (i = 0; i < FF_ARRAY_ELEMS(log_levels); i++)
2385
            fprintf(stderr, "\"%s\"\n", log_levels[i].name);
2386
        av_exit(1);
2387
    }
2360 2388
    av_log_set_level(level);
2361 2389
    return 0;
2362 2390
}
......
3800 3828
    { "loop_input", OPT_BOOL | OPT_EXPERT, {(void*)&loop_input}, "loop (current only works with images)" },
3801 3829
    { "loop_output", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&loop_output}, "number of times to loop output in formats that support looping (0 loops forever)", "" },
3802 3830
    { "v", HAS_ARG | OPT_FUNC2, {(void*)opt_verbose}, "set ffmpeg verbosity level", "number" },
3803
    { "loglevel", HAS_ARG | OPT_FUNC2, {(void*)opt_loglevel}, "set libav* logging level", "number" },
3831
    { "loglevel", HAS_ARG | OPT_FUNC2, {(void*)opt_loglevel}, "set libav* logging level", "logging level number or string" },
3804 3832
    { "target", HAS_ARG, {(void*)opt_target}, "specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\", \"dv50\", \"pal-vcd\", \"ntsc-svcd\", ...)", "type" },
3805 3833
    { "threads", OPT_FUNC2 | HAS_ARG | OPT_EXPERT, {(void*)opt_thread_count}, "thread count", "count" },
3806 3834
    { "vsync", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&video_sync_method}, "video sync method", "" },

Also available in: Unified diff