This is used to control the output at frame rate or field rate when deinterlace is expected and framerate is not specified.
Showing the changes to libavfilter (1 of 1 file). Show all
Unified · Split
| @@ -101,6 +101,7 @@ typedef struct VPPContext{ · 100 unmodified lines | |||
| 101 | char *output_format_str; | 101 | char *output_format_str; |
| 102 | 102 | ||
| 103 | int has_passthrough; /* apply pass through mode if possible */ | 103 | int has_passthrough; /* apply pass through mode if possible */ |
| 104 | int field_rate; /* Generate output at frame rate or field rate for deinterlace mode, 0: frame, 1: field */ | ||
| 104 | } VPPContext; | 105 | } VPPContext; |
| 105 | 106 | ||
| 106 | static const char *const var_names[] = { | 107 | static const char *const var_names[] = { |
| @@ -255,9 +256,14 @@ static int config_input(AVFilterLink *inlink) · 148 unmodified lines | |||
| 255 | int ret; | 256 | int ret; |
| 256 | int64_t ow, oh; | 257 | int64_t ow, oh; |
| 257 | 258 | ||
| 258 | if (vpp->framerate.den == 0 || vpp->framerate.num == 0) | 259 | if (vpp->framerate.den == 0 || vpp->framerate.num == 0) { |
| 259 | vpp->framerate = inlink->frame_rate; | 260 | vpp->framerate = inlink->frame_rate; |
| 260 | 261 | ||
| 262 | if (vpp->deinterlace && vpp->field_rate) | ||
| 263 | vpp->framerate = av_mul_q(inlink->frame_rate, | ||
| 264 | (AVRational){ 2, 1 }); | ||
| 265 | } | ||
| 266 | |||
| 261 | if (av_cmp_q(vpp->framerate, inlink->frame_rate)) | 267 | if (av_cmp_q(vpp->framerate, inlink->frame_rate)) |
| 262 | vpp->use_frc = 1; | 268 | vpp->use_frc = 1; |
| 263 | 269 | ||
| @@ -352,7 +358,7 @@ static int config_output(AVFilterLink *outlink) · 88 unmodified lines | |||
| 352 | outlink->w = vpp->out_width; | 358 | outlink->w = vpp->out_width; |
| 353 | outlink->h = vpp->out_height; | 359 | outlink->h = vpp->out_height; |
| 354 | outlink->frame_rate = vpp->framerate; | 360 | outlink->frame_rate = vpp->framerate; |
| 355 | outlink->time_base = inlink->time_base; | 361 | outlink->time_base = av_inv_q(vpp->framerate); |
| 356 | 362 | ||
| 357 | param.filter_frame = NULL; | 363 | param.filter_frame = NULL; |
| 358 | param.num_ext_buf = 0; | 364 | param.num_ext_buf = 0; |
| @@ -678,6 +684,13 @@ static const AVOption vpp_options[] = { · 319 unmodified lines | |||
| 678 | { "low_power", "low power mode", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCALING_MODE_LOWPOWER}, INT_MIN, INT_MAX, FLAGS, "scale mode"}, | 684 | { "low_power", "low power mode", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCALING_MODE_LOWPOWER}, INT_MIN, INT_MAX, FLAGS, "scale mode"}, |
| 679 | { "hq", "high quality mode", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCALING_MODE_QUALITY}, INT_MIN, INT_MAX, FLAGS, "scale mode"}, | 685 | { "hq", "high quality mode", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCALING_MODE_QUALITY}, INT_MIN, INT_MAX, FLAGS, "scale mode"}, |
| 680 | 686 | ||
| 687 | { "rate", "Generate output at frame rate or field rate, available only for deinterlace mode", | ||
| 688 | OFFSET(field_rate), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, FLAGS, "rate" }, | ||
| 689 | { "frame", "Output at frame rate (one frame of output for each field-pair)", | ||
| 690 | 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, FLAGS, "rate" }, | ||
| 691 | { "field", "Output at field rate (one frame of output for each field)", | ||
| 692 | 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0, FLAGS, "rate" }, | ||
| 693 | |||
| 681 | { NULL } | 694 | { NULL } |
| 682 | }; | 695 | }; |
| 683 | 696 | ||