summaryrefslogtreecommitdiff
path: root/libavfilter/af_volume.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefasab@gmail.com>2013-12-23 18:24:57 +0100
committerStefano Sabatini <stefasab@gmail.com>2013-12-25 18:25:53 +0100
commit97aa554634044b84a498f41ac9bd88b688731c3b (patch)
tree31ec381ccdd68888939b3e1655bb41fe167502b5 /libavfilter/af_volume.c
parent7619a87cc8b9a1ac6ea6cf03b674f5a74b1ac90c (diff)
downloadffmpeg-97aa554634044b84a498f41ac9bd88b688731c3b.tar.gz
lavfi/volume: implement process_command() callback, with the volume command
Address trac ticket #2868.
Diffstat (limited to 'libavfilter/af_volume.c')
-rw-r--r--libavfilter/af_volume.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/libavfilter/af_volume.c b/libavfilter/af_volume.c
index b4ab6fee88..9dc868f91a 100644
--- a/libavfilter/af_volume.c
+++ b/libavfilter/af_volume.c
@@ -296,6 +296,22 @@ static int config_output(AVFilterLink *outlink)
return set_volume(ctx);
}
+static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
+ char *res, int res_len, int flags)
+{
+ VolumeContext *vol = ctx->priv;
+ int ret = AVERROR(ENOSYS);
+
+ if (!strcmp(cmd, "volume")) {
+ if ((ret = set_expr(&vol->volume_pexpr, args, ctx)) < 0)
+ return ret;
+ if (vol->eval_mode == EVAL_MODE_ONCE)
+ set_volume(ctx);
+ }
+
+ return ret;
+}
+
#define D2TS(d) (isnan(d) ? AV_NOPTS_VALUE : (int64_t)(d))
#define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts))
#define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts)*av_q2d(tb))
@@ -403,4 +419,5 @@ AVFilter ff_af_volume = {
.inputs = avfilter_af_volume_inputs,
.outputs = avfilter_af_volume_outputs,
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC,
+ .process_command = process_command,
};