Message ID | 20200502223547.335955-1-me@jailuthra.in |
---|---|
State | Withdrawn, archived |
Headers | show |
Series | [FFmpeg-devel] lavf/fps: add cmd to force write buf frame | expand |
Context | Check | Description |
---|---|---|
andriy/default | pending | |
andriy/make | success | Make finished |
andriy/make_fate | success | Make fate finished |
Missing documentation. Also it is lavfi not lavf. On 5/3/20, Jai Luthra <me@jailuthra.in> wrote: > Enables writing buffered frames to the outsink using send command api. > > This is useful when a lavf user wants to fetch buffered frames without > closing/reopening the filtergraph again and again. > > Signed-off-by: Jai Luthra <me@jailuthra.in> > --- > libavfilter/vf_fps.c | 36 +++++++++++++++++++++++++++--------- > 1 file changed, 27 insertions(+), 9 deletions(-) > > diff --git a/libavfilter/vf_fps.c b/libavfilter/vf_fps.c > index cf1e36726a..fa856a8f45 100644 > --- a/libavfilter/vf_fps.c > +++ b/libavfilter/vf_fps.c > @@ -326,6 +326,23 @@ static int activate(AVFilterContext *ctx) > return FFERROR_NOT_READY; > } > > +static int process_command(AVFilterContext *ctx, const char *cmd, const > char *args, > + char *res, int res_len, int flags) > +{ > + FPSContext *s = ctx->priv; > + int ret, again = 0; > + > + if (!strcmp(cmd, "force_write")) { > + AVFilterLink *outlink = ctx->outputs[0]; > + ret = write_frame(ctx, s, outlink, &again); > + if (again) > + ff_filter_set_ready(ctx, 100); > + } else > + ret = AVERROR(ENOSYS); > + > + return ret; > +} > + > static const AVFilterPad avfilter_vf_fps_inputs[] = { > { > .name = "default", > @@ -344,13 +361,14 @@ static const AVFilterPad avfilter_vf_fps_outputs[] = { > }; > > AVFilter ff_vf_fps = { > - .name = "fps", > - .description = NULL_IF_CONFIG_SMALL("Force constant framerate."), > - .init = init, > - .uninit = uninit, > - .priv_size = sizeof(FPSContext), > - .priv_class = &fps_class, > - .activate = activate, > - .inputs = avfilter_vf_fps_inputs, > - .outputs = avfilter_vf_fps_outputs, > + .name = "fps", > + .description = NULL_IF_CONFIG_SMALL("Force constant framerate."), > + .init = init, > + .uninit = uninit, > + .priv_size = sizeof(FPSContext), > + .priv_class = &fps_class, > + .activate = activate, > + .inputs = avfilter_vf_fps_inputs, > + .outputs = avfilter_vf_fps_outputs, > + .process_command = process_command, > }; > -- > 2.26.2 > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
On 2020-05-02 15:35, Jai Luthra wrote: > Enables writing buffered frames to the outsink using send command api. > > This is useful when a lavf user wants to fetch buffered frames without > closing/reopening the filtergraph again and again. > > Signed-off-by: Jai Luthra <me@jailuthra.in> > --- > libavfilter/vf_fps.c | 36 +++++++++++++++++++++++++++--------- > 1 file changed, 27 insertions(+), 9 deletions(-) …[snip]… Jai: I'm not an official reviewer or anything, but I have looked at the libavfilter/vf_fps.c code recently. This looks like a useful extension. I can imagine it being useful to flush frames through the *fps* filter while FFmpeg is running. I could imagine this patch pointing the way for further improvements later. However, I don't see any change to the *fps* filter documentation in this patch. If a patch changes the way a user can control a filter, but doesn't document that change, then doesn't the patch cause the code to diverge further from the documentation? And long-term, doesn't that lead to problems? Best regards, —Jim DeLaHunt, software engineer, Vancouver, Canada
diff --git a/libavfilter/vf_fps.c b/libavfilter/vf_fps.c index cf1e36726a..fa856a8f45 100644 --- a/libavfilter/vf_fps.c +++ b/libavfilter/vf_fps.c @@ -326,6 +326,23 @@ static int activate(AVFilterContext *ctx) return FFERROR_NOT_READY; } +static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, + char *res, int res_len, int flags) +{ + FPSContext *s = ctx->priv; + int ret, again = 0; + + if (!strcmp(cmd, "force_write")) { + AVFilterLink *outlink = ctx->outputs[0]; + ret = write_frame(ctx, s, outlink, &again); + if (again) + ff_filter_set_ready(ctx, 100); + } else + ret = AVERROR(ENOSYS); + + return ret; +} + static const AVFilterPad avfilter_vf_fps_inputs[] = { { .name = "default", @@ -344,13 +361,14 @@ static const AVFilterPad avfilter_vf_fps_outputs[] = { }; AVFilter ff_vf_fps = { - .name = "fps", - .description = NULL_IF_CONFIG_SMALL("Force constant framerate."), - .init = init, - .uninit = uninit, - .priv_size = sizeof(FPSContext), - .priv_class = &fps_class, - .activate = activate, - .inputs = avfilter_vf_fps_inputs, - .outputs = avfilter_vf_fps_outputs, + .name = "fps", + .description = NULL_IF_CONFIG_SMALL("Force constant framerate."), + .init = init, + .uninit = uninit, + .priv_size = sizeof(FPSContext), + .priv_class = &fps_class, + .activate = activate, + .inputs = avfilter_vf_fps_inputs, + .outputs = avfilter_vf_fps_outputs, + .process_command = process_command, };
Enables writing buffered frames to the outsink using send command api. This is useful when a lavf user wants to fetch buffered frames without closing/reopening the filtergraph again and again. Signed-off-by: Jai Luthra <me@jailuthra.in> --- libavfilter/vf_fps.c | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-)