I have tried to add process_command in vf_eq.c. I have attached the patch.
From 1d65e493a8eb247d86b0db324cb740579662706d Mon Sep 17 00:00:00 2001 From: Arwa Arif <arwaarif1...@gmail.com> Date: Fri, 30 Jan 2015 23:06:50 +0530 Subject: [PATCH] Add support to process_command in vf_eq.c
--- libavfilter/vf_eq.c | 53 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 13 deletions(-) diff --git a/libavfilter/vf_eq.c b/libavfilter/vf_eq.c index ad2a37e..5899abb 100644 --- a/libavfilter/vf_eq.c +++ b/libavfilter/vf_eq.c @@ -27,11 +27,6 @@ * very simple video equalizer */ -/** - * TODO: - * - Add support to process_command - */ - #include "libavfilter/internal.h" #include "libavutil/common.h" #include "libavutil/imgutils.h" @@ -217,6 +212,37 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) av_frame_free(&in); return ff_filter_frame(outlink, out); } + +static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, + char *res, int res_len, int flags) +{ + EQContext *eq = ctx->priv; + + if (!strcmp(cmd, "contrast")) + eq->contrast = av_clipf(strtod(args, NULL), -2.0, 2.0); + if (!strcmp(cmd, "brightness")) + eq->brightness = av_clipf(strtod(args, NULL), -1.0, 1.0); + if (!strcmp(cmd, "saturation")) + eq->saturation = av_clipf(strtod(args, NULL), 0.0, 3.0); + if (!strcmp(cmd, "gamma")) + eq->gamma = av_clipf(strtod(args, NULL), 0.1, 10.0); + if (!strcmp(cmd, "gamma_r")) + eq->gamma_r = av_clipf(strtod(args, NULL), 0.1, 10.0); + if (!strcmp(cmd, "gamma_g")) + eq->gamma_g = av_clipf(strtod(args, NULL), 0.1, 10.0); + if (!strcmp(cmd, "gamma_b")) + eq->gamma_b = av_clipf(strtod(args, NULL), 0.1, 10.0); + if (!strcmp(cmd, "gamma_weight")) + eq->gamma_weight = av_clipf(strtod(args, NULL), 0.0, 1.0); + + set_gamma(eq); + set_contrast(eq); + set_brightness(eq); + set_saturation(eq); + + return 0; +} + static const AVFilterPad eq_inputs[] = { { .name = "default", @@ -260,12 +286,13 @@ static const AVOption eq_options[] = { AVFILTER_DEFINE_CLASS(eq); AVFilter ff_vf_eq = { - .name = "eq", - .description = NULL_IF_CONFIG_SMALL("Adjust brightness, contrast, gamma, and saturation."), - .priv_size = sizeof(EQContext), - .priv_class = &eq_class, - .inputs = eq_inputs, - .outputs = eq_outputs, - .query_formats = query_formats, - .init = initialize, + .name = "eq", + .description = NULL_IF_CONFIG_SMALL("Adjust brightness, contrast, gamma, and saturation."), + .priv_size = sizeof(EQContext), + .priv_class = &eq_class, + .inputs = eq_inputs, + .outputs = eq_outputs, + .process_command = process_command, + .query_formats = query_formats, + .init = initialize, }; -- 1.7.9.5
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel