diff options
author | wm4 <wm4@nowhere> | 2018-04-19 17:42:14 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2018-04-19 23:22:48 +0200 |
commit | ff24285eb15676dc7519b858be01a1def155e847 (patch) | |
tree | da962345d8d33108c0b096c3aaeec6cbc41fe25c /filters/f_lavfi.c | |
parent | e7e06a47a0b5626c3abe81f3627d10ed58d92d3b (diff) | |
download | mpv-ff24285eb15676dc7519b858be01a1def155e847.tar.bz2 mpv-ff24285eb15676dc7519b858be01a1def155e847.tar.xz |
video: pass through container fps to filters
This means vf_vapoursynth doesn't need a hack to work around the filter
code, and libavfilter filters now actually get the frame_rate field on
input pads set.
The libavfilter doxygen says the frame_rate field is only to be set if
the frame rate is known to be constant, and uses the word "must" (which
probably means they really mean it?) - but ffmpeg.c sets the field to
mere guesses anyway, and it looks like this normally won't lead to
problems.
Diffstat (limited to 'filters/f_lavfi.c')
-rw-r--r-- | filters/f_lavfi.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/filters/f_lavfi.c b/filters/f_lavfi.c index 1b41c93aac..2c01eaf59c 100644 --- a/filters/f_lavfi.c +++ b/filters/f_lavfi.c @@ -340,7 +340,8 @@ static bool is_vformat_ok(struct mp_image *a, struct mp_image *b) { return a->imgfmt == b->imgfmt && a->w == b->w && a->h && b->h && - a->params.p_w == b->params.p_w && a->params.p_h == b->params.p_h; + a->params.p_w == b->params.p_w && a->params.p_h == b->params.p_h && + a->nominal_fps == b->nominal_fps; } static bool is_format_ok(struct mp_frame a, struct mp_frame b) { @@ -483,6 +484,7 @@ static bool init_pads(struct lavfi *c) params->sample_aspect_ratio.num = fmt->params.p_w; params->sample_aspect_ratio.den = fmt->params.p_h; params->hw_frames_ctx = fmt->hwctx; + params->frame_rate = av_d2q(fmt->nominal_fps, 1000000); filter_name = "buffer"; } else { assert(0); @@ -680,6 +682,11 @@ static bool read_output_pads(struct lavfi *c) mp_aframe_set_pts(aframe, c->in_pts + (c->in_pts != MP_NOPTS_VALUE ? (out_time - in_time) : 0)); } + if (frame.type == MP_FRAME_VIDEO) { + struct mp_image *vframe = frame.data; + vframe->nominal_fps = + av_q2d(av_buffersink_get_frame_rate(pad->buffer)); + } av_frame_unref(c->tmp_frame); if (frame.type) { mp_pin_in_write(pad->pin, frame); |