Revision dbe94539 ffmpeg.c

View differences:

ffmpeg.c
2788 2788
    return 0;
2789 2789
}
2790 2790

  
2791
static void opt_qscale(const char *arg)
2791
static int opt_qscale(const char *opt, const char *arg)
2792 2792
{
2793
    video_qscale = atof(arg);
2794
    if (video_qscale <= 0 ||
2795
        video_qscale > 255) {
2793
    video_qscale = parse_number_or_die(opt, arg, OPT_FLOAT, 0, 255);
2794
    if (video_qscale == 0) {
2796 2795
        fprintf(stderr, "qscale must be > 0.0 and <= 255\n");
2797
        ffmpeg_exit(1);
2796
        return AVERROR(EINVAL);
2798 2797
    }
2798
    return 0;
2799 2799
}
2800 2800

  
2801
static void opt_top_field_first(const char *arg)
2801
static int opt_top_field_first(const char *opt, const char *arg)
2802 2802
{
2803
    top_field_first= atoi(arg);
2803
    top_field_first = parse_number_or_die(opt, arg, OPT_INT, 0, 1);
2804
    return 0;
2804 2805
}
2805 2806

  
2806 2807
static int opt_thread_count(const char *opt, const char *arg)
......
2842 2843
    return 0;
2843 2844
}
2844 2845

  
2845
static void opt_video_channel(const char *arg)
2846
static int opt_video_channel(const char *opt, const char *arg)
2846 2847
{
2847
    video_channel = strtol(arg, NULL, 0);
2848
    video_channel = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX);
2849
    return 0;
2848 2850
}
2849 2851

  
2850 2852
static void opt_video_standard(const char *arg)
......
3825 3827
}
3826 3828

  
3827 3829
/* same option as mencoder */
3828
static void opt_pass(const char *pass_str)
3830
static int opt_pass(const char *opt, const char *arg)
3829 3831
{
3830
    int pass;
3831
    pass = atoi(pass_str);
3832
    if (pass != 1 && pass != 2) {
3833
        fprintf(stderr, "pass number can be only 1 or 2\n");
3834
        ffmpeg_exit(1);
3835
    }
3836
    do_pass = pass;
3832
    do_pass = parse_number_or_die(opt, arg, OPT_INT, 1, 2);
3833
    return 0;
3837 3834
}
3838 3835

  
3839 3836
static int64_t getutime(void)
......
4254 4251
    { "intra", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&intra_only}, "use only intra frames"},
4255 4252
    { "vn", OPT_BOOL | OPT_VIDEO, {(void*)&video_disable}, "disable video" },
4256 4253
    { "vdt", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&video_discard}, "discard threshold", "n" },
4257
    { "qscale", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_qscale}, "use fixed video quantizer scale (VBR)", "q" },
4254
    { "qscale", HAS_ARG | OPT_FUNC2 | OPT_EXPERT | OPT_VIDEO, {(void*)opt_qscale}, "use fixed video quantizer scale (VBR)", "q" },
4258 4255
    { "rc_override", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_video_rc_override_string}, "rate control override for specific intervals", "override" },
4259 4256
    { "vcodec", HAS_ARG | OPT_VIDEO, {(void*)opt_video_codec}, "force video codec ('copy' to copy stream)", "codec" },
4260 4257
    { "me_threshold", HAS_ARG | OPT_FUNC2 | OPT_EXPERT | OPT_VIDEO, {(void*)opt_me_threshold}, "motion estimaton threshold",  "threshold" },
4261 4258
    { "sameq", OPT_BOOL | OPT_VIDEO, {(void*)&same_quality},
4262 4259
      "use same quantizer as source (implies VBR)" },
4263
    { "pass", HAS_ARG | OPT_VIDEO, {(void*)&opt_pass}, "select the pass number (1 or 2)", "n" },
4260
    { "pass", HAS_ARG | OPT_FUNC2 | OPT_VIDEO, {(void*)opt_pass}, "select the pass number (1 or 2)", "n" },
4264 4261
    { "passlogfile", HAS_ARG | OPT_STRING | OPT_VIDEO, {(void*)&pass_logfilename_prefix}, "select two pass log file name prefix", "prefix" },
4265 4262
    { "deinterlace", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&do_deinterlace},
4266 4263
      "deinterlace pictures" },
......
4272 4269
#endif
4273 4270
    { "intra_matrix", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_intra_matrix}, "specify intra matrix coeffs", "matrix" },
4274 4271
    { "inter_matrix", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_inter_matrix}, "specify inter matrix coeffs", "matrix" },
4275
    { "top", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_top_field_first}, "top=1/bottom=0/auto=-1 field first", "" },
4272
    { "top", HAS_ARG | OPT_FUNC2 | OPT_EXPERT | OPT_VIDEO, {(void*)opt_top_field_first}, "top=1/bottom=0/auto=-1 field first", "" },
4276 4273
    { "dc", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&intra_dc_precision}, "intra_dc_precision", "precision" },
4277 4274
    { "vtag", OPT_FUNC2 | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_codec_tag}, "force video tag/fourcc", "fourcc/tag" },
4278 4275
    { "newvideo", OPT_VIDEO | OPT_FUNC2, {(void*)opt_new_stream}, "add a new video stream to the current output stream" },
......
4304 4301
    { "stag", OPT_FUNC2 | HAS_ARG | OPT_EXPERT | OPT_SUBTITLE, {(void*)opt_codec_tag}, "force subtitle tag/fourcc", "fourcc/tag" },
4305 4302

  
4306 4303
    /* grab options */
4307
    { "vc", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_GRAB, {(void*)opt_video_channel}, "set video grab channel (DV1394 only)", "channel" },
4304
    { "vc", HAS_ARG | OPT_FUNC2 | OPT_EXPERT | OPT_VIDEO | OPT_GRAB, {(void*)opt_video_channel}, "set video grab channel (DV1394 only)", "channel" },
4308 4305
    { "tvstd", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_GRAB, {(void*)opt_video_standard}, "set television standard (NTSC, PAL (SECAM))", "standard" },
4309 4306
    { "isync", OPT_BOOL | OPT_EXPERT | OPT_GRAB, {(void*)&input_sync}, "sync read on input", "" },
4310 4307

  

Also available in: Unified diff