diff options
author | Anton Khirnov <anton@khirnov.net> | 2022-08-16 17:02:11 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2022-10-04 11:55:03 +0200 |
commit | a6bf4d47a99732bcecc0294ef39ac0a297680b63 (patch) | |
tree | cb90dd7ee68dc850b0a4a507361c8223b16a5c4d | |
parent | 06758370aafc7f89344c91d3d05c41c606ad03eb (diff) | |
download | ffmpeg-a6bf4d47a99732bcecc0294ef39ac0a297680b63.tar.gz |
lavfi/avf_showspatial: add framerate option
Apparently this option was intended (the context contains a
currently-unused frame_rate field), but was never added. This results in
the output timebase being unset after config_output(), so the input
audio timebase ends up being used for video output, which is clearly
wrong.
Add an option for setting output video framerate. Also set output frame
durations.
-rw-r--r-- | doc/filters.texi | 3 | ||||
-rw-r--r-- | libavfilter/avf_showspatial.c | 4 | ||||
-rw-r--r-- | libavfilter/version.h | 2 |
3 files changed, 8 insertions, 1 deletions
diff --git a/doc/filters.texi b/doc/filters.texi index d0f718678c..7e516a43ba 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -29337,6 +29337,9 @@ Default value is @code{hann}. Set ratio of overlap window. Default value is @code{0.5}. When value is @code{1} overlap is set to recommended size for specific window function currently used. + +@item rate, r +Set output framerate. @end table @anchor{showspectrum} diff --git a/libavfilter/avf_showspatial.c b/libavfilter/avf_showspatial.c index 7807628540..3db4db9af0 100644 --- a/libavfilter/avf_showspatial.c +++ b/libavfilter/avf_showspatial.c @@ -62,6 +62,8 @@ static const AVOption showspatial_options[] = { { "win_size", "set window size", OFFSET(win_size), AV_OPT_TYPE_INT, {.i64 = 4096}, 1024, 65536, FLAGS }, WIN_FUNC_OPTION("win_func", OFFSET(win_func), FLAGS, WFUNC_HANNING), { "overlap", "set window overlap", OFFSET(overlap), AV_OPT_TYPE_FLOAT, {.dbl=0.5}, 0, 1, FLAGS }, + { "rate", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str="25"}, 0, INT_MAX, FLAGS }, + { "r", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str="25"}, 0, INT_MAX, FLAGS }, { NULL } }; @@ -187,6 +189,7 @@ static int config_output(AVFilterLink *outlink) } } + outlink->frame_rate = s->frame_rate; outlink->time_base = av_inv_q(outlink->frame_rate); av_audio_fifo_free(s->fifo); @@ -253,6 +256,7 @@ static int draw_spatial(AVFilterLink *inlink, AVFrame *insamples) } outpicref->pts = av_rescale_q(insamples->pts, inlink->time_base, outlink->time_base); + outpicref->duration = 1; return ff_filter_frame(outlink, outpicref); } diff --git a/libavfilter/version.h b/libavfilter/version.h index 5aac9c513a..4ccbf5641c 100644 --- a/libavfilter/version.h +++ b/libavfilter/version.h @@ -32,7 +32,7 @@ #include "version_major.h" #define LIBAVFILTER_VERSION_MINOR 49 -#define LIBAVFILTER_VERSION_MICRO 100 +#define LIBAVFILTER_VERSION_MICRO 101 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ |