History

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.

Anton Khirnov committed 4 years ago

Commit a6bf4d41 parent 06758373 files · +8 −1Browse files

Showing the changes to libavfilter (2 of 3 files). Show all

Unified · Split

2 files
  1. libavfilter/avf_showspatial.c +4 −0
  2. libavfilter/version.h +1 −1
libavfilter/avf_showspatial.c+4−0
@@ -62,6 +62,8 @@ static const AVOption showspatial_options[] = { · 61 unmodified lines
6262 { "win_size", "set window size", OFFSET(win_size), AV_OPT_TYPE_INT, {.i64 = 4096}, 1024, 65536, FLAGS },
6363 WIN_FUNC_OPTION("win_func", OFFSET(win_func), FLAGS, WFUNC_HANNING),
6464 { "overlap", "set window overlap", OFFSET(overlap), AV_OPT_TYPE_FLOAT, {.dbl=0.5}, 0, 1, FLAGS },
65+ { "rate", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str="25"}, 0, INT_MAX, FLAGS },
66+ { "r", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str="25"}, 0, INT_MAX, FLAGS },
6567 { NULL }
6668 };
6769
@@ -187,6 +189,7 @@ static int config_output(AVFilterLink *outlink) · 119 unmodified lines
187189 }
188190 }
189191
192+ outlink->frame_rate = s->frame_rate;
190193 outlink->time_base = av_inv_q(outlink->frame_rate);
191194
192195 av_audio_fifo_free(s->fifo);
@@ -253,6 +256,7 @@ static int draw_spatial(AVFilterLink *inlink, AVFrame *insamples) · 60 unmodified lines
253256 }
254257
255258 outpicref->pts = av_rescale_q(insamples->pts, inlink->time_base, outlink->time_base);
259+ outpicref->duration = 1;
256260
257261 return ff_filter_frame(outlink, outpicref);
258262 }
libavfilter/version.h+1−1
@@ -32,7 +32,7 @@ · 31 unmodified lines
3232 #include "version_major.h"
3333
3434 #define LIBAVFILTER_VERSION_MINOR 49
35−#define LIBAVFILTER_VERSION_MICRO 100
35+#define LIBAVFILTER_VERSION_MICRO 101
3636
3737
3838 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t