Revision bdf3d3bf

View differences:

ffmpeg.c
2922 2922
    return 0;
2923 2923
}
2924 2924

  
2925
static void opt_qscale(const char *arg)
2925
static int opt_qscale(const char *opt, const char *arg)
2926 2926
{
2927
    video_qscale = atof(arg);
2928
    if (video_qscale <= 0 ||
2929
        video_qscale > 255) {
2927
    video_qscale = parse_number_or_die(opt, arg, OPT_FLOAT, 0, 255);
2928
    if (video_qscale <= 0 || video_qscale > 255) {
2930 2929
        fprintf(stderr, "qscale must be > 0.0 and <= 255\n");
2931
        ffmpeg_exit(1);
2930
        return AVERROR(EINVAL);
2932 2931
    }
2932
    return 0;
2933 2933
}
2934 2934

  
2935
static void opt_top_field_first(const char *arg)
2935
static int opt_top_field_first(const char *opt, const char *arg)
2936 2936
{
2937
    top_field_first= atoi(arg);
2937
    top_field_first = parse_number_or_die(opt, arg, OPT_INT, 0, 1);
2938
    return 0;
2938 2939
}
2939 2940

  
2940 2941
static int opt_thread_count(const char *opt, const char *arg)
......
2976 2977
    return 0;
2977 2978
}
2978 2979

  
2979
static void opt_video_channel(const char *arg)
2980
static int opt_video_channel(const char *opt, const char *arg)
2980 2981
{
2981
    video_channel = strtol(arg, NULL, 0);
2982
    video_channel = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX);
2983
    return 0;
2982 2984
}
2983 2985

  
2984 2986
static void opt_video_standard(const char *arg)
......
3912 3914
}
3913 3915

  
3914 3916
/* same option as mencoder */
3915
static void opt_pass(const char *pass_str)
3917
static int opt_pass(const char *opt, const char *arg)
3916 3918
{
3917
    int pass;
3918
    pass = atoi(pass_str);
3919
    if (pass != 1 && pass != 2) {
3920
        fprintf(stderr, "pass number can be only 1 or 2\n");
3921
        ffmpeg_exit(1);
3922
    }
3923
    do_pass = pass;
3919
    do_pass = parse_number_or_die(opt, arg, OPT_INT, 1, 2);
3920
    return 0;
3924 3921
}
3925 3922

  
3926 3923
static int64_t getutime(void)
......
4340 4337
    { "intra", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&intra_only}, "use only intra frames"},
4341 4338
    { "vn", OPT_BOOL | OPT_VIDEO, {(void*)&video_disable}, "disable video" },
4342 4339
    { "vdt", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&video_discard}, "discard threshold", "n" },
4343
    { "qscale", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_qscale}, "use fixed video quantizer scale (VBR)", "q" },
4340
    { "qscale", HAS_ARG | OPT_FUNC2 | OPT_EXPERT | OPT_VIDEO, {(void*)opt_qscale}, "use fixed video quantizer scale (VBR)", "q" },
4344 4341
    { "rc_override", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_video_rc_override_string}, "rate control override for specific intervals", "override" },
4345 4342
    { "vcodec", HAS_ARG | OPT_VIDEO, {(void*)opt_video_codec}, "force video codec ('copy' to copy stream)", "codec" },
4346 4343
    { "me_threshold", HAS_ARG | OPT_FUNC2 | OPT_EXPERT | OPT_VIDEO, {(void*)opt_me_threshold}, "motion estimaton threshold",  "threshold" },
4347 4344
    { "sameq", OPT_BOOL | OPT_VIDEO, {(void*)&same_quality},
4348 4345
      "use same quantizer as source (implies VBR)" },
4349
    { "pass", HAS_ARG | OPT_VIDEO, {(void*)&opt_pass}, "select the pass number (1 or 2)", "n" },
4346
    { "pass", HAS_ARG | OPT_FUNC2 | OPT_VIDEO, {(void*)opt_pass}, "select the pass number (1 or 2)", "n" },
4350 4347
    { "passlogfile", HAS_ARG | OPT_STRING | OPT_VIDEO, {(void*)&pass_logfilename_prefix}, "select two pass log file name prefix", "prefix" },
4351 4348
    { "deinterlace", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&do_deinterlace},
4352 4349
      "deinterlace pictures" },
......
4358 4355
#endif
4359 4356
    { "intra_matrix", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_intra_matrix}, "specify intra matrix coeffs", "matrix" },
4360 4357
    { "inter_matrix", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_inter_matrix}, "specify inter matrix coeffs", "matrix" },
4361
    { "top", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_top_field_first}, "top=1/bottom=0/auto=-1 field first", "" },
4358
    { "top", HAS_ARG | OPT_FUNC2 | OPT_EXPERT | OPT_VIDEO, {(void*)opt_top_field_first}, "top=1/bottom=0/auto=-1 field first", "" },
4362 4359
    { "dc", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&intra_dc_precision}, "intra_dc_precision", "precision" },
4363 4360
    { "vtag", OPT_FUNC2 | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_codec_tag}, "force video tag/fourcc", "fourcc/tag" },
4364 4361
    { "newvideo", OPT_VIDEO | OPT_FUNC2, {(void*)opt_new_stream}, "add a new video stream to the current output stream" },
......
4390 4387
    { "stag", OPT_FUNC2 | HAS_ARG | OPT_EXPERT | OPT_SUBTITLE, {(void*)opt_codec_tag}, "force subtitle tag/fourcc", "fourcc/tag" },
4391 4388

  
4392 4389
    /* grab options */
4393
    { "vc", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_GRAB, {(void*)opt_video_channel}, "set video grab channel (DV1394 only)", "channel" },
4390
    { "vc", HAS_ARG | OPT_FUNC2 | OPT_EXPERT | OPT_VIDEO | OPT_GRAB, {(void*)opt_video_channel}, "set video grab channel (DV1394 only)", "channel" },
4394 4391
    { "tvstd", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_GRAB, {(void*)opt_video_standard}, "set television standard (NTSC, PAL (SECAM))", "standard" },
4395 4392
    { "isync", OPT_BOOL | OPT_EXPERT | OPT_GRAB, {(void*)&input_sync}, "sync read on input", "" },
4396 4393

  

Also available in: Unified diff