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
62 { "win_size", "set window size", OFFSET(win_size), AV_OPT_TYPE_INT, {.i64 = 4096}, 1024, 65536, FLAGS },62 { "win_size", "set window size", OFFSET(win_size), AV_OPT_TYPE_INT, {.i64 = 4096}, 1024, 65536, FLAGS },
63 WIN_FUNC_OPTION("win_func", OFFSET(win_func), FLAGS, WFUNC_HANNING),63 WIN_FUNC_OPTION("win_func", OFFSET(win_func), FLAGS, WFUNC_HANNING),
64 { "overlap", "set window overlap", OFFSET(overlap), AV_OPT_TYPE_FLOAT, {.dbl=0.5}, 0, 1, FLAGS },64 { "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 },
65 { NULL }67 { NULL }
66};68};
67 69
@@ -187,6 +189,7 @@ static int config_output(AVFilterLink *outlink) · 119 unmodified lines
187 }189 }
188 }190 }
189 191
192 outlink->frame_rate = s->frame_rate;
190 outlink->time_base = av_inv_q(outlink->frame_rate);193 outlink->time_base = av_inv_q(outlink->frame_rate);
191 194
192 av_audio_fifo_free(s->fifo);195 av_audio_fifo_free(s->fifo);
@@ -253,6 +256,7 @@ static int draw_spatial(AVFilterLink *inlink, AVFrame *insamples) · 60 unmodified lines
253 }256 }
254 257
255 outpicref->pts = av_rescale_q(insamples->pts, inlink->time_base, outlink->time_base);258 outpicref->pts = av_rescale_q(insamples->pts, inlink->time_base, outlink->time_base);
259 outpicref->duration = 1;
256 260
257 return ff_filter_frame(outlink, outpicref);261 return ff_filter_frame(outlink, outpicref);
258}262}
libavfilter/version.h+1−1
@@ -32,7 +32,7 @@ · 31 unmodified lines
32#include "version_major.h"32#include "version_major.h"
33 33
34#define LIBAVFILTER_VERSION_MINOR 4934#define LIBAVFILTER_VERSION_MINOR 49
35#define LIBAVFILTER_VERSION_MICRO 10035#define LIBAVFILTER_VERSION_MICRO 101
36 36
37 37
38#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \38#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