Revision 4c97a6fa ffmpeg.c

View differences:

ffmpeg.c
2354 2354
    return 0;
2355 2355
}
2356 2356

  
2357
static int opt_loglevel(const char *opt, const char *arg)
2358
{
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
    }
2388
    av_log_set_level(level);
2389
    return 0;
2390
}
2391

  
2392 2357
static int opt_verbose(const char *opt, const char *arg)
2393 2358
{
2394 2359
    verbose = parse_number_or_die(opt, arg, OPT_INT64, -10, 10);

Also available in: Unified diff