[FFmpeg-cvslog] avfilter/avf_showvolume: make it possible to use current channel number in color expression

Paul B Mahol git at videolan.org
Sat Jul 4 10:56:38 CEST 2015


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Fri Jul  3 18:30:27 2015 +0000| [e658b1036c0b9e0eedf41eb3b4eae569952ec575] | committer: Paul B Mahol

avfilter/avf_showvolume: make it possible to use current channel number in color expression

Signed-off-by: Paul B Mahol <onemda at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e658b1036c0b9e0eedf41eb3b4eae569952ec575
---

 doc/filters.texi             |    3 +++
 libavfilter/avf_showvolume.c |    5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index ed33621..7cd0635 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -12158,6 +12158,9 @@ The expression can use the following variables:
 @table @option
 @item VOLUME
 Current max volume of channel in dB.
+
+ at item CHANNEL
+Current channel number, starting from 0.
 @end table
 
 @item t
diff --git a/libavfilter/avf_showvolume.c b/libavfilter/avf_showvolume.c
index 72e18d5..19dcc84 100644
--- a/libavfilter/avf_showvolume.c
+++ b/libavfilter/avf_showvolume.c
@@ -59,8 +59,8 @@ static const AVOption showvolume_options[] = {
 
 AVFILTER_DEFINE_CLASS(showvolume);
 
-static const char *const var_names[] = {   "VOLUME", NULL };
-enum                                   { VAR_VOLUME, VAR_VARS_NB };
+static const char *const var_names[] = {   "VOLUME",   "CHANNEL",        NULL };
+enum                                   { VAR_VOLUME, VAR_CHANNEL, VAR_VARS_NB };
 
 static av_cold int init(AVFilterContext *ctx)
 {
@@ -201,6 +201,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
 
         max = av_clipf(max, 0, 1);
         values[VAR_VOLUME] = 20.0 * log(max) / M_LN10;
+        values[VAR_CHANNEL] = c;
         color = av_expr_eval(s->c_expr, values, NULL);
 
         for (j = 0; j < s->h; j++) {



More information about the ffmpeg-cvslog mailing list