[FFmpeg-devel] [PATCH] lavf/fps: add cmd to force write buf frame

Paul B Mahol onemda at gmail.com
Sun May 3 15:11:39 EEST 2020


Missing documentation. Also it is lavfi not lavf.

On 5/3/20, Jai Luthra <me at 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 at 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 at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list